<commit_before><?php
namespace GMO\Common;

class DateTime extends \DateTime implements ISerializable {

	const SIMPLE_DATE = "Y-m-d H:i:s";

    public static function castFromBuiltin(\DateTime $dt) {
        $newCls = new static();
        $newCls->setTimestamp($dt->getTimestamp());
        $newCls->setTimezone($dt->getTimezone());
        return $newCls;
    }

	public static function now($timezone = null) {
		return new static(null, $timezone);
	}

	public function toString($format = self::SIMPLE_DATE) {
		return $this->format($format);
	}

	public function __toString() {
		return $this->toString();
	}

	//region Serializable Methods

	public function toArray() {
		return SerializeHelper::serializeObject(get_called_class(), get_object_vars($this));
	}

	public static function fromArray($obj) {
		$tz = $obj['timezone'] ? new \DateTimeZone($obj['timezone']) : null;
		return new static($obj['date'], $tz);
	}
<commit_msg>Fixing a bug in Datetime::now due to timezone not being passed in.<commit_after><?php
namespace GMO\Common;

class DateTime extends \DateTime implements ISerializable {

	const SIMPLE_DATE = "Y-m-d H:i:s";

    public static function castFromBuiltin(\DateTime $dt) {
        $newCls = new static();
        $newCls->setTimestamp($dt->getTimestamp());
        $newCls->setTimezone($dt->getTimezone());
        return $newCls;
    }

	public static function now($timezone = null) {
		if ($timezone) {
			return new static(null, $timezone);
		}
		return new static();
	}

	public function toString($format = self::SIMPLE_DATE) {
		return $this->format($format);
	}

	public function __toString() {
		return $this->toString();
	}

	//region Serializable Methods

	public function toArray() {
		return SerializeHelper::serializeObject(get_called_class(), get_object_vars($this));
	}

	public static function fromArray($obj) {
		$tz = $obj['timezone'] ? new \DateTimeZone($obj['timezone']) : null;
		return new static($obj['date'], $tz);
	}

{'fraction_non_alphanumeric': 0.14568527918781726, 'fraction_numerical': 0.0, 'mean_word_length': 4.256, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '2832583', 'n_tokens_mistral': 646, 'n_tokens_neox': 611, 'n_words': 150}