File tree Expand file tree Collapse file tree 2 files changed +3
-17
lines changed
Expand file tree Collapse file tree 2 files changed +3
-17
lines changed Original file line number Diff line number Diff line change 33 "description" : " Automatically and recursively require_once all php files in a given directory." ,
44 "type" : " library" ,
55 "license" : " UNLICENSE" ,
6- "version" : " 2.0.4 " ,
6+ "version" : " 2.0.5 " ,
77 "authors" : [
88 {
99 "name" : " A7" ,
Original file line number Diff line number Diff line change 66 * Recursively loads all php files in all subdirectories of the given path
77 *
88 * @param $directory
9- * @param $recurse
109 *
1110 * @throws \Exception
1211 */
13- function autoload ( $ directory , $ recurse = false ) {
14- static $ recurse_depth = 0 ;
15-
16- if ( true === $ recurse ) {
17- $ recurse_depth ++;
18- }
19-
20- if ( $ recurse_depth > 10 ) {
21- trigger_error ( 'Using autoload for more than 10 directories is not recommended ' , E_USER_WARNING );
22- }
23-
24- if ( $ recurse_depth > 15 ) {
25- throw new \Exception ( 'Maximum recurse depth reached for autoload. ' );
26- }
12+ function autoload ( $ directory ) {
2713
2814 // Get a listing of the current directory
2915 $ scanned_dir = scandir ( $ directory );
@@ -63,7 +49,7 @@ function autoload( $directory, $recurse = false ) {
6349 // If it's a directory then recursively load it
6450 if ( 'dir ' === $ filetype ) {
6551
66- autoload ( $ real_path, true );
52+ autoload ( $ real_path );
6753 }
6854
6955 // If it's a file, let's try to load it
You can’t perform that action at this time.
0 commit comments