<commit_before><?php
    namespace b3nl\SWRedis\DI\Bridge;

    use b3nl\SWRedis\Session\SaveHandler,
        Predis\Client as PredisClient,
        Shopware\Components\DependencyInjection\Bridge\Session as SessionBase,
        Shopware\Components\DependencyInjection\Container;

    /**
     * Injects the session to redis.
     * @author blange <<EMAIL>>
     * @package b3nl\SWRedis
     * @subpackage DI\Bridge
     * @version $id$
     */
    class Session extends SessionBase
    {
        /**
         * Starts the redis connection.
         * @param Container $container
         * @return \Enlight_Components_Session_Namespace
         */
        public function factory(Container $container)
        {
            $sessionOptions = Shopware()->getOption('session', array());

            if (@$sessionOptions['save_handler'] === 'redis') {
                $redisOptions = array_merge(
                    [
                        'exceptions' => true,
                        'prefix' => 'session:'
                    ],
                    isset($sessionOptions['redis_options']) && is_array($sessionOptions['redis_options'])
                        ? $sessionOptions['redis_options']
                        : []
                );

                $redisOptions['prefix'] = @$redisOptions['prefix'] ?: 'session:';

                $client = new PredisClient($redisOptions);

                \Enlight_Components_Session::setSaveHandler(new SaveHandler($client));

                unset($sessionOptions['save_handler']);
            } // if

            return parent::factory($container);
        } // function
    }<commit_msg>+ added an option overwrite<commit_after><?php
    namespace b3nl\SWRedis\DI\Bridge;

    use b3nl\SWRedis\Session\SaveHandler,
        Predis\Client as PredisClient,
        Shopware\Components\DependencyInjection\Bridge\Session as SessionBase,
        Shopware\Components\DependencyInjection\Container;

    /**
     * Injects the session to redis.
     * @author blange <<EMAIL>>
     * @package b3nl\SWRedis
     * @subpackage DI\Bridge
     * @version $id$
     */
    class Session extends SessionBase
    {
        /**
         * Starts the redis connection.
         * @param Container $container
         * @return \Enlight_Components_Session_Namespace
         */
        public function factory(Container $container)
        {
            $sessionOptions = Shopware()->getOption('session', array());

            if (@$sessionOptions['save_handler'] === 'redis') {
                $redisOptions = array_merge(
                    [
                        'exceptions' => true,
                        'prefix' => 'session:'
                    ],
                    isset($sessionOptions['redis_options']) && is_array($sessionOptions['redis_options'])
                        ? $sessionOptions['redis_options']
                        : []
                );

                $redisOptions['prefix'] = @$redisOptions['prefix'] ?: 'session:';

                $client = new PredisClient($redisOptions);

                \Enlight_Components_Session::setSaveHandler(new SaveHandler($client));

                unset($sessionOptions['save_handler'], $sessionOptions['redis_options']);

                Shopware()->setOptions('session', $sessionOptions);
            } // if

            return parent::factory($container);
        } // function
    } // class
{'fraction_non_alphanumeric': 0.11847507331378299, 'fraction_numerical': 0.0017595307917888563, 'mean_word_length': 1.828358208955224, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4791541', 'n_tokens_mistral': 897, 'n_tokens_neox': 842, 'n_words': 150}