PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.2.90
WindPress – Tailwind CSS integration for WordPress v3.2.90
3.2.90 3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 All 144 releases
windpress / vendor / symfony / property-info / Extractor / SerializerExtractor.php

SerializerExtractor.php in WindPress – Tailwind CSS integration for WordPress 3.2.90, at vendor/symfony/property-info/Extractor/SerializerExtractor.php

51 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 namespace WindPressDeps\Symfony\Component\PropertyInfo\Extractor;
12
13 use WindPressDeps\Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
14 use WindPressDeps\Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
15 /**
16 * Lists available properties using Symfony Serializer Component metadata.
17 *
18 * @author Kévin Dunglas <dunglas@gmail.com>
19 *
20 * @final
21 */
22 class SerializerExtractor implements PropertyListExtractorInterface
23 {
24 private $classMetadataFactory;
25 public function __construct(ClassMetadataFactoryInterface $classMetadataFactory)
26 {
27 $this->classMetadataFactory = $classMetadataFactory;
28 }
29 /**
30 * {@inheritdoc}
31 */
32 public function getProperties(string $class, array $context = []): ?array
33 {
34 if (!\array_key_exists('serializer_groups', $context) || null !== $context['serializer_groups'] && !\is_array($context['serializer_groups'])) {
35 return null;
36 }
37 if (!$this->classMetadataFactory->getMetadataFor($class)) {
38 return null;
39 }
40 $properties = [];
41 $serializerClassMetadata = $this->classMetadataFactory->getMetadataFor($class);
42 foreach ($serializerClassMetadata->getAttributesMetadata() as $serializerAttributeMetadata) {
43 $ignored = method_exists($serializerAttributeMetadata, 'isIgnored') && $serializerAttributeMetadata->isIgnored();
44 if (!$ignored && (null === $context['serializer_groups'] || array_intersect($context['serializer_groups'], $serializerAttributeMetadata->getGroups()))) {
45 $properties[] = $serializerAttributeMetadata->getName();
46 }
47 }
48 return $properties;
49 }
50 }
51