Completed
Push — master ( 68fe25...8e1e8c )
by Woody
11s
created

PathCollection::add()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Northwoods\Config\Path;
4
5
use Exception;
6
use Northwoods\Config\ArrayCollection;
7
8
/**
9
 * @method Path get($key)
10
 */
11
class PathCollection extends ArrayCollection
12
{
13
    /**
14
     * @param string|Path $path
15
     * @return bool
16
     * @throws Exception
17
     */
18 26
    public function add($path)
19
    {
20 26
        if (!$path instanceof Path) {
21 26
            $path = new Path($path);
22
        }
23 25
        $this->container[] = $path;
24 25
        return true;
25
    }
26
}
27