PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.2.84
WindPress – Tailwind CSS integration for WordPress v3.2.84
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 / PropertyInfoExtractor.php

PropertyInfoExtractor.php in WindPress – Tailwind CSS integration for WordPress 3.2.84, at vendor/symfony/property-info/PropertyInfoExtractor.php

109 lines 3.8 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;
12
13 /**
14 * Default {@see PropertyInfoExtractorInterface} implementation.
15 *
16 * @author Kévin Dunglas <dunglas@gmail.com>
17 *
18 * @final
19 */
20 class PropertyInfoExtractor implements PropertyInfoExtractorInterface, PropertyInitializableExtractorInterface
21 {
22 private $listExtractors;
23 private $typeExtractors;
24 private $descriptionExtractors;
25 private $accessExtractors;
26 private $initializableExtractors;
27 /**
28 * @param iterable<mixed, PropertyListExtractorInterface> $listExtractors
29 * @param iterable<mixed, PropertyTypeExtractorInterface> $typeExtractors
30 * @param iterable<mixed, PropertyDescriptionExtractorInterface> $descriptionExtractors
31 * @param iterable<mixed, PropertyAccessExtractorInterface> $accessExtractors
32 * @param iterable<mixed, PropertyInitializableExtractorInterface> $initializableExtractors
33 */
34 public function __construct(iterable $listExtractors = [], iterable $typeExtractors = [], iterable $descriptionExtractors = [], iterable $accessExtractors = [], iterable $initializableExtractors = [])
35 {
36 $this->listExtractors = $listExtractors;
37 $this->typeExtractors = $typeExtractors;
38 $this->descriptionExtractors = $descriptionExtractors;
39 $this->accessExtractors = $accessExtractors;
40 $this->initializableExtractors = $initializableExtractors;
41 }
42 /**
43 * {@inheritdoc}
44 */
45 public function getProperties(string $class, array $context = []): ?array
46 {
47 return $this->extract($this->listExtractors, 'getProperties', [$class, $context]);
48 }
49 /**
50 * {@inheritdoc}
51 */
52 public function getShortDescription(string $class, string $property, array $context = []): ?string
53 {
54 return $this->extract($this->descriptionExtractors, 'getShortDescription', [$class, $property, $context]);
55 }
56 /**
57 * {@inheritdoc}
58 */
59 public function getLongDescription(string $class, string $property, array $context = []): ?string
60 {
61 return $this->extract($this->descriptionExtractors, 'getLongDescription', [$class, $property, $context]);
62 }
63 /**
64 * {@inheritdoc}
65 */
66 public function getTypes(string $class, string $property, array $context = []): ?array
67 {
68 return $this->extract($this->typeExtractors, 'getTypes', [$class, $property, $context]);
69 }
70 /**
71 * {@inheritdoc}
72 */
73 public function isReadable(string $class, string $property, array $context = []): ?bool
74 {
75 return $this->extract($this->accessExtractors, 'isReadable', [$class, $property, $context]);
76 }
77 /**
78 * {@inheritdoc}
79 */
80 public function isWritable(string $class, string $property, array $context = []): ?bool
81 {
82 return $this->extract($this->accessExtractors, 'isWritable', [$class, $property, $context]);
83 }
84 /**
85 * {@inheritdoc}
86 */
87 public function isInitializable(string $class, string $property, array $context = []): ?bool
88 {
89 return $this->extract($this->initializableExtractors, 'isInitializable', [$class, $property, $context]);
90 }
91 /**
92 * Iterates over registered extractors and return the first value found.
93 *
94 * @param iterable<mixed, object> $extractors
95 * @param list<mixed> $arguments
96 *
97 * @return mixed
98 */
99 private function extract(iterable $extractors, string $method, array $arguments)
100 {
101 foreach ($extractors as $extractor) {
102 if (null !== $value = $extractor->{$method}(...$arguments)) {
103 return $value;
104 }
105 }
106 return null;
107 }
108 }
109