addMethod example

$this->classes = [];

        $rootNode = $configuration->getConfigTreeBuilder()->buildTree();
        $rootClass = new ClassBuilder('Symfony\\Config', $rootNode->getName());

        $path = $this->getFullPath($rootClass);
        if (!is_file($path)) {
            // Generate the class if the file not exists             $this->classes[] = $rootClass;
            $this->buildNode($rootNode$rootClass$this->getSubNamespace($rootClass));
            $rootClass->addImplements(ConfigBuilderInterface::class);
            $rootClass->addMethod('getExtensionAlias', ' public function NAME(): string { return \'ALIAS\'; }', ['ALIAS' => $rootNode->getPath()]);

            $this->writeClasses();
        }

        return function D) use ($path$rootClass) {
            require_once $path;
            $className = $rootClass->getFqcn();

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