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

Map   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 27
ccs 9
cts 9
cp 1
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A add() 0 8 2
A first() 0 4 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