@@ -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 | |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | |
336 | 336 | |
337 | 337 | /** |
338 | - * @see Nette\Application\Control#render() |
|
339 | - */ |
|
338 | + * @see Nette\Application\Control#render() |
|
339 | + */ |
|
340 | 340 | public function render() |
341 | 341 | { |
342 | 342 | if ($this->staticMap) |
@@ -351,16 +351,16 @@ discard block |
||
351 | 351 | } else |
352 | 352 | { |
353 | 353 | $map = array( |
354 | - 'position' => $this->coordinates, |
|
355 | - 'height' => $this->height, |
|
356 | - 'width' => $this->width, |
|
357 | - 'zoom' => $this->zoom, |
|
358 | - 'type' => $this->type, |
|
359 | - 'scrollable' => $this->scrollable, |
|
360 | - 'key' => $this->key, |
|
361 | - 'bound' => $this->bound, |
|
362 | - 'cluster' => $this->markerClusterer, |
|
363 | - 'waypoint' => !is_null($this->waypoints) ? array_merge($this->waypoints, $this->direction) : NULL |
|
354 | + 'position' => $this->coordinates, |
|
355 | + 'height' => $this->height, |
|
356 | + 'width' => $this->width, |
|
357 | + 'zoom' => $this->zoom, |
|
358 | + 'type' => $this->type, |
|
359 | + 'scrollable' => $this->scrollable, |
|
360 | + 'key' => $this->key, |
|
361 | + 'bound' => $this->bound, |
|
362 | + 'cluster' => $this->markerClusterer, |
|
363 | + 'waypoint' => !is_null($this->waypoints) ? array_merge($this->waypoints, $this->direction) : NULL |
|
364 | 364 | ); |
365 | 365 | $this->template->map = \Nette\Utils\Json::encode($map); |
366 | 366 | $this->template->setFile(dirname(__FILE__) . '/template.latte'); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function setCoordinates(array $coordinates) |
97 | 97 | { |
98 | - if(!count($coordinates)) |
|
98 | + if (!count($coordinates)) |
|
99 | 99 | { |
100 | 100 | $this->coordinates = array(NULL, NULL); |
101 | 101 | } else |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function setType($type) |
165 | 165 | { |
166 | - if($type !== self::HYBRID && $type !== self::ROADMAP && $type !== self::SATELLITE && |
|
166 | + if ($type !== self::HYBRID && $type !== self::ROADMAP && $type !== self::SATELLITE && |
|
167 | 167 | $type !== self::TERRAIN) |
168 | 168 | { |
169 | 169 | throw new \InvalidArgumentException; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | public function setWaypoint($key, $waypoint) |
177 | 177 | { |
178 | - if($key === 'waypoints') |
|
178 | + if ($key === 'waypoints') |
|
179 | 179 | { |
180 | 180 | $this->waypoints['waypoints'][] = $waypoint; |
181 | 181 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | public function setDirection(array $direction) |
191 | 191 | { |
192 | 192 | $this->direction = $direction; |
193 | - if(!array_key_exists('travelmode', $this->direction)) |
|
193 | + if (!array_key_exists('travelmode', $this->direction)) |
|
194 | 194 | { |
195 | 195 | $this->direction['travelmode'] = 'DRIVING'; |
196 | 196 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $this->template->position = $this->coordinates; |
348 | 348 | $this->template->markers = $this->markers; |
349 | 349 | $this->template->clickable = $this->clickable; |
350 | - $this->template->setFile(dirname(__FILE__) . '/static.latte'); |
|
350 | + $this->template->setFile(dirname(__FILE__).'/static.latte'); |
|
351 | 351 | } else |
352 | 352 | { |
353 | 353 | $map = array( |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | 'waypoint' => !is_null($this->waypoints) ? array_merge($this->waypoints, $this->direction) : NULL |
364 | 364 | ); |
365 | 365 | $this->template->map = \Nette\Utils\Json::encode($map); |
366 | - $this->template->setFile(dirname(__FILE__) . '/template.latte'); |
|
366 | + $this->template->setFile(dirname(__FILE__).'/template.latte'); |
|
367 | 367 | } |
368 | 368 | $this->template->render(); |
369 | 369 | } |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | { |
378 | 378 | |
379 | 379 | //Process callbacks |
380 | - foreach($this->onMarkers AS $onMarker){ |
|
381 | - if(is_callable($onMarker)){ |
|
380 | + foreach ($this->onMarkers AS $onMarker) { |
|
381 | + if (is_callable($onMarker)) { |
|
382 | 382 | $onMarker($this); |
383 | 383 | } |
384 | 384 | } |
@@ -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,13 +58,13 @@ 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 | |
65 | 65 | $this->markers[] = array( |
66 | 66 | 'position' => $position, |
67 | - 'title' => (string)$title, |
|
67 | + 'title' => (string) $title, |
|
68 | 68 | 'animation' => $animation, |
69 | 69 | 'visible' => true |
70 | 70 | ); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | { |
104 | 104 | throw new \InvalidArgumentException("setMessage must be called after addMarker()"); |
105 | 105 | } |
106 | - end($this->markers); // move the internal pointer to the end of the array |
|
106 | + end($this->markers); // move the internal pointer to the end of the array |
|
107 | 107 | $key = key($this->markers); |
108 | 108 | $this->markers[$key]['message'] = $message; |
109 | 109 | $this->markers[$key]['autoOpen'] = $autoOpen; |
@@ -172,16 +172,16 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function setIcon($icon) |
174 | 174 | { |
175 | - end($this->markers); // move the internal pointer to the end of the array |
|
175 | + end($this->markers); // move the internal pointer to the end of the array |
|
176 | 176 | $key = key($this->markers); |
177 | - if($icon instanceof Marker\Icon) |
|
177 | + if ($icon instanceof Marker\Icon) |
|
178 | 178 | { |
179 | - $icon->setUrl(is_null($this->iconDefaultPath) ? $icon->getUrl() : $this->iconDefaultPath . $icon->getUrl()); |
|
179 | + $icon->setUrl(is_null($this->iconDefaultPath) ? $icon->getUrl() : $this->iconDefaultPath.$icon->getUrl()); |
|
180 | 180 | $this->markers[$key]['icon'] = $icon->getArray(); |
181 | 181 | |
182 | 182 | } else |
183 | 183 | { |
184 | - $this->markers[$key]['icon'] = is_null($this->iconDefaultPath) ? $icon : $this->iconDefaultPath . $icon; |
|
184 | + $this->markers[$key]['icon'] = is_null($this->iconDefaultPath) ? $icon : $this->iconDefaultPath.$icon; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return $this; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function setDefaultIconPath($defaultPath) |
197 | 197 | { |
198 | - if(!is_null($defaultPath) && |
|
198 | + if (!is_null($defaultPath) && |
|
199 | 199 | !\Nette\Utils\Strings::endsWith($defaultPath, '/') && |
200 | 200 | !\Nette\Utils\Strings::endsWith($defaultPath, '\\')) |
201 | 201 | { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | throw new \Nette\InvalidArgumentException('Color must be 24-bit color or from the allowed list.'); |
228 | 228 | } |
229 | 229 | } |
230 | - end($this->markers); // move the internal pointer to the end of the array |
|
230 | + end($this->markers); // move the internal pointer to the end of the array |
|
231 | 231 | $key = key($this->markers); |
232 | 232 | $this->markers[$key]['color'] = $color; |
233 | 233 | return $this; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | private function createMarker(array $marker) |
238 | 238 | { |
239 | - if(!array_key_exists('coordinates', $marker)) |
|
239 | + if (!array_key_exists('coordinates', $marker)) |
|
240 | 240 | { |
241 | 241 | throw new \Nette\InvalidArgumentException('Coordinates must be set in every marker'); |
242 | 242 | } |
@@ -245,9 +245,9 @@ discard block |
||
245 | 245 | isset($marker['animation']) ? $marker['animation'] : false, |
246 | 246 | isset($marker['title']) ? $marker['title'] : null); |
247 | 247 | |
248 | - if(array_key_exists('message', $marker)) |
|
248 | + if (array_key_exists('message', $marker)) |
|
249 | 249 | { |
250 | - if(is_array($marker['message'])) |
|
250 | + if (is_array($marker['message'])) |
|
251 | 251 | { |
252 | 252 | $message = array_values($marker['message']); |
253 | 253 | $this->setMessage($message[0], $message[1]); |
@@ -257,23 +257,23 @@ discard block |
||
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
260 | - if(array_key_exists('icon', $marker)) |
|
260 | + if (array_key_exists('icon', $marker)) |
|
261 | 261 | { |
262 | - if(is_array($marker['icon'])) |
|
262 | + if (is_array($marker['icon'])) |
|
263 | 263 | { |
264 | 264 | $icon = new Marker\Icon($marker['icon']['url']); |
265 | 265 | |
266 | - if(array_key_exists('size', $marker['icon'])) |
|
266 | + if (array_key_exists('size', $marker['icon'])) |
|
267 | 267 | { |
268 | 268 | $icon->setSize($marker['icon']['size']); |
269 | 269 | } |
270 | 270 | |
271 | - if(array_key_exists('anchor', $marker['icon'])) |
|
271 | + if (array_key_exists('anchor', $marker['icon'])) |
|
272 | 272 | { |
273 | 273 | $icon->setAnchor($marker['icon']['anchor']); |
274 | 274 | } |
275 | 275 | |
276 | - if(array_key_exists('origin', $marker['icon'])) |
|
276 | + if (array_key_exists('origin', $marker['icon'])) |
|
277 | 277 | { |
278 | 278 | $icon->setOrigin($marker['icon']['origin']); |
279 | 279 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
288 | - if(array_key_exists('color', $marker)) |
|
288 | + if (array_key_exists('color', $marker)) |
|
289 | 289 | { |
290 | 290 | $this->setColor($marker['color']); |
291 | 291 | } |
@@ -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 |
@@ -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 |