Creates a tree of RouteDefinition

@throws \RuntimeException
763927
private function gatherRoutesDefinitions()
    {
        $route = $this->findRouteByName($this->homeRouteName);
        $this->homeDefinition = new RouteDefinition($this->homeRouteName, $this->resolveRouteOptions($route, $this->homeRouteName));

        /** @var Route $route */
        foreach ($this->routes as $name => $route) {
            if ($this->homeRouteName !== $name && null !== $cms = $route->getOption('_cms')) {
                if (array_key_exists('name', $cms)) {
                    $this->createRouteDefinition($name, $route);
                }
            }
        }

        $this->homeDefinition->sortChildren();
    }
858143
private function initMethodDefinitionList()
    {
        $class = new \ReflectionClass( $this->className );
        $methods = $class->getMethods( \ReflectionMethod::IS_PUBLIC );

        foreach( $methods as /* @var $reflect \ReflectionMethod */
                 $reflect )
        {
            if( $reflect->class != $this->className )
            {
                continue;
            }

            $docComment = $reflect->getDocComment();
            $phpDoc = array(
                'name' => $reflect->getName(),
                'definition' => implode( "\n", array_map( 'trim', explode( "\n", $docComment ) ) )
            );

            $this->methodDefinitionList[] = $phpDoc;
        }
    }
806588
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('propel');

        $this->addGeneralSection($rootNode);
        $this->addExcludeTablesSection($rootNode);
        $this->addPathsSection($rootNode);
        $this->addDatabaseSection($rootNode);
        $this->addMigrationsSection($rootNode);
        $this->addReverseSection($rootNode);
        $this->addRuntimeSection($rootNode);
        $this->addGeneratorSection($rootNode);

        return $treeBuilder;
    }
225379
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root($this->root);

        $filterDefinition = $rootNode
            ->children()
                ->arrayNode('configurations')
                    ->prototype('array')
                        ->children();

        $this->appendFilterDefinition($filterDefinition);

        $filterDefinition->end()
                    ->end()
                ->end()
            ->end();

        return $treeBuilder;
    }
1277883
private function createControllerDefinition()
    {
        $id = $this->getServiceId('controller');
        if (!$this->container->has($id)) {
            $definition = new Definition($this->getServiceClass('controller'));
            $definition
                ->addMethodCall('setConfiguration', [new Reference($this->getServiceId('configuration'))])
                ->addMethodCall('setContainer', [new Reference('service_container')])
            ;
            $this->container->setDefinition($id, $definition);
        }
    }
115689
protected function _initItems()
    {
        if (!$this->_itemsXmlPath) {
            throw new RuntimeException('XML Path for facade items is not specified');
        }
        
        $config = Mage::getConfig()->getNode($this->_itemsXmlPath)->children();
        
        foreach ($config as $class) {
            $this->add(Mage::getModel($class));
        }
        
        return $this;
    }
657961
private function createStepsNodeDefinition()
    {
        $stepsNode = new ArrayNodeDefinition('steps');

        $stepsNode
            ->defaultValue(array())
            ->useAttributeAsKey('name')
            ->prototype('array')
                ->addDefaultsIfNotSet()
                ->children()
                    ->scalarNode('label')
                        ->defaultValue('')
                    ->end()

                    ->arrayNode('roles')
                        ->prototype('scalar')->end()
                    ->end()

                    ->arrayNode('model_status')
                        ->validate()
                            ->ifTrue(function ($value) {
                                return (is_array($value) && count($value) < 2);
                            })
                            ->thenInvalid('You must specify an array with [ method, constant ]')
                            ->ifTrue(function ($value) {
                                return ( ! defined($value[1]));
                            })
                            ->thenInvalid('You must specify a valid constant name as second parameter')
                        ->end()
                        ->prototype('scalar')->end()
                    ->end()

                    ->scalarNode('on_invalid')
                        ->defaultNull()
                    ->end()
                ->end()
                ->append($this->createNextStatesNodeDefinition())
            ->end()
        ;

        return $stepsNode;
    }
1012234
protected function lexDirectiveDefinition(): DirectiveDefinitionNode
    {
        $start = $this->lexer->getToken();

        $description = $this->lexDescription();

        $this->expectKeyword(KeywordEnum::DIRECTIVE);
        $this->expect(TokenKindEnum::AT);

        $name      = $this->lexName();
        $arguments = $this->lexArgumentsDefinition();

        $this->expectKeyword(KeywordEnum::ON);

        $locations = $this->lexDirectiveLocations();

        return new DirectiveDefinitionNode(
            $description,
            $name,
            $arguments,
            $locations,
            $this->createLocation($start)
        );
    }
1243661
protected function init()
	{
		if (isset($this->template) === false)
		{
			throw new \RuntimeException('Template property does not exist.');
		}

		if (empty($this->template) === false and is_string($this->template))
		{
			$this->template = $this->view($this->template);
		}
	}
723315
protected function init()
	{
		if (isset($this->theme) === false)
		{
			throw new \RuntimeException('Theme property does not exist.');
		}

		if (empty($this->theme) === false and is_string($this->theme))
		{
			$this->theme = \Theme::instance($this->theme);
		}

		// Sets active theme
		if (empty($this->theme_active) === false and is_string($this->theme_active))
		{
			$this->theme->active($this->theme_active);
		}

		// Initialize template
		$this->template_init();

		$this->theme->set_template($this->template);

		// Makes the theme instance available in all views
		$this->template->set_global('theme', $this->theme, false);
	}
71843
protected function setupTree(ArrayNodeDefinition $rootNode)
    {
        $rootNode
            ->addDefaultsIfNotSet()
            ->children()
                ->arrayNode('queues')
                    ->prototype('scalar')->end()
                ->end()
                ->scalarNode('serializer')
                    ->treatNullLike('RSQueue\\Serializer\\JsonSerializer')
                    ->defaultValue('RSQueue\\Serializer\\JsonSerializer')
                ->end()
                ->arrayNode('collector')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('enable')
                            ->defaultTrue()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('server')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('redis')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->scalarNode('cluster')
                                    ->defaultFalse()
                                ->end()
                                ->scalarNode('host')
                                    ->defaultValue('127.0.0.1')
                                ->end()
                                ->scalarNode('port')
                                    ->defaultValue(6379)
                                ->end()
                                ->scalarNode('database')
                                    ->defaultNull()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }
993927
protected function lexSchemaDefinition(): SchemaDefinitionNode
    {
        $start = $this->lexer->getToken();

        $this->expectKeyword(KeywordEnum::SCHEMA);

        return new SchemaDefinitionNode(
            $this->lexDirectives(),
            $this->many(
                TokenKindEnum::BRACE_L,
                [$this, 'lexOperationTypeDefinition'],
                TokenKindEnum::BRACE_R
            ),
            $this->createLocation($start)
        );
    }
1059394
public function createRuntime(TraversableNodeInterface $currentSiteNode, ControllerContext $controllerContext)
    {
        $fusionObjectTree = $this->getMergedFusionObjectTree($currentSiteNode);
        $fusionRuntime = new Runtime($fusionObjectTree, $controllerContext);
        return $fusionRuntime;
    }
958840
public function configure(ArrayNodeDefinition $builder)
    {
        $paths = $builder->children()->arrayNode('path')->children();
        foreach (array('resources', 'base') as $namespaceType) {
            $paths->scalarNode($namespaceType);
        }
        $builder->children()->variableNode('resource_map');
        $builder->children()->scalarNode('factory_class');
    }
266577
public function getConfigTreeBuilder()
	{
		$treeBuilder = new TreeBuilder();

		$treeBuilder->root('framework')
				->children()
					->append($this->getLocalesDefinition())
					->append($this->getDoctrineDefinition())
					->append($this->getAuditDefinition())
					->append($this->getSessionDefinition())
					->append($this->getMailerDefinition())
					->append($this->getServicesDefinition())
				->end();

		return $treeBuilder;
	}
1232463
private void buildRuntimeTree() {
    updateRuntime();
    Runtime rootInfo = findRuntime();
    root = new RuntimeNode();
    root.setFrameName("_top");
    root.setRuntimeID(rootInfo.getRuntimeID());

    List<Runtime> runtimeInfos = Lists.newArrayList(runtimesList.values());
    runtimeInfos.remove(rootInfo);

    for (Runtime runtimeInfo : runtimeInfos) {
      addNode(runtimeInfo, root);
    }
  }
1178524
public static function init()
    {
        if(static::$isInited)
        {
            throw new \RuntimeException('MemoryTableManager can not repeated init');
        }
        foreach(static::$tables as $name => $option)
        {
            $table = new \Swoole\Table($option['size'] ?? 1024, $option['conflictProportion'] ?? 0.2);
            foreach($option['columns'] as $column)
            {
                $table->column($column['name'], $column['type'] ?? swoole_table::TYPE_STRING, $column['size'] ?? 0);
            }
            if(!$table->create())
            {
                throw new \RuntimeException('MemoryTableManager create table failed');
            }
            static::$tables[$name] = $table;
        }
        static::$isInited = true;
    }