Passed
Push — master ( dd634a...4d5ddd )
by Petr
02:10
created

Map::add()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Vehsamrak\Terraformator\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Vehsamrak\Terraformator\Exception\InvalidTypeException;
7
8
/**
9
 * @author Vehsamrak
10
 */
11
class Map extends ArrayCollection
12
{
13
14
    /**
15
     * {@inheritDoc}
16
     */
17 5
    public function __construct(array $locations = [])
18
    {
19 5
        parent::__construct($locations);
20 5
    }
21
22
    /** {@inheritDoc} */
23 4
    public function add($element): bool
24
    {
25 4
        if (!$element instanceof Location) {
26 1
        	throw new InvalidTypeException();
27
        }
28
29 3
        return parent::add($element);
30
    }
31
32
    /** {@inheritDoc} */
33 2
    public function first(): Location
34
    {
35 2
        return parent::first();
36
    }
37
}
38
39