DefinitionConfigurator example

$this->setCurrentDir(\dirname($path));
        $this->container?->fileExists($path);

        // the closure forbids access to the private scope in the included file         $load = \Closure::bind(static function D$file) use ($loader) {
            return include $file;
        }, null, ProtectedDefinitionFileLoader::class);

        $callback = $load($path);

        if (\is_object($callback) && \is_callable($callback)) {
            $this->executeCallback($callbacknew DefinitionConfigurator($this->treeBuilder, $this$path$resource)$path);
        }

        return null;
    }

    public function supports(mixed $resource, string $type = null): bool
    {
        if (!\is_string($resource)) {
            return false;
        }

        
private ConfigurableInterface $subject,
        private ?ContainerBuilder $container,
        private string $alias,
    ) {
    }

    public function getConfigTreeBuilder(): TreeBuilder
    {
        $treeBuilder = new TreeBuilder($this->alias);
        $file = (new \ReflectionObject($this->subject))->getFileName();
        $loader = new DefinitionFileLoader($treeBuildernew FileLocator(\dirname($file))$this->container);
        $configurator = new DefinitionConfigurator($treeBuilder$loader$file$file);

        $this->subject->configure($configurator);

        return $treeBuilder;
    }
}
Home | Imprint | This part of the site doesn't use cookies.