private function createTokenNode($tokenName, $defaultClass, $tokenInterface, $defaultTtl)
    {
        $builder = new TreeBuilder();
        $node = $builder->root($tokenName);
        $node
            ->addDefaultsIfNotSet()
            ->children()
                ->integerNode('ttl')
                    ->defaultValue($defaultTtl)
                ->end()
                ->scalarNode('class')
                    ->cannotBeEmpty()
                    ->defaultValue($defaultClass)
                    ->validate()
                        ->ifTrue(function ($accessTokenClass) use ($tokenInterface) {
                            return !(
                                class_exists($accessTokenClass, true)
                                && (new \ReflectionClass($accessTokenClass))
                                    ->implementsInterface($tokenInterface)
                            );
                        })
                        ->thenInvalid(sprintf(
                            'Provided access_token configuration has to be a valid class which implements %s.',
                            $tokenInterface
                        ))
                    ->end()
                ->end()
                ->append($this->createDriverStrategyNode('loader'))
                ->append($this->createDriverStrategyNode('repository'))
            ->end()
        ;

        return $node;
    }
private function createTokenNode($tokenName, $defaultClass, $tokenInterface, $defaultTtl)
    {
        $builder = new TreeBuilder();
        $node = $builder->root($tokenName);
        $node
            ->addDefaultsIfNotSet()
            ->children()
                ->integerNode('ttl')
                    ->defaultValue($defaultTtl)
                ->end()
                ->scalarNode('class')
                    ->cannotBeEmpty()
                    ->defaultValue($defaultClass)
                    ->validate()
                        ->ifTrue(function ($accessTokenClass) use ($tokenInterface) {
                            return !(
                                class_exists($accessTokenClass, true)
                                && (new \ReflectionClass($accessTokenClass))
                                    ->implementsInterface($tokenInterface)
                            );
                        })
                        ->thenInvalid(sprintf(
                            'Provided access_token configuration has to be a valid class which implements %s.',
                            $tokenInterface
                        ))
                    ->end()
                ->end()
                ->append($this->createDriverStrategyNode('loader'))
                ->append($this->createDriverStrategyNode('repository'))
            ->end()
        ;

        return $node;
    }
private function createTokenNode ( $ tokenName , $ defaultClass , $ tokenInterface , $ defaultTtl ) { $ builder = new TreeBuilder ( ) ; $ node = $ builder -> root ( $ tokenName ) ; $ node -> addDefaultsIfNotSet ( ) -> children ( ) -> integerNode ( 'ttl' ) -> defaultValue ( $ defaultTtl ) -> end ( ) -> scalarNode ( 'class' ) -> cannotBeEmpty ( ) -> defaultValue ( $ defaultClass ) -> validate ( ) -> ifTrue ( function ( $ accessTokenClass ) use ( $ tokenInterface ) { return ! ( class_exists ( $ accessTokenClass , true ) && ( new \ ReflectionClass ( $ accessTokenClass ) ) -> implementsInterface ( $ tokenInterface ) ) ; } ) -> thenInvalid ( sprintf ( 'Provided access_token configuration has to be a valid class which implements %s.' , $ tokenInterface ) ) -> end ( ) -> end ( ) -> append ( $ this -> createDriverStrategyNode ( 'loader' ) ) -> append ( $ this -> createDriverStrategyNode ( 'repository' ) ) -> end ( ) ; return $ node ; }
Create a token configuration node.

@param string $tokenName
@param string $defaultClass
@param string $tokenInterface
@param string $defaultTtl

@return Node
Create a token configuration node .