@@ -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 | |
@@ -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 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | public function getDirection() |
| 299 | 299 | { |
| 300 | - return $this->direction; |
|
| 300 | + return $this->direction; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | |
@@ -433,17 +433,17 @@ discard block |
||
| 433 | 433 | } else |
| 434 | 434 | { |
| 435 | 435 | $map = array( |
| 436 | - 'position' => $this->coordinates, |
|
| 437 | - 'height' => $this->height, |
|
| 438 | - 'width' => $this->width, |
|
| 439 | - 'zoom' => $this->zoom, |
|
| 440 | - 'type' => $this->type, |
|
| 441 | - 'scrollable' => $this->scrollable, |
|
| 442 | - 'key' => $this->key, |
|
| 443 | - 'bound' => $this->bound, |
|
| 444 | - 'cluster' => $this->markerClusterer, |
|
| 445 | - 'clusterOptions' => $this->clusterOptions, |
|
| 446 | - 'waypoint' => !is_null($this->waypoints) ? array_merge($this->waypoints, $this->direction) : NULL |
|
| 436 | + 'position' => $this->coordinates, |
|
| 437 | + 'height' => $this->height, |
|
| 438 | + 'width' => $this->width, |
|
| 439 | + 'zoom' => $this->zoom, |
|
| 440 | + 'type' => $this->type, |
|
| 441 | + 'scrollable' => $this->scrollable, |
|
| 442 | + 'key' => $this->key, |
|
| 443 | + 'bound' => $this->bound, |
|
| 444 | + 'cluster' => $this->markerClusterer, |
|
| 445 | + 'clusterOptions' => $this->clusterOptions, |
|
| 446 | + 'waypoint' => !is_null($this->waypoints) ? array_merge($this->waypoints, $this->direction) : NULL |
|
| 447 | 447 | ); |
| 448 | 448 | $this->template->map = Json::encode($map); |
| 449 | 449 | $this->template->setFile(dirname(__FILE__) . '/template.latte'); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function setCoordinates(array $coordinates) |
| 128 | 128 | { |
| 129 | - if(!count($coordinates)) |
|
| 129 | + if (!count($coordinates)) |
|
| 130 | 130 | { |
| 131 | 131 | $this->coordinates = array(NULL, NULL); |
| 132 | 132 | } else |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function setType($type) |
| 194 | 194 | { |
| 195 | - if($type !== self::HYBRID && $type !== self::ROADMAP && $type !== self::SATELLITE && |
|
| 195 | + if ($type !== self::HYBRID && $type !== self::ROADMAP && $type !== self::SATELLITE && |
|
| 196 | 196 | $type !== self::TERRAIN) |
| 197 | 197 | { |
| 198 | 198 | throw new InvalidArgumentException; |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | { |
| 213 | 213 | if (!in_array($key, ['start', 'end', 'waypoint'])) |
| 214 | 214 | { |
| 215 | - throw new InvalidArgumentException('First argument must be "start|end|waypoint", ' . $key . ' was given'); |
|
| 215 | + throw new InvalidArgumentException('First argument must be "start|end|waypoint", '.$key.' was given'); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if($key === 'waypoint') |
|
| 218 | + if ($key === 'waypoint') |
|
| 219 | 219 | { |
| 220 | 220 | $this->waypoints['waypoints'][] = $waypoint; |
| 221 | 221 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | public function setDirection(array $direction) |
| 236 | 236 | { |
| 237 | 237 | $this->direction = $direction; |
| 238 | - if(!array_key_exists('travelmode', $this->direction)) |
|
| 238 | + if (!array_key_exists('travelmode', $this->direction)) |
|
| 239 | 239 | { |
| 240 | 240 | $this->direction['travelmode'] = 'DRIVING'; |
| 241 | 241 | } else if (!in_array($direction['travelmode'], [ |
@@ -361,8 +361,8 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | } else if ($clickable !== FALSE) |
| 363 | 363 | { |
| 364 | - $this->clickable = '<a href="https://maps.google.com/maps/place/' . |
|
| 365 | - $this->coordinates[0] . ',' . $this->coordinates[1] . '/">'; |
|
| 364 | + $this->clickable = '<a href="https://maps.google.com/maps/place/'. |
|
| 365 | + $this->coordinates[0].','.$this->coordinates[1].'/">'; |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | return $this; |
@@ -437,8 +437,8 @@ discard block |
||
| 437 | 437 | if (is_callable($this->clickable)) |
| 438 | 438 | { |
| 439 | 439 | $this->clickable = call_user_func_array($this->clickable, [ |
| 440 | - 'https://maps.google.com/maps/place/' . $this->coordinates[0] . ',' . |
|
| 441 | - $this->coordinates[1] . '/', |
|
| 440 | + 'https://maps.google.com/maps/place/'.$this->coordinates[0].','. |
|
| 441 | + $this->coordinates[1].'/', |
|
| 442 | 442 | $this->getCoordinates() |
| 443 | 443 | ]); |
| 444 | 444 | } |
@@ -448,9 +448,8 @@ discard block |
||
| 448 | 448 | $this->template->zoom = $this->zoom; |
| 449 | 449 | $this->template->position = $this->coordinates; |
| 450 | 450 | $this->template->markers = $this->markers; |
| 451 | - $this->template->clickable = $this->clickable instanceof Html ? $this->clickable->startTag() : |
|
| 452 | - $this->clickable; |
|
| 453 | - $this->template->setFile(dirname(__FILE__) . '/static.latte'); |
|
| 451 | + $this->template->clickable = $this->clickable instanceof Html ? $this->clickable->startTag() : $this->clickable; |
|
| 452 | + $this->template->setFile(dirname(__FILE__).'/static.latte'); |
|
| 454 | 453 | } else |
| 455 | 454 | { |
| 456 | 455 | $map = array( |
@@ -467,7 +466,7 @@ discard block |
||
| 467 | 466 | 'waypoint' => !is_null($this->waypoints) ? array_merge($this->waypoints, $this->direction) : NULL |
| 468 | 467 | ); |
| 469 | 468 | $this->template->map = Json::encode($map); |
| 470 | - $this->template->setFile(dirname(__FILE__) . '/template.latte'); |
|
| 469 | + $this->template->setFile(dirname(__FILE__).'/template.latte'); |
|
| 471 | 470 | } |
| 472 | 471 | $this->template->render(); |
| 473 | 472 | } |
@@ -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 | |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function addMarkers(array $markers) |
| 56 | 56 | { |
| 57 | - if(count($markers)) |
|
| 57 | + if (count($markers)) |
|
| 58 | 58 | { |
| 59 | - foreach($markers as $marker) |
|
| 59 | + foreach ($markers as $marker) |
|
| 60 | 60 | { |
| 61 | 61 | $this->createMarker($marker); |
| 62 | 62 | } |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | if (!is_string($animation) && !is_bool($animation)) |
| 76 | 76 | { |
| 77 | - throw new InvalidArgumentException("Animation must be string or boolean, $animation (" . |
|
| 78 | - gettype($animation) . ") was given"); |
|
| 77 | + throw new InvalidArgumentException("Animation must be string or boolean, $animation (". |
|
| 78 | + gettype($animation).") was given"); |
|
| 79 | 79 | } |
| 80 | 80 | if (!is_string($title) && $title != null) |
| 81 | 81 | { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | throw new LogicException("setMessage must be called after addMarker()"); |
| 129 | 129 | } |
| 130 | - end($this->markers); // move the internal pointer to the end of the array |
|
| 130 | + end($this->markers); // move the internal pointer to the end of the array |
|
| 131 | 131 | $key = key($this->markers); |
| 132 | 132 | $this->markers[$key]['message'] = $message; |
| 133 | 133 | $this->markers[$key]['autoOpen'] = $autoOpen; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | throw new InvalidArgumentException("customField must be array, $customField (".gettype($customField).") was given"); |
| 152 | 152 | } |
| 153 | - end($this->markers); // move the internal pointer to the end of the array |
|
| 153 | + end($this->markers); // move the internal pointer to the end of the array |
|
| 154 | 154 | $key = key($this->markers); |
| 155 | 155 | $this->markers[$key]['customField'] = $customField; |
| 156 | 156 | return $this; |
@@ -240,16 +240,16 @@ discard block |
||
| 240 | 240 | { |
| 241 | 241 | throw new LogicException("setIcon must be called after addMarker()"); |
| 242 | 242 | } |
| 243 | - end($this->markers); // move the internal pointer to the end of the array |
|
| 243 | + end($this->markers); // move the internal pointer to the end of the array |
|
| 244 | 244 | $key = key($this->markers); |
| 245 | - if($icon instanceof Marker\Icon) |
|
| 245 | + if ($icon instanceof Marker\Icon) |
|
| 246 | 246 | { |
| 247 | - $icon->setUrl(is_null($this->iconDefaultPath) ? $icon->getUrl() : $this->iconDefaultPath . $icon->getUrl()); |
|
| 247 | + $icon->setUrl(is_null($this->iconDefaultPath) ? $icon->getUrl() : $this->iconDefaultPath.$icon->getUrl()); |
|
| 248 | 248 | $this->markers[$key]['icon'] = $icon->getArray(); |
| 249 | 249 | |
| 250 | 250 | } else |
| 251 | 251 | { |
| 252 | - $this->markers[$key]['icon'] = is_null($this->iconDefaultPath) ? $icon : $this->iconDefaultPath . $icon; |
|
| 252 | + $this->markers[$key]['icon'] = is_null($this->iconDefaultPath) ? $icon : $this->iconDefaultPath.$icon; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | return $this; |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function setDefaultIconPath($defaultPath) |
| 264 | 264 | { |
| 265 | - if(!is_null($defaultPath) && |
|
| 265 | + if (!is_null($defaultPath) && |
|
| 266 | 266 | !Strings::endsWith($defaultPath, '/') && |
| 267 | 267 | !Strings::endsWith($defaultPath, '\\')) |
| 268 | 268 | { |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | { |
| 299 | 299 | throw new InvalidArgumentException("setColor must be called after addMarker()"); |
| 300 | 300 | } |
| 301 | - end($this->markers); // move the internal pointer to the end of the array |
|
| 301 | + end($this->markers); // move the internal pointer to the end of the array |
|
| 302 | 302 | $key = key($this->markers); |
| 303 | 303 | $this->markers[$key]['color'] = $color; |
| 304 | 304 | return $this; |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | private function createMarker(array $marker) |
| 312 | 312 | { |
| 313 | - if(!array_key_exists('coordinates', $marker)) |
|
| 313 | + if (!array_key_exists('coordinates', $marker)) |
|
| 314 | 314 | { |
| 315 | 315 | throw new InvalidArgumentException('Coordinates must be set in every marker'); |
| 316 | 316 | } |
@@ -319,9 +319,9 @@ discard block |
||
| 319 | 319 | isset($marker['animation']) ? $marker['animation'] : false, |
| 320 | 320 | isset($marker['title']) ? $marker['title'] : null); |
| 321 | 321 | |
| 322 | - if(array_key_exists('message', $marker)) |
|
| 322 | + if (array_key_exists('message', $marker)) |
|
| 323 | 323 | { |
| 324 | - if(is_array($marker['message'])) |
|
| 324 | + if (is_array($marker['message'])) |
|
| 325 | 325 | { |
| 326 | 326 | $message = array_values($marker['message']); |
| 327 | 327 | $this->setMessage($message[0], $message[1]); |
@@ -331,23 +331,23 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if(array_key_exists('icon', $marker)) |
|
| 334 | + if (array_key_exists('icon', $marker)) |
|
| 335 | 335 | { |
| 336 | - if(is_array($marker['icon'])) |
|
| 336 | + if (is_array($marker['icon'])) |
|
| 337 | 337 | { |
| 338 | 338 | $icon = new Marker\Icon($marker['icon']['url']); |
| 339 | 339 | |
| 340 | - if(array_key_exists('size', $marker['icon'])) |
|
| 340 | + if (array_key_exists('size', $marker['icon'])) |
|
| 341 | 341 | { |
| 342 | 342 | $icon->setSize($marker['icon']['size']); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if(array_key_exists('anchor', $marker['icon'])) |
|
| 345 | + if (array_key_exists('anchor', $marker['icon'])) |
|
| 346 | 346 | { |
| 347 | 347 | $icon->setAnchor($marker['icon']['anchor']); |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if(array_key_exists('origin', $marker['icon'])) |
|
| 350 | + if (array_key_exists('origin', $marker['icon'])) |
|
| 351 | 351 | { |
| 352 | 352 | $icon->setOrigin($marker['icon']['origin']); |
| 353 | 353 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - if(array_key_exists('color', $marker)) |
|
| 362 | + if (array_key_exists('color', $marker)) |
|
| 363 | 363 | { |
| 364 | 364 | $this->setColor($marker['color']); |
| 365 | 365 | } |