@@ 8-88 (lines=81) @@ | ||
5 | /** |
|
6 | * The description is expressed as an array of description objects, each of which represent a paragraph or section. |
|
7 | */ |
|
8 | class DescriptionObject implements \JsonSerializable |
|
9 | { |
|
10 | /** @var null|string */ |
|
11 | private $heading; |
|
12 | ||
13 | /** @var null|DimensionsObject */ |
|
14 | private $dimensions; |
|
15 | ||
16 | /** @var null|string */ |
|
17 | private $text; |
|
18 | ||
19 | /** |
|
20 | * @return null|string |
|
21 | */ |
|
22 | public function getHeading() |
|
23 | { |
|
24 | return $this->heading; |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * @param string $heading |
|
29 | * |
|
30 | * @return DescriptionObject |
|
31 | */ |
|
32 | public function setHeading(string $heading): self |
|
33 | { |
|
34 | $this->heading = $heading; |
|
35 | ||
36 | return $this; |
|
37 | } |
|
38 | ||
39 | /** |
|
40 | * @return null|DimensionsObject |
|
41 | */ |
|
42 | public function getDimensions() |
|
43 | { |
|
44 | return $this->dimensions; |
|
45 | } |
|
46 | ||
47 | /** |
|
48 | * @param DimensionsObject $dimensions |
|
49 | * |
|
50 | * @return DescriptionObject |
|
51 | */ |
|
52 | public function setDimensions(DimensionsObject $dimensions): self |
|
53 | { |
|
54 | $this->dimensions = $dimensions; |
|
55 | ||
56 | return $this; |
|
57 | } |
|
58 | ||
59 | /** |
|
60 | * @return null|string |
|
61 | */ |
|
62 | public function getText() |
|
63 | { |
|
64 | return $this->text; |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * @param string $text |
|
69 | * |
|
70 | * @return DescriptionObject |
|
71 | */ |
|
72 | public function setText(string $text): self |
|
73 | { |
|
74 | $this->text = $text; |
|
75 | ||
76 | return $this; |
|
77 | } |
|
78 | ||
79 | /** {@inheritDoc} */ |
|
80 | public function jsonSerialize(): array |
|
81 | { |
|
82 | return array_filter([ |
|
83 | 'heading' => $this->getHeading(), |
|
84 | 'dimensions' => $this->getDimensions(), |
|
85 | 'text' => $this->getText(), |
|
86 | ]); |
|
87 | } |
|
88 | } |
|
89 |
@@ 10-90 (lines=81) @@ | ||
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 | class GoogleStreetViewObject implements \JsonSerializable |
|
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 | public function getCoordinates() |
|
25 | { |
|
26 | return $this->coordinates; |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @param CoordinatesObject $coordinates |
|
31 | * |
|
32 | * @return GoogleStreetViewObject |
|
33 | */ |
|
34 | public function setCoordinates(CoordinatesObject $coordinates): self |
|
35 | { |
|
36 | $this->coordinates = $coordinates; |
|
37 | ||
38 | return $this; |
|
39 | } |
|
40 | ||
41 | /** |
|
42 | * @return null|float |
|
43 | */ |
|
44 | public function getHeading() |
|
45 | { |
|
46 | return $this->heading; |
|
47 | } |
|
48 | ||
49 | /** |
|
50 | * @param float $heading |
|
51 | * |
|
52 | * @return GoogleStreetViewObject |
|
53 | */ |
|
54 | public function setHeading(float $heading): self |
|
55 | { |
|
56 | $this->heading = $heading; |
|
57 | ||
58 | return $this; |
|
59 | } |
|
60 | ||
61 | /** |
|
62 | * @return null|float |
|
63 | */ |
|
64 | public function getPitch() |
|
65 | { |
|
66 | return $this->pitch; |
|
67 | } |
|
68 | ||
69 | /** |
|
70 | * @param float $pitch |
|
71 | * |
|
72 | * @return GoogleStreetViewObject |
|
73 | */ |
|
74 | public function setPitch(float $pitch): self |
|
75 | { |
|
76 | $this->pitch = $pitch; |
|
77 | ||
78 | return $this; |
|
79 | } |
|
80 | ||
81 | /** {@inheritDoc} */ |
|
82 | public function jsonSerialize(): array |
|
83 | { |
|
84 | return array_filter([ |
|
85 | 'coordinates' => $this->getCoordinates(), |
|
86 | 'heading' => $this->getHeading(), |
|
87 | 'pitch' => $this->getPitch(), |
|
88 | ]); |
|
89 | } |
|
90 | } |
|
91 |