public function load($resources, $extension = '')
    {
        $finder = new Finder();
        $collection = array();

        if (is_array($resources)) {
            foreach ($resources as $resource) {
                $subcollection = array();
                $subcollection = $this->load($resource);
                $collection = array_merge($collection, $subcollection);
            }
        } elseif (is_dir($resources)) {
            $files = $finder->files()->name('*'.$extension)->in($resources);
            foreach ($files as $file) {
                $collection[] = realpath($file->getPathName());
            }
        } elseif (is_file($resources)) {
            $collection = array(realpath($resources));
        } else {
            throw new \InvalidArgumentException('Argument must be an absolute directory or a file path or both in an array');
        }

        return $collection;
    }
public function load($resources, $extension = '')
    {
        $finder = new Finder();
        $collection = array();

        if (is_array($resources)) {
            foreach ($resources as $resource) {
                $subcollection = array();
                $subcollection = $this->load($resource);
                $collection = array_merge($collection, $subcollection);
            }
        } elseif (is_dir($resources)) {
            $files = $finder->files()->name('*'.$extension)->in($resources);
            foreach ($files as $file) {
                $collection[] = realpath($file->getPathName());
            }
        } elseif (is_file($resources)) {
            $collection = array(realpath($resources));
        } else {
            throw new \InvalidArgumentException('Argument must be an absolute directory or a file path or both in an array');
        }

        return $collection;
    }
public function load ( $ resources , $ extension = '' ) { $ finder = new Finder ( ) ; $ collection = array ( ) ; if ( is_array ( $ resources ) ) { foreach ( $ resources as $ resource ) { $ subcollection = array ( ) ; $ subcollection = $ this -> load ( $ resource ) ; $ collection = array_merge ( $ collection , $ subcollection ) ; } } elseif ( is_dir ( $ resources ) ) { $ files = $ finder -> files ( ) -> name ( '*' . $ extension ) -> in ( $ resources ) ; foreach ( $ files as $ file ) { $ collection [ ] = realpath ( $ file -> getPathName ( ) ) ; } } elseif ( is_file ( $ resources ) ) { $ collection = array ( realpath ( $ resources ) ) ; } else { throw new \ InvalidArgumentException ( 'Argument must be an absolute directory or a file path or both in an array' ) ; } return $ collection ; }
Return a collection of files

@param mixed  $resources Absolute file or directory path or an array of both
@param string $extension File extension to load/filter with the prefixed dot (.php, .yml)

@throws InvalidArgumentException If resources aren't absolute dir or file path

@return array
Return a collection of files