Conditions | 6 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
15 | 3 | public function qualifyBiom(Map $map): Biom |
|
16 | { |
||
17 | 3 | $firstLocationInMap = $map->first(); |
|
18 | |||
19 | 3 | if ($firstLocationInMap) { |
|
20 | 2 | $firstBiom = $firstLocationInMap->getBiom(); |
|
21 | 2 | $locationsAreSame = true; |
|
22 | |||
23 | /** @var Location $location */ |
||
24 | 2 | foreach ($map->toArray() as $location) { |
|
25 | 2 | if (!$location->getBiom()->equals($firstBiom)) { |
|
26 | 2 | $locationsAreSame = false; |
|
27 | } |
||
28 | } |
||
29 | |||
30 | 2 | if ($map->count() == 8 && $locationsAreSame) { |
|
31 | 2 | return $firstBiom; |
|
32 | } |
||
33 | } |
||
34 | |||
35 | 1 | return $this->getRandomBiom(); |
|
36 | } |
||
37 | |||
46 |