AuthRequest::getPassword()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Auth;
6
7
use Yiisoft\RequestModel\RequestModel;
8
use Yiisoft\Validator\Rule\Required;
9
use Yiisoft\Validator\RulesProviderInterface;
10
use OpenApi\Annotations as OA;
11
12
/**
13
 * @OA\Schema(
14
 *      schema="AuthRequest",
15
 *      @OA\Property(example="Opal1144", property="login", format="string"),
16
 *      @OA\Property(example="Opal1144", property="password", format="string"),
17
 * )
18
 */
19
final class AuthRequest extends RequestModel implements RulesProviderInterface
20
{
21 1
    public function getLogin(): string
22
    {
23 1
        return (string)$this->getAttributeValue('body.login');
24
    }
25
26 1
    public function getPassword(): string
27
    {
28 1
        return (string)$this->getAttributeValue('body.password');
29
    }
30
31 1
    public function getRules(): array
32
    {
33
        return [
34
            'body.login' => [
35 1
                new Required(),
36
            ],
37
            'body.password' => [
38 1
                new Required(),
39
            ],
40
        ];
41
    }
42
}
43