Example #1
0
 public function testZoomControlWithNullValue()
 {
     $this->map->setZoomControl($this->getMock('Ivory\\GoogleMap\\Controls\\ZoomControl'));
     $this->map->setZoomControl(null);
     $this->assertNull($this->map->getZoomControl());
     $this->assertFalse($this->map->hasMapOption('zoomControl'));
 }
Example #2
0
 /**
  * Renders a map control in the json builder.
  *
  * @param \Ivory\GoogleMap\Map $map           The map.
  * @param string               $controlName   The control name.
  * @param mixed                $controlHelper The control helper.
  */
 protected function renderMapControl(Map $map, $controlName, $controlHelper)
 {
     $lcFirstControlName = lcfirst($controlName);
     if (!$map->hasMapOption($lcFirstControlName)) {
         return;
     }
     $this->jsonBuilder->setValue(sprintf('[%s]', $lcFirstControlName), (bool) $map->getMapOption($lcFirstControlName));
     if ($map->getMapOption($lcFirstControlName)) {
         $hasControlMethod = 'has' . $controlName;
         if ($map->{$hasControlMethod}()) {
             $getControlMethod = 'get' . $controlName;
             $this->jsonBuilder->setValue(sprintf('[%sOptions]', $lcFirstControlName), $controlHelper->render($map->{$getControlMethod}()), false);
         }
     }
     $map->removeMapOption($lcFirstControlName);
 }