Initial Drupal 11 with DDEV setup
This commit is contained in:
188
vendor/symfony/serializer/Context/Normalizer/AbstractNormalizerContextBuilder.php
vendored
Normal file
188
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
vendor/symfony/serializer/Context/Normalizer/AbstractObjectNormalizerContextBuilder.php
vendored
Normal file
131
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
vendor/symfony/serializer/Context/Normalizer/BackedEnumNormalizerContextBuilder.php
vendored
Normal file
35
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);
|
||||
}
|
||||
}
|
||||
71
vendor/symfony/serializer/Context/Normalizer/ConstraintViolationListNormalizerContextBuilder.php
vendored
Normal file
71
vendor/symfony/serializer/Context/Normalizer/ConstraintViolationListNormalizerContextBuilder.php
vendored
Normal file
@ -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
vendor/symfony/serializer/Context/Normalizer/DateIntervalNormalizerContextBuilder.php
vendored
Normal file
36
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);
|
||||
}
|
||||
}
|
||||
72
vendor/symfony/serializer/Context/Normalizer/DateTimeNormalizerContextBuilder.php
vendored
Normal file
72
vendor/symfony/serializer/Context/Normalizer/DateTimeNormalizerContextBuilder.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\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
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function withTimezone(\DateTimeZone|string|null $timezone): static
|
||||
{
|
||||
if (null === $timezone) {
|
||||
return $this->with(DateTimeNormalizer::TIMEZONE_KEY, null);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param 'int'|'float'|null $cast
|
||||
*/
|
||||
public function withCast(?string $cast): static
|
||||
{
|
||||
return $this->with(DateTimeNormalizer::CAST_KEY, $cast);
|
||||
}
|
||||
}
|
||||
50
vendor/symfony/serializer/Context/Normalizer/FormErrorNormalizerContextBuilder.php
vendored
Normal file
50
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
vendor/symfony/serializer/Context/Normalizer/GetSetMethodNormalizerContextBuilder.php
vendored
Normal file
21
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
|
||||
{
|
||||
}
|
||||
21
vendor/symfony/serializer/Context/Normalizer/JsonSerializableNormalizerContextBuilder.php
vendored
Normal file
21
vendor/symfony/serializer/Context/Normalizer/JsonSerializableNormalizerContextBuilder.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 JsonSerializableNormalizer options.
|
||||
*
|
||||
* @author Mathias Arlaud <mathias.arlaud@gmail.com>
|
||||
*/
|
||||
final class JsonSerializableNormalizerContextBuilder extends AbstractNormalizerContextBuilder
|
||||
{
|
||||
}
|
||||
21
vendor/symfony/serializer/Context/Normalizer/ObjectNormalizerContextBuilder.php
vendored
Normal file
21
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
vendor/symfony/serializer/Context/Normalizer/ProblemNormalizerContextBuilder.php
vendored
Normal file
50
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
vendor/symfony/serializer/Context/Normalizer/PropertyNormalizerContextBuilder.php
vendored
Normal file
30
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
vendor/symfony/serializer/Context/Normalizer/UidNormalizerContextBuilder.php
vendored
Normal file
41
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
vendor/symfony/serializer/Context/Normalizer/UnwrappingDenormalizerContextBuilder.php
vendored
Normal file
53
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user