Auth   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 25
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A auth() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Component;
6
7
use Nymfonya\Component\Config;
8
use Nymfonya\Component\Container;
9
use App\Model\Users;
10
11
class Auth
12
{
13
14
    protected $userModel;
15
16
    /**
17
     * instanciate
18
     */
19 2
    public function __construct(Container $container)
20
    {
21 2
        $this->userModel = new Users(
22 2
            $container->getService(Config::class)
23
        );
24
    }
25
26
    /**
27
     * auth from login password and return user as array
28
     *
29
     * @param string $login
30
     * @param string $password
31
     * @return array
32
     */
33 1
    public function auth(string $login, string $password): array
34
    {
35 1
        return $this->userModel->auth($login, $password);
36
    }
37
}
38