コード例 #1
0
 public function testCoordinateGetter()
 {
     $stub = $this->getMockBuilder('Location\\Coordinate\\CoordinateInterface')->getMock();
     $stub->method('getLatitude')->willReturn(51.3775265);
     $stub->method('getLongitude')->willReturn(6.0789937);
     $location = new Location($stub);
     $this->assertSame($stub, $location->getCoordinate());
 }
コード例 #2
0
ファイル: Location.php プロジェクト: patrickkempff/location
 /**
  * Returns the distance in meters from the receiver’s location to
  * the given location using the given distance calculator formula.
  *
  * @param Location $location The location to calculate the distance from.
  * @param DistanceCalculatorInterface $calculator The distance calculator formula.
  *
  * @return float The distance in meters between the two locations.
  */
 public function calculateDistanceFromLocation(Location $location, DistanceCalculatorInterface $calculator)
 {
     return $calculator->calculateDistanceBetween($this->getCoordinate(), $location->getCoordinate());
 }