Passed
Push — master ( ec5386...e56f88 )
by Andrey
53s queued 14s
created

CreateUserRequest::parseValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\GraphQL\Type;
6
7
use Andi\GraphQL\Attribute\InputObjectField;
8
use Andi\GraphQL\Attribute\InputObjectType;
9
use Andi\GraphQL\Definition\Type\ParseValueAwareInterface;
10
11
#[InputObjectType]
12
final class CreateUserRequest implements ParseValueAwareInterface
13
{
14
    /**
15
     * @param string $lastname Фамилия
16
     * @param string $firstname Имя
17
     * @param string $middlename Отчество
18
     */
19
    public function __construct(
20
        #[InputObjectField] public readonly string $lastname,
21
        #[InputObjectField] public readonly string $firstname,
22
        #[InputObjectField] public readonly string $middlename,
23
    ) {
24
    }
25
26
    public static function parseValue(array $values): self
27
    {
28
        return new self($values['lastname'], $values['firstname'], $values['middlename']);
29
    }
30
}
31