Пример #1
0
 /**
  * Sets the control position.
  *
  * @param string $controlPosition The control position.
  *
  * @throws \Ivory\GoogleMap\Exception\ControlException If the control position is not valid.
  */
 public function setControlPosition($controlPosition)
 {
     if (!in_array($controlPosition, ControlPosition::getControlPositions())) {
         throw ControlException::invalidControlPosition();
     }
     $this->controlPosition = $controlPosition;
 }
 public function testControlPositions()
 {
     $expected = array(ControlPosition::BOTTOM_CENTER, ControlPosition::BOTTOM_LEFT, ControlPosition::BOTTOM_RIGHT, ControlPosition::LEFT_BOTTOM, ControlPosition::LEFT_CENTER, ControlPosition::LEFT_TOP, ControlPosition::RIGHT_BOTTOM, ControlPosition::RIGHT_CENTER, ControlPosition::RIGHT_TOP, ControlPosition::TOP_CENTER, ControlPosition::TOP_LEFT, ControlPosition::TOP_RIGHT);
     $this->assertSame($expected, ControlPosition::getControlPositions());
 }
 /**
  * Gets the "INVALID CONTROL POSITION" exception.
  *
  * @return \Ivory\GoogleMap\Exception\ControlException The "INVALID CONTROL POSITION" exception.
  */
 public static function invalidControlPosition()
 {
     return new static(sprintf('The control position can only be : %s.', implode(', ', ControlPosition::getControlPositions())));
 }