Copied!

Normalizes an {@see \SplFileInfo} object to a data URI.

Denormalizes a data URI to a {@see \SplFileObject} object.

CloneableFinalInstantiable
Constants
public Symfony\Component\Serializer\Normalizer\DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS = 'collect_denormalization_errors'
Methods
public __construct(?Symfony\Component\Mime\MimeTypeGuesserInterface $mimeTypeGuesser = NULL)
public denormalize(?mixed $data, string $type, ?string $format = NULL, array $context = []) : SplFileInfo
 

Regex adapted from Brian Grinstead code.

  • see https://gist.github.com/bgrins/6194623
  • throws \InvalidArgumentException
  • throws \NotNormalizableValueException
public getSupportedTypes(?string $format) : array
public normalize(?mixed $object, ?string $format = NULL, array $context = []) : string
public supportsDenormalization(?mixed $data, string $type, ?string $format = NULL, array $context = []) : bool
public supportsNormalization(?mixed $data, ?string $format = NULL, array $context = []) : bool
Constants
private Symfony\Component\Serializer\Normalizer\DataUriNormalizer::SUPPORTED_TYPES = ['SplFileInfo' => true, 'SplFileObject' => true, 'Symfony\Component\HttpFoundation\File\File' => true]
Properties
private readonly ?Symfony\Component\Mime\MimeTypeGuesserInterface $mimeTypeGuesser
Methods
private extractSplFileObject(SplFileInfo $object) : SplFileObject
 

Returns the \SplFileObject instance associated with the given \SplFileInfo instance.

private getMimeType(SplFileInfo $object) : string
 

Gets the mime type of the object. Defaults to application/octet-stream.

© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration