/** * 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()))); }
/** * 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; }
public function testUnitSystems() { $expected = array(UnitSystem::IMPERIAL, UnitSystem::METRIC); $this->assertSame($expected, UnitSystem::getUnitSystems()); }