Completed
Push — rover-kata ( e3c1b4...ca5c00 )
by Marcos
20:12 queued 04:03
created

Coordinates   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 91.67%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 30
ccs 11
cts 12
cp 0.9167
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 8 3
1
<?php
2
3
namespace Kata\Rover;
4
5
final class Coordinates
6
{
7
    private $coordinateX;
8
    private $coordinateY;
9
10 2
    public function __construct(int $a_coordinateX, int $a_coordinateY)
11
    {
12 2
        $this->coordinateX = $a_coordinateX;
13 2
        $this->coordinateY = $a_coordinateY;
14 2
    }
15
16 2
    public function coordinateX(): int
17
    {
18 2
        return $this->coordinateX;
19
    }
20
21 2
    public function coordinateY(): int
22
    {
23 2
        return $this->coordinateY;
24
    }
25
26 1
    public function equals(Coordinates $coordinates): bool
27
    {
28 1
        if ($this->coordinateX === $coordinates->coordinateX() && $this->coordinateY === $coordinates->coordinateY()) {
29 1
            return true;
30
        }
31
32
        return false;
33
    }
34
}
35