World::getSpecies()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace MidoriKocak\GameOfLife;
4
5
/**
6
 * Class World
7
 * @package MidoriKocak\GameOfLife
8
 */
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
52
    {
53 2
        return $this->cells;
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
72
    {
73 5
        return $this->iterations;
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)
102
    {
103 12
        $this->species = $species;
104
    }
105
}