Redaxscript\Directory::_scan PHP Method

_scan() protected method

scan the directory
Since: 2.0.0
protected _scan ( string $directory = null ) : array
$directory string name of the directory
return array
    protected function _scan($directory = null)
    {
        $realpath = realpath($directory);
        /* use static cache */
        if (array_key_exists($realpath, self::$_directoryCache)) {
            $directoryArray = self::$_directoryCache[$realpath];
        } else {
            $directoryArray = scandir($directory);
            self::$_directoryCache[$realpath] = $directoryArray;
        }
        $directoryArray = array_values(array_diff($directoryArray, $this->_excludeArray));
        return $directoryArray;
    }