Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| UserAngelTypeResource | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| toArray | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Engelsystem\Controllers\Api\Resources; |
| 6 | |
| 7 | use Engelsystem\Models\AngelType; |
| 8 | |
| 9 | class UserAngelTypeResource extends AngelTypeResource |
| 10 | { |
| 11 | public function toArray(): array |
| 12 | { |
| 13 | /** @var AngelType $angelType */ |
| 14 | $angelType = $this->model; |
| 15 | /** @var AngelType $angelType */ |
| 16 | $userAngelType = $this->model->pivot; |
| 17 | |
| 18 | return [ |
| 19 | 'angeltype' => AngelTypeResource::toIdentifierArray($angelType), |
| 20 | 'confirmed' => !$angelType->restricted |
| 21 | || $userAngelType->supporter |
| 22 | || $userAngelType->confirm_user_id, |
| 23 | 'supporter' => $userAngelType->supporter, |
| 24 | ]; |
| 25 | } |
| 26 | } |