<commit_before><?php
/*
 * This file is part of the php-utilities package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Asm\Config;

/**
 * Class ConfigTimer
 *
 * @package Asm\Config
 * @author <NAME> <<EMAIL>>
 */
final class ConfigTimer extends ConfigAbstract implements ConfigInterface
{
    /**
     * Convert config date strings to \DateTime objects or \DateIntervals.
     *
     * @param string $file config file
     */
    public function setConfig($file)
    {
        $config = $this->readConfig($file);

        // iterate conf and check if there are dates/datetimes/times and so on, for conversion
        foreach ($config as $timerKey => $timers) {
            switch ($timerKey) {
                case 'timers':
                    foreach ($timers as $timerSubKey => $params) {
                        foreach ($params as $paramKey => $paramVal) {
                            switch ($paramKey) {
                                case 'interval':
                                    // check the contents of interval
                                    foreach ($paramVal as $intervalKey => $interval) {
                                        // convert all sub elements
                                        foreach ($interval as $key => $intervalValue) {
                                            // just a date, no time - one element
                                            switch (count($interval)) {
                                                case 1:
                                                    $dateEnd = new \DateTime(
                                                        $intervalValue . ' 23:59:59'
                                                    );
                                                    $config[$timerKey][$timerSubKey][$paramKey][$intervalKey][1] =
                                                        $dateEnd;
                                                //fallthrough<commit_msg>Added typehint for value<commit_after><?php
/*
 * This file is part of the php-utilities package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Asm\Config;

/**
 * Class ConfigTimer
 *
 * @package Asm\Config
 * @author <NAME> <<EMAIL>>
 */
final class ConfigTimer extends ConfigAbstract implements ConfigInterface
{
    /**
     * Convert config date strings to \DateTime objects or \DateIntervals.
     *
     * @param string $file config file
     */
    public function setConfig($file)
    {
        /** @var array $config */
        $config = $this->readConfig($file);

        // iterate conf and check if there are dates/datetimes/times and so on, for conversion
        foreach ($config as $timerKey => $timers) {
            switch ($timerKey) {
                case 'timers':
                    foreach ($timers as $timerSubKey => $params) {
                        foreach ($params as $paramKey => $paramVal) {
                            switch ($paramKey) {
                                case 'interval':
                                    // check the contents of interval
                                    foreach ($paramVal as $intervalKey => $interval) {
                                        // convert all sub elements
                                        foreach ($interval as $key => $intervalValue) {
                                            // just a date, no time - one element
                                            switch (count($interval)) {
                                                case 1:
                                                    $dateEnd = new \DateTime(
                                                        $intervalValue . ' 23:59:59'
                                                    );
                                                    $config[$timerKey][$timerSubKey][$paramKey][$intervalKey][1] =
                                                        $dateEnd;
                                                //fallthrough
{'fraction_non_alphanumeric': 0.08711132209826727, 'fraction_numerical': 0.0037977688108236413, 'mean_word_length': 1.0466245750364254, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 46, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1165973', 'n_tokens_mistral': 846, 'n_tokens_neox': 817, 'n_words': 285}