Test Failed
Pull Request — master (#20)
by Alexander
04:17 queued 01:35
created

AuthRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPassword() 0 3 1
A getRules() 0 8 1
A getLogin() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Auth;
6
7
use Yiisoft\RequestModel\RequestModel;
8
use Yiisoft\RequestModel\ValidatableModelInterface;
9
use Yiisoft\Validator\Rule\Required;
10
11
final class AuthRequest extends RequestModel implements ValidatableModelInterface
12
{
13
    public function getLogin(): string
14
    {
15
        return (string)$this->getValue('body.login');
16
    }
17
18
    public function getPassword(): string
19
    {
20
        return (string)$this->getValue('body.password');
21
    }
22
23
    public function getRules(): array
24
    {
25
        return [
26
            'body.login' => [
27
                new Required(),
28
            ],
29
            'body.password' => [
30
                new Required(),
31
            ],
32
        ];
33
    }
34
}
35