<commit_before><?php

/*
 * This file is part of StashServiceProvider
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Bt51\Silex\Provider\StashServiceProvider;

use Silex\Application;
use Silex\ServiceProviderInterface;
use Stash\Pool;

class StashServiceProvider implements ServiceProviderInterface
{
    public function register(Application $app)
    {
        if (! isset($app['stash.driver.class'])) {
            $app['stash.driver.class'] = 'Ephemeral';
        }

        $app['stash.driver'] = $app->share(function ($app) {
            $options = (isset($app['stash.driver.options']) ? $app['stash.driver.options'] : array());
            $class = sprintf('\\Stash\\Driver\\%s', $app['stash.driver.class']);
            $driver = new \ReflectionClass($class);
            return $driver->newInstanceArgs(array($options));
        });
        
        $app['stash'] = $app->share(function ($app) {
            return new Pool($app['stash.driver']);
        });
    }
    
    public function boot(Application $app)
    {
        
    }
}<commit_msg>Fix to use setOptions() syntax<commit_after><?php

/*
 * This file is part of StashServiceProvider
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Bt51\Silex\Provider\StashServiceProvider;

use Silex\Application;
use Silex\ServiceProviderInterface;
use Stash\Pool;

class StashServiceProvider implements ServiceProviderInterface
{
    public function register(Application $app)
    {
        if (! isset($app['stash.driver.class'])) {
            $app['stash.driver.class'] = 'Ephemeral';
        }

        $app['stash.driver'] = $app->share(function ($app) {
            $options = (isset($app['stash.driver.options']) ? $app['stash.driver.options'] : array());
            $class = sprintf('\\Stash\\Driver\\%s', $app['stash.driver.class']);
            $driver  = new $class;
            $driver->setOptions($options);
            return $driver;            
        });
        
        $app['stash'] = $app->share(function ($app) {
            return new Pool($app['stash.driver']);
        });
    }
    
    public function boot(Application $app)
    {
        
    }
}
{'fraction_non_alphanumeric': 0.1499370012599748, 'fraction_numerical': 0.0016799664006719867, 'mean_word_length': 2.6422018348623855, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '4671032', 'n_tokens_mistral': 700, 'n_tokens_neox': 698, 'n_words': 153}