/** {@inheritdoc} */ public function convertToPHPValue($value) { if (is_object($value)) { throw ConversionException::conversionFailed(gettype($value), $this); } return null === $value ? null : (int) $value; }
/** {@inheritdoc} */ public function convertToPHPValue($value) { if (null === $value || $value instanceof \DateTime) { return $value; } $val = date_create($value); if (!$val) { throw ConversionException::conversionFailed($value, $this); } return $val; }
/** {@inheritdoc} */ public function convertToPHPValue($value) { if (null === $value || is_array($value)) { return $value; } if (is_resource($value)) { $value = stream_get_contents($value); } $val = @unserialize($value); if (false === $val && 'b:0;' !== $value) { throw ConversionException::conversionFailed($value, $this); } return $val; }
/** {@inheritdoc} */ public function convertToPHPValue($value) { if (null === $value) { return null; } if (is_string($value)) { $stream = fopen('php://memory', 'r+b'); fwrite($stream, $value); rewind($stream); $value = $stream; } if (!is_resource($value)) { throw ConversionException::conversionFailed($value, $this); } return $value; }
/** {@inheritdoc} */ public function convertToPHPValue($value) { if (null === $value) { return null; } elseif (is_string($value) && class_exists($value, false)) { return (new \ReflectionClass($value))->newInstanceWithoutConstructor(); } if (is_resource($value)) { $value = stream_get_contents($value); } $val = @unserialize($value); if (false === $val && 'b:0;' !== $value) { throw ConversionException::conversionFailed($value, $this); } return $val; }