We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 7 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | final class GlobalID extends ExpressionFunction |
||
| 11 | { |
||
| 12 | 137 | public function __construct() |
|
| 13 | { |
||
| 14 | 137 | parent::__construct( |
|
| 15 | 137 | 'globalId', |
|
| 16 | function (string $id, string $typeName = null): string { |
||
| 17 | 1 | $typeName = $this->isTypeNameEmpty($typeName) ? '$info->parentType->name' : $typeName; |
|
| 18 | |||
| 19 | 1 | return \sprintf('\%s::toGlobalId(%s, %s)', GlobalIdHelper::class, $typeName, $id); |
|
| 20 | 137 | }, |
|
| 21 | function ($arguments, $id, $typeName = null) { |
||
| 22 | 1 | $typeName = empty($typeName) ? $arguments['info']->parentType->name : $typeName; |
|
| 23 | |||
| 24 | 1 | return GlobalIdHelper::toGlobalId($typeName, $id); |
|
| 25 | 137 | } |
|
| 26 | ); |
||
| 27 | 137 | } |
|
| 28 | |||
| 29 | 1 | private function isTypeNameEmpty($typeName): bool |
|
| 32 | } |
||
| 33 | } |
||
| 34 |