<commit_before><?php

namespace Ronanchilvers\Silex\Provider;

use Silex\Application;
use Silex\ServiceProviderInterface;
use Symfony\Component\Yaml\Parser as YamlParser;

/**
 * Simple class to provide a config service parsed from a YAML file.
 * 
 * @author <NAME> <<EMAIL>>
 */
class YamlConfigServiceProvider implements ServiceProviderInterface
{
    /**
     * The yml filename to parse
     * 
     * @var string
     */
    protected $filename;

    /**
     * Class constructor
     *
     * @param  string $filename
     * 
     * @author <NAME> <<EMAIL>>
     */
    public function __construct($filename)
    {
        $this->filename = $filename;
    }

    /**
     * Register this provider.
     *
     * @param Silex\Application $app
     *
     * @author <NAME> <<EMAIL>>
     */
    public function register(Application $app)
    {
        if (is_null($this->filename)) {
            throw new \RuntimeException('You must provide a valid config filename');
        }
        if (!file_exists($this->filename)) {
            throw new \RuntimeException(sprintf('Config path \'%s\' is not valid', $this->filename));
        }
        if (!is_readable($this->filename)) {
            throw new \RuntimeException(sprintf('Config path \'%s\' is not readable', $this->filename));
        }
        $parser = new YamlParser();
        $config = $parser->parse(file_get_contents($this->filename));
        if (is_array($config) && !empty($config)) {
            if (isset($app['config']) && is_array($app['config'])) {
                $config = array_replace_recursive($app['config'], $config);
            }
            $app['config'] = $config;
        }
    }

    /**
     * Boot the provider.
     *
     * @param Silex\Application $app
     *
     * @author <NAME> <<EMAIL>>
     */
    public function boot(Application $app)
    {
    }
}
<commit_msg>PSR changes<commit_after><?php

namespace Ronanchilvers\Silex\Provider;

use Silex\Application;
use Silex\ServiceProviderInterface;
use Symfony\Component\Yaml\Parser as YamlParser;

/**
 * Simple class to provide a config service parsed from a YAML file.
 * 
 * @author <NAME> <<EMAIL>>
 */
class YamlConfigServiceProvider implements ServiceProviderInterface
{
    /**
     * The yml filename to parse.
     * 
     * @var string
     */
    protected $filename;

    /**
     * Class constructor.
     *
     * @param string $filename
     * 
     * @author <NAME> <<EMAIL>>
     */
    public function __construct($filename)
    {
        $this->filename = $filename;
    }

    /**
     * Register this provider.
     *
     * @param Silex\Application $app
     *
     * @author <NAME> <<EMAIL>>
     */
    public function register(Application $app)
    {
        if (is_null($this->filename)) {
            throw new \RuntimeException('You must provide a valid config filename');
        }
        if (!file_exists($this->filename)) {
            throw new \RuntimeException(sprintf('Config path \'%s\' is not valid', $this->filename));
        }
        if (!is_readable($this->filename)) {
            throw new \RuntimeException(sprintf('Config path \'%s\' is not readable', $this->filename));
        }
        $parser = new YamlParser();
        $config = $parser->parse(file_get_contents($this->filename));
        if (is_array($config) && !empty($config)) {
            if (isset($app['config']) && is_array($app['config'])) {
                $config = array_replace_recursive($app['config'], $config);
            }
            $app['config'] = $config;
        }
    }

    /**
     * Boot the provider.
     *
     * @param Silex\Application $app
     *
     * @author <NAME> <<EMAIL>>
     */
    public function boot(Application $app)
    {
    }
}

{'fraction_non_alphanumeric': 0.14358424859362443, 'fraction_numerical': 0.0, 'mean_word_length': 2.2329004329004327, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 43, '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': '2644318', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1081, 'n_words': 255}