예제 #1
0
 /**
  * @expectedException \Ivory\GoogleMap\Exception\MapException
  * @expectedExceptionMessage The map option "foo" does not exist.
  */
 public function testRemoveMapOptionWithInvalidValue()
 {
     $this->map->removeMapOption('foo');
 }
예제 #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);
 }