PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.3
Kubio AI Page Builder v2.8.3
2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / vendor / symfony / property-info / Extractor / SerializerExtractor.php
kubio / vendor / symfony / property-info / Extractor Last commit date
ConstructorArgumentTypeExtractorInterface.php 1 year ago ConstructorExtractor.php 1 year ago PhpDocExtractor.php 1 year ago PhpStanExtractor.php 1 year ago ReflectionExtractor.php 1 year ago SerializerExtractor.php 1 year ago
SerializerExtractor.php
59 lines
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\PropertyInfo\Extractor;
13
14 use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
15 use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
16
17 /**
18 * Lists available properties using Symfony Serializer Component metadata.
19 *
20 * @author Kévin Dunglas <dunglas@gmail.com>
21 *
22 * @final
23 */
24 class SerializerExtractor implements PropertyListExtractorInterface
25 {
26 private $classMetadataFactory;
27
28 public function __construct(ClassMetadataFactoryInterface $classMetadataFactory)
29 {
30 $this->classMetadataFactory = $classMetadataFactory;
31 }
32
33 /**
34 * {@inheritdoc}
35 */
36 public function getProperties(string $class, array $context = []): ?array
37 {
38 if (!\array_key_exists('serializer_groups', $context) || (null !== $context['serializer_groups'] && !\is_array($context['serializer_groups']))) {
39 return null;
40 }
41
42 if (!$this->classMetadataFactory->getMetadataFor($class)) {
43 return null;
44 }
45
46 $properties = [];
47 $serializerClassMetadata = $this->classMetadataFactory->getMetadataFor($class);
48
49 foreach ($serializerClassMetadata->getAttributesMetadata() as $serializerAttributeMetadata) {
50 $ignored = method_exists($serializerAttributeMetadata, 'isIgnored') && $serializerAttributeMetadata->isIgnored();
51 if (!$ignored && (null === $context['serializer_groups'] || array_intersect($context['serializer_groups'], $serializerAttributeMetadata->getGroups()))) {
52 $properties[] = $serializerAttributeMetadata->getName();
53 }
54 }
55
56 return $properties;
57 }
58 }
59