Completed
Branch master (597d40)
by Douglas
02:41 queued 01:20
created

CompassMove   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A northward() 0 4 1
A eastward() 0 4 1
A southward() 0 4 1
A westward() 0 4 1
1
<?php
2
3
/**
4
 * (c) 2018 Douglas Reith.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
declare(strict_types=1);
10
11
namespace Reith\ToyRobot\Domain\Robot;
12
13
/**
14
 * Model movement as the application of a Vector (place)
15
 * in a 2 dimensional space.
16
 */
17
class CompassMove
18
{
19 2
    public static function northward(): Place
20
    {
21 2
        return Place::create([0, 1]);
22
    }
23
24 1
    public static function eastward(): Place
25
    {
26 1
        return Place::create([1, 0]);
27
    }
28
29 2
    public static function southward(): Place
30
    {
31 2
        return Place::create([0, -1]);
32
    }
33
34 2
    public static function westward(): Place
35
    {
36 2
        return Place::create([-1, 0]);
37
    }
38
}
39