1 | <?php |
||
2 | |||
3 | namespace ZpgRtf\Objects; |
||
4 | |||
5 | /** |
||
6 | * Google Street View provides users with the ability to virtually explore outdoor areas. This is becoming increasingly |
||
7 | * valuable to users, who are able to, for example: plan routes to bus stops; see which services are provided by local |
||
8 | * shops. |
||
9 | */ |
||
10 | View Code Duplication | class GoogleStreetViewObject implements \JsonSerializable |
|
0 ignored issues
–
show
|
|||
11 | { |
||
12 | /** @var null|CoordinatesObject */ |
||
13 | private $coordinates; |
||
14 | |||
15 | /** @var null|float */ |
||
16 | private $heading; |
||
17 | |||
18 | /** @var null|float */ |
||
19 | private $pitch; |
||
20 | |||
21 | /** |
||
22 | * @return null|CoordinatesObject |
||
23 | */ |
||
24 | 3 | public function getCoordinates() |
|
25 | { |
||
26 | 3 | return $this->coordinates; |
|
27 | } |
||
28 | |||
29 | /** |
||
30 | * @param CoordinatesObject $coordinates |
||
31 | * |
||
32 | * @return GoogleStreetViewObject |
||
33 | */ |
||
34 | 2 | public function setCoordinates(CoordinatesObject $coordinates): self |
|
35 | { |
||
36 | 2 | $this->coordinates = $coordinates; |
|
37 | |||
38 | 2 | return $this; |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * @return null|float |
||
43 | */ |
||
44 | 3 | public function getHeading() |
|
45 | { |
||
46 | 3 | return $this->heading; |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * @param float $heading |
||
51 | * |
||
52 | * @return GoogleStreetViewObject |
||
53 | */ |
||
54 | 2 | public function setHeading(float $heading): self |
|
55 | { |
||
56 | 2 | $this->heading = $heading; |
|
57 | |||
58 | 2 | return $this; |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return null|float |
||
63 | */ |
||
64 | 3 | public function getPitch() |
|
65 | { |
||
66 | 3 | return $this->pitch; |
|
67 | } |
||
68 | |||
69 | /** |
||
70 | * @param float $pitch |
||
71 | * |
||
72 | * @return GoogleStreetViewObject |
||
73 | */ |
||
74 | 2 | public function setPitch(float $pitch): self |
|
75 | { |
||
76 | 2 | $this->pitch = $pitch; |
|
77 | |||
78 | 2 | return $this; |
|
79 | } |
||
80 | |||
81 | /** {@inheritDoc} */ |
||
82 | 2 | public function jsonSerialize(): array |
|
83 | { |
||
84 | 2 | return array_filter([ |
|
85 | 2 | 'coordinates' => $this->getCoordinates(), |
|
86 | 2 | 'heading' => $this->getHeading(), |
|
87 | 2 | 'pitch' => $this->getPitch(), |
|
88 | ]); |
||
89 | } |
||
90 | } |
||
91 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.