Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public function create(string $resourceClass): ResourceMetadata |
||
35 | { |
||
36 | $resourceMetadata = $this->decorated->create($resourceClass); |
||
37 | if (!is_a($resourceClass, AbstractUser::class, true)) { |
||
38 | return $resourceMetadata; |
||
39 | } |
||
40 | |||
41 | $itemOperations = $resourceMetadata->getItemOperations() ?? []; |
||
42 | $itemOperations['me'] = array_replace_recursive([], $itemOperations['get'], [ |
||
43 | 'method' => 'GET', |
||
44 | 'path' => '/me.{_format} ', |
||
45 | 'security' => 'is_granted("IS_AUTHENTICATED_FULLY")', |
||
46 | ]); |
||
47 | |||
48 | return $resourceMetadata->withItemOperations($itemOperations); |
||
49 | } |
||
51 |