/** * Sets the distance matrix response status. * * @param string $status The distance matrix status. * * @throws \Ivory\GoogleMap\Exception\DistanceMatrixException If the status is not valid. */ public function setStatus($status) { if (!in_array($status, DistanceMatrixElementStatus::getDistanceMatrixElementStatus())) { throw DistanceMatrixException::invalidDistanceMatrixResponseElementStatus(); } $this->status = $status; }
public function testDistanceMatrixElementStatus() { $expected = array(DistanceMatrixElementStatus::NOT_FOUND, DistanceMatrixElementStatus::OK, DistanceMatrixElementStatus::ZERO_RESULTS); $this->assertSame($expected, DistanceMatrixElementStatus::getDistanceMatrixElementStatus()); }
/** * Gets the "INVALID DISTANCE MATRIX RESPONSE ELEMENT STATUS" exception. * * @return \Ivory\GoogleMap\Exception\DistanceMatrixException The "INVALID DISTANCE MATRIX RESPONSE ELEMENT STATUS" exception. */ public static function invalidDistanceMatrixResponseElementStatus() { return new static(sprintf('The distance matrix response element status can only be : %s.', implode(', ', DistanceMatrixElementStatus::getDistanceMatrixElementStatus()))); }