Auth::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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