<?php
namespace Incoviba\Common\Implement\Repository\Mapper;

use DateTimeImmutable;
use Incoviba\Common\Implement\Repository\Mapper;

class DateTime extends Mapper
{
    public function __construct(string $column, ?string $property = null)
    {
        $this->setFunction(function($data) use ($column) {
            return new DateTimeImmutable($data[$column]);
        });
        if ($property !== null) {
            $this->setProperty($property);
        }
    }
}
