-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvehicle.php
64 lines (56 loc) · 994 Bytes
/
vehicle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Created by PhpStorm.
* User: Nikolay
* Date: 01.04.2020
* Time: 12:37
*/
class Vehicle
{
/**
* @var int
*/
private $position;
/**
* @var string
*/
private $direction;
/**
* @var int
*/
private $speed;
/**
* Vehicle constructor.
*
* @param int $position
* @param string $direction
* @param int $speed
*/
public function __construct(int $position, string $direction = 'left', int $speed = 1)
{
$this->position = $position;
$this->direction = $direction;
$this->speed = $speed;
}
/**
* @return int
*/
public function getPosition(): int
{
return $this->position;
}
/**
* @return string
*/
public function getDirection(): string
{
return $this->direction;
}
/**
* @return int
*/
public function getSpeed(): int
{
return $this->speed;
}
}