Configure the "cache.session" section.

@return ArrayNodeDefinition
188220
private function addSessionSupportSection()
    {
        $tree = new TreeBuilder();
        $node = $tree->root('session');

        $node
            ->canBeEnabled()
            ->addDefaultsIfNotSet()
            ->children()
                ->scalarNode('service_id')->isRequired()->end()
                ->booleanNode('use_tagging')->defaultTrue()->end()
                ->scalarNode('prefix')->defaultValue('session_')->end()
                ->scalarNode('ttl')->end()
            ->end();

        $this->normalizeEnabled($node);

        return $node;
    }
934008
private function addCacheSection(ArrayNodeDefinition $node, array $cacheFactories)
    {
        $cacheNodeBuilder = $node
            ->children()
                ->arrayNode('cache')
                    ->useAttributeAsKey('name')
                    ->prototype('array')
                        ->children()
                            ->scalarNode('type')->isRequired()->cannotBeEmpty()->end()
        ;

        foreach ($cacheFactories as $factory) {
            $factory->addConfiguration($cacheNodeBuilder);
        }
    }
904801
private function initConfig()
    {
        // Admin users can request to load config from db instead out of cache
        // @TODO Cache not implemented for now
        #$refresh_cache = isset($this->user) && $this->user->getAdmin() && isset($_REQUEST['refresh_config_cache']);

        $repository = new \Core\Config\Repository\DbRepository();
        $repository->setPdo($this->di->get('db.default.conn'));
        $repository->setTable('tekfw_core_configs');

        $this->config = new \Core\Config\Config($repository);

        // Create the Core config storage
        $core_storage = $this->config->createStorage('Core');

        // Load config from repository
        $this->config->load();

        // Make sure sites protocol is set
        if (empty($this->settings['protcol'])) {
            $this->settings['protocol'] = 'http';
        }

        // Check for baseurl or stop here
        if (empty($this->settings['baseurl'])) {
            Throw new FrameworkException('Baseurl not set in Settings.php');
        }

        // Define some basic url constants
        define('BASEURL', $this->settings['protocol'] . '://' . $this->settings['baseurl']);
        define('THEMESURL', BASEURL . '/Themes');

        $core_storage->set('site.protocol', $this->settings['protocol']);
        $core_storage->set('site.baseurl', $this->settings['baseurl']);

        // Check and set basic cookiename to config
        if (empty($this->settings['cookie'])) {
            Throw new FrameworkException('Cookiename not set in Settings.php');
        }

        $core_storage->set('cookie.name', $this->settings['cookie']);

        // Add dirs to config
        $dirs = [
            // Framework directory
            'fw' => $this->basedir . '/Core',

            // Framwork subdirectories
            'assets' => $this->basedir . '/Assets',
            'lib' => $this->basedir . '/Core',
            'html' => $this->basedir . '/Core/Html',
            'cache' => $this->basedir . '/Cache',

            // Public application dir
            'apps' => $this->basedir . '/Apps'
        ];

        $core_storage->addPaths($dirs);

        // Add urls to config
        $urls = [
            'apps' => BASEURL . '/Apps',
            'cache' => BASEURL . '/Cache',
            'vendor' => BASEURL . '/vendor',
            'vendor_tekkla' => BASEURL . '/vendor/tekkla',
        ];

        $core_storage->addUrls($urls);

        $this->di->mapValue('core.config', $this->config);
    }
1331050
public function configure(ArrayNodeDefinition $builder)
    {
        $builder
            ->children()
                ->scalarNode('host')
                    ->defaultNull()
                ->end()
                ->scalarNode('port')
                    ->defaultNull()
                ->end()
                ->scalarNode('docroot')
                    ->defaultNull()
                ->end()
                ->arrayNode('suites')
                    ->prototype('scalar')->end()
                ->end()
                ->scalarNode('router')
                    ->defaultNull()
                ->end()
            ->end()
        ->end();
    }
556546
protected function _initCache()
    {
        if (!Cache::getConfig(static::$cacheConfig)) {
            Cache::setConfig(static::$cacheConfig, [
                'className' => $this->_getDefaultCacheConfigClassName(),
                'prefix' => static::$cacheConfig . '_' . $this->_identifier,
                'duration' => $this->getConfig('interval'),
            ]);
        }
    }
1090801
private function addDbalSection(ArrayNodeDefinition $node)
    {
        $node
            ->children()
            ->arrayNode('dbal')
                ->beforeNormalization()
                    ->ifTrue(static function ($v) {
                        return is_array($v) && ! array_key_exists('connections', $v) && ! array_key_exists('connection', $v);
                    })
                    ->then(static function ($v) {
                        // Key that should not be rewritten to the connection config
                        $excludedKeys = ['default_connection' => true, 'types' => true, 'type' => true];
                        $connection   = [];
                        foreach ($v as $key => $value) {
                            if (isset($excludedKeys[$key])) {
                                continue;
                            }
                            $connection[$key] = $v[$key];
                            unset($v[$key]);
                        }
                        $v['default_connection'] = isset($v['default_connection']) ? (string) $v['default_connection'] : 'default';
                        $v['connections']        = [$v['default_connection'] => $connection];

                        return $v;
                    })
                ->end()
                ->children()
                    ->scalarNode('default_connection')->end()
                ->end()
                ->fixXmlConfig('type')
                ->children()
                    ->arrayNode('types')
                        ->useAttributeAsKey('name')
                        ->prototype('array')
                            ->beforeNormalization()
                                ->ifString()
                                ->then(static function ($v) {
                                    return ['class' => $v];
                                })
                            ->end()
                            ->children()
                                ->scalarNode('class')->isRequired()->end()
                                ->booleanNode('commented')->defaultNull()->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
                ->fixXmlConfig('connection')
                ->append($this->getDbalConnectionsNode())
            ->end();
    }
1366560
private function addPoolsSection(ArrayNodeDefinition $node)
    {
        $node
            ->children()
                ->arrayNode('pools')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('user')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->variableNode('templates')->defaultValue([
                                    '_form.html' => 'EkynaUserBundle:Admin/User:_form.html',
                                    'show.html'  => 'EkynaUserBundle:Admin/User:show.html',
                                ])->end()
                                ->scalarNode('entity')->defaultValue('Ekyna\Bundle\UserBundle\Entity\User')->end()
                                ->scalarNode('controller')->defaultValue('Ekyna\Bundle\UserBundle\Controller\Admin\UserController')->end()
                                ->scalarNode('repository')->defaultValue('Ekyna\Bundle\UserBundle\Entity\UserRepository')->end()
                                ->scalarNode('form')->defaultValue('Ekyna\Bundle\UserBundle\Form\Type\UserType')->end()
                                ->scalarNode('table')->defaultValue('Ekyna\Bundle\UserBundle\Table\Type\UserType')->end()
                                ->scalarNode('parent')->end()
                                ->scalarNode('event')->defaultValue('Ekyna\Bundle\UserBundle\Event\UserEvent')->end()
                            ->end()
                        ->end()
                        ->arrayNode('group')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->variableNode('templates')->defaultValue([
                                    '_form.html' => 'EkynaUserBundle:Admin/Group:_form.html',
                                    'show.html'  => 'EkynaUserBundle:Admin/Group:show.html',
                                ])->end()
                                ->scalarNode('entity')->defaultValue('Ekyna\Bundle\UserBundle\Entity\Group')->end()
                                ->scalarNode('controller')->defaultValue('Ekyna\Bundle\UserBundle\Controller\Admin\GroupController')->end()
                                ->scalarNode('repository')->defaultValue('Ekyna\Bundle\UserBundle\Entity\GroupRepository')->end()
                                ->scalarNode('form')->defaultValue('Ekyna\Bundle\UserBundle\Form\Type\GroupType')->end()
                                ->scalarNode('table')->defaultValue('Ekyna\Bundle\UserBundle\Table\Type\GroupType')->end()
                                ->scalarNode('parent')->end()
                                ->scalarNode('event')->end()
                            ->end()
                        ->end()
                        ->arrayNode('address')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->variableNode('templates')->defaultValue('EkynaUserBundle:Admin/Address')->end()
                                ->scalarNode('entity')->defaultValue('Ekyna\Bundle\UserBundle\Entity\Address')->end()
                                ->scalarNode('controller')->end()
                                ->scalarNode('repository')->defaultValue('Ekyna\Bundle\UserBundle\Entity\AddressRepository')->end()
                                ->scalarNode('form')->defaultValue('Ekyna\Bundle\UserBundle\Form\Type\AddressType')->end()
                                ->scalarNode('table')->defaultValue('Ekyna\Bundle\UserBundle\Table\Type\AddressType')->end()
                                ->scalarNode('parent')->defaultValue('ekyna_user.user')->end()
                                ->scalarNode('event')->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end()
        ;
    }
1230490
protected function configure()
    {
        $this
            ->setName($this->getName())
            ->setDescription($this->getDescription())
            ->addOption(
                'storage',
                null,
                InputOption::VALUE_OPTIONAL,
                'Environment Location Storage',
                $this->getDefaultFileName()
            );
    }
753637
public function cache() {
        $config = array();

        foreach (Cache::configured() as $key) {
            $temp = Cache::config($key);
            $config[$key] = $temp['settings'];
        }

        ksort($config);

        $this->set('configuration', $config);
    }
547717
protected function configure()
	{
		$this->setName( self::$defaultName );
		$this->setDescription( 'Clears the content cache' );
		$this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' );
	}
420342
protected function configure()
    {
        $this->setName('phpjunitmerge')
            ->setDefinition(
                array(
                    new InputArgument(
                        'dir',
                        InputArgument::REQUIRED,
                        'Directory where all files ready to get merged are stored'
                    ),
                    new InputArgument(
                        'file',
                        InputArgument::REQUIRED,
                        'The target file in which the merged result should be written'
                    )
                )
            )
            ->addOption(
                'names',
                null,
                InputOption::VALUE_REQUIRED,
                'A comma-separated list of file names to check',
                '*.xml'
            )
            ->addOption(
                'ignore',
                null,
                InputOption::VALUE_REQUIRED,
                'A comma-separated list of file names to ignore',
                'result.xml'
            )
			->addOption(
				'no-suffix',
				null,
				InputOption::VALUE_NONE,
				'Do not add suffix for test suites with duplicate names',
				null
			);
    }
1223688
protected function configureUser()
    {
        if (!$this->confirm('Do you want to create an admin user?')) {
            return;
        }

        // We need to refresh the config to get access to the newly connected database.
        $this->getFreshConfiguration();

        // Now we need to install the application.
        // $this->call('cachet:install');

        $user = [
            'username' => $this->ask('Please enter your username'),
            'email'    => $this->ask('Please enter your email'),
            'password' => $this->secret('Please enter your password'),
            'level'    => User::LEVEL_ADMIN,
        ];

        User::create($user);
    }
1297970
public function init()
    {
        parent::init();
        $this->sessionKey = $this->getSessionKey();
        $this->cache = Instance::ensure($this->cache, Cache::class);
    }
63184
private function configCache(): ConfigCache
    {
        if (null === $this->configCache)
        {
            $this->configCache = new ConfigCache($this->getContainerClassPath(), $this->environment->isDebug());
        }

        return $this->configCache;
    }
1018295
public function init()
    {
        if ($this->isCacheEnabled() and file_exists(self::CACHE_LOCATION)) {
            $store = include self::CACHE_LOCATION;
        } else {
            $store        = [];
            $finalList    = [];
            $config       = $this->serviceManager->get('config');
            $dirLocations = (array)$config['pagebuilder']['widgets']['paths'];

            foreach ($dirLocations as $namespace => $dirLocation) {
                $iterator = new \RecursiveIteratorIterator(
                    new \RecursiveDirectoryIterator($dirLocation, \FilesystemIterator::SKIP_DOTS),
                    \RecursiveIteratorIterator::CHILD_FIRST
                );

                /** @var $splFileInfo \SplFileInfo */
                foreach ($iterator as $splFileInfo) {
                    $ext = substr(basename($splFileInfo->getFilename()), -4);
                    if ($splFileInfo->isFile() and $ext == '.php') {
                        $widgetId  = substr(basename($splFileInfo->getFilename()), 0, -4);
                        $className = substr(
                            $namespace . str_replace(
                                '/', "\\", str_replace($dirLocation, '', $splFileInfo->getPathname())
                            ),
                            0, -4
                        );

                        $reflection = new \ReflectionClass($className);

                        if ($reflection->isInstantiable()
                            and $reflection->implementsInterface('PageBuilder\WidgetInterface')
                        ) {
                            $attributes = $reflection->getDefaultProperties();
                            $id         = !empty($attributes['id']) ? preg_replace(
                                '/[^a-z]/i', '',
                                $attributes['id']
                            )
                                : $widgetId;
                            $id         = strtolower($id);
                            $category   = basename(dirname($splFileInfo->getPathname()));

                            $data = [
                                'id'          => $id,
                                'class'       => $className,
                                'category'    => ($category == 'Widget') ? 'General' : $category,
                                'title'       => $attributes['name'] ?: $widgetId,
                                'description' => $attributes['description'] ?: 'No description found',
                                'options'     => $attributes['options'],
                            ];

                            $path          = [$id => $data];
                            $store[0][$id] = $data;
                        } else {
                            continue;
                        }
                    } else {
                        $dirName = $splFileInfo->getFilename();
                        $path    = [$dirName => []];
                    }

                    for ($depth = $iterator->getDepth() - 1; $depth >= 0; $depth--) {
                        $dirName = $iterator->getSubIterator($depth)->current()->getFilename();
                        $path    = [$dirName => $path];
                    }

                    uasort(
                        $path,
                        function ($a, $b) {
                            return strcmp($a['title'], $b['title']);
                        }
                    );

                    $finalList = array_merge_recursive($finalList, $path);
                }
            }

            $store[1] = $finalList;

            if ($this->isCacheEnabled()) {
                $data = '<?php return ' . var_export($store, true) . ' ;';
                file_put_contents(self::CACHE_LOCATION, $data);
            }
        }

        $this->dataStore = $store;
    }
1291791
protected function sessionSection(Request $request): SectionInterface
    {
        if (empty($request->getAttribute(SessionStarter::ATTRIBUTE))) {
            throw new AuthException("Unable to use authorization thought session, no session exists");
        }

        /** @var SessionInterface $session */
        $session = $request->getAttribute(SessionStarter::ATTRIBUTE);

        return $session->getSection($this->section);
    }
633861
protected function _init() {
		$this->connection = $this->connection ?: new Memcached();
		$this->connection->addServers($this->_formatHostList($this->_config['host']));

		if ($this->_config['scope']) {
			$this->connection->setOption(Memcached::OPT_PREFIX_KEY, "{$this->_config['scope']}:");
		}
	}