Passed
Push — master ( ab9dd5...179053 )
by Petr
05:44
created

SurroundingMap   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A add() 0 8 2
1
<?php
2
3
namespace Vehsamrak\Terraformator\Entity;
4
5
use Vehsamrak\Terraformator\Exception\TooManyLocationsException;
6
7
/**
8
 * Map with 8 or less locations to represend surroundings of central location (3x3 location square)
9
 * @author Vehsamrak
10
 */
11
class SurroundingMap extends Map
12
{
13
14
    /** {@inheritDoc} */
15 3
    public function add($element): bool
16
    {
17 3
        if ($this->count() < 8) {
18 2
            return parent::add($element);
19
        } else {
20 1
            throw new TooManyLocationsException();
21
        }
22
    }
23
}
24
25