Completed
Push — rover-kata ( e3c1b4 )
by Marcos
09:02
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 $coordinateX;
8
    private $coordinateY;
9
10 1
    public function __construct(int $a_coordinateX, int $a_coordinateY)
11
    {
12 1
        $this->coordinateX = $a_coordinateX;
13 1
        $this->coordinateY = $a_coordinateY;
14 1
    }
15
16 1
    public function coordinateX(): int
17
    {
18 1
        return $this->coordinateX;
19
    }
20
21 1
    public function coordinateY(): int
22
    {
23 1
        return $this->coordinateY;
24
    }
25
26
    public function equals(Coordinates $coordinates): bool
27
    {
28
        if ($this->coordinateX === $coordinates->coordinateX() && $this->coordinateY === $coordinates->coordinateY()) {
29
            return true;
30
        }
31
32
        return false;
33
    }
34
}
35