mediatekformation

DataUriNormalizer
in package
implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface

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

Denormalizes a data URI to a SplFileObject object.

Tags
author

Kévin Dunglas dunglas@gmail.com

Interfaces, Classes, Traits and Enums

NormalizerInterface
DenormalizerInterface
CacheableSupportsMethodInterface
Marker interface for normalizers and denormalizers that use only the type and the format in their supports*() methods.

Table of Contents

SUPPORTED_TYPES  = [\SplFileInfo::class => true, \SplFileObject::class => true, \Symfony\Component\HttpFoundation\File\File::class => true]
$mimeTypeGuesser  : MimeTypeGuesserInterface|null
__construct()  : mixed
denormalize()  : SplFileInfo
Denormalizes data back into an object of the given class.
hasCacheableSupportsMethod()  : bool
normalize()  : string
Normalizes an object into a set of arrays/scalars.
supportsDenormalization()  : bool
Checks whether the given class is supported for denormalization by this normalizer.
supportsNormalization()  : bool
Checks whether the given class is supported for normalization by this normalizer.
extractSplFileObject()  : SplFileObject
Returns the \SplFileObject instance associated with the given \SplFileInfo instance.
getMimeType()  : string
Gets the mime type of the object. Defaults to application/octet-stream.

Constants

SUPPORTED_TYPES

private mixed SUPPORTED_TYPES = [\SplFileInfo::class => true, \SplFileObject::class => true, \Symfony\Component\HttpFoundation\File\File::class => true]

Properties

Methods

denormalize()

Denormalizes data back into an object of the given class.

public denormalize(mixed $data, mixed $type[, mixed $format = null ][, array<string|int, mixed> $context = [] ]) : SplFileInfo

Regex adapted from Brian Grinstead code.

Parameters
$data : mixed

Data to restore

$type : mixed

The expected class to instantiate

$format : mixed = null

Format the given data was extracted from

$context : array<string|int, mixed> = []

Options available to the denormalizer

Tags
see
https://gist.github.com/bgrins/6194623
throws
InvalidArgumentException
throws
NotNormalizableValueException
Return values
SplFileInfo

hasCacheableSupportsMethod()

public hasCacheableSupportsMethod() : bool
Return values
bool

normalize()

Normalizes an object into a set of arrays/scalars.

public normalize(mixed $object[, mixed $format = null ][, array<string|int, mixed> $context = [] ]) : string
Parameters
$object : mixed

Object to normalize

$format : mixed = null

Format the normalization result will be encoded as

$context : array<string|int, mixed> = []

Context options for the normalizer

Return values
string

supportsDenormalization()

Checks whether the given class is supported for denormalization by this normalizer.

public supportsDenormalization(mixed $data, mixed $type[, mixed $format = null ]) : bool
Parameters
$data : mixed

Data to denormalize from

$type : mixed

The class to which the data should be denormalized

$format : mixed = null

The format being deserialized from

Return values
bool

supportsNormalization()

Checks whether the given class is supported for normalization by this normalizer.

public supportsNormalization(mixed $data[, mixed $format = null ]) : bool
Parameters
$data : mixed

Data to normalize

$format : mixed = null

The format being (de-)serialized from or into

Return values
bool

extractSplFileObject()

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

private extractSplFileObject(SplFileInfo $object) : SplFileObject
Parameters
$object : SplFileInfo
Return values
SplFileObject

getMimeType()

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

private getMimeType(SplFileInfo $object) : string
Parameters
$object : SplFileInfo
Return values
string

Search results