init
This commit is contained in:
31
backend/vendor/symfony/serializer/Context/ContextBuilderInterface.php
vendored
Normal file
31
backend/vendor/symfony/serializer/Context/ContextBuilderInterface.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context;
|
||||
|
||||
/**
|
||||
* Common interface for context builders.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
* @author Robin Chalas <robin.chalas@gmail.com>
|
||||
*/
|
||||
interface ContextBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @param self|array<string, mixed> $context
|
||||
*/
|
||||
public function withContext(self|array $context): static;
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(): array;
|
||||
}
|
||||
54
backend/vendor/symfony/serializer/Context/ContextBuilderTrait.php
vendored
Normal file
54
backend/vendor/symfony/serializer/Context/ContextBuilderTrait.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context;
|
||||
|
||||
/**
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
trait ContextBuilderTrait
|
||||
{
|
||||
/**
|
||||
* @var array<string, mixed>
|
||||
*/
|
||||
private array $context = [];
|
||||
|
||||
protected function with(string $key, mixed $value): static
|
||||
{
|
||||
$instance = new static();
|
||||
$instance->context = array_merge($this->context, [$key => $value]);
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContextBuilderInterface|array<string, mixed> $context
|
||||
*/
|
||||
public function withContext(ContextBuilderInterface|array $context): static
|
||||
{
|
||||
if ($context instanceof ContextBuilderInterface) {
|
||||
$context = $context->toArray();
|
||||
}
|
||||
|
||||
$instance = new static();
|
||||
$instance->context = array_merge($this->context, $context);
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
}
|
||||
139
backend/vendor/symfony/serializer/Context/Encoder/CsvEncoderContextBuilder.php
vendored
Normal file
139
backend/vendor/symfony/serializer/Context/Encoder/CsvEncoderContextBuilder.php
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Encoder;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Encoder\CsvEncoder;
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available CsvEncoder options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class CsvEncoderContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures the column delimiter character.
|
||||
*
|
||||
* Must be a single character.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function withDelimiter(?string $delimiter): static
|
||||
{
|
||||
if (null !== $delimiter && 1 !== \strlen($delimiter)) {
|
||||
throw new InvalidArgumentException(\sprintf('The "%s" delimiter must be a single character.', $delimiter));
|
||||
}
|
||||
|
||||
return $this->with(CsvEncoder::DELIMITER_KEY, $delimiter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the field enclosure character.
|
||||
*
|
||||
* Must be a single character.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function withEnclosure(?string $enclosure): static
|
||||
{
|
||||
if (null !== $enclosure && 1 !== \strlen($enclosure)) {
|
||||
throw new InvalidArgumentException(\sprintf('The "%s" enclosure must be a single character.', $enclosure));
|
||||
}
|
||||
|
||||
return $this->with(CsvEncoder::ENCLOSURE_KEY, $enclosure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the escape character.
|
||||
*
|
||||
* Must be empty or a single character.
|
||||
*
|
||||
* @deprecated since Symfony 7.2, to be removed in 8.0
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function withEscapeChar(?string $escapeChar): static
|
||||
{
|
||||
trigger_deprecation('symfony/serializer', '7.2', 'The "%s" method is deprecated. It will be removed in 8.0.', __METHOD__);
|
||||
|
||||
if (null !== $escapeChar && \strlen($escapeChar) > 1) {
|
||||
throw new InvalidArgumentException(\sprintf('The "%s" escape character must be empty or a single character.', $escapeChar));
|
||||
}
|
||||
|
||||
return $this->with(CsvEncoder::ESCAPE_CHAR_KEY, $escapeChar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the key separator when (un)flattening arrays.
|
||||
*/
|
||||
public function withKeySeparator(?string $keySeparator): static
|
||||
{
|
||||
return $this->with(CsvEncoder::KEY_SEPARATOR_KEY, $keySeparator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the headers.
|
||||
*
|
||||
* @param list<mixed>|null $headers
|
||||
*/
|
||||
public function withHeaders(?array $headers): static
|
||||
{
|
||||
return $this->with(CsvEncoder::HEADERS_KEY, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether formulas should be escaped.
|
||||
*/
|
||||
public function withEscapedFormulas(?bool $escapedFormulas): static
|
||||
{
|
||||
return $this->with(CsvEncoder::ESCAPE_FORMULAS_KEY, $escapedFormulas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether the decoded result should be considered as a collection
|
||||
* or as a single element.
|
||||
*/
|
||||
public function withAsCollection(?bool $asCollection): static
|
||||
{
|
||||
return $this->with(CsvEncoder::AS_COLLECTION_KEY, $asCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether the input (or output) is containing (or will contain) headers.
|
||||
*/
|
||||
public function withNoHeaders(?bool $noHeaders): static
|
||||
{
|
||||
return $this->with(CsvEncoder::NO_HEADERS_KEY, $noHeaders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the end of line characters.
|
||||
*/
|
||||
public function withEndOfLine(?string $endOfLine): static
|
||||
{
|
||||
return $this->with(CsvEncoder::END_OF_LINE, $endOfLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether to add the UTF-8 Byte Order Mark (BOM)
|
||||
* at the beginning of the encoded result or not.
|
||||
*/
|
||||
public function withOutputUtf8Bom(?bool $outputUtf8Bom): static
|
||||
{
|
||||
return $this->with(CsvEncoder::OUTPUT_UTF8_BOM_KEY, $outputUtf8Bom);
|
||||
}
|
||||
}
|
||||
72
backend/vendor/symfony/serializer/Context/Encoder/JsonEncoderContextBuilder.php
vendored
Normal file
72
backend/vendor/symfony/serializer/Context/Encoder/JsonEncoderContextBuilder.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Encoder;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Encoder\JsonDecode;
|
||||
use Symfony\Component\Serializer\Encoder\JsonEncode;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available JsonEncoder options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class JsonEncoderContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures the json_encode flags bitmask.
|
||||
*
|
||||
* @see https://php.net/json.constants
|
||||
*
|
||||
* @param positive-int|null $options
|
||||
*/
|
||||
public function withEncodeOptions(?int $options): static
|
||||
{
|
||||
return $this->with(JsonEncode::OPTIONS, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the json_decode flags bitmask.
|
||||
*
|
||||
* @see https://php.net/json.constants
|
||||
*
|
||||
* @param positive-int|null $options
|
||||
*/
|
||||
public function withDecodeOptions(?int $options): static
|
||||
{
|
||||
return $this->with(JsonDecode::OPTIONS, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether decoded objects will be given as
|
||||
* associative arrays or as nested stdClass.
|
||||
*/
|
||||
public function withAssociative(?bool $associative): static
|
||||
{
|
||||
return $this->with(JsonDecode::ASSOCIATIVE, $associative);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the maximum recursion depth.
|
||||
*
|
||||
* Must be strictly positive.
|
||||
*
|
||||
* @param positive-int|null $recursionDepth
|
||||
*/
|
||||
public function withRecursionDepth(?int $recursionDepth): static
|
||||
{
|
||||
return $this->with(JsonDecode::RECURSION_DEPTH, $recursionDepth);
|
||||
}
|
||||
}
|
||||
179
backend/vendor/symfony/serializer/Context/Encoder/XmlEncoderContextBuilder.php
vendored
Normal file
179
backend/vendor/symfony/serializer/Context/Encoder/XmlEncoderContextBuilder.php
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Encoder;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Encoder\XmlEncoder;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available XmlEncoder options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class XmlEncoderContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures whether the decoded result should be considered as a collection
|
||||
* or as a single element.
|
||||
*/
|
||||
public function withAsCollection(?bool $asCollection): static
|
||||
{
|
||||
return $this->with(XmlEncoder::AS_COLLECTION, $asCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures node types to ignore while decoding.
|
||||
*
|
||||
* @see https://php.net/dom.constants
|
||||
*
|
||||
* @param list<int>|null $decoderIgnoredNodeTypes
|
||||
*/
|
||||
public function withDecoderIgnoredNodeTypes(?array $decoderIgnoredNodeTypes): static
|
||||
{
|
||||
return $this->with(XmlEncoder::DECODER_IGNORED_NODE_TYPES, $decoderIgnoredNodeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures node types to ignore while encoding.
|
||||
*
|
||||
* @see https://php.net/dom.constants
|
||||
*
|
||||
* @param list<int>|null $encoderIgnoredNodeTypes
|
||||
*/
|
||||
public function withEncoderIgnoredNodeTypes(?array $encoderIgnoredNodeTypes): static
|
||||
{
|
||||
return $this->with(XmlEncoder::ENCODER_IGNORED_NODE_TYPES, $encoderIgnoredNodeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the DOMDocument encoding.
|
||||
*
|
||||
* @see https://php.net/class.domdocument#domdocument.props.encoding
|
||||
*/
|
||||
public function withEncoding(?string $encoding): static
|
||||
{
|
||||
return $this->with(XmlEncoder::ENCODING, $encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether to encode with indentation and extra space.
|
||||
*
|
||||
* @see https://php.net/class.domdocument#domdocument.props.formatoutput
|
||||
*/
|
||||
public function withFormatOutput(?bool $formatOutput): static
|
||||
{
|
||||
return $this->with(XmlEncoder::FORMAT_OUTPUT, $formatOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the DOMDocument::loadXml options bitmask.
|
||||
*
|
||||
* @see https://php.net/libxml.constants
|
||||
*
|
||||
* @param positive-int|null $loadOptions
|
||||
*/
|
||||
public function withLoadOptions(?int $loadOptions): static
|
||||
{
|
||||
return $this->with(XmlEncoder::LOAD_OPTIONS, $loadOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the DOMDocument::saveXml options bitmask.
|
||||
*
|
||||
* @see https://php.net/libxml.constants
|
||||
*
|
||||
* @param positive-int|null $saveOptions
|
||||
*/
|
||||
public function withSaveOptions(?int $saveOptions): static
|
||||
{
|
||||
return $this->with(XmlEncoder::SAVE_OPTIONS, $saveOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether to keep empty nodes.
|
||||
*/
|
||||
public function withRemoveEmptyTags(?bool $removeEmptyTags): static
|
||||
{
|
||||
return $this->with(XmlEncoder::REMOVE_EMPTY_TAGS, $removeEmptyTags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures name of the root node.
|
||||
*/
|
||||
public function withRootNodeName(?string $rootNodeName): static
|
||||
{
|
||||
return $this->with(XmlEncoder::ROOT_NODE_NAME, $rootNodeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether the document will be standalone.
|
||||
*
|
||||
* @see https://php.net/class.domdocument#domdocument.props.xmlstandalone
|
||||
*/
|
||||
public function withStandalone(?bool $standalone): static
|
||||
{
|
||||
return $this->with(XmlEncoder::STANDALONE, $standalone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether casting numeric string attributes to integers or floats.
|
||||
*/
|
||||
public function withTypeCastAttributes(?bool $typeCastAttributes): static
|
||||
{
|
||||
return $this->with(XmlEncoder::TYPE_CAST_ATTRIBUTES, $typeCastAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the version number of the document.
|
||||
*
|
||||
* @see https://php.net/class.domdocument#domdocument.props.xmlversion
|
||||
*/
|
||||
public function withVersion(?string $version): static
|
||||
{
|
||||
return $this->with(XmlEncoder::VERSION, $version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether to wrap strings within CDATA sections.
|
||||
*/
|
||||
public function withCdataWrapping(?bool $cdataWrapping): static
|
||||
{
|
||||
return $this->with(XmlEncoder::CDATA_WRAPPING, $cdataWrapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the pattern used to evaluate if a CDATA section should be added.
|
||||
*/
|
||||
public function withCdataWrappingPattern(?string $cdataWrappingPattern): static
|
||||
{
|
||||
return $this->with(XmlEncoder::CDATA_WRAPPING_PATTERN, $cdataWrappingPattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether to ignore empty attributes.
|
||||
*/
|
||||
public function withIgnoreEmptyAttributes(?bool $ignoreEmptyAttributes): static
|
||||
{
|
||||
return $this->with(XmlEncoder::IGNORE_EMPTY_ATTRIBUTES, $ignoreEmptyAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether to preserve numeric keys in array.
|
||||
*/
|
||||
public function withPreserveNumericKeys(?bool $preserveNumericKeys): static
|
||||
{
|
||||
return $this->with(XmlEncoder::PRESERVE_NUMERIC_KEYS, $preserveNumericKeys);
|
||||
}
|
||||
}
|
||||
69
backend/vendor/symfony/serializer/Context/Encoder/YamlEncoderContextBuilder.php
vendored
Normal file
69
backend/vendor/symfony/serializer/Context/Encoder/YamlEncoderContextBuilder.php
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Encoder;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Encoder\YamlEncoder;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available YamlEncoder options.
|
||||
*
|
||||
* Note that the "indentation" setting is not offered in this builder because
|
||||
* it can only be set during the construction of the YamlEncoder, but not per
|
||||
* call.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class YamlEncoderContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures the threshold to switch to inline YAML.
|
||||
*/
|
||||
public function withInlineThreshold(?int $inlineThreshold): static
|
||||
{
|
||||
return $this->with(YamlEncoder::YAML_INLINE, $inlineThreshold);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the indentation level.
|
||||
*
|
||||
* Must be positive.
|
||||
*
|
||||
* @param int<0, max>|null $indentLevel
|
||||
*/
|
||||
public function withIndentLevel(?int $indentLevel): static
|
||||
{
|
||||
return $this->with(YamlEncoder::YAML_INDENT, $indentLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures \Symfony\Component\Yaml\Dumper::dump flags bitmask.
|
||||
*
|
||||
* @see Yaml
|
||||
*/
|
||||
public function withFlags(?int $flags): static
|
||||
{
|
||||
return $this->with(YamlEncoder::YAML_FLAGS, $flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether to preserve empty objects "{}" or to convert them to null.
|
||||
*/
|
||||
public function withPreservedEmptyObjects(?bool $preserveEmptyObjects): static
|
||||
{
|
||||
return $this->with(YamlEncoder::PRESERVE_EMPTY_OBJECTS, $preserveEmptyObjects);
|
||||
}
|
||||
}
|
||||
188
backend/vendor/symfony/serializer/Context/Normalizer/AbstractNormalizerContextBuilder.php
vendored
Normal file
188
backend/vendor/symfony/serializer/Context/Normalizer/AbstractNormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available AbstractNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
abstract class AbstractNormalizerContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures how many loops of circular reference to allow while normalizing.
|
||||
*
|
||||
* The value 1 means that when we encounter the same object a
|
||||
* second time, we consider that a circular reference.
|
||||
*
|
||||
* You can raise this value for special cases, e.g. in combination with the
|
||||
* max depth setting of the object normalizer.
|
||||
*
|
||||
* Must be strictly positive.
|
||||
*
|
||||
* @param positive-int|null $circularReferenceLimit
|
||||
*/
|
||||
public function withCircularReferenceLimit(?int $circularReferenceLimit): static
|
||||
{
|
||||
return $this->with(AbstractNormalizer::CIRCULAR_REFERENCE_LIMIT, $circularReferenceLimit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures an object to be updated instead of creating a new instance.
|
||||
*
|
||||
* If you have a nested structure, child objects will be overwritten with
|
||||
* new instances unless you set AbstractObjectNormalizer::DEEP_OBJECT_TO_POPULATE to true.
|
||||
*/
|
||||
public function withObjectToPopulate(?object $objectToPopulate): static
|
||||
{
|
||||
return $this->with(AbstractNormalizer::OBJECT_TO_POPULATE, $objectToPopulate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures groups containing attributes to (de)normalize.
|
||||
*
|
||||
* Eg: ['group1', 'group2']
|
||||
*
|
||||
* @param list<string>|string|null $groups
|
||||
*/
|
||||
public function withGroups(array|string|null $groups): static
|
||||
{
|
||||
if (null === $groups) {
|
||||
return $this->with(AbstractNormalizer::GROUPS, null);
|
||||
}
|
||||
|
||||
return $this->with(AbstractNormalizer::GROUPS, (array) $groups);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures attributes to (de)normalize.
|
||||
*
|
||||
* For nested structures, this list needs to reflect the object tree.
|
||||
*
|
||||
* Eg: ['foo', 'bar', 'object' => ['baz']]
|
||||
*
|
||||
* @param array<string|array>|null $attributes
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function withAttributes(?array $attributes): static
|
||||
{
|
||||
$it = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($attributes ?? []), \RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
|
||||
foreach ($it as $attribute) {
|
||||
if (!\is_string($attribute)) {
|
||||
throw new InvalidArgumentException(\sprintf('Each attribute must be a string, "%s" given.', get_debug_type($attribute)));
|
||||
}
|
||||
}
|
||||
|
||||
return $this->with(AbstractNormalizer::ATTRIBUTES, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* If AbstractNormalizer::ATTRIBUTES are specified, and the source has fields that are not part of that list,
|
||||
* configures whether to ignore those attributes or throw an ExtraAttributesException.
|
||||
*/
|
||||
public function withAllowExtraAttributes(?bool $allowExtraAttributes): static
|
||||
{
|
||||
return $this->with(AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES, $allowExtraAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 7.1, use withDefaultConstructorArguments(?array $defaultConstructorArguments)" instead
|
||||
*
|
||||
* @param array<class-string, array<string, mixed>>|null $defaultContructorArguments
|
||||
*/
|
||||
public function withDefaultContructorArguments(?array $defaultContructorArguments): static
|
||||
{
|
||||
trigger_deprecation('symfony/serializer', '7.1', 'The "%s()" method is deprecated, use "withDefaultConstructorArguments(?array $defaultConstructorArguments)" instead.', __METHOD__);
|
||||
|
||||
return self::withDefaultConstructorArguments($defaultContructorArguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a hashmap of classes containing hashmaps of constructor argument => default value.
|
||||
*
|
||||
* The names need to match the parameter names in the constructor arguments.
|
||||
*
|
||||
* Eg: [Foo::class => ['foo' => true, 'bar' => 0]]
|
||||
*
|
||||
* @param array<class-string, array<string, mixed>>|null $defaultConstructorArguments
|
||||
*/
|
||||
public function withDefaultConstructorArguments(?array $defaultConstructorArguments): static
|
||||
{
|
||||
return $this->with(AbstractNormalizer::DEFAULT_CONSTRUCTOR_ARGUMENTS, $defaultConstructorArguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures an hashmap of field name => callable to normalize this field.
|
||||
*
|
||||
* The callable is called if the field is encountered with the arguments:
|
||||
*
|
||||
* - mixed $attributeValue value of this field
|
||||
* - object $object the whole object being normalized
|
||||
* - string $attributeName name of the attribute being normalized
|
||||
* - string $format the requested format
|
||||
* - array<string, mixed> $context the serialization context
|
||||
*
|
||||
* @param array<string, callable>|null $callbacks
|
||||
*/
|
||||
public function withCallbacks(?array $callbacks): static
|
||||
{
|
||||
return $this->with(AbstractNormalizer::CALLBACKS, $callbacks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures an handler to call when a circular reference has been detected.
|
||||
*
|
||||
* If no handler is specified, a CircularReferenceException is thrown.
|
||||
*
|
||||
* The method will be called with ($object, $format, $context) and its
|
||||
* return value is returned as the result of the normalize call.
|
||||
*/
|
||||
public function withCircularReferenceHandler(?callable $circularReferenceHandler): static
|
||||
{
|
||||
return $this->with(AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER, $circularReferenceHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures attributes to be skipped when normalizing an object tree.
|
||||
*
|
||||
* This list is applied to each element of nested structures.
|
||||
*
|
||||
* Eg: ['foo', 'bar']
|
||||
*
|
||||
* Note: The behaviour for nested structures is different from ATTRIBUTES
|
||||
* for historical reason. Aligning the behaviour would be a BC break.
|
||||
*
|
||||
* @param list<string>|null $ignoredAttributes
|
||||
*/
|
||||
public function withIgnoredAttributes(?array $ignoredAttributes): static
|
||||
{
|
||||
return $this->with(AbstractNormalizer::IGNORED_ATTRIBUTES, $ignoredAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures requiring all properties to be listed in the input instead
|
||||
* of falling back to null for nullable ones.
|
||||
*/
|
||||
public function withRequireAllProperties(?bool $requireAllProperties = true): static
|
||||
{
|
||||
return $this->with(AbstractNormalizer::REQUIRE_ALL_PROPERTIES, $requireAllProperties);
|
||||
}
|
||||
}
|
||||
131
backend/vendor/symfony/serializer/Context/Normalizer/AbstractObjectNormalizerContextBuilder.php
vendored
Normal file
131
backend/vendor/symfony/serializer/Context/Normalizer/AbstractObjectNormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available AbstractObjectNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
abstract class AbstractObjectNormalizerContextBuilder extends AbstractNormalizerContextBuilder
|
||||
{
|
||||
/**
|
||||
* Configures whether to respect the max depth metadata on fields.
|
||||
*/
|
||||
public function withEnableMaxDepth(?bool $enableMaxDepth): static
|
||||
{
|
||||
return $this->with(AbstractObjectNormalizer::ENABLE_MAX_DEPTH, $enableMaxDepth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a pattern to keep track of the current depth.
|
||||
*
|
||||
* Must contain exactly two string placeholders.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function withDepthKeyPattern(?string $depthKeyPattern): static
|
||||
{
|
||||
if (null === $depthKeyPattern) {
|
||||
return $this->with(AbstractObjectNormalizer::DEPTH_KEY_PATTERN, null);
|
||||
}
|
||||
|
||||
// This will match every occurrences of sprintf specifiers
|
||||
$matches = [];
|
||||
preg_match_all('/(?<!%)(?:%{2})*%(?<specifier>[a-z])/', $depthKeyPattern, $matches);
|
||||
|
||||
if (2 !== \count($matches['specifier']) || 's' !== $matches['specifier'][0] || 's' !== $matches['specifier'][1]) {
|
||||
throw new InvalidArgumentException(\sprintf('The depth key pattern "%s" is not valid. You must set exactly two string placeholders.', $depthKeyPattern));
|
||||
}
|
||||
|
||||
return $this->with(AbstractObjectNormalizer::DEPTH_KEY_PATTERN, $depthKeyPattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether verifying types match during denormalization.
|
||||
*/
|
||||
public function withDisableTypeEnforcement(?bool $disableTypeEnforcement): static
|
||||
{
|
||||
return $this->with(AbstractObjectNormalizer::DISABLE_TYPE_ENFORCEMENT, $disableTypeEnforcement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether fields with the value `null` should be output during normalization.
|
||||
*/
|
||||
public function withSkipNullValues(?bool $skipNullValues): static
|
||||
{
|
||||
return $this->with(AbstractObjectNormalizer::SKIP_NULL_VALUES, $skipNullValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether uninitialized typed class properties should be excluded during normalization.
|
||||
*/
|
||||
public function withSkipUninitializedValues(?bool $skipUninitializedValues): static
|
||||
{
|
||||
return $this->with(AbstractObjectNormalizer::SKIP_UNINITIALIZED_VALUES, $skipUninitializedValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a callback to allow to set a value for an attribute when the max depth has
|
||||
* been reached.
|
||||
*
|
||||
* If no callback is given, the attribute is skipped. If a callable is
|
||||
* given, its return value is used (even if null).
|
||||
*
|
||||
* The arguments are:
|
||||
*
|
||||
* - mixed $attributeValue value of this field
|
||||
* - object $object the whole object being normalized
|
||||
* - string $attributeName name of the attribute being normalized
|
||||
* - string $format the requested format
|
||||
* - array<string, mixed> $context the serialization context
|
||||
*/
|
||||
public function withMaxDepthHandler(?callable $maxDepthHandler): static
|
||||
{
|
||||
return $this->with(AbstractObjectNormalizer::MAX_DEPTH_HANDLER, $maxDepthHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures which context key are not relevant to determine which attributes
|
||||
* of an object to (de)normalize.
|
||||
*
|
||||
* @param list<string>|null $excludeFromCacheKeys
|
||||
*/
|
||||
public function withExcludeFromCacheKeys(?array $excludeFromCacheKeys): static
|
||||
{
|
||||
return $this->with(AbstractObjectNormalizer::EXCLUDE_FROM_CACHE_KEY, $excludeFromCacheKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether to tell the denormalizer to also populate existing objects on
|
||||
* attributes of the main object.
|
||||
*
|
||||
* Setting this to true is only useful if you also specify the root object
|
||||
* in AbstractNormalizer::OBJECT_TO_POPULATE.
|
||||
*/
|
||||
public function withDeepObjectToPopulate(?bool $deepObjectToPopulate): static
|
||||
{
|
||||
return $this->with(AbstractObjectNormalizer::DEEP_OBJECT_TO_POPULATE, $deepObjectToPopulate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures whether an empty object should be kept as an object (in
|
||||
* JSON: {}) or converted to a list (in JSON: []).
|
||||
*/
|
||||
public function withPreserveEmptyObjects(?bool $preserveEmptyObjects): static
|
||||
{
|
||||
return $this->with(AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS, $preserveEmptyObjects);
|
||||
}
|
||||
}
|
||||
35
backend/vendor/symfony/serializer/Context/Normalizer/BackedEnumNormalizerContextBuilder.php
vendored
Normal file
35
backend/vendor/symfony/serializer/Context/Normalizer/BackedEnumNormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\BackedEnumNormalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available BackedEnumNormalizer options.
|
||||
*
|
||||
* @author Nicolas PHILIPPE <nikophil@gmail.com>
|
||||
*/
|
||||
final class BackedEnumNormalizerContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures if invalid values are allowed in denormalization.
|
||||
* They will be denormalized into `null` values.
|
||||
*/
|
||||
public function withAllowInvalidValues(bool $allowInvalidValues): static
|
||||
{
|
||||
return $this->with(BackedEnumNormalizer::ALLOW_INVALID_VALUES, $allowInvalidValues);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available ConstraintViolationList options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class ConstraintViolationListNormalizerContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configure the instance field of normalized data.
|
||||
*/
|
||||
public function withInstance(mixed $instance): static
|
||||
{
|
||||
return $this->with(ConstraintViolationListNormalizer::INSTANCE, $instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the status field of normalized data.
|
||||
*/
|
||||
public function withStatus(?int $status): static
|
||||
{
|
||||
return $this->with(ConstraintViolationListNormalizer::STATUS, $status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the title field of normalized data.
|
||||
*/
|
||||
public function withTitle(?string $title): static
|
||||
{
|
||||
return $this->with(ConstraintViolationListNormalizer::TITLE, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the type field of normalized data.
|
||||
*/
|
||||
public function withType(?string $type): static
|
||||
{
|
||||
return $this->with(ConstraintViolationListNormalizer::TYPE, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the payload fields which will act as an allowlist
|
||||
* for the payload field of normalized data.
|
||||
*
|
||||
* Eg: ['foo', 'bar']
|
||||
*
|
||||
* @param list<string>|null $payloadFields
|
||||
*/
|
||||
public function withPayloadFields(?array $payloadFields): static
|
||||
{
|
||||
return $this->with(ConstraintViolationListNormalizer::PAYLOAD_FIELDS, $payloadFields);
|
||||
}
|
||||
}
|
||||
36
backend/vendor/symfony/serializer/Context/Normalizer/DateIntervalNormalizerContextBuilder.php
vendored
Normal file
36
backend/vendor/symfony/serializer/Context/Normalizer/DateIntervalNormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available DateIntervalNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class DateIntervalNormalizerContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures the format of the interval.
|
||||
*
|
||||
* @see https://php.net/manual/en/dateinterval.format.php
|
||||
*/
|
||||
public function withFormat(?string $format): static
|
||||
{
|
||||
return $this->with(DateIntervalNormalizer::FORMAT_KEY, $format);
|
||||
}
|
||||
}
|
||||
74
backend/vendor/symfony/serializer/Context/Normalizer/DateTimeNormalizerContextBuilder.php
vendored
Normal file
74
backend/vendor/symfony/serializer/Context/Normalizer/DateTimeNormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available DateTimeNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class DateTimeNormalizerContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures the format of the date.
|
||||
*
|
||||
* @see https://secure.php.net/manual/en/datetime.format.php
|
||||
*/
|
||||
public function withFormat(?string $format): static
|
||||
{
|
||||
return $this->with(DateTimeNormalizer::FORMAT_KEY, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the timezone of the date.
|
||||
*
|
||||
* It could be either a \DateTimeZone or a string
|
||||
* that will be used to construct the \DateTimeZone
|
||||
*
|
||||
* @see https://secure.php.net/manual/en/class.datetimezone.php
|
||||
*
|
||||
* @param ?bool $force Whether to enforce the timezone during denormalization
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function withTimezone(\DateTimeZone|string|null $timezone, ?bool $force = null): static
|
||||
{
|
||||
if (null === $timezone) {
|
||||
return $this->with(DateTimeNormalizer::TIMEZONE_KEY, null)->with(DateTimeNormalizer::FORCE_TIMEZONE_KEY, $force);
|
||||
}
|
||||
|
||||
if (\is_string($timezone)) {
|
||||
try {
|
||||
$timezone = new \DateTimeZone($timezone);
|
||||
} catch (\Exception $e) {
|
||||
throw new InvalidArgumentException(\sprintf('The "%s" timezone is invalid.', $timezone), previous: $e);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->with(DateTimeNormalizer::TIMEZONE_KEY, $timezone)->with(DateTimeNormalizer::FORCE_TIMEZONE_KEY, $force);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param 'int'|'float'|null $cast
|
||||
*/
|
||||
public function withCast(?string $cast): static
|
||||
{
|
||||
return $this->with(DateTimeNormalizer::CAST_KEY, $cast);
|
||||
}
|
||||
}
|
||||
50
backend/vendor/symfony/serializer/Context/Normalizer/FormErrorNormalizerContextBuilder.php
vendored
Normal file
50
backend/vendor/symfony/serializer/Context/Normalizer/FormErrorNormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\FormErrorNormalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available FormErrorNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class FormErrorNormalizerContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures the title of the normalized data.
|
||||
*/
|
||||
public function withTitle(?string $title): static
|
||||
{
|
||||
return $this->with(FormErrorNormalizer::TITLE, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the type of the normalized data.
|
||||
*/
|
||||
public function withType(?string $type): static
|
||||
{
|
||||
return $this->with(FormErrorNormalizer::TYPE, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the code of the normalized data.
|
||||
*/
|
||||
public function withStatusCode(?int $statusCode): static
|
||||
{
|
||||
return $this->with(FormErrorNormalizer::CODE, $statusCode);
|
||||
}
|
||||
}
|
||||
21
backend/vendor/symfony/serializer/Context/Normalizer/GetSetMethodNormalizerContextBuilder.php
vendored
Normal file
21
backend/vendor/symfony/serializer/Context/Normalizer/GetSetMethodNormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available GetSetMethodNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class GetSetMethodNormalizerContextBuilder extends AbstractObjectNormalizerContextBuilder
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available JsonSerializableNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class JsonSerializableNormalizerContextBuilder extends AbstractNormalizerContextBuilder
|
||||
{
|
||||
}
|
||||
21
backend/vendor/symfony/serializer/Context/Normalizer/ObjectNormalizerContextBuilder.php
vendored
Normal file
21
backend/vendor/symfony/serializer/Context/Normalizer/ObjectNormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available ObjectNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class ObjectNormalizerContextBuilder extends AbstractObjectNormalizerContextBuilder
|
||||
{
|
||||
}
|
||||
50
backend/vendor/symfony/serializer/Context/Normalizer/ProblemNormalizerContextBuilder.php
vendored
Normal file
50
backend/vendor/symfony/serializer/Context/Normalizer/ProblemNormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\ProblemNormalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available ProblemNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class ProblemNormalizerContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configure the title field of normalized data.
|
||||
*/
|
||||
public function withTitle(?string $title): static
|
||||
{
|
||||
return $this->with(ProblemNormalizer::TITLE, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the type field of normalized data.
|
||||
*/
|
||||
public function withType(?string $type): static
|
||||
{
|
||||
return $this->with(ProblemNormalizer::TYPE, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the status field of normalized data.
|
||||
*/
|
||||
public function withStatusCode(int|string|null $statusCode): static
|
||||
{
|
||||
return $this->with(ProblemNormalizer::STATUS, $statusCode);
|
||||
}
|
||||
}
|
||||
30
backend/vendor/symfony/serializer/Context/Normalizer/PropertyNormalizerContextBuilder.php
vendored
Normal file
30
backend/vendor/symfony/serializer/Context/Normalizer/PropertyNormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available PropertyNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class PropertyNormalizerContextBuilder extends AbstractObjectNormalizerContextBuilder
|
||||
{
|
||||
/**
|
||||
* Configures whether fields should be output based on visibility.
|
||||
*/
|
||||
public function withNormalizeVisibility(int $normalizeVisibility): static
|
||||
{
|
||||
return $this->with(PropertyNormalizer::NORMALIZE_VISIBILITY, $normalizeVisibility);
|
||||
}
|
||||
}
|
||||
41
backend/vendor/symfony/serializer/Context/Normalizer/UidNormalizerContextBuilder.php
vendored
Normal file
41
backend/vendor/symfony/serializer/Context/Normalizer/UidNormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Normalizer\UidNormalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available UidNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class UidNormalizerContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures the uuid format for normalization.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function withNormalizationFormat(?string $normalizationFormat): static
|
||||
{
|
||||
if (null !== $normalizationFormat && !\in_array($normalizationFormat, UidNormalizer::NORMALIZATION_FORMATS, true)) {
|
||||
throw new InvalidArgumentException(\sprintf('The "%s" normalization format is not valid.', $normalizationFormat));
|
||||
}
|
||||
|
||||
return $this->with(UidNormalizer::NORMALIZATION_FORMAT_KEY, $normalizationFormat);
|
||||
}
|
||||
}
|
||||
53
backend/vendor/symfony/serializer/Context/Normalizer/UnwrappingDenormalizerContextBuilder.php
vendored
Normal file
53
backend/vendor/symfony/serializer/Context/Normalizer/UnwrappingDenormalizerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context\Normalizer;
|
||||
|
||||
use Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException;
|
||||
use Symfony\Component\PropertyAccess\PropertyPath;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderInterface;
|
||||
use Symfony\Component\Serializer\Context\ContextBuilderTrait;
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Normalizer\UnwrappingDenormalizer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available UnwrappingDenormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class UnwrappingDenormalizerContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures the path of wrapped data during denormalization.
|
||||
*
|
||||
* Eg: [foo].bar[bar]
|
||||
*
|
||||
* @see https://symfony.com/doc/current/components/property_access.html
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function withUnwrapPath(?string $unwrapPath): static
|
||||
{
|
||||
if (null === $unwrapPath) {
|
||||
return $this->with(UnwrappingDenormalizer::UNWRAP_PATH, null);
|
||||
}
|
||||
|
||||
try {
|
||||
new PropertyPath($unwrapPath);
|
||||
} catch (InvalidPropertyPathException $e) {
|
||||
throw new InvalidArgumentException(\sprintf('The "%s" property path is not valid.', $unwrapPath), previous: $e);
|
||||
}
|
||||
|
||||
return $this->with(UnwrappingDenormalizer::UNWRAP_PATH, $unwrapPath);
|
||||
}
|
||||
}
|
||||
39
backend/vendor/symfony/serializer/Context/SerializerContextBuilder.php
vendored
Normal file
39
backend/vendor/symfony/serializer/Context/SerializerContextBuilder.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Serializer\Context;
|
||||
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
|
||||
/**
|
||||
* A helper providing autocompletion for available Serializer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class SerializerContextBuilder implements ContextBuilderInterface
|
||||
{
|
||||
use ContextBuilderTrait;
|
||||
|
||||
/**
|
||||
* Configures whether an empty array should be transformed to an
|
||||
* object (in JSON: {}) or to a list (in JSON: []).
|
||||
*/
|
||||
public function withEmptyArrayAsObject(?bool $emptyArrayAsObject): static
|
||||
{
|
||||
return $this->with(Serializer::EMPTY_ARRAY_AS_OBJECT, $emptyArrayAsObject);
|
||||
}
|
||||
|
||||
public function withCollectDenormalizationErrors(?bool $collectDenormalizationErrors): static
|
||||
{
|
||||
return $this->with(DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS, $collectDenormalizationErrors);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user