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

Coordinates   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 92.31%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 31
ccs 12
cts 13
cp 0.9231
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A coordinateX() 0 4 1
A coordinateY() 0 4 1
A equals() 0 9 3
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