Doctrine\ODM\OrientDB\Mapper\ClassMetadataFactory::getClassByPath PHP Метод

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

Returns the fully qualified name of a class by its path
public getClassByPath ( string $file, string $namespace ) : string
$file string
$namespace string
Результат string
    public function getClassByPath($file, $namespace)
    {
        $absPath = realpath($file);
        $namespaces = explode('/', $absPath);
        $start = false;
        $i = 0;
        $chunk = explode('\\', $namespace);
        $namespace = array_shift($chunk);
        while ($namespaces[$i] != $namespace) {
            unset($namespaces[$i]);
            if (!array_key_exists(++$i, $namespaces)) {
                break;
            }
        }
        $className = str_replace('.php', null, array_pop($namespaces));
        return '\\' . implode('\\', $namespaces) . '\\' . $className;
    }