/** * @param array $marker */ private function createMarker(array $marker) { if (!array_key_exists('coordinates', $marker)) { throw new InvalidArgumentException('Coordinates must be set in every marker'); } $this->addMarker(array_values($marker['coordinates']), isset($marker['animation']) ? $marker['animation'] : false, isset($marker['title']) ? $marker['title'] : null); if (array_key_exists('message', $marker)) { if (is_array($marker['message'])) { $message = array_values($marker['message']); $this->setMessage($message[0], $message[1]); } else { $this->setMessage($marker['message']); } } if (array_key_exists('icon', $marker)) { if (is_array($marker['icon'])) { $icon = new Marker\Icon($marker['icon']['url']); if (array_key_exists('size', $marker['icon'])) { $icon->setSize($marker['icon']['size']); } if (array_key_exists('anchor', $marker['icon'])) { $icon->setAnchor($marker['icon']['anchor']); } if (array_key_exists('origin', $marker['icon'])) { $icon->setOrigin($marker['icon']['origin']); } $this->setIcon($icon); } else { $this->setIcon($marker['icon']); } } if (array_key_exists('color', $marker)) { $this->setColor($marker['color']); } }