MoveLocationResponse::doLocationResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Adventure\ActionResponses;
4
5
use App\Adventure\Location;
6
7
/**
8
 * MoveLocationResponse implements the LocationResponseInterface.
9
 * It moves the player to a new location.
10
 */
11
class MoveLocationResponse implements LocationResponseInterface
12
{
13
    /**
14
     * @var Location The new location to move to.
15
     */
16
    private $newLocation;
17
18
    /**
19
     * MoveLocationResponse constructor.
20
     *
21
     * @param Location $newLocation The new location to move to.
22
     */
23 1
    public function __construct(Location $newLocation)
24
    {
25 1
        $this->newLocation = $newLocation;
26
    }
27
28
    /**
29
     * Performs the location response action by returning the new location.
30
     *
31
     * @param  Location|null $oldLocation The current location.
32
     * @return Location The resulting location after the move, will be the new location.
33
     */
34 1
    public function doLocationResponse(?Location $oldLocation): Location
35
    {
36 1
        $resultLocation = $this->newLocation;
37
38 1
        return $resultLocation;
39
    }
40
}
41