BlackList::isUsernameBlackListed()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Botonomous;
4
5
class BlackList extends AbstractAccessList
6
{
7
    /**
8
     * BlackList constructor.
9
     *
10
     * @param $request
11
     */
12 11
    public function __construct($request)
13
    {
14 11
        $this->setRequest($request);
15 11
    }
16
17
    /**
18
     * @throws \Exception
19
     *
20
     * @return bool
21
     */
22 6
    public function isBlackListed(): bool
23
    {
24 6
        return $this->isUsernameBlackListed()
25 6
            || $this->isUserIdBlackListed()
26 6
            || $this->isEmailBlackListed();
27
    }
28
29
    /**
30
     * @throws \Exception
31
     *
32
     * @return bool
33
     */
34 7
    public function isUsernameBlackListed(): bool
35
    {
36 7
        return $this->findInListByRequestKey('user_name', $this->getShortClassName(), 'username') === true
37 7
            ? true : false;
38
    }
39
40
    /**
41
     * @throws \Exception
42
     *
43
     * @return bool
44
     */
45 7
    public function isUserIdBlackListed(): bool
46
    {
47 7
        return $this->findInListByRequestKey('user_id', $this->getShortClassName(), 'userId') === true
48 7
            ? true : false;
49
    }
50
51
    /**
52
     * @throws \Exception
53
     *
54
     * @return bool
55
     */
56 7
    public function isEmailBlackListed()
57
    {
58 7
        return $this->checkEmail();
59
    }
60
}
61