<commit_before><?php

/*
 * This file is part of the EasyBanglaDate package.
 *
 * Copyright (c) 2015 <NAME>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */


namespace EasyBanglaDate\Types;

use EasyBanglaDate\Common\BaseDateTime;
use EasyBanglaDate\Tools\Converter;

class BnDateTime  extends BaseDateTime
{

    protected static $bnMonths = array('', 'বৈশাখ','জ্যৈষ্ঠ','আষাঢ়','শ্রাবণ','ভাদ্র','আশ্বিন','কার্তিক','অগ্রহায়ণ','পৌষ','মাঘ','ফাল্গুন','চৈত্র');

    private $morning = 6;

    protected function replaceDateNumbers($format)
    {
        $bnDate = $this->getBengaliDateMonthYear();

        $format = str_replace('S', $this->getSuffix($bnDate['date']), $format);
        $format = str_replace('d', str_pad($bnDate['date'], 2, 0, STR_PAD_LEFT), $format);
        $format = str_replace('j', $bnDate['date'], $format);

        //@TODO: Implement get day in month
        //$format = str_replace('t', $this->getDayInMonth($bnDate['month']), $format);
        $format = str_replace('m', str_pad($bnDate['month'], 2, 0, STR_PAD_LEFT), $format);
        $format = str_replace('n', $bnDate['month'], $format);
        $format = str_replace('F', self::$bnMonths[$bnDate['month']], $format);
        $format = str_replace('M', self::$bnMonths[$bnDate['month']], $format);
        $format = str_replace('Y', $bnDate['year'], $format);
        $format = str_replace('y', substr($bnDate['year'], -2), $format);

        return $format;
    }

    public function format($format)
    {
        $out = $this->replaceTimes($format);
        $out = $this->replaceTimePrefix($out);
        $out = $this->replaceDateNumbers($out);
        $out = $this->replaceDays($out);
        $out = $this->replaceMeridian($out);

        return $this->translateNumbers($out);
    }

    /**
     * @param int $morning
     */
    public function setMorning($morning)
    {
        $this->morning = $morning;
    }

    private function getBengaliDateMonthYear()
    {
        return Converter::getBengaliDateMonthYear($this->getNativeDateTimeObject(), $this->morning);
    }

    /**
     * @return \DateTime
     */
    private function getNativeDateTimeObject()
    {
        $dateTime = new \DateTime();

        return $dateTime
            ->setTimestamp($this->getTimestamp())
            ->setTimezone($this->getTimezone())
            ;
    }
}<commit_msg>t flag replaced with empty string<commit_after><?php

/*
 * This file is part of the EasyBanglaDate package.
 *
 * Copyright (c) 2015 <NAME>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */


namespace EasyBanglaDate\Types;

use EasyBanglaDate\Common\BaseDateTime;
use EasyBanglaDate\Tools\Converter;

class BnDateTime  extends BaseDateTime
{

    protected static $bnMonths = array('', 'বৈশাখ','জ্যৈষ্ঠ','আষাঢ়','শ্রাবণ','ভাদ্র','আশ্বিন','কার্তিক','অগ্রহায়ণ','পৌষ','মাঘ','ফাল্গুন','চৈত্র');

    private $morning = 6;

    protected function replaceDateNumbers($format)
    {
        $bnDate = $this->getBengaliDateMonthYear();

        $format = str_replace('S', $this->getSuffix($bnDate['date']), $format);
        $format = str_replace('d', str_pad($bnDate['date'], 2, 0, STR_PAD_LEFT), $format);
        $format = str_replace('j', $bnDate['date'], $format);

        //@TODO: Implement getDayInMonth function $this->getDayInMonth($bnDate['month'])
        $format = str_replace('t', "", $format);
        $format = str_replace('m', str_pad($bnDate['month'], 2, 0, STR_PAD_LEFT), $format);
        $format = str_replace('n', $bnDate['month'], $format);
        $format = str_replace('F', self::$bnMonths[$bnDate['month']], $format);
        $format = str_replace('M', self::$bnMonths[$bnDate['month']], $format);
        $format = str_replace('Y', $bnDate['year'], $format);
        $format = str_replace('y', substr($bnDate['year'], -2), $format);

        return $format;
    }

    public function format($format)
    {
        $out = $this->replaceTimes($format);
        $out = $this->replaceTimePrefix($out);
        $out = $this->replaceDateNumbers($out);
        $out = $this->replaceDays($out);
        $out = $this->replaceMeridian($out);

        return $this->translateNumbers($out);
    }

    /**
     * @param int $morning
     */
    public function setMorning($morning)
    {
        $this->morning = $morning;
    }

    private function getBengaliDateMonthYear()
    {
        return Converter::getBengaliDateMonthYear($this->getNativeDateTimeObject(), $this->morning);
    }

    /**
     * @return \DateTime
     */
    private function getNativeDateTimeObject()
    {
        $dateTime = new \DateTime();

        return $dateTime
            ->setTimestamp($this->getTimestamp())
            ->setTimezone($this->getTimezone())
            ;
    }
}
{'fraction_non_alphanumeric': 0.18013571869216533, 'fraction_numerical': 0.004112687641373638, 'mean_word_length': 3.2185602775368602, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 37, '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': '6773180', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1654, 'n_words': 307}