Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Commit

Permalink
Forgot to commit in the new interfaces :(
Browse files Browse the repository at this point in the history
  • Loading branch information
treffynnon committed Feb 18, 2016
1 parent f246065 commit 5ae81ce
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 0 deletions.
52 changes: 52 additions & 0 deletions lib/Treffynnon/Navigator/Coordinate/ParserInterface.php
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);
}
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 lib/Treffynnon/Navigator/Distance/Converter/ConverterInterface.php
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);

}

0 comments on commit 5ae81ce

Please sign in to comment.