Recursively finds all files with the .php extension in the provided
$path adds them to $this->files.
@param  string $path Path in which to look for .php files.
@return void
481208
private function getPhpFilesFromPath(string $path)
    {
        $directoryIterator = new RecursiveDirectoryIterator($path);
        foreach (new RecursiveIteratorIterator($directoryIterator) as $file) {
            if (! in_array($file->getExtension(), $this->fileExtensions)) {
                continue;
            }

            if ($this->fileShouldBeIgnored($file)) {
                continue;
            }

            $this->files->push(new File(['displayPath' => $file->getPathName(), 'fullPath' => $file->getRealPath()]));
        }
    }
578599
private function loadFromFile($path)
    {
        if ( ! is_file($path)) {
            return;
        }
        
        $config = require_once $path;
        
        if (is_array($config)) {
            $this->config = $config;
        }
    }
1145820
public static function load($path = BASE_DIR) {
        $librariesDir = dirname(dirname($path)) . DS . 'libraries';
        foreach (glob($librariesDir . DS . "*.php") as $filename) {
            require_once $filename;
        }
    }
1345676
protected function ensureDirectory($path)
    {

        if ( !$this->fs->exists($path) )
        {
            $this->fs->makeDirectory($path);
        }
    }
679573
protected function _setDir($path) {
        if ($handle = opendir($path)) {
            while (false !== ($entry = readdir($handle))) {
                $extension = explode('.', basename($entry));
                $ext = $extension[count($extension) - 1];

                if ($ext == $this->_type) {
                    $this->_setFile($path . $entry);
                }
            }

            closedir($handle);
        }
    }
698907
protected function _setUploadDir($path = null) {
		$path = (string)$path;
		if (file_exists($path)) {
			$this->_pathUploadDir = $path;
		}
	}
69192
public function withPath($path = __DIR__)
    {
        $before = get_declared_classes();

        $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
        foreach ($iterator as $item) {
            if (!$item->isDir() && substr($item->getPathname(), -4) == '.php') {
                require_once $item->getPathname();
            }
        }

        $after    = get_declared_classes();
        $commands = array_diff($after, $before);

        $this->withCommands($commands);

        return $this;
    }
579659
public function writeFile($path) {
        if (is_array($path)) {
            $this->files = array_merge($this->files, $path);
        }
        elseif (!empty($path)) {
            $this->files[] = $path;
        }
    }
210494
protected function makeDir($path)
    {
        if (! file_exists(dirname($path))) {
            $this->makeDir(dirname($path));
        }

        if (! file_exists($path)) {
            mkdir($path);
        }
    }
1135916
public function addPath($path)
    {
        // just force to array
        settype($path, 'array');

        // loop through the path directories
        foreach ($path as $dir) {
            // no surrounding spaces allowed!
            $dir = trim($dir);

            // remove trailing slash
            if (substr($dir, -1) == DIRECTORY_SEPARATOR) {
                $dir = substr_replace($dir, '', -1);
            }

            // add to the top of the search dirs
            array_unshift($this->_paths, $dir);
        }
    }
711059
public function deleteRecursive($path)
	{
		if (!$this->tryDelete($path)) {
			foreach ((array) $this->nlist($path) as $file) {
				if ($file !== '.' && $file !== '..') {
					$this->deleteRecursive(strpos($file, '/') === FALSE ? "$path/$file" : $file);
				}
			}
			$this->rmdir($path);
		}
	}
1101317
public static function mkfolders($path){
        $exFolder = explode("/", $path);
        $curpath = "";
        if(is_array($exFolder)) foreach ($exFolder as $key => $value) {
            if($value && $value != "." && $value != ".."){
                $curpath = $curpath."/".$value;
                File::mkfolder($curpath);
            }else if($value == "." || $value == ".."){
                $curpath = $value;
            }
        }
    }
894988
protected function makeDirectory($path)
    {
        if (! $this->fileHelper->exists($path)) {
            $this->fileHelper->makeDirectory($path, 0777, true, true);
        }
    }
464998
protected function ensureCacheDirectoryExists($path)
    {
        if (! $this->files->exists(dirname($path))) {
            $this->files->makeDirectory(dirname($path), 0777, true, true);
        }
    }
491720
protected function findFileAt($path)
    {
        try {
            $files = $this->fromDirectory('')
                ->withPrefix($path)
                ->withDelimiter('')
                ->limit(1)
                ->get();
        } catch (ApiRequestFailedException $e) {
            return;
        }

        return $files->get(0);
    }
835603
public function amInPath($path)
    {
        chdir($this->path = $this->absolutizePath($path) . DIRECTORY_SEPARATOR);
        $this->debug('Moved to ' . getcwd());
    }
179947
protected function makeDirectories(string $path)
    {
        $directoryName = dirname($path);

        if (!$this->fileSystem->isDirectory($directoryName)) {
            $this->fileSystem->makeDirectory($directoryName, 0777, true);
        }
    }