<commit_before><?php
namespace DoctrineExtensions\Tests\Query;

use Doctrine\ORM\Configuration;
use Symfony\Component\Yaml\Parser;

class ConfigLoader
{
    const MYSQL    = 'mysql';
    const ORACLE   = 'oracle';
    const POSTGRES = 'postgres';
    const SQLITE   = 'sqlite';

    /**
     * @param Configuration $configuration
     * @param string        $database
     */
    public static function load(Configuration $configuration, $database)
    {
        $parser = new Parser();
        // Load the corresponding config file.
        $parsed = $parser->parse( file_get_contents( realpath( __DIR__ . '/../../config/' . $database . '.yml' ) ) );

        // Make sure it has the correct structure.
        if (array_key_exists('doctrine', $parsed)
            and array_key_exists('orm', $parsed['doctrine'])
            and array_key_exists('dql', $parsed['doctrine']['orm'])
        ) {
            $parsed = $parsed['doctrine']['orm']['dql'];
        } else {
            throw new \Exception('/config/' . $database . '.yml does not have the proper doctrine configuration.');
        }

        // Load the existing function classes.
        if (array_key_exists('datetime_functions', $parsed)) {
            foreach ($parsed[ 'datetime_functions' ] as $key => $value) {
                $configuration->addCustomDatetimeFunction(strtoupper($key), $value);
            }
        }
        if (array_key_exists('numeric_functions', $parsed)) {
            foreach ($parsed[ 'numeric_functions' ] as $key => $value) {
                $configuration->addCustomNumericFunction(strtoupper($key), $value);
            }
        }
        if (array_key_exists('string_functions', $parsed)) {
            foreach ($parsed[ 'string_functions' ] as $key => $value) {
                $configuration->addCustomStringFunction(strtoupper($key), $value);
            }
        }
    }
}<commit_msg>Remove yml config checking in ConfigLoader.<commit_after><?php
namespace DoctrineExtensions\Tests\Query;

use Doctrine\ORM\Configuration;
use Symfony\Component\Yaml\Parser;

class ConfigLoader
{
    const MYSQL    = 'mysql';
    const ORACLE   = 'oracle';
    const POSTGRES = 'postgres';
    const SQLITE   = 'sqlite';

    /**
     * @param Configuration $configuration
     * @param string        $database
     */
    public static function load(Configuration $configuration, $database)
    {
        $parser = new Parser();
        // Load the corresponding config file.
        $config = $parser->parse( file_get_contents( realpath( __DIR__ . '/../../config/' . $database . '.yml' ) ) );
        $parsed = $config['doctrine']['orm']['dql'];

        // Load the existing function classes.
        if (array_key_exists('datetime_functions', $parsed)) {
            foreach ($parsed[ 'datetime_functions' ] as $key => $value) {
                $configuration->addCustomDatetimeFunction(strtoupper($key), $value);
            }
        }
        if (array_key_exists('numeric_functions', $parsed)) {
            foreach ($parsed[ 'numeric_functions' ] as $key => $value) {
                $configuration->addCustomNumericFunction(strtoupper($key), $value);
            }
        }
        if (array_key_exists('string_functions', $parsed)) {
            foreach ($parsed[ 'string_functions' ] as $key => $value) {
                $configuration->addCustomStringFunction(strtoupper($key), $value);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.13822326125073056, 'fraction_numerical': 0.0, 'mean_word_length': 2.4195804195804196, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '7530671', 'n_tokens_mistral': 945, 'n_tokens_neox': 949, 'n_words': 212}