@@ -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; |
@@ -218,16 +218,16 @@ discard block |
||
| 218 | 218 | { |
| 219 | 219 | throw new LogicException("setIcon must be called after addMarker()"); |
| 220 | 220 | } |
| 221 | - end($this->markers); // move the internal pointer to the end of the array |
|
| 221 | + end($this->markers); // move the internal pointer to the end of the array |
|
| 222 | 222 | $key = key($this->markers); |
| 223 | - if($icon instanceof Marker\Icon) |
|
| 223 | + if ($icon instanceof Marker\Icon) |
|
| 224 | 224 | { |
| 225 | - $icon->setUrl(is_null($this->iconDefaultPath) ? $icon->getUrl() : $this->iconDefaultPath . $icon->getUrl()); |
|
| 225 | + $icon->setUrl(is_null($this->iconDefaultPath) ? $icon->getUrl() : $this->iconDefaultPath.$icon->getUrl()); |
|
| 226 | 226 | $this->markers[$key]['icon'] = $icon->getArray(); |
| 227 | 227 | |
| 228 | 228 | } else |
| 229 | 229 | { |
| 230 | - $this->markers[$key]['icon'] = is_null($this->iconDefaultPath) ? $icon : $this->iconDefaultPath . $icon; |
|
| 230 | + $this->markers[$key]['icon'] = is_null($this->iconDefaultPath) ? $icon : $this->iconDefaultPath.$icon; |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | return $this; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function setDefaultIconPath($defaultPath) |
| 242 | 242 | { |
| 243 | - if(!is_null($defaultPath) && |
|
| 243 | + if (!is_null($defaultPath) && |
|
| 244 | 244 | !Strings::endsWith($defaultPath, '/') && |
| 245 | 245 | !Strings::endsWith($defaultPath, '\\')) |
| 246 | 246 | { |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | { |
| 277 | 277 | throw new InvalidArgumentException("setColor must be called after addMarker()"); |
| 278 | 278 | } |
| 279 | - end($this->markers); // move the internal pointer to the end of the array |
|
| 279 | + end($this->markers); // move the internal pointer to the end of the array |
|
| 280 | 280 | $key = key($this->markers); |
| 281 | 281 | $this->markers[$key]['color'] = $color; |
| 282 | 282 | return $this; |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | private function createMarker(array $marker) |
| 290 | 290 | { |
| 291 | - if(!array_key_exists('coordinates', $marker)) |
|
| 291 | + if (!array_key_exists('coordinates', $marker)) |
|
| 292 | 292 | { |
| 293 | 293 | throw new InvalidArgumentException('Coordinates must be set in every marker'); |
| 294 | 294 | } |
@@ -297,9 +297,9 @@ discard block |
||
| 297 | 297 | isset($marker['animation']) ? $marker['animation'] : false, |
| 298 | 298 | isset($marker['title']) ? $marker['title'] : null); |
| 299 | 299 | |
| 300 | - if(array_key_exists('message', $marker)) |
|
| 300 | + if (array_key_exists('message', $marker)) |
|
| 301 | 301 | { |
| 302 | - if(is_array($marker['message'])) |
|
| 302 | + if (is_array($marker['message'])) |
|
| 303 | 303 | { |
| 304 | 304 | $message = array_values($marker['message']); |
| 305 | 305 | $this->setMessage($message[0], $message[1]); |
@@ -309,23 +309,23 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - if(array_key_exists('icon', $marker)) |
|
| 312 | + if (array_key_exists('icon', $marker)) |
|
| 313 | 313 | { |
| 314 | - if(is_array($marker['icon'])) |
|
| 314 | + if (is_array($marker['icon'])) |
|
| 315 | 315 | { |
| 316 | 316 | $icon = new Marker\Icon($marker['icon']['url']); |
| 317 | 317 | |
| 318 | - if(array_key_exists('size', $marker['icon'])) |
|
| 318 | + if (array_key_exists('size', $marker['icon'])) |
|
| 319 | 319 | { |
| 320 | 320 | $icon->setSize($marker['icon']['size']); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if(array_key_exists('anchor', $marker['icon'])) |
|
| 323 | + if (array_key_exists('anchor', $marker['icon'])) |
|
| 324 | 324 | { |
| 325 | 325 | $icon->setAnchor($marker['icon']['anchor']); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - if(array_key_exists('origin', $marker['icon'])) |
|
| 328 | + if (array_key_exists('origin', $marker['icon'])) |
|
| 329 | 329 | { |
| 330 | 330 | $icon->setOrigin($marker['icon']['origin']); |
| 331 | 331 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if(array_key_exists('color', $marker)) |
|
| 340 | + if (array_key_exists('color', $marker)) |
|
| 341 | 341 | { |
| 342 | 342 | $this->setColor($marker['color']); |
| 343 | 343 | } |
@@ -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 | } |