<commit_before><?php declare(strict_types=1);

namespace Formapro\Values\Cast;

class CastDateTime
{
    public static function to(?\DateTime $date): ?array
    {
        if (null === $date) {
            return null;
        }

        return [
            'unix' => (int) $date->format('U'),<commit_msg>add set\get methods to CastDateTime.<commit_after><?php declare(strict_types=1);

namespace Formapro\Values\Cast;

use function Formapro\Values\get_value;
use function Formapro\Values\set_value;

class CastDateTime
{
    public static function set(object $object, string $key, ?\DateTime $value): void
    {
        set_value($object, $key, self::to($value));        
    }

    public static function get(object $object, string $key, \DateTime $default = null): ?\DateTime
    {
        return self::from(get_value($object, $key)) ?: $default;
    }

    public static function to(?\DateTime $date): ?array
    {
        if (null === $date) {
            return null;
        }

        return [
            'unix' => (int) $date->format('U'),
{'fraction_non_alphanumeric': 0.14204003813155386, 'fraction_numerical': 0.0019065776930409914, 'mean_word_length': 2.6842105263157894, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1650555', 'n_tokens_mistral': 321, 'n_tokens_neox': 316, 'n_words': 79}