Esempio n. 1
0
 /**
  * Sets the map street view control.
  *
  * Available prototypes:
  *  - function setStreetViewControl(Ivory\GoogleMap\Controls\StreetViewControl $streetViewControl = null)
  *  - function setStreetViewControl(string $controlPosition)
  *
  * @throws \Ivory\GoogleMap\Exception\MapException If the street view control is not valid (prototypes).
  */
 public function setStreetViewControl()
 {
     $args = func_get_args();
     if (isset($args[0]) && $args[0] instanceof StreetViewControl) {
         $this->streetViewControl = $args[0];
         $this->mapOptions['streetViewControl'] = true;
     } elseif (isset($args[0]) && is_string($args[0])) {
         if ($this->streetViewControl === null) {
             $this->streetViewControl = new StreetViewControl();
         }
         $this->streetViewControl->setControlPosition($args[0]);
         $this->mapOptions['streetViewControl'] = true;
     } elseif (!isset($args[0])) {
         $this->streetViewControl = null;
         if (isset($this->mapOptions['streetViewControl'])) {
             unset($this->mapOptions['streetViewControl']);
         }
     } else {
         throw MapException::invalidStreetViewControl();
     }
 }
 /**
  * Renders the street view control
  *
  * @param Ivory\GoogleMapBundle\Model\Controls\StreetViewControl $streetViewControl
  * @return string HTML output
  */
 public function render(StreetViewControl $streetViewControl)
 {
     return $this->jsonBuilder->reset()->setValue('[position]', $this->controlPositionHelper->render($streetViewControl->getControlPosition()), false)->build();
 }
 /**
  * @expectedException \Ivory\GoogleMap\Exception\ControlException
  */
 public function testControlPositionWithInvalidValue()
 {
     $this->streetViewControl->setControlPosition('foo');
 }