| Total Complexity | 5 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 9 | class CastsDirective implements ModelDirectiveInterface |
||
| 10 | { |
||
| 11 | public static function processModelTypeDirective( |
||
| 12 | ModelGenerator $generator, |
||
| 13 | \GraphQL\Language\AST\DirectiveNode $directive |
||
| 14 | ): void { |
||
| 15 | } |
||
| 16 | |||
| 17 | public static function processModelFieldDirective( |
||
| 18 | ModelGenerator $generator, |
||
| 19 | \GraphQL\Type\Definition\FieldDefinition $field, |
||
| 20 | \GraphQL\Language\AST\DirectiveNode $directive |
||
| 21 | ): void { |
||
| 22 | $fieldName = $field->name; |
||
| 23 | foreach ($directive->arguments as $arg) { |
||
| 24 | /** |
||
| 25 | * @var \GraphQL\Language\AST\ArgumentNode $arg |
||
| 26 | */ |
||
| 27 | /** @phpstan-ignore-next-line */ |
||
| 28 | $value = $arg->value->value; |
||
|
|
|||
| 29 | |||
| 30 | switch ($arg->name->value) { |
||
| 31 | case 'type': |
||
| 32 | $generator->casts[$fieldName] = $value; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | public function processModelRelationshipDirective( |
||
| 42 | } |
||
| 43 | } |
||
| 44 |