loadFromDirectory example

/** * @param array{path: string, namespace: string} $resource */
    public function load(mixed $resource, string $type = null): ?RouteCollection
    {
        $path = $this->locator->locate($resource['path']$this->currentDirectory);
        if (!is_dir($path)) {
            return new RouteCollection();
        }

        return $this->loadFromDirectory($pathtrim($resource['namespace'], '\\'));
    }

    public function supports(mixed $resource, string $type = null): bool
    {
        return ('attribute' === $type || 'annotation' === $type) && \is_array($resource) && isset($resource['path']$resource['namespace']);
    }

    public function forDirectory(string $currentDirectory)static
    {
        $loader = clone $this;
        $loader->currentDirectory = $currentDirectory;

        
/** * @param array{path: string, namespace: string} $resource */
    public function load(mixed $resource, string $type = null): ?RouteCollection
    {
        $path = $this->locator->locate($resource['path']$this->currentDirectory);
        if (!is_dir($path)) {
            return new RouteCollection();
        }

        return $this->loadFromDirectory($pathtrim($resource['namespace'], '\\'));
    }

    public function supports(mixed $resource, string $type = null): bool
    {
        return ('attribute' === $type || 'annotation' === $type) && \is_array($resource) && isset($resource['path']$resource['namespace']);
    }

    public function forDirectory(string $currentDirectory)static
    {
        $loader = clone $this;
        $loader->currentDirectory = $currentDirectory;

        
Home | Imprint | This part of the site doesn't use cookies.