From 60fe79983bb986574ed8517f8ec8b80253dec507 Mon Sep 17 00:00:00 2001 From: Aaron Holbrook Date: Tue, 21 Mar 2017 13:21:02 -0500 Subject: [PATCH] Remove recursion checking --- composer.json | 2 +- src/autoload.php | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 2eebd19..67dc38e 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Automatically and recursively require_once all php files in a given directory.", "type": "library", "license": "UNLICENSE", - "version": "2.0.4", + "version": "2.0.5", "authors": [ { "name": "A7", diff --git a/src/autoload.php b/src/autoload.php index 010f07b..96a13a3 100644 --- a/src/autoload.php +++ b/src/autoload.php @@ -6,24 +6,10 @@ * Recursively loads all php files in all subdirectories of the given path * * @param $directory - * @param $recurse * * @throws \Exception */ -function autoload( $directory, $recurse = false ) { - static $recurse_depth = 0; - - if ( true === $recurse ) { - $recurse_depth++; - } - - if ( $recurse_depth > 10 ) { - trigger_error( 'Using autoload for more than 10 directories is not recommended', E_USER_WARNING ); - } - - if ( $recurse_depth > 15 ) { - throw new \Exception( 'Maximum recurse depth reached for autoload.' ); - } +function autoload( $directory ) { // Get a listing of the current directory $scanned_dir = scandir( $directory ); @@ -63,7 +49,7 @@ function autoload( $directory, $recurse = false ) { // If it's a directory then recursively load it if ( 'dir' === $filetype ) { - autoload( $real_path, true ); + autoload( $real_path ); } // If it's a file, let's try to load it