<commit_before><?php
namespace core;

use InvalidArgumentException;

class Config
{
    /** @var  array $settings */
    private static $settings;

    /**
     * @param string $name
     * @param null $default
     * @return string
     */
    public static function get($name, $default = null) {
        if (empty($name)) {
            Report::reportFatal('Nothing to get', InvalidArgumentException::class);
        }
        if (self::$settings === null) {
            parse_ini_file(PROPERTIES);
        }
        if (isset(self::$settings[ $name ])) {
            return (string)self::$settings[ $name ];
        } elseif ($default !== null) {
            return $default;
        }
        Report::reportFatal("Setting $name not found", InvalidArgumentException::class);

        return null;
    }
}<commit_msg>Check for disabled function parse_ini_file<commit_after><?php
namespace core;

use InvalidArgumentException;

class Config
{
    /** @var  array $settings */
    private static $settings;

    /**
     * @param string $name
     * @param null $default
     * @return string
     */
    public static function get ( $name, $default = null ) {
        if ( empty( $name ) ) {
            Report::reportFatal ( 'Nothing to get', InvalidArgumentException::class );
        }
        if ( self::$settings === null ) {
            self::getSettings ();
        }
        if ( isset( self::$settings[ $name ] ) ) {
            return (string) self::$settings[ $name ];
        } elseif ( $default !== null ) {
            return $default;
        }
        var_dump(self::$settings);
        Report::reportFatal ( "Setting $name not found", InvalidArgumentException::class );

        return null;
    }

    private static function getSettings () {
        if ( function_exists ( 'parse_ini_file' ) ) {
            self::$settings = parse_ini_file ( PROPERTIES );
        } else {
            $content = preg_grep ( "/^[\w .]+=.*/", explode ( PHP_EOL, file_get_contents ( PROPERTIES ) ) );
            foreach ( $content as $row ) {
                $row                    = strstr ( $row . ";", ";", true );
                $key                    = trim ( strstr ( $row, "=", true ), " \n\r" );
                $value                  = trim ( strstr ( $row, "=", false ), " \"=\n\r" );
                self::$settings[ $key ] = $value;
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.1452560873215785, 'fraction_numerical': 0.0, 'mean_word_length': 1.8676293622141997, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '619840', 'n_tokens_mistral': 662, 'n_tokens_neox': 652, 'n_words': 162}