for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Maps\Geocoders;
use DataValues\Geo\Values\LatLongValue;
/**
* @since 3.8
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
class InMemoryGeocoder implements Geocoder {
private $locations;
* @param LatLongValue[] $locations
public function __construct( array $locations ) {
$this->locations = $locations;
}
* @param string $address
* @return LatLongValue|null
public function geocode( $address ) {
if ( array_key_exists( $address, $this->locations ) ) {
return $this->locations[$address];
return null;