Issues (105)

src/AutoMapper/UserGroup/RequestMapper.php (1 issue)

1
<?php
2
declare(strict_types = 1);
3
/**
4
 * /src/AutoMapper/UserGroup/RequestMapper.php
5
 *
6
 * @author TLe, Tarmo Leppänen <[email protected]>
7
 */
8
9
namespace App\AutoMapper\UserGroup;
10
11
use App\AutoMapper\RestRequestMapper;
12
use App\Entity\Role;
13
use App\Resource\RoleResource;
14
use Throwable;
15
16
/**
17
 * Class RequestMapper
18
 *
19
 * @package App\AutoMapper
20
 * @author TLe, Tarmo Leppänen <[email protected]>
21
 */
22
class RequestMapper extends RestRequestMapper
23
{
24
    /**
25
     * @var array<int, non-empty-string>
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<int, non-empty-string> at position 4 could not be parsed: Unknown type name 'non-empty-string' at position 4 in array<int, non-empty-string>.
Loading history...
26
     */
27
    protected static array $properties = [
28
        'name',
29
        'role',
30
    ];
31
32 88
    public function __construct(
33
        private readonly RoleResource $roleResource,
34
    ) {
35 88
    }
36
37
    /**
38
     * @throws Throwable
39
     */
40 4
    protected function transformRole(string $role): Role
41
    {
42 4
        return $this->roleResource->getReference($role);
43
    }
44
}
45