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

Map::first()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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