This repository has been archived by the owner on Jul 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forgot to commit in the new interfaces :(
- Loading branch information
1 parent
f246065
commit 5ae81ce
Showing
3 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
/** | ||
* Navigator: a geographic calculation library for PHP | ||
* @link http://navigator.simonholywell.com | ||
* @license http://www.opensource.org/licenses/bsd-license.php BSD 2-Clause License | ||
* @copyright 2012, Simon Holywell | ||
* @author Simon Holywell <treffynnon@php.net> | ||
*/ | ||
|
||
namespace Treffynnon\Navigator\Coordinate; | ||
|
||
use Treffynnon\Navigator as N; | ||
use Treffynnon\Navigator\Exception as E; | ||
|
||
/** | ||
* A base set of methods to set a direction (N,S,E,W) and validate | ||
* coordinates for classes that extend this abstract | ||
*/ | ||
interface ParserInterface { | ||
|
||
/** | ||
* Initialise parser. Pass in either Treffynnon\Navigator::Long or Treffynnon\Navigator::Lat | ||
* @param string $direction | ||
*/ | ||
public function __construct($direction = null); | ||
|
||
/** | ||
* Get the direction string | ||
* @return string | ||
*/ | ||
public function getDirection(); | ||
|
||
/** | ||
* Set the direction using Treffynnon\Navigator::Long or Treffynnon\Navigator::Lat | ||
* @param string $direction | ||
*/ | ||
public function setDirection($direction); | ||
|
||
/** | ||
* Wrapper function around the parse method to allow for coordinate | ||
* validation | ||
* @param float|string $coord | ||
* @return float | ||
* @throws \Exception | ||
*/ | ||
public function set($coord); | ||
|
||
public function parse($coord); | ||
|
||
public function get($coord); | ||
} |
34 changes: 34 additions & 0 deletions
34
lib/Treffynnon/Navigator/Distance/Calculator/CalculatorInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/** | ||
* Navigator: a geographic calculation library for PHP | ||
* @link http://navigator.simonholywell.com | ||
* @license http://www.opensource.org/licenses/bsd-license.php BSD 2-Clause License | ||
* @copyright 2012, Simon Holywell | ||
* @author Simon Holywell <treffynnon@php.net> | ||
*/ | ||
|
||
namespace Treffynnon\Navigator\Distance\Calculator; | ||
|
||
use Treffynnon\Navigator as N; | ||
use Treffynnon\Navigator\CelestialBody as CB; | ||
|
||
/** | ||
* A base set of methods to implement the setting of a celestial body | ||
* for a calculator | ||
*/ | ||
interface CalculatorInterface { | ||
|
||
/** | ||
* Calculate the distance between two coordinates | ||
* @return float Distance in metres | ||
*/ | ||
public function calculate(N\LatLong $point1, N\LatLong $point2); | ||
|
||
public function __construct(CB\CelestialBodyAbstract $body = null); | ||
|
||
public function setCelestialBody(CB\CelestialBodyAbstract $body); | ||
|
||
public function getCelestialBody(); | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
lib/Treffynnon/Navigator/Distance/Converter/ConverterInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
/** | ||
* Navigator: a geographic calculation library for PHP | ||
* @link http://navigator.simonholywell.com | ||
* @license http://www.opensource.org/licenses/bsd-license.php BSD 2-Clause License | ||
* @copyright 2012, Simon Holywell | ||
* @author Simon Holywell <treffynnon@php.net> | ||
*/ | ||
|
||
namespace Treffynnon\Navigator\Distance\Converter; | ||
|
||
/** | ||
* A couple of alias functions for a shorter syntax when using the | ||
* converter objects that extend this abstract | ||
*/ | ||
interface ConverterInterface { | ||
|
||
/** | ||
* Convert the supplied value using factor | ||
* @param float Value to be converted | ||
* @return mixed Converted value | ||
*/ | ||
public function convert($distance); | ||
|
||
/** | ||
* Convert the supplied value by reversing the factor | ||
* @param float Value to be reverse converted | ||
* @return mixed Reversed value | ||
*/ | ||
public function reverse($distance); | ||
|
||
/** | ||
* Convert the distance | ||
* @param float $distance | ||
* @return float | ||
*/ | ||
public function c($distance); | ||
|
||
/** | ||
* Reverse the distance conversion | ||
* @param float $distance | ||
* @return float | ||
*/ | ||
public function r($distance); | ||
|
||
} |