TestBag   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 7
dl 0
loc 33
rs 10
c 0
b 0
f 0
ccs 8
cts 8
cp 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTests() 0 3 1
A __construct() 0 4 2
A add() 0 3 1
1
<?php
2
3
/*
4
 *
5
 * (c) Yaroslav Honcharuk <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Yarhon\RouteGuardBundle\Security\Test;
12
13
/**
14
 * TestBag holds a set of authorization tests. Each test is represented by a TestInterface instance.
15
 *
16
 * @author Yaroslav Honcharuk <[email protected]>
17
 */
18
class TestBag implements TestBagInterface, ProviderAwareInterface
19
{
20
    use ProviderAwareTrait;
21
22
    /**
23
     * @var TestInterface[]
24
     */
25
    private $tests = [];
26
27
    /**
28
     * @param TestInterface[] $tests
29
     */
30 40
    public function __construct(array $tests)
31
    {
32 40
        foreach ($tests as $test) {
33 40
            $this->add($test);
34
        }
35 40
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 31
    public function getTests()
41
    {
42 31
        return $this->tests;
43
    }
44
45
    /**
46
     * @param TestInterface $test
47
     */
48 40
    private function add(TestInterface $test)
49
    {
50 40
        $this->tests[] = $test;
51 40
    }
52
}
53