Passed
Push — main ( a841d7...dafacd )
by Daniel
53s queued 13s
created

AllowBouncer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 4
dl 0
loc 15
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A deny() 0 3 1
A isAllowed() 0 3 1
A allow() 0 3 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 * This file is part of the theroadbunch/bouncer package.
5
 *
6
 * (c) Dan McAdams <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace RoadBunch\Bouncer;
13
14
15
/**
16
 * Class AllowBouncer
17
 *
18
 * @author Dan McAdams <[email protected]>
19
 */
20
class AllowBouncer extends AbstractBouncer
21
{
22
    public function isAllowed(string $subject): bool
23
    {
24
        return $this->has($subject);
25
    }
26
27
    public function allow(string $subject): void
28
    {
29
        $this->add($subject);
30
    }
31
32
    public function deny(string $subject): void
33
    {
34
        $this->remove($subject);
35
    }
36
}
37