| Total Complexity | 7 |
| Total Lines | 95 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class World |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Size of the square matrix. |
||
| 13 | * |
||
| 14 | * @var int |
||
| 15 | */ |
||
| 16 | private $cells; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Number of max iterations. |
||
| 20 | * |
||
| 21 | * @var int |
||
| 22 | */ |
||
| 23 | private $iterations; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Number of max species. |
||
| 27 | * |
||
| 28 | * @var int |
||
| 29 | */ |
||
| 30 | private $species; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * World constructor. |
||
| 34 | * |
||
| 35 | * @param int $cells |
||
| 36 | * @param int $species |
||
| 37 | * @param int $iterations |
||
| 38 | */ |
||
| 39 | 12 | public function __construct(int $cells, int $species, int $iterations) |
|
| 40 | { |
||
| 41 | 12 | $this->setCells($cells); |
|
| 42 | 12 | $this->setIterations($iterations); |
|
| 43 | 12 | $this->setSpecies($species); |
|
| 44 | 12 | } |
|
| 45 | |||
| 46 | /** |
||
| 47 | * Returns the size of the square matrix. |
||
| 48 | * |
||
| 49 | * @return int |
||
| 50 | */ |
||
| 51 | 2 | public function getCells(): int |
|
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Set's the size of the square matrix. |
||
| 58 | * |
||
| 59 | * @param int $cells |
||
| 60 | */ |
||
| 61 | 12 | public function setCells(int $cells) |
|
| 62 | { |
||
| 63 | 12 | $this->cells = $cells; |
|
| 64 | 12 | } |
|
| 65 | |||
| 66 | /** |
||
| 67 | * Returns the number of max iterations. |
||
| 68 | * |
||
| 69 | * @return int |
||
| 70 | */ |
||
| 71 | 5 | public function getIterations(): int |
|
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Sets the number of max iterations. |
||
| 78 | * |
||
| 79 | * @param int $iterations |
||
| 80 | */ |
||
| 81 | 12 | public function setIterations(int $iterations) |
|
| 82 | { |
||
| 83 | 12 | $this->iterations = $iterations; |
|
| 84 | 12 | } |
|
| 85 | |||
| 86 | /** |
||
| 87 | * Returns the number of max species. |
||
| 88 | * |
||
| 89 | * @return int |
||
| 90 | */ |
||
| 91 | 1 | public function getSpecies(): int |
|
| 92 | { |
||
| 93 | 1 | return $this->species; |
|
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Sets the number of max species. |
||
| 98 | * |
||
| 99 | * @param int $species |
||
| 100 | */ |
||
| 101 | 12 | public function setSpecies(int $species) |
|
| 104 | } |
||
| 105 | } |