]> git.openstreetmap.org Git - nominatim.git/blob - lib/SpecialSearchOperator.php
small typos and wording in the API docs
[nominatim.git] / lib / SpecialSearchOperator.php
1 <?php
2
3 namespace Nominatim;
4
5 /**
6  * Operators describing special searches.
7  */
8 abstract class Operator
9 {
10     /// No operator selected.
11     const NONE = 0;
12     /// Search for POI of the given type.
13     const TYPE = 1;
14     /// Search for POIs near the given place.
15     const NEAR = 2;
16     /// Search for POIS in the given place.
17     const IN = 3;
18     /// Search for POIS named as given.
19     const NAME = 4;
20     /// Search for postcodes.
21     const POSTCODE = 5;
22
23     private static $aConstantNames = null;
24
25
26     public static function toString($iOperator)
27     {
28         if ($iOperator == Operator::NONE) {
29             return '';
30         }
31
32         if (Operator::$aConstantNames === null) {
33             $oReflector = new \ReflectionClass('Nominatim\Operator');
34             $aConstants = $oReflector->getConstants();
35
36             Operator::$aConstantNames = array();
37             foreach ($aConstants as $sName => $iValue) {
38                 Operator::$aConstantNames[$iValue] = $sName;
39             }
40         }
41
42         return Operator::$aConstantNames[$iOperator];
43     }
44 }