FOF30\Autoloader\Autoloader::findFile PHP Метод

findFile() публичный Метод

Finds the path to the file where the class is defined.
public findFile ( string $class ) : string | false
$class string The name of the class
Результат string | false The path if found, false otherwise
    public function findFile($class)
    {
        // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
        if ('\\' == $class[0]) {
            $class = substr($class, 1);
        }
        // PSR-4 lookup
        $logicalPath = strtr($class, '\\', DIRECTORY_SEPARATOR) . '.php';
        $first = $class[0];
        if (isset($this->prefixLengths[$first])) {
            foreach ($this->prefixLengths[$first] as $prefix => $length) {
                if (0 === strpos($class, $prefix)) {
                    foreach ($this->prefixDirs[$prefix] as $dir) {
                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPath, $length))) {
                            return $file;
                        }
                    }
                }
            }
        }
        // PSR-4 fallback dirs
        foreach ($this->fallbackDirs as $dir) {
            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPath)) {
                return $file;
            }
        }
    }