File::getById()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
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\Auth\Adapters;
6
7
use Nymfonya\Component\Container;
8
use App\Component\Auth\AdapterInterface;
9
use App\Model\Accounts;
10
11
/**
12
 * Adapter File let auth from csv file accounts
13
 * Decryption required on password.
14
 */
15
class File implements AdapterInterface
16
{
17
18
    /**
19
     * container
20
     *
21
     * @var Container
22
     */
23
    protected $container;
24
25
    /**
26
     * model accounts
27
     *
28
     * @var Accounts
29
     */
30
    protected $modelAccounts;
31
32
    /**
33
     * instanciate
34
     *
35
     * @param Container $container
36
     */
37 4
    public function __construct(Container $container)
38
    {
39 4
        $this->container = $container;
40 4
        $this->modelAccounts = new Accounts($this->container);
41
    }
42
43
    /**
44
     * auth process
45
     *
46
     * @return array
47
     */
48 2
    public function auth(string $login, string $password): array
49
    {
50 2
        return $this->modelAccounts->auth($login, $password);
51
    }
52
53
    /**
54
     * return account by id
55
     *
56
     * @return array
57
     */
58 1
    public function getById(int $id): array
59
    {
60 1
        return $this->modelAccounts->getById($id);
61
    }
62
}
63