AAdapter   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 55
ccs 16
cts 16
cp 1
rs 10
wmc 8

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getGroups() 0 6 2
A getAccounts() 0 6 2
A getClasses() 0 6 2
A getAuth() 0 6 2
1
<?php
2
3
namespace kalanis\kw_auth_sources\Access\SourcesAdapters;
4
5
6
use kalanis\kw_accounts\Interfaces;
7
use kalanis\kw_auth_sources\AuthSourcesException;
8
use kalanis\kw_auth_sources\Traits\TLang;
9
10
11
/**
12
 * Class AAdapter
13
 * @package kalanis\kw_auth_sources\Access\SourcesAdapters
14
 */
15
abstract class AAdapter
16
{
17
    use TLang;
18
19
    protected ?Interfaces\IAuth $auth = null;
20
    protected ?Interfaces\IProcessAccounts $accounts = null;
21
    protected ?Interfaces\IProcessClasses $classes = null;
22
    protected ?Interfaces\IProcessGroups $groups = null;
23
24
    /**
25
     * @throws AuthSourcesException
26
     * @return Interfaces\IAuth
27
     */
28 6
    public function getAuth(): Interfaces\IAuth
29
    {
30 6
        if (!$this->auth) {
31 1
            throw new AuthSourcesException($this->getAusLang()->kauGroupMissAccounts());
32
        }
33 5
        return $this->auth;
34
    }
35
36
    /**
37
     * @throws AuthSourcesException
38
     * @return Interfaces\IProcessAccounts
39
     */
40 6
    public function getAccounts(): Interfaces\IProcessAccounts
41
    {
42 6
        if (!$this->accounts) {
43 1
            throw new AuthSourcesException($this->getAusLang()->kauGroupMissAuth());
44
        }
45 5
        return $this->accounts;
46
    }
47
48
    /**
49
     * @throws AuthSourcesException
50
     * @return Interfaces\IProcessClasses
51
     */
52 5
    public function getClasses(): Interfaces\IProcessClasses
53
    {
54 5
        if (!$this->classes) {
55 1
            throw new AuthSourcesException($this->getAusLang()->kauGroupMissClasses());
56
        }
57 4
        return $this->classes;
58
    }
59
60
    /**
61
     * @throws AuthSourcesException
62
     * @return Interfaces\IProcessGroups
63
     */
64 5
    public function getGroups(): Interfaces\IProcessGroups
65
    {
66 5
        if (!$this->groups) {
67 1
            throw new AuthSourcesException($this->getAusLang()->kauGroupMissGroups());
68
        }
69 4
        return $this->groups;
70
    }
71
}
72