<commit_before><?php

namespace Modularity\Helper;

/**
 * Returns format for date and time
 * @param  string $format      A string that is either date or time or date-time
 * @return string              The format for date/time
 */

class Date
{
    public static function getDateFormat($format)
    {
        $defaultTime = 'H:i';
        $defaultDate = 'Y-m-d';
        $dateFormat = function_exists('get_option') && !empty(get_option('date_format')) ?
        get_option('date_format') : $defaultDate;

        $timeFormat = function_exists('get_option') && !empty(get_option('time_format')) ?
        get_option('time_format') : $defaultTime;

        if ($format === 'date') {
            return $dateFormat;
        } elseif ($format === 'time') {
            return $timeFormat;
        } elseif ($format === 'date-time') {
            return $dateFormat . ' ' . $timeFormat;
        }

        return $dateFormat . ' ' . $timeFormat;
    }
}<commit_msg>Getting/supplying timeformat from the date helper<commit_after><?php

namespace Modularity\Helper;

use DateTime;
use DateTimeZone;


/**
 * Returns format for date and time
 * @param  string $format      A string that is either date or time or date-time
 * @return string              The format for date/time
 */

class Date
{
    public static function getDateFormat($format)
    {
        $defaultTime = 'H:i';
        $defaultDate = 'Y-m-d';
        $dateFormat = function_exists('get_option') && !empty(get_option('date_format')) ?
        get_option('date_format') : $defaultDate;

        $timeFormat = function_exists('get_option') && !empty(get_option('time_format')) ?
        get_option('time_format') : $defaultTime;

        if ($format === 'date') {
            return $dateFormat;
        } elseif ($format === 'time') {
            return $timeFormat;
        } elseif ($format === 'date-time') {
            return $dateFormat . ' ' . $timeFormat;
        }

        return $dateFormat . ' ' . $timeFormat;
    }


    public function getTimeStamp($dateStr) {
        $timezone = wp_timezone_string();
        $dateObj = new DateTime($dateStr, new DateTimeZone($timezone));
        return $dateObj->format('U');
    }    
}
{'fraction_non_alphanumeric': 0.1366318656377667, 'fraction_numerical': 0.0, 'mean_word_length': 2.5207667731629395, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '1432007', 'n_tokens_mistral': 642, 'n_tokens_neox': 636, 'n_words': 155}