LocationGenerator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 19
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A generateLocation() 0 8 1
1
<?php
2
3
namespace Vehsamrak\Terraformator\LocationGenerator;
4
5
use Vehsamrak\Terraformator\Entity\Location;
6
use Vehsamrak\Terraformator\Entity\PreviousLocationMap;
7
use Vehsamrak\Terraformator\Enum\LocationType;
8
9
/**
10
 * @author Vehsamrak
11
 */
12
class LocationGenerator
13
{
14
    /** @var BiomQualifier $biomQualifier */
15
    private $biomQualifier;
16
17 3
    public function __construct(BiomQualifier $biomQualifier)
18
    {
19 3
        $this->biomQualifier = $biomQualifier;
20 3
    }
21
22 3
    public function generateLocation(PreviousLocationMap $map, int $x, int $y): Location
23
    {
24 3
        $biom = $this->biomQualifier->qualifyBiom($map);
25
        // TODO: qualify location type by biom
26 3
        $type = LocationType::DEEP_FOREST();
27
28 3
        return new Location($x, $y, $type, $biom);
29
    }
30
}
31