| Total Complexity | 6 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | trait InputOutputMetadataTrait |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var \ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface |
||
| 22 | */ |
||
| 23 | protected $resourceMetadataFactory; |
||
| 24 | |||
| 25 | private function getInputOutputMetadata(string $class, string $inputOrOutput, array $context) |
||
| 26 | { |
||
| 27 | if (null === $this->resourceMetadataFactory || null !== ($context[$inputOrOutput]['class'] ?? null)) { |
||
| 28 | return $context[$inputOrOutput]['class'] ?? null; |
||
| 29 | } |
||
| 30 | |||
| 31 | try { |
||
| 32 | $metadata = $this->resourceMetadataFactory->create($class); |
||
| 33 | } catch (ResourceClassNotFoundException $e) { |
||
| 34 | return null; |
||
| 35 | } |
||
| 36 | |||
| 37 | return $metadata->getAttribute($inputOrOutput)['class'] ?? null; |
||
| 38 | } |
||
| 39 | |||
| 40 | protected function getInputClass(string $class, array $context = []): ?string |
||
| 43 | } |
||
| 44 | |||
| 45 | protected function getOutputClass(string $class, array $context = []): ?string |
||
| 48 | } |
||
| 49 | } |
||
| 50 |