Completed
Push — rover-kata ( af6137...5671db )
by Marcos
32:21 queued 27:49
created

Coordinates::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Kata\Rover;
4
5
final class Coordinates
6
{
7
    private $coordinate_x;
8
    private $coordinate_y;
9
10 2
    public function __construct(int $a_coordinate_x, int $a_coordinate_y)
11
    {
12 2
        $this->coordinate_x = $a_coordinate_x;
13 2
        $this->coordinate_y = $a_coordinate_y;
14 2
    }
15
16 2
    public function coordinateX(): int
17
    {
18 2
        return $this->coordinate_x;
19
    }
20
21 2
    public function coordinateY(): int
22
    {
23 2
        return $this->coordinate_y;
24
    }
25
26 1
    public function equals(Coordinates $coordinates): bool
27
    {
28 1
        if ($this->coordinate_x === $coordinates->coordinateX()
29 1
            && $this->coordinate_y === $coordinates->coordinateY()) {
30 1
            return true;
31
        }
32
33
        return false;
34
    }
35
}
36