1 | <?php namespace Arcanedev\GeoLocation\Google\DistanceMatrix; |
||
14 | class DistanceMatrixResponse extends AbstractResponse |
||
15 | { |
||
16 | /* ----------------------------------------------------------------- |
||
17 | | Getters & Setters |
||
18 | | ----------------------------------------------------------------- |
||
19 | */ |
||
20 | |||
21 | /** |
||
22 | * Get the first origin address. |
||
23 | * |
||
24 | * @return string|null |
||
25 | */ |
||
26 | 15 | public function getOriginAddress() |
|
30 | |||
31 | /** |
||
32 | * Get the original addresses. |
||
33 | * |
||
34 | * @return array |
||
35 | */ |
||
36 | 15 | public function getOriginAddresses() |
|
40 | |||
41 | /** |
||
42 | * Get the first destination address. |
||
43 | * |
||
44 | * @return string|null |
||
45 | */ |
||
46 | 15 | public function getDestinationAddress() |
|
50 | |||
51 | /** |
||
52 | * Get the destination addresses. |
||
53 | * |
||
54 | * @return array |
||
55 | */ |
||
56 | 15 | public function getDestinationAddresses() |
|
60 | |||
61 | /** |
||
62 | * Get the distance (text or value). |
||
63 | * |
||
64 | * @param bool $text |
||
65 | * |
||
66 | * @return string|int |
||
67 | */ |
||
68 | 12 | public function distance($text = true) |
|
74 | |||
75 | /** |
||
76 | * Get the distance. |
||
77 | * |
||
78 | * @return \Arcanedev\GeoLocation\Entities\Measures\Distance |
||
79 | */ |
||
80 | 18 | public function getDistance() |
|
81 | { |
||
82 | 18 | return Distance::makeFromArray( |
|
83 | 18 | $this->get('rows.0.elements.0.distance') |
|
84 | ); |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * Get the duration (text or value). |
||
89 | * |
||
90 | * @param bool $text |
||
91 | * |
||
92 | * @return string|int |
||
93 | */ |
||
94 | 12 | public function duration($text = true) |
|
100 | |||
101 | /** |
||
102 | * Get the duration (text or value). |
||
103 | * |
||
104 | * @return \Arcanedev\GeoLocation\Entities\Measures\Duration |
||
105 | */ |
||
106 | 18 | public function getDuration() |
|
112 | |||
113 | /* ----------------------------------------------------------------- |
||
114 | | Main Methods |
||
115 | | ----------------------------------------------------------------- |
||
116 | */ |
||
117 | |||
118 | /** |
||
119 | * Convert the object to array. |
||
120 | * |
||
121 | * @return array |
||
122 | */ |
||
123 | 6 | public function toArray() |
|
132 | } |
||
133 |