Passed
Push — master ( 141183...2b56eb )
by Petr
08:03
created

AGroups::checkRest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 0
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 2
ccs 1
cts 1
cp 1
crap 1
rs 10
1
<?php
2
3
namespace kalanis\kw_auth\Sources\Files;
4
5
6
use kalanis\kw_auth\AuthException;
7
use kalanis\kw_auth\Interfaces\IAccessGroups;
8
use kalanis\kw_auth\Interfaces\IKATranslations;
9
use kalanis\kw_locks\Interfaces\ILock;
10
11
12
/**
13
 * Class AGroups
14
 * @package kalanis\kw_auth\Sources\Files
15
 * Authenticate via files - manage groups
16
 */
17
abstract class AGroups implements IAccessGroups
18
{
19
    use TGroups;
20
    use TLines;
21
    use TStore;
22
23
    /** @var string */
24
    protected $path = '';
25
26
    /**
27
     * @param ILock $lock
28
     * @param string $path full path to group file
29
     * @param IKATranslations|null $lang
30
     */
31 17
    public function __construct(ILock $lock, string $path, ?IKATranslations $lang = null)
32
    {
33 17
        $this->setLang($lang);
34 17
        $this->initAuthLock($lock);
35 17
        $this->path = $path;
36 17
    }
37
38 5
    protected function checkRest(/** @scrutinizer ignore-unused */ int $groupId): void
39
    {
40
        // nothing here
41 5
    }
42
43
    /**
44
     * @throws AuthException
45
     * @return array<int, array<int, string>>
46
     */
47 13
    protected function openGroups(): array
48
    {
49 13
        return $this->openFile($this->path);
50
    }
51
52
    /**
53
     * @param array<int, array<int, string|int>> $lines
54
     * @throws AuthException
55
     */
56 5
    protected function saveGroups(array $lines): void
57
    {
58 5
        $this->saveFile($this->path, $lines);
59 3
    }
60
}
61