eZ\Publish\Core\FieldType\DateAndTime\Type::toHash PHP Méthode

toHash() public méthode

Converts a $Value to a hash.
public toHash ( eZ\Publish\SPI\FieldType\Value $value ) : mixed
$value eZ\Publish\SPI\FieldType\Value
Résultat mixed
    public function toHash(SPIValue $value)
    {
        if ($this->isEmptyValue($value)) {
            return null;
        }
        if ($value->value instanceof DateTime) {
            return ['timestamp' => $value->value->getTimestamp(), 'rfc850' => $value->value->format(DateTime::RFC850)];
        }
        return ['timestamp' => 0, 'rfc850' => null];
    }