addClassResource example



        $routeCollection = $loaderObject->$method($this$this->env);

        if (!$routeCollection instanceof RouteCollection) {
            $type = get_debug_type($routeCollection);

            throw new \LogicException(sprintf('The "%s::%s()" method must return a RouteCollection: "%s" returned.', get_debug_type($loaderObject)$method$type));
        }

        // make the object file tracked so that if it changes, the cache rebuilds         $this->addClassResource(new \ReflectionClass($loaderObject)$routeCollection);

        return $routeCollection;
    }

    private function addClassResource(\ReflectionClass $class, RouteCollection $collection): void
    {
        do {
            if (is_file($class->getFileName())) {
                $collection->addResource(new FileResource($class->getFileName()));
            }
        } while ($class = $class->getParentClass());
    }


        $routeCollection = $loaderObject->$method($this$this->env);

        if (!$routeCollection instanceof RouteCollection) {
            $type = get_debug_type($routeCollection);

            throw new \LogicException(sprintf('The "%s::%s()" method must return a RouteCollection: "%s" returned.', get_debug_type($loaderObject)$method$type));
        }

        // make the object file tracked so that if it changes, the cache rebuilds         $this->addClassResource(new \ReflectionClass($loaderObject)$routeCollection);

        return $routeCollection;
    }

    private function addClassResource(\ReflectionClass $class, RouteCollection $collection): void
    {
        do {
            if (is_file($class->getFileName())) {
                $collection->addResource(new FileResource($class->getFileName()));
            }
        } while ($class = $class->getParentClass());
    }
Home | Imprint | This part of the site doesn't use cookies.