| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 3 | public function __construct() |
|
| 15 | { |
||
| 16 | 1 | $config = [ |
|
| 17 | 1 | 'name' => 'CrudPermissions', |
|
| 18 | 1 | 'description' => 'Describe global permissions for currently logged in user', |
|
| 19 | 1 | 'fields' => [ |
|
| 20 | 1 | 'create' => [ |
|
| 21 | 1 | 'type' => self::nonNull(self::boolean()), |
|
| 22 | 1 | 'description' => 'Whether the user can create', |
|
| 23 | 1 | 'resolve' => function ($root, array $args, $context, ResolveInfo $info): bool { |
|
| 24 | /** @var class-string<AbstractModel> $type */ |
||
| 25 | 3 | $type = $root['type']; |
|
| 26 | |||
| 27 | 3 | $instance = new $type(); |
|
| 28 | 3 | $acl = new Acl(); |
|
| 29 | |||
| 30 | 3 | return $acl->isCurrentUserAllowed($instance, 'create'); |
|
| 31 | 1 | }, |
|
| 32 | 1 | ], |
|
| 33 | 1 | ], |
|
| 34 | 1 | ]; |
|
| 35 | |||
| 36 | 1 | parent::__construct($config); |
|
| 37 | } |
||
| 39 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.