TestBag::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
cc 2
nc 2
nop 1
crap 2
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