public static valueDoesNotMatchType ( Dumplie\Metadata\Schema\FieldDefinition $type, $value ) : |
||
$type | Dumplie\Metadata\Schema\FieldDefinition | |
return |
/** * @param $value * * @return string * @throws InvalidValueException */ public function serialize($value) : string { if (!is_numeric($value)) { throw InvalidValueException::valueDoesNotMatchType($this, $value); } return (string) (double) $value; }
/** * @param $value * * @return string * @throws InvalidValueException */ public function serialize($value) : string { if (!$value instanceof Metadata) { throw InvalidValueException::valueDoesNotMatchType($this, $value); } return (string) $value->id(); }
/** * @param $value * * @return string * @throws InvalidValueException */ public function serialize($value) : string { if (null !== $value && !is_array($value)) { throw InvalidValueException::valueDoesNotMatchType($this, $value); } return json_encode($value); }
/** * @param $value * @return string * @throws InvalidValueException */ public function serialize($value) : string { if (!is_string($value)) { throw InvalidValueException::valueDoesNotMatchType($this, $value); } return $value; }
/** * @param $value * * @return string * @throws InvalidValueException */ public function serialize($value) : string { if (!$value instanceof \DateTimeInterface) { throw InvalidValueException::valueDoesNotMatchType($this, $value); } return (string) $value->format($this->format); }