Completed
Push — rover-kata ( db70b6...cc14c5 )
by Marcos
18:19 queued 11:27
created

Direction::west()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Kata\Rover;
4
5
final class Direction
6
{
7
    public const NORTH = 'n';
8
    public const SOUTH = 's';
9
    public const EAST = 'e';
10
    public const WEST = 'w';
11
12
    private $direction;
13
14 1
    private function __construct(string $direction)
15
    {
16 1
        $this->direction = $direction;
17 1
    }
18
19 1
    public static function north(): Direction
20
    {
21 1
        return new self(Direction::NORTH);
22
    }
23
24 1
    public static function south(): Direction
25
    {
26 1
        return new self(Direction::SOUTH);
27
    }
28
29 1
    public static function east(): Direction
30
    {
31 1
        return new self(Direction::EAST);
32
    }
33
34 1
    public static function west(): Direction
35
    {
36 1
        return new self(Direction::WEST);
37
    }
38
39 1
    public function direction(): string
40
    {
41 1
        return $this->direction;
42
    }
43
}
44