getDirectories example

private readonly array $paths,
        private readonly string $projectRootDir,
        private readonly array $excludedPathPatterns = [],
    ) {
    }

    /** * Given the logical path - styles/app.css - returns the absolute path to the file. */
    public function find(string $logicalPath): ?string
    {
        foreach ($this->getDirectories() as $path => $namespace) {
            $localLogicalPath = $logicalPath;
            // if this path has a namespace, only look for files in that namespace             if ('' !== $namespace) {
                if (!str_starts_with($logicalPathrtrim($namespace, '/').'/')) {
                    continue;
                }

                $localLogicalPath = substr($logicalPath, \strlen($namespace) + 1);
            }

            $file = rtrim($path, '/').'/'.$localLogicalPath;
            
Home | Imprint | This part of the site doesn't use cookies.