@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Copyright (c) 2015 Petr Olišar (http://olisar.eu) |
|
4 | - * |
|
5 | - * For the full copyright and license information, please view |
|
6 | - * the file LICENSE.md that was distributed with this source code. |
|
7 | - */ |
|
3 | + * Copyright (c) 2015 Petr Olišar (http://olisar.eu) |
|
4 | + * |
|
5 | + * For the full copyright and license information, please view |
|
6 | + * the file LICENSE.md that was distributed with this source code. |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | namespace Oli\GoogleAPI; |
10 | 10 | |
@@ -18,21 +18,21 @@ discard block |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | public $defaults = array( |
21 | - 'key' => null, |
|
22 | - 'width' => '100%', |
|
23 | - 'height' => '100%', |
|
24 | - 'zoom' => 7, |
|
25 | - 'coordinates' => array(), |
|
26 | - 'type' => 'ROADMAP', |
|
27 | - 'scrollable' => true, |
|
28 | - 'static' => false, |
|
29 | - 'markers' => array( |
|
21 | + 'key' => null, |
|
22 | + 'width' => '100%', |
|
23 | + 'height' => '100%', |
|
24 | + 'zoom' => 7, |
|
25 | + 'coordinates' => array(), |
|
26 | + 'type' => 'ROADMAP', |
|
27 | + 'scrollable' => true, |
|
28 | + 'static' => false, |
|
29 | + 'markers' => array( |
|
30 | 30 | 'bound' => false, |
31 | 31 | 'markerClusterer' => false, |
32 | 32 | 'iconDefaultPath' => null, |
33 | 33 | 'icon' => null, |
34 | 34 | 'addMarkers' => array() |
35 | - ) |
|
35 | + ) |
|
36 | 36 | ); |
37 | 37 | |
38 | 38 |
@@ -49,11 +49,11 @@ |
||
49 | 49 | |
50 | 50 | |
51 | 51 | /** |
52 | - * @param array $position |
|
53 | - * @param boolean $animation |
|
54 | - * @param String $title |
|
55 | - * @return Markers |
|
56 | - */ |
|
52 | + * @param array $position |
|
53 | + * @param boolean $animation |
|
54 | + * @param String $title |
|
55 | + * @return Markers |
|
56 | + */ |
|
57 | 57 | public function addMarker(array $position, $animation = false, $title = null) |
58 | 58 | { |
59 | 59 | if (!is_string($animation) && !is_bool($animation)) |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function addMarkers(array $markers) |
40 | 40 | { |
41 | - if(count($markers)) |
|
41 | + if (count($markers)) |
|
42 | 42 | { |
43 | - foreach($markers as $marker) |
|
43 | + foreach ($markers as $marker) |
|
44 | 44 | { |
45 | 45 | $this->createMarker($marker); |
46 | 46 | } |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | { |
59 | 59 | if (!is_string($animation) && !is_bool($animation)) |
60 | 60 | { |
61 | - throw new \InvalidArgumentException("Animation must be string or boolean, $animation (" . |
|
62 | - gettype($animation) . ") was given"); |
|
61 | + throw new \InvalidArgumentException("Animation must be string or boolean, $animation (". |
|
62 | + gettype($animation).") was given"); |
|
63 | 63 | } |
64 | 64 | if (!is_string($title) && $title != null) |
65 | 65 | { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | throw new \InvalidArgumentException("setMessage must be called after addMarker()"); |
108 | 108 | } |
109 | - end($this->markers); // move the internal pointer to the end of the array |
|
109 | + end($this->markers); // move the internal pointer to the end of the array |
|
110 | 110 | $key = key($this->markers); |
111 | 111 | $this->markers[$key]['message'] = $message; |
112 | 112 | $this->markers[$key]['autoOpen'] = $autoOpen; |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function setIcon($icon) |
177 | 177 | { |
178 | - end($this->markers); // move the internal pointer to the end of the array |
|
178 | + end($this->markers); // move the internal pointer to the end of the array |
|
179 | 179 | $key = key($this->markers); |
180 | - if($icon instanceof Marker\Icon) |
|
180 | + if ($icon instanceof Marker\Icon) |
|
181 | 181 | { |
182 | - $icon->setUrl(is_null($this->iconDefaultPath) ? $icon->getUrl() : $this->iconDefaultPath . $icon->getUrl()); |
|
182 | + $icon->setUrl(is_null($this->iconDefaultPath) ? $icon->getUrl() : $this->iconDefaultPath.$icon->getUrl()); |
|
183 | 183 | $this->markers[$key]['icon'] = $icon->getArray(); |
184 | 184 | |
185 | 185 | } else |
186 | 186 | { |
187 | - $this->markers[$key]['icon'] = is_null($this->iconDefaultPath) ? $icon : $this->iconDefaultPath . $icon; |
|
187 | + $this->markers[$key]['icon'] = is_null($this->iconDefaultPath) ? $icon : $this->iconDefaultPath.$icon; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | return $this; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function setDefaultIconPath($defaultPath) |
200 | 200 | { |
201 | - if(!is_null($defaultPath) && |
|
201 | + if (!is_null($defaultPath) && |
|
202 | 202 | !\Nette\Utils\Strings::endsWith($defaultPath, '/') && |
203 | 203 | !\Nette\Utils\Strings::endsWith($defaultPath, '\\')) |
204 | 204 | { |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | throw new \Nette\InvalidArgumentException('Color must be 24-bit color or from the allowed list.'); |
231 | 231 | } |
232 | 232 | } |
233 | - end($this->markers); // move the internal pointer to the end of the array |
|
233 | + end($this->markers); // move the internal pointer to the end of the array |
|
234 | 234 | $key = key($this->markers); |
235 | 235 | $this->markers[$key]['color'] = $color; |
236 | 236 | return $this; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | private function createMarker(array $marker) |
241 | 241 | { |
242 | - if(!array_key_exists('coordinates', $marker)) |
|
242 | + if (!array_key_exists('coordinates', $marker)) |
|
243 | 243 | { |
244 | 244 | throw new \Nette\InvalidArgumentException('Coordinates must be set in every marker'); |
245 | 245 | } |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | isset($marker['animation']) ? $marker['animation'] : false, |
249 | 249 | isset($marker['title']) ? $marker['title'] : null); |
250 | 250 | |
251 | - if(array_key_exists('message', $marker)) |
|
251 | + if (array_key_exists('message', $marker)) |
|
252 | 252 | { |
253 | - if(is_array($marker['message'])) |
|
253 | + if (is_array($marker['message'])) |
|
254 | 254 | { |
255 | 255 | $message = array_values($marker['message']); |
256 | 256 | $this->setMessage($message[0], $message[1]); |
@@ -260,23 +260,23 @@ discard block |
||
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | - if(array_key_exists('icon', $marker)) |
|
263 | + if (array_key_exists('icon', $marker)) |
|
264 | 264 | { |
265 | - if(is_array($marker['icon'])) |
|
265 | + if (is_array($marker['icon'])) |
|
266 | 266 | { |
267 | 267 | $icon = new Marker\Icon($marker['icon']['url']); |
268 | 268 | |
269 | - if(array_key_exists('size', $marker['icon'])) |
|
269 | + if (array_key_exists('size', $marker['icon'])) |
|
270 | 270 | { |
271 | 271 | $icon->setSize($marker['icon']['size']); |
272 | 272 | } |
273 | 273 | |
274 | - if(array_key_exists('anchor', $marker['icon'])) |
|
274 | + if (array_key_exists('anchor', $marker['icon'])) |
|
275 | 275 | { |
276 | 276 | $icon->setAnchor($marker['icon']['anchor']); |
277 | 277 | } |
278 | 278 | |
279 | - if(array_key_exists('origin', $marker['icon'])) |
|
279 | + if (array_key_exists('origin', $marker['icon'])) |
|
280 | 280 | { |
281 | 281 | $icon->setOrigin($marker['icon']['origin']); |
282 | 282 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
291 | - if(array_key_exists('color', $marker)) |
|
291 | + if (array_key_exists('color', $marker)) |
|
292 | 292 | { |
293 | 293 | $this->setColor($marker['color']); |
294 | 294 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Copyright (c) 2015 Petr Olišar (http://olisar.eu) |
|
4 | - * |
|
5 | - * For the full copyright and license information, please view |
|
6 | - * the file LICENSE.md that was distributed with this source code. |
|
7 | - */ |
|
3 | + * Copyright (c) 2015 Petr Olišar (http://olisar.eu) |
|
4 | + * |
|
5 | + * For the full copyright and license information, please view |
|
6 | + * the file LICENSE.md that was distributed with this source code. |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | namespace Oli\GoogleAPI; |
10 | 10 |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function setCoordinates(array $coordinates) |
92 | 92 | { |
93 | - if(!count($coordinates)) |
|
93 | + if (!count($coordinates)) |
|
94 | 94 | { |
95 | 95 | $this->coordinates = array(NULL, NULL); |
96 | 96 | } else |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function setType($type) |
160 | 160 | { |
161 | - if($type !== self::HYBRID && $type !== self::ROADMAP && $type !== self::SATELLITE && |
|
161 | + if ($type !== self::HYBRID && $type !== self::ROADMAP && $type !== self::SATELLITE && |
|
162 | 162 | $type !== self::TERRAIN) |
163 | 163 | { |
164 | 164 | throw new \InvalidArgumentException; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | public function setWaypoint($key, $waypoint) |
172 | 172 | { |
173 | - if($key === 'waypoints') |
|
173 | + if ($key === 'waypoints') |
|
174 | 174 | { |
175 | 175 | $this->waypoints['waypoints'][] = $waypoint; |
176 | 176 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | public function setDirection(array $direction) |
186 | 186 | { |
187 | 187 | $this->direction = $direction; |
188 | - if(!array_key_exists('travelmode', $this->direction)) |
|
188 | + if (!array_key_exists('travelmode', $this->direction)) |
|
189 | 189 | { |
190 | 190 | $this->direction['travelmode'] = 'DRIVING'; |
191 | 191 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $this->template->position = $this->coordinates; |
343 | 343 | $this->template->markers = $this->markers; |
344 | 344 | $this->template->clickable = $this->clickable; |
345 | - $this->template->setFile(dirname(__FILE__) . '/static.latte'); |
|
345 | + $this->template->setFile(dirname(__FILE__).'/static.latte'); |
|
346 | 346 | } else |
347 | 347 | { |
348 | 348 | $map = array( |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | 'waypoint' => !is_null($this->waypoints) ? array_merge($this->waypoints, $this->direction) : NULL |
359 | 359 | ); |
360 | 360 | $this->template->map = \Nette\Utils\Json::encode($map); |
361 | - $this->template->setFile(dirname(__FILE__) . '/template.latte'); |
|
361 | + $this->template->setFile(dirname(__FILE__).'/template.latte'); |
|
362 | 362 | } |
363 | 363 | $this->template->render(); |
364 | 364 | } |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | |
340 | 340 | |
341 | 341 | /** |
342 | - * @see Nette\Application\Control#render() |
|
343 | - */ |
|
342 | + * @see Nette\Application\Control#render() |
|
343 | + */ |
|
344 | 344 | public function render() |
345 | 345 | { |
346 | 346 | if ($this->staticMap) |
@@ -355,17 +355,17 @@ discard block |
||
355 | 355 | } else |
356 | 356 | { |
357 | 357 | $map = array( |
358 | - 'position' => $this->coordinates, |
|
359 | - 'height' => $this->height, |
|
360 | - 'width' => $this->width, |
|
361 | - 'zoom' => $this->zoom, |
|
362 | - 'type' => $this->type, |
|
363 | - 'scrollable' => $this->scrollable, |
|
364 | - 'key' => $this->key, |
|
365 | - 'bound' => $this->bound, |
|
366 | - 'cluster' => $this->markerClusterer, |
|
367 | - 'clusterOptions' => $this->clusterOptions, |
|
368 | - 'waypoint' => !is_null($this->waypoints) ? array_merge($this->waypoints, $this->direction) : NULL |
|
358 | + 'position' => $this->coordinates, |
|
359 | + 'height' => $this->height, |
|
360 | + 'width' => $this->width, |
|
361 | + 'zoom' => $this->zoom, |
|
362 | + 'type' => $this->type, |
|
363 | + 'scrollable' => $this->scrollable, |
|
364 | + 'key' => $this->key, |
|
365 | + 'bound' => $this->bound, |
|
366 | + 'cluster' => $this->markerClusterer, |
|
367 | + 'clusterOptions' => $this->clusterOptions, |
|
368 | + 'waypoint' => !is_null($this->waypoints) ? array_merge($this->waypoints, $this->direction) : NULL |
|
369 | 369 | ); |
370 | 370 | $this->template->map = \Nette\Utils\Json::encode($map); |
371 | 371 | $this->template->setFile(dirname(__FILE__) . '/template.latte'); |