Completed
Push — master ( b2bf8f...b90fcd )
by Pierre
03:08
created

File::getById()   A

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