コード例 #1
0
 /**
  * Gets the "INVALID DIRECTIONS REQUEST UNIT SYSTEM" exception.
  *
  * @return \Ivory\GoogleMap\Exception\DirectionsException The "INVALID DIRECTIONS REQUEST UNIT SYSTEM" exception.
  */
 public static function invalidDirectionsRequestUnitSystem()
 {
     return new static(sprintf('The directions request unit system can only be : %s.', implode(', ', UnitSystem::getUnitSystems())));
 }
コード例 #2
0
 /**
  * Sets  the distance matrix request unit system.
  *
  * @param string $unitSystem The distance matrix request unit system.
  *
  * @throws \Ivory\GoogleMap\Exception\DistanceMatrixException If the unit system is not valid.
  */
 public function setUnitSystem($unitSystem = null)
 {
     if (!in_array($unitSystem, UnitSystem::getUnitSystems()) && $unitSystem !== null) {
         throw DistanceMatrixException::invalidDistanceMatrixRequestUnitSystem();
     }
     $this->unitSystem = $unitSystem;
 }
コード例 #3
0
 public function testUnitSystems()
 {
     $expected = array(UnitSystem::IMPERIAL, UnitSystem::METRIC);
     $this->assertSame($expected, UnitSystem::getUnitSystems());
 }