Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | 22 | public function generate($rows, $columns, $seed = null) |
|
16 | { |
||
17 | 22 | $this->validatePositiveInteger($rows); |
|
18 | 16 | $this->validatePositiveInteger($columns); |
|
19 | 10 | $this->validateOptionalInteger($seed); |
|
20 | |||
21 | 3 | mt_srand($seed); |
|
|
|||
22 | |||
23 | 3 | $terrainCost = array(); |
|
24 | |||
25 | 3 | foreach (range(0, $rows - 1) as $row) { |
|
26 | 3 | foreach (range(0, $columns - 1) as $column) { |
|
27 | 3 | $terrainCost[$row][$column] = mt_rand(1, 10); |
|
28 | } |
||
29 | } |
||
30 | |||
31 | 3 | return new TerrainCost($terrainCost); |
|
32 | } |
||
52 |