Skip to content

Commit

Permalink
Fix PR phayes#130 for PhpUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
jmleroux committed Feb 8, 2017
1 parent 13f6880 commit 84fe82a
Show file tree
Hide file tree
Showing 23 changed files with 1,151 additions and 1,124 deletions.
41 changes: 16 additions & 25 deletions src/Adapters/EWKB.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,19 @@

namespace Phayes\GeoPHP\Adapters;

use Phayes\GeoPHP\GeoPHP;
use Phayes\GeoPHP\Adapters\GeoAdapter;
use Phayes\GeoPHP\Adapters\WKB;
use Phayes\GeoPHP\Geometry\Point;
use Phayes\GeoPHP\Geometry\Polygon;
use Phayes\GeoPHP\Geometry\LineString;
use Phayes\GeoPHP\Geometry\MultiPoint;
use Phayes\GeoPHP\Geometry\MultiPolygon;
use Phayes\GeoPHP\Geometry\MultiLineString;
use Phayes\GeoPHP\Geometry\Geometry;
use Phayes\GeoPHP\Geometry\GeometryCollection;
use Exception;

class EWKB extends WKB
{

/**
* Read WKB binary string into geometry objects
*
* @param string $wkb An Extended-WKB binary string
*
* @return Geometry
*/
/**
* Read WKB binary string into geometry objects
*
* @param string $wkb An Extended-WKB binary string
* @param bool $is_hex_string
*
* @return Geometry
*/
public function read($wkb, $is_hex_string = false)
{
if ($is_hex_string) {
Expand Down Expand Up @@ -56,13 +46,14 @@ public function read($wkb, $is_hex_string = false)
return $geom;
}

/**
* Serialize geometries into an EWKB binary string.
*
* @param Geometry $geometry
*
* @return string The Extended-WKB binary string representation of the input geometries
*/
/**
* Serialize geometries into an EWKB binary string.
*
* @param Geometry $geometry
* @param bool $write_as_hex
*
* @return string The Extended-WKB binary string representation of the input geometries
*/
public function write(Geometry $geometry, $write_as_hex = false)
{
// We always write into NDR (little endian)
Expand Down
10 changes: 4 additions & 6 deletions src/Adapters/EWKT.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
<?php
<?php

namespace Phayes\GeoPHP\Adapters;

use Phayes\GeoPHP\Adapters\WKT;
use Phayes\GeoPHP\Geometry\Geometry;

class EWKT extends WKT
{

/**
* Serialize geometries into an EWKT string.
*
* @param Geometry $geometry
*
* @return string The Extended-WKT string representation of the input geometries
*/
public function write(Geometry $geometry)
public function write(Geometry $geometry)
{
$srid = $geometry->SRID();
$wkt = '';
if ($srid) {
$wkt = 'SRID=' . $srid . ';';
$wkt .= $geometry->out('wkt');
Expand All @@ -27,4 +25,4 @@ public function write(Geometry $geometry)
return $geometry->out('wkt');
}
}
}
}
Loading

0 comments on commit 84fe82a

Please sign in to comment.