Collective\Annotations\NamespaceToPathConverterTrait::getPathFromNamespace PHP Method

getPathFromNamespace() public method

Convert the given namespace to a file path.
public getPathFromNamespace ( string $namespace, $base = null ) : string
$namespace string the namespace to convert
return string
    public function getPathFromNamespace($namespace, $base = null)
    {
        $appNamespace = $this->getAppNamespace();
        // remove the app namespace from the namespace if it is there
        if (substr($namespace, 0, strlen($appNamespace)) == $appNamespace) {
            $namespace = substr($namespace, strlen($appNamespace));
        }
        $path = str_replace('\\', '/', trim($namespace, ' \\'));
        // trim and return the path
        return ($base ?: app_path()) . '/' . $path;
    }
NamespaceToPathConverterTrait