Returns an array of scanned and prepared files
@param string $path
@param array $params
@return array
358075
protected function getFilesListing($path, array $params)
    {
        $files = $this->getFiles($path, $params);
        return $this->prepareFiles($files);
    }
888657
public function view($path, array $params = [])
    {
        $params = array_merge($params,
            [
                'module' => $this,
                'module_resource' => 'module_resource::' . $this->author . '.' . $this->name . '.resources.'
            ]);
        return view('module_resource::' . $this->author . '.' . $this->name . '.resources.' . $path, $params);
    }
1355642
protected function getFileKeys($path, array $keys)
    {
        if (!$this->hasFile($path)) {
            return false;
        }

        return $this->getKeys($path, $keys);
    }
378908
protected static function getFilesFromPath($path)
    {
        $files = [];
        $path = rtrim($path, '/') . DIRECTORY_SEPARATOR;

        if (false !== $items = scandir($path)) {
            foreach ($items as $item) {
                $file = $path . $item;
                if (is_file($file)) {
                    $extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
                    if (in_array($extension, [Packager::FILE_EXTENSION, Package::FILE_EXTENSION])) {
                        $files[] = $file;
                    }
                }
            }
        }

        return $files;
    }
828155
public function getMigrationFiles($path)
    {
        $files = $this->files->glob($path .'/*_*.php');

        // Once we have the array of files in the directory we will just remove the
        // extension and take the basename of the file which is all we need when
        // finding the migrations that haven't been run against the databases.
        if ($files === false) return array();

        $files = array_map(function($file)
        {
            return str_replace('.php', '', basename($file));

        }, $files);

        // Once we have all of the formatted file names we will sort them and since
        // they all start with a timestamp this should give us the migrations in
        // the order they were actually created by the application developers.
        sort($files);

        return $files;
    }
515578
protected function _scandir($path) {
		
		$s3path = preg_replace("/^\//", "", $path) . '/';
		
		$files = $this->s3->ListBucket(array('Bucket' => $this->options['bucket'], 'delimiter' => '/', 'Prefix' => $s3path))->ListBucketResponse->Contents;
	
		$finalfiles = array();
		
		foreach ($files as $file) {
			if (preg_match("|^" . $s3path . "[^/]*/?$|", $file->Key)) {
				$fname = preg_replace("/\/$/", "", $file->Key);
				$fname = $file->Key;
				
				if ($fname != preg_replace("/\/$/", "", $s3path)) {
					
				}
				
				$finalfiles[] = $fname;
			}
		}
		
		sort($finalfiles);
		return $finalfiles;
	}
83031
public function getDirectoryFiles(string $path, string $postfix = '')
    {
        if (!is_dir($path)) {
            return [];
        }

        $results = [];
        $files   = array_diff(scandir($path), ['..', '.']);
        foreach ($files as $file) {
            $absolutePath = $path.DIRECTORY_SEPARATOR.$file;
            if (!is_dir($absolutePath) && empty($postfix) || Str::endsWith($file, $postfix)) {
                $results[] = $absolutePath;
            }
        }

        return $results;
    }
1332778
public static function fileGetContents(array $params = [])
    {
        /** @var string $toPath Path to get request from */
        /** @var array $clientParams parameters passed into client */
        /** @var \GuzzleHttp\Client $client */
        /** @var string $request_type request type */
        /** @var array $requestParams parameters to pass into request */
        /** @var string $request type of request */
        $parameters = new Collection();
        $parameters->addItems((array)Arrays::defaultAttributes([
            "toPath" => self::httpProtocol() . '://' . self::serverName() . '/',
            "clientParams" => [],
            "client" => "\\GuzzleHttp\\Client",
            "request" => "GET",
            "requestParams" => [],
        ], $params));

        $parameters->addItem(parse_url($parameters->getItem('toPath'), PHP_URL_SCHEME) . "://" . parse_url($parameters->getItem('toPath'), PHP_URL_HOST), 'base_uri');
        $parameters->setItem(array_merge($parameters->getItem('clientParams'), array('base_uri' => $parameters->getItem('base_uri'))), 'clientParams');
        if (is_string($parameters->getItem('client'))) {
            $client = $parameters->getItem('client');
            $parameters->setItem(new $client($parameters->getItem('clientParams')), 'client');
        }

        $path = substr($parameters->getItem('toPath'), strlen($parameters->getItem('base_uri')), strlen($parameters->getItem('toPath')));
        if (method_exists($parameters->getItem('client'), 'request')) {
            // For GuzzleHttp 6
            return $parameters->getItem('client')
                ->request($parameters->getItem('request'), $path, $parameters->getItem('requestParams'))
                ->getBody()
                ->getContents();
        } elseif (method_exists($parameters->getItem('client'), 'createRequest')) {
            // for GuzzleHttp 5.3
            $request = $parameters->getItem('client')
                ->createRequest($parameters->getItem('request'), $path, $parameters->getItem('requestParams'));
            return $parameters->getItem('client')->send($request)->getBody();
        } else {
          throw new FileGetContentsException('The client must be an instance of \\GuzzleHttp\\Client');
        }
    }
1156631
private static function scanCurrentDir(string $path, bool $ignoreDir = true): array
    {
        $path = self::formatPath($path);
        $dh = opendir($path);
        if (! $dh) {
            return [];
        }

        $files = [];
        while (false !== ($file = readdir($dh))) {
            if ($file == '.' || $file == '..') {
                continue;
            }
            $fileType = filetype($path . $file);
            if ('dir' == $fileType && false === $ignoreDir) {
                $files[] = $path . $file . '/';
            }
            if ('file' == $fileType) {
                $files[] = $path . $file;
            }
        }
        closedir($dh);
        return $files;
    }
167860
public function get($path, $params = null){
        $url_params = '';
        if (is_array($params)){
            $url_params = '?' . http_build_query($params);
        }
        
        return $this->_call('GET', $path . $url_params);
    }
657369
public function loadFromDirectory($path)
    {
        return $this->file->listFiles($path)->mapWithKeys(function ($file, $key) {
            return [$key => $this->loadFile($file)];
        });
    }
73431
protected function getPhpFiles($path)
    {
        if (is_dir($path)) {
            return new RegexIterator(
                new RecursiveIteratorIterator(
                    new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS),
                    RecursiveIteratorIterator::SELF_FIRST,
                    RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore "Permission denied"
                ),
                '/^.+\.php$/i',
                RecursiveRegexIterator::GET_MATCH
            );
        }
        else {
            return [];
        }
    }
978147
private static function scanBfs(string $path, bool $ignoreDir = true): array
    {
        $files = [];
        $queue = new \SplQueue();
        $queue->enqueue($path);

        while (! $queue->isEmpty()) {
            $file = $queue->dequeue();
            $fileType = filetype($file);
            if ('dir' == $fileType) {
                $subFiles = self::scanCurrentDir($file, false);
                foreach ($subFiles as $subFile) {
                    $queue->enqueue($subFile);
                }
                if (false === $ignoreDir && $file !== $path) {
                    $files[] = $file;
                }
            }
            if ('file' == $fileType) {
                $files[] = $file;
            }
        }
        return $files;
    }
812391
public function readFileList($path){
        $open_file = opendir($path);

        while($opendir = readdir($open_file)) {
            if(($opendir != ".") && ($opendir != "..") && is_file($targetdir."/".$opendir)) {
                //$createTime   = filemtime($path.$opendir);
                $fileArr[] = $opendir;
            }
        }
        closedir($open_file);
        return $fileArr;

    }
1178729
protected function findNewFiles(string $path) : array
    {
        $arrReturn = [];
        $arrFolders = scandir($path);
        $arrSkip = [
            '.',
            '..',
        ];
        
        foreach ($arrFolders as $file) {
            //No Folder Defaults
            if (in_array($file, $arrSkip)) {
                continue;
            }
            //Process Subfolders
            if (is_dir($path.$file)) {
                $arrSubFolderFiles = $this->findNewFiles($path.$file."/");
                $arrReturn = $this->addArrayToNewFiles($arrSubFolderFiles, $arrReturn);
                continue;
            }
            $arrReturn[] = $path.$file;
        }
        
        //Remove file from list if already processed
        foreach($arrReturn as $key => $file) {
            if (in_array($file, $this->knownUpdateFiles)) {
                unset($arrReturn[$key]);
            }
        }
        return $arrReturn;
    }
1212470
public function getFilesWithExtension($path, $ext = 'php')
    {
        if (is_dir($path)) {
            return new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore "Permission denied"
            ), '/^.+\.'.$ext.'$/i', RecursiveRegexIterator::GET_MATCH);
        } else {
            return [];
        }
    }
1290443
public function get($path, array $parameters)
    {
        try {
    	    $response = $this->client->request('GET', $path, [
    	        'query' => $parameters
    	    ]);

            return $this->toArray($response);
    	}
    	catch (ClientException $e) {
    	    return $this->toArray($e->getResponse());
    	}
    }