| @@ -13,6 +13,9 @@ discard block | ||
| 13 | 13 |  function sparql_connect( $endpoint ) { return new sparql_connection( $endpoint ); } | 
| 14 | 14 | |
| 15 | 15 |  function sparql_ns( $short, $long, $db = null ) { return _sparql_a_connection( $db )->ns( $short, $long ); } | 
| 16 | +/** | |
| 17 | + * @param string $sparql | |
| 18 | + */ | |
| 16 | 19 |  function sparql_query( $sparql, $db = null ) { return _sparql_a_connection( $db )->query( $sparql ); } | 
| 17 | 20 |  function sparql_errno( $db = null ) { return _sparql_a_connection( $db )->errno(); } | 
| 18 | 21 |  function sparql_error( $db = null ) { return _sparql_a_connection( $db )->error(); } | 
| @@ -84,6 +87,9 @@ discard block | ||
| 84 | 87 | $this->params = $params; | 
| 85 | 88 | } | 
| 86 | 89 | |
| 90 | + /** | |
| 91 | + * @param integer $timeout | |
| 92 | + */ | |
| 87 | 93 | function query( $query, $timeout=null ) | 
| 88 | 94 |  	{	 | 
| 89 | 95 | $prefixes = ""; | 
| @@ -324,6 +330,10 @@ discard block | ||
| 324 | 330 | var $fields; | 
| 325 | 331 | var $db; | 
| 326 | 332 | var $i = 0; | 
| 333 | + | |
| 334 | + /** | |
| 335 | + * @param sparql_connection $db | |
| 336 | + */ | |
| 327 | 337 | function __construct( $db, $rows, $fields ) | 
| 328 | 338 |  	{ | 
| 329 | 339 | $this->rows = $rows; | 
| @@ -118,6 +118,9 @@ discard block | ||
| 118 | 118 | ); | 
| 119 | 119 | } | 
| 120 | 120 | |
| 121 | + /** | |
| 122 | + * @param boolean $force | |
| 123 | + */ | |
| 121 | 124 |    static function geosInstalled($force = NULL) {
 | 
| 122 | 125 | static $geos_installed = NULL; | 
| 123 | 126 | if ($force !== NULL) $geos_installed = $force; | 
| @@ -222,6 +225,10 @@ discard block | ||
| 222 | 225 | |
| 223 | 226 | // Detect a format given a value. This function is meant to be SPEEDY. | 
| 224 | 227 | // It could make a mistake in XML detection if you are mixing or using namespaces in weird ways (ie, KML inside an RSS feed) | 
| 228 | + | |
| 229 | + /** | |
| 230 | + * @return string | |
| 231 | + */ | |
| 225 | 232 |    static function detectFormat(&$input) {
 | 
| 226 | 233 |      $mem = fopen('php://memory', 'r+');
 | 
| 227 | 234 | fwrite($mem, $input, 11); // Write 11 bytes - we can detect the vast majority of formats in the first 11 bytes | 
| @@ -113,7 +113,6 @@ discard block | ||
| 113 | 113 | * Serializes an object into a geojson string | 
| 114 | 114 | * | 
| 115 | 115 | * | 
| 116 | - * @param Geometry $obj The object to serialize | |
| 117 | 116 | * | 
| 118 | 117 | * @return string The GeoJSON string | 
| 119 | 118 | */ | 
| @@ -126,6 +125,9 @@ discard block | ||
| 126 | 125 | } | 
| 127 | 126 | } | 
| 128 | 127 | |
| 128 | + /** | |
| 129 | + * @param Geometry $geometry | |
| 130 | + */ | |
| 129 | 131 |    public function getArray($geometry) { | 
| 130 | 132 |      if ($geometry->getGeomType() == 'GeometryCollection') { | 
| 131 | 133 | $component_array = array(); | 
| @@ -18,8 +18,6 @@ discard block | ||
| 18 | 18 | /** | 
| 19 | 19 | * Read GeoRSS string into geometry objects | 
| 20 | 20 | * | 
| 21 | - * @param string $georss - an XML feed containing geoRSS | |
| 22 | - * | |
| 23 | 21 | * @return Geometry|GeometryCollection | 
| 24 | 22 | */ | 
| 25 | 23 |    public function read($gpx) {
 | 
| @@ -80,6 +78,9 @@ discard block | ||
| 80 | 78 | return geoPHP::geometryReduce($geometries); | 
| 81 | 79 | } | 
| 82 | 80 | |
| 81 | + /** | |
| 82 | + * @param string $string | |
| 83 | + */ | |
| 83 | 84 |    protected function getPointsFromCoords($string) {
 | 
| 84 | 85 | $coords = array(); | 
| 85 | 86 |      $latlon = explode(' ',$string);
 | 
| @@ -42,6 +42,9 @@ | ||
| 42 | 42 | return '<'.$this->nss.'gpx creator="geoPHP" version="1.0">'.$this->geometryToGPX($geometry).'</'.$this->nss.'gpx>'; | 
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | + /** | |
| 46 | + * @param string $text | |
| 47 | + */ | |
| 45 | 48 |    public function geomFromText($text) {
 | 
| 46 | 49 | // Change to lower-case and strip all CDATA | 
| 47 | 50 | $text = strtolower($text); | 
| @@ -49,6 +49,9 @@ discard block | ||
| 49 | 49 | return $this->geometryToKML($geometry); | 
| 50 | 50 | } | 
| 51 | 51 | |
| 52 | + /** | |
| 53 | + * @param string $text | |
| 54 | + */ | |
| 52 | 55 |    public function geomFromText($text) {
 | 
| 53 | 56 | |
| 54 | 57 | // Change to lower-case and strip all CDATA | 
| @@ -184,6 +187,9 @@ discard block | ||
| 184 | 187 | return $coordinates; | 
| 185 | 188 | } | 
| 186 | 189 | |
| 190 | + /** | |
| 191 | + * @param Geometry $geom | |
| 192 | + */ | |
| 187 | 193 |    private function geometryToKML($geom) {
 | 
| 188 | 194 | $type = strtolower($geom->getGeomType()); | 
| 189 | 195 |      switch ($type) {
 | 
| @@ -123,6 +123,9 @@ discard block | ||
| 123 | 123 | return new Polygon($components); | 
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | + /** | |
| 127 | + * @param string $type | |
| 128 | + */ | |
| 126 | 129 |    function getMulti(&$mem, $type) {
 | 
| 127 | 130 | // Get the number of items expected in this multi out of the first 4 bytes | 
| 128 | 131 |      $multi_length = unpack('L',fread($mem,4));
 | 
| @@ -196,6 +199,9 @@ discard block | ||
| 196 | 199 | } | 
| 197 | 200 | } | 
| 198 | 201 | |
| 202 | + /** | |
| 203 | + * @param Geometry $point | |
| 204 | + */ | |
| 199 | 205 |    function writePoint($point) {
 | 
| 200 | 206 | // Set the coords | 
| 201 | 207 |      $wkb = pack('dd',$point->x(), $point->y());
 | 
| @@ -215,6 +221,9 @@ discard block | ||
| 215 | 221 | return $wkb; | 
| 216 | 222 | } | 
| 217 | 223 | |
| 224 | + /** | |
| 225 | + * @param Geometry $poly | |
| 226 | + */ | |
| 218 | 227 |    function writePolygon($poly) {
 | 
| 219 | 228 | // Set the number of lines in this poly | 
| 220 | 229 |      $wkb = pack('L',$poly->numGeometries());
 | 
| @@ -227,6 +236,9 @@ discard block | ||
| 227 | 236 | return $wkb; | 
| 228 | 237 | } | 
| 229 | 238 | |
| 239 | + /** | |
| 240 | + * @param Geometry $geometry | |
| 241 | + */ | |
| 230 | 242 |    function writeMulti($geometry) {
 | 
| 231 | 243 | // Set the number of components | 
| 232 | 244 |      $wkb = pack('L',$geometry->numGeometries());
 | 
| @@ -8,7 +8,6 @@ discard block | ||
| 8 | 8 | /** | 
| 9 | 9 | * Read WKT string into geometry objects | 
| 10 | 10 | * | 
| 11 | - * @param string $WKT A WKT string | |
| 12 | 11 | * | 
| 13 | 12 | * @return Geometry | 
| 14 | 13 | */ | 
| @@ -184,11 +183,17 @@ discard block | ||
| 184 | 183 | else return $str; | 
| 185 | 184 | } | 
| 186 | 185 | |
| 186 | + /** | |
| 187 | + * @param string $char | |
| 188 | + */ | |
| 187 | 189 |    protected function beginsWith($str, $char) { | 
| 188 | 190 | if (substr($str,0,strlen($char)) == $char) return TRUE; | 
| 189 | 191 | else return FALSE; | 
| 190 | 192 | } | 
| 191 | 193 | |
| 194 | + /** | |
| 195 | + * @param string $char | |
| 196 | + */ | |
| 192 | 197 |    protected function endsWith($str, $char) { | 
| 193 | 198 | if (substr($str,(0 - strlen($char))) == $char) return TRUE; | 
| 194 | 199 | else return FALSE; | 
| @@ -193,6 +193,9 @@ | ||
| 193 | 193 | } | 
| 194 | 194 | } | 
| 195 | 195 | |
| 196 | + /** | |
| 197 | + * @param Point $point | |
| 198 | + */ | |
| 196 | 199 |    public function pointOnVertex($point) { | 
| 197 | 200 |      foreach($this->getPoints() as $vertex) { | 
| 198 | 201 |        if ($point->equals($vertex)) { |