Merge pull request #18118 from MoonE/gis-generate-params
Proper method inheritance for gis generateParams
This commit is contained in:
commit
a7dd3bd380
@ -20,6 +20,7 @@ use function preg_match;
|
||||
use function random_int;
|
||||
use function sprintf;
|
||||
use function str_replace;
|
||||
use function strtoupper;
|
||||
use function trim;
|
||||
|
||||
/**
|
||||
@ -166,15 +167,14 @@ abstract class GisGeometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates parameters for the GIS data editor from the value of the GIS column.
|
||||
* This method performs common work.
|
||||
* More specific work is performed by each of the geom classes.
|
||||
* Parses the wkt and optional srid from a combined string for the GIS data editor
|
||||
*
|
||||
* @param string $value value of the GIS column
|
||||
*
|
||||
* @return array parameters for the GIS editor from the value of the GIS column
|
||||
* @return array<string,int|string> parameters for the GIS editor from the value of the GIS column
|
||||
* @psalm-return array{'srid':int,'wkt':string}
|
||||
*/
|
||||
public function generateParams($value): array
|
||||
protected function parseWktAndSrid(string $value): array
|
||||
{
|
||||
$geom_types = '(POINT|MULTIPOINT|LINESTRING|MULTILINESTRING|POLYGON|MULTIPOLYGON|GEOMETRYCOLLECTION)';
|
||||
$srid = 0;
|
||||
@ -194,6 +194,38 @@ abstract class GisGeometry
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate coordinate parameters for the GIS data editor from the value of the GIS column.
|
||||
*
|
||||
* @param string $wkt Value of the GIS column
|
||||
*
|
||||
* @return array Coordinate params for the GIS data editor from the value of the GIS column
|
||||
*/
|
||||
abstract protected function getCoordinateParams(string $wkt): array;
|
||||
|
||||
/**
|
||||
* Generate parameters for the GIS data editor from the value of the GIS column.
|
||||
*
|
||||
* @param string $value Value of the GIS column
|
||||
*
|
||||
* @return array params for the GIS data editor from the value of the GIS column
|
||||
*/
|
||||
public function generateParams(string $value): array
|
||||
{
|
||||
$data = $this->parseWktAndSrid($value);
|
||||
$index = 0;
|
||||
$wkt = $data['wkt'];
|
||||
preg_match('/^\w+/', $wkt, $matches);
|
||||
$wkt_type = strtoupper($matches[0]);
|
||||
|
||||
return [
|
||||
'srid' => $data['srid'],
|
||||
$index => [
|
||||
$wkt_type => $this->getCoordinateParams($wkt),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts points, scales and returns them as an array.
|
||||
*
|
||||
|
||||
@ -7,14 +7,15 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Gis;
|
||||
|
||||
use ErrorException;
|
||||
use PhpMyAdmin\Image\ImageWrapper;
|
||||
use TCPDF;
|
||||
|
||||
use function array_merge;
|
||||
use function count;
|
||||
use function mb_strpos;
|
||||
use function mb_substr;
|
||||
use function str_split;
|
||||
use function strtoupper;
|
||||
|
||||
/**
|
||||
* Handles actions related to GIS GEOMETRYCOLLECTION objects
|
||||
@ -299,6 +300,16 @@ class GisGeometryCollection extends GisGeometry
|
||||
return $wkt . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* GeometryCollection does not have coordinates of its own
|
||||
*
|
||||
* @param string $wkt Value of the GIS column
|
||||
*/
|
||||
protected function getCoordinateParams(string $wkt): array
|
||||
{
|
||||
throw new ErrorException('Has no own coordinates');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates parameters for the GIS data editor from the value of the GIS column.
|
||||
*
|
||||
@ -306,37 +317,38 @@ class GisGeometryCollection extends GisGeometry
|
||||
*
|
||||
* @return array parameters for the GIS editor from the value of the GIS column
|
||||
*/
|
||||
public function generateParams($value): array
|
||||
public function generateParams(string $value): array
|
||||
{
|
||||
$params = [];
|
||||
$data = GisGeometry::generateParams($value);
|
||||
$params['srid'] = $data['srid'];
|
||||
$data = $this->parseWktAndSrid($value);
|
||||
$wkt = $data['wkt'];
|
||||
|
||||
// Trim to remove leading 'GEOMETRYCOLLECTION(' and trailing ')'
|
||||
$goem_col = mb_substr($wkt, 19, -1);
|
||||
// Split the geometry collection object to get its constituents.
|
||||
$sub_parts = $this->explodeGeomCol($goem_col);
|
||||
$params['GEOMETRYCOLLECTION']['geom_count'] = count($sub_parts);
|
||||
$wkt_geometries = $this->explodeGeomCol($goem_col);
|
||||
$params = [
|
||||
'srid' => $data['srid'],
|
||||
'GEOMETRYCOLLECTION' => [
|
||||
'geom_count' => count($wkt_geometries),
|
||||
],
|
||||
];
|
||||
|
||||
$i = 0;
|
||||
foreach ($sub_parts as $sub_part) {
|
||||
$type_pos = mb_strpos($sub_part, '(');
|
||||
foreach ($wkt_geometries as $wkt_geometry) {
|
||||
$type_pos = mb_strpos($wkt_geometry, '(');
|
||||
if ($type_pos === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$type = mb_substr($sub_part, 0, $type_pos);
|
||||
/**
|
||||
* @var GisMultiPolygon|GisPolygon|GisMultiPoint|GisPoint|GisMultiLineString|GisLineString $gis_obj
|
||||
*/
|
||||
$gis_obj = GisFactory::factory($type);
|
||||
$wkt_type = strtoupper(mb_substr($wkt_geometry, 0, $type_pos));
|
||||
$gis_obj = GisFactory::factory($wkt_type);
|
||||
if (! $gis_obj) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$params = array_merge($params, $gis_obj->generateParams($sub_part, $i));
|
||||
$i++;
|
||||
$params[$i++] = [
|
||||
'gis_type' => $wkt_type,
|
||||
$wkt_type => $gis_obj->getCoordinateParams($wkt_geometry),
|
||||
];
|
||||
}
|
||||
|
||||
return $params;
|
||||
|
||||
@ -270,37 +270,27 @@ class GisLineString extends GisGeometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate parameters for the GIS data editor from the value of the GIS column.
|
||||
* Generate coordinate parameters for the GIS data editor from the value of the GIS column.
|
||||
*
|
||||
* @param string $value of the GIS column
|
||||
* @param int $index of the geometry
|
||||
* @param string $wkt Value of the GIS column
|
||||
*
|
||||
* @return array params for the GIS data editor from the value of the GIS column
|
||||
* @return array Coordinate params for the GIS data editor from the value of the GIS column
|
||||
*/
|
||||
public function generateParams($value, $index = -1): array
|
||||
protected function getCoordinateParams(string $wkt): array
|
||||
{
|
||||
$params = [];
|
||||
if ($index == -1) {
|
||||
$index = 0;
|
||||
$data = GisGeometry::generateParams($value);
|
||||
$params['srid'] = $data['srid'];
|
||||
$wkt = $data['wkt'];
|
||||
} else {
|
||||
$params[$index]['gis_type'] = 'LINESTRING';
|
||||
$wkt = $value;
|
||||
}
|
||||
|
||||
// Trim to remove leading 'LINESTRING(' and trailing ')'
|
||||
$linestring = mb_substr($wkt, 11, -1);
|
||||
$points_arr = $this->extractPoints($linestring, null);
|
||||
|
||||
$no_of_points = count($points_arr);
|
||||
$params[$index]['LINESTRING']['no_of_points'] = $no_of_points;
|
||||
$coords = ['no_of_points' => $no_of_points];
|
||||
for ($i = 0; $i < $no_of_points; $i++) {
|
||||
$params[$index]['LINESTRING'][$i]['x'] = $points_arr[$i][0];
|
||||
$params[$index]['LINESTRING'][$i]['y'] = $points_arr[$i][1];
|
||||
$coords[$i] = [
|
||||
'x' => $points_arr[$i][0],
|
||||
'y' => $points_arr[$i][1],
|
||||
];
|
||||
}
|
||||
|
||||
return $params;
|
||||
return $coords;
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,45 +341,31 @@ class GisMultiLineString extends GisGeometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate parameters for the GIS data editor from the value of the GIS column.
|
||||
* Generate coordinate parameters for the GIS data editor from the value of the GIS column.
|
||||
*
|
||||
* @param string $value Value of the GIS column
|
||||
* @param int $index Index of the geometry
|
||||
* @param string $wkt Value of the GIS column
|
||||
*
|
||||
* @return array params for the GIS data editor from the value of the GIS column
|
||||
* @return array Coordinate params for the GIS data editor from the value of the GIS column
|
||||
*/
|
||||
public function generateParams($value, $index = -1): array
|
||||
protected function getCoordinateParams(string $wkt): array
|
||||
{
|
||||
$params = [];
|
||||
if ($index == -1) {
|
||||
$index = 0;
|
||||
$data = GisGeometry::generateParams($value);
|
||||
$params['srid'] = $data['srid'];
|
||||
$wkt = $data['wkt'];
|
||||
} else {
|
||||
$params[$index]['gis_type'] = 'MULTILINESTRING';
|
||||
$wkt = $value;
|
||||
}
|
||||
|
||||
// Trim to remove leading 'MULTILINESTRING((' and trailing '))'
|
||||
$multilinestirng = mb_substr($wkt, 17, -2);
|
||||
// Separate each linestring
|
||||
$linestirngs = explode('),(', $multilinestirng);
|
||||
$params[$index]['MULTILINESTRING']['no_of_lines'] = count($linestirngs);
|
||||
$wkt_multilinestring = mb_substr($wkt, 17, -2);
|
||||
$wkt_linestrings = explode('),(', $wkt_multilinestring);
|
||||
$coords = ['no_of_lines' => count($wkt_linestrings)];
|
||||
|
||||
$j = 0;
|
||||
foreach ($linestirngs as $linestring) {
|
||||
$points_arr = $this->extractPoints($linestring, null);
|
||||
$no_of_points = count($points_arr);
|
||||
$params[$index]['MULTILINESTRING'][$j]['no_of_points'] = $no_of_points;
|
||||
foreach ($wkt_linestrings as $j => $wkt_linestring) {
|
||||
$points = $this->extractPoints($wkt_linestring, null);
|
||||
$no_of_points = count($points);
|
||||
$coords[$j] = ['no_of_points' => $no_of_points];
|
||||
for ($i = 0; $i < $no_of_points; $i++) {
|
||||
$params[$index]['MULTILINESTRING'][$j][$i]['x'] = $points_arr[$i][0];
|
||||
$params[$index]['MULTILINESTRING'][$j][$i]['y'] = $points_arr[$i][1];
|
||||
$coords[$j][$i] = [
|
||||
'x' => $points[$i][0],
|
||||
'y' => $points[$i][1],
|
||||
];
|
||||
}
|
||||
|
||||
$j++;
|
||||
}
|
||||
|
||||
return $params;
|
||||
return $coords;
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,38 +317,28 @@ class GisMultiPoint extends GisGeometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate parameters for the GIS data editor from the value of the GIS column.
|
||||
* Generate coordinate parameters for the GIS data editor from the value of the GIS column.
|
||||
*
|
||||
* @param string $value Value of the GIS column
|
||||
* @param int $index Index of the geometry
|
||||
* @param string $wkt Value of the GIS column
|
||||
*
|
||||
* @return array params for the GIS data editor from the value of the GIS column
|
||||
* @return array Coordinate params for the GIS data editor from the value of the GIS column
|
||||
*/
|
||||
public function generateParams($value, $index = -1): array
|
||||
protected function getCoordinateParams(string $wkt): array
|
||||
{
|
||||
$params = [];
|
||||
if ($index == -1) {
|
||||
$index = 0;
|
||||
$data = GisGeometry::generateParams($value);
|
||||
$params['srid'] = $data['srid'];
|
||||
$wkt = $data['wkt'];
|
||||
} else {
|
||||
$params[$index]['gis_type'] = 'MULTIPOINT';
|
||||
$wkt = $value;
|
||||
}
|
||||
|
||||
// Trim to remove leading 'MULTIPOINT(' and trailing ')'
|
||||
$points = mb_substr($wkt, 11, -1);
|
||||
$points_arr = $this->extractPoints($points, null);
|
||||
$wkt_points = mb_substr($wkt, 11, -1);
|
||||
$points = $this->extractPoints($wkt_points, null);
|
||||
|
||||
$no_of_points = count($points_arr);
|
||||
$params[$index]['MULTIPOINT']['no_of_points'] = $no_of_points;
|
||||
$no_of_points = count($points);
|
||||
$coords = ['no_of_points' => $no_of_points];
|
||||
for ($i = 0; $i < $no_of_points; $i++) {
|
||||
$params[$index]['MULTIPOINT'][$i]['x'] = $points_arr[$i][0];
|
||||
$params[$index]['MULTIPOINT'][$i]['y'] = $points_arr[$i][1];
|
||||
$coords[$i] = [
|
||||
'x' => $points[$i][0],
|
||||
'y' => $points[$i][1],
|
||||
];
|
||||
}
|
||||
|
||||
return $params;
|
||||
return $coords;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -448,54 +448,35 @@ class GisMultiPolygon extends GisGeometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate parameters for the GIS data editor from the value of the GIS column.
|
||||
* Generate coordinate parameters for the GIS data editor from the value of the GIS column.
|
||||
*
|
||||
* @param string $value Value of the GIS column
|
||||
* @param int $index Index of the geometry
|
||||
* @param string $wkt Value of the GIS column
|
||||
*
|
||||
* @return array params for the GIS data editor from the value of the GIS column
|
||||
* @return array Coordinate params for the GIS data editor from the value of the GIS column
|
||||
*/
|
||||
public function generateParams($value, $index = -1): array
|
||||
protected function getCoordinateParams(string $wkt): array
|
||||
{
|
||||
$params = [];
|
||||
if ($index == -1) {
|
||||
$index = 0;
|
||||
$data = GisGeometry::generateParams($value);
|
||||
$params['srid'] = $data['srid'];
|
||||
$wkt = $data['wkt'];
|
||||
} else {
|
||||
$params[$index]['gis_type'] = 'MULTIPOLYGON';
|
||||
$wkt = $value;
|
||||
}
|
||||
|
||||
// Trim to remove leading 'MULTIPOLYGON(((' and trailing ')))'
|
||||
$multipolygon = mb_substr($wkt, 15, -3);
|
||||
// Separate each polygon
|
||||
$wkt_polygons = explode(')),((', $multipolygon);
|
||||
$wkt_multipolygon = mb_substr($wkt, 15, -3);
|
||||
$wkt_polygons = explode(')),((', $wkt_multipolygon);
|
||||
$coords = ['no_of_polygons' => count($wkt_polygons)];
|
||||
|
||||
$param_row =& $params[$index]['MULTIPOLYGON'];
|
||||
$param_row['no_of_polygons'] = count($wkt_polygons);
|
||||
|
||||
$k = 0;
|
||||
foreach ($wkt_polygons as $wkt_polygon) {
|
||||
foreach ($wkt_polygons as $k => $wkt_polygon) {
|
||||
$wkt_rings = explode('),(', $wkt_polygon);
|
||||
$param_row[$k]['no_of_lines'] = count($wkt_rings);
|
||||
$j = 0;
|
||||
foreach ($wkt_rings as $wkt_ring) {
|
||||
$points_arr = $this->extractPoints($wkt_ring, null);
|
||||
$no_of_points = count($points_arr);
|
||||
$param_row[$k][$j]['no_of_points'] = $no_of_points;
|
||||
$coords[$k] = ['no_of_lines' => count($wkt_rings)];
|
||||
foreach ($wkt_rings as $j => $wkt_ring) {
|
||||
$points = $this->extractPoints($wkt_ring, null);
|
||||
$no_of_points = count($points);
|
||||
$coords[$k][$j] = ['no_of_points' => $no_of_points];
|
||||
for ($i = 0; $i < $no_of_points; $i++) {
|
||||
$param_row[$k][$j][$i]['x'] = $points_arr[$i][0];
|
||||
$param_row[$k][$j][$i]['y'] = $points_arr[$i][1];
|
||||
$coords[$k][$j][$i] = [
|
||||
'x' => $points[$i][0],
|
||||
'y' => $points[$i][1],
|
||||
];
|
||||
}
|
||||
|
||||
$j++;
|
||||
}
|
||||
|
||||
$k++;
|
||||
}
|
||||
|
||||
return $params;
|
||||
return $coords;
|
||||
}
|
||||
}
|
||||
|
||||
@ -288,33 +288,21 @@ class GisPoint extends GisGeometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate parameters for the GIS data editor from the value of the GIS column.
|
||||
* Generate coordinate parameters for the GIS data editor from the value of the GIS column.
|
||||
*
|
||||
* @param string $value of the GIS column
|
||||
* @param int $index of the geometry
|
||||
* @param string $wkt Value of the GIS column
|
||||
*
|
||||
* @return array params for the GIS data editor from the value of the GIS column
|
||||
* @return array Coordinate params for the GIS data editor from the value of the GIS column
|
||||
*/
|
||||
public function generateParams($value, $index = -1): array
|
||||
protected function getCoordinateParams(string $wkt): array
|
||||
{
|
||||
$params = [];
|
||||
if ($index == -1) {
|
||||
$index = 0;
|
||||
$data = GisGeometry::generateParams($value);
|
||||
$params['srid'] = $data['srid'];
|
||||
$wkt = $data['wkt'];
|
||||
} else {
|
||||
$params[$index]['gis_type'] = 'POINT';
|
||||
$wkt = $value;
|
||||
}
|
||||
|
||||
// Trim to remove leading 'POINT(' and trailing ')'
|
||||
$point = mb_substr($wkt, 6, -1);
|
||||
$points_arr = $this->extractPoints($point, null);
|
||||
$wkt_point = mb_substr($wkt, 6, -1);
|
||||
$points = $this->extractPoints($wkt_point, null);
|
||||
|
||||
$params[$index]['POINT']['x'] = $points_arr[0][0];
|
||||
$params[$index]['POINT']['y'] = $points_arr[0][1];
|
||||
|
||||
return $params;
|
||||
return [
|
||||
'x' => $points[0][0],
|
||||
'y' => $points[0][1],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -471,45 +471,31 @@ class GisPolygon extends GisGeometry
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate parameters for the GIS data editor from the value of the GIS column.
|
||||
* Generate coordinate parameters for the GIS data editor from the value of the GIS column.
|
||||
*
|
||||
* @param string $value Value of the GIS column
|
||||
* @param int $index Index of the geometry
|
||||
* @param string $wkt Value of the GIS column
|
||||
*
|
||||
* @return array params for the GIS data editor from the value of the GIS column
|
||||
* @return array Coordinate params for the GIS data editor from the value of the GIS column
|
||||
*/
|
||||
public function generateParams($value, $index = -1): array
|
||||
protected function getCoordinateParams(string $wkt): array
|
||||
{
|
||||
$params = [];
|
||||
if ($index == -1) {
|
||||
$index = 0;
|
||||
$data = GisGeometry::generateParams($value);
|
||||
$params['srid'] = $data['srid'];
|
||||
$wkt = $data['wkt'];
|
||||
} else {
|
||||
$params[$index]['gis_type'] = 'POLYGON';
|
||||
$wkt = $value;
|
||||
}
|
||||
|
||||
// Trim to remove leading 'POLYGON((' and trailing '))'
|
||||
$polygon = mb_substr($wkt, 9, -2);
|
||||
// Separate each linestring
|
||||
$linerings = explode('),(', $polygon);
|
||||
$params[$index]['POLYGON']['no_of_lines'] = count($linerings);
|
||||
$wkt_polygon = mb_substr($wkt, 9, -2);
|
||||
$wkt_rings = explode('),(', $wkt_polygon);
|
||||
$coords = ['no_of_lines' => count($wkt_rings)];
|
||||
|
||||
$j = 0;
|
||||
foreach ($linerings as $linering) {
|
||||
$points_arr = $this->extractPoints($linering, null);
|
||||
$no_of_points = count($points_arr);
|
||||
$params[$index]['POLYGON'][$j]['no_of_points'] = $no_of_points;
|
||||
foreach ($wkt_rings as $j => $wkt_ring) {
|
||||
$points = $this->extractPoints($wkt_ring, null);
|
||||
$no_of_points = count($points);
|
||||
$coords[$j] = ['no_of_points' => $no_of_points];
|
||||
for ($i = 0; $i < $no_of_points; $i++) {
|
||||
$params[$index]['POLYGON'][$j][$i]['x'] = $points_arr[$i][0];
|
||||
$params[$index]['POLYGON'][$j][$i]['y'] = $points_arr[$i][1];
|
||||
$coords[$j][$i] = [
|
||||
'x' => $points[$i][0],
|
||||
'y' => $points[$i][1],
|
||||
];
|
||||
}
|
||||
|
||||
$j++;
|
||||
}
|
||||
|
||||
return $params;
|
||||
return $coords;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4250,6 +4250,11 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisGeometry.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getCoordinateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisGeometry.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getLineArrayForOpenLayers\\(\\) has parameter \\$lines with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -4320,6 +4325,11 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisGeometryCollection.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisGeometryCollection\\:\\:getCoordinateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisGeometryCollection.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisGeometryCollection\\:\\:prepareRowAsOl\\(\\) has parameter \\$scale_data with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -4340,23 +4350,18 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisGeometryCollection.php
|
||||
|
||||
-
|
||||
message: "#^Negated boolean expression is always false\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisGeometryCollection.php
|
||||
|
||||
-
|
||||
message: "#^Static property PhpMyAdmin\\\\Gis\\\\GisGeometryCollection\\:\\:\\$instance \\(PhpMyAdmin\\\\Gis\\\\GisGeometryCollection\\) in isset\\(\\) is not nullable\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisGeometryCollection.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisLineString\\:\\:generateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisLineString\\:\\:generateWkt\\(\\) has parameter \\$gis_data with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisLineString.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisLineString\\:\\:generateWkt\\(\\) has parameter \\$gis_data with no value type specified in iterable type array\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisLineString\\:\\:getCoordinateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisLineString.php
|
||||
|
||||
@ -4396,7 +4401,7 @@ parameters:
|
||||
path: libraries/classes/Gis/GisLineString.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiLineString\\:\\:generateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
message: "#^Cannot access offset int\\<0, max\\> on non\\-empty\\-array\\<'no_of_points'\\|int\\<0, max\\>, array\\{x\\: mixed, y\\: mixed\\}\\|int\\<0, max\\>\\>\\|int\\<1, max\\>\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisMultiLineString.php
|
||||
|
||||
@ -4405,6 +4410,11 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisMultiLineString.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiLineString\\:\\:getCoordinateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisMultiLineString.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiLineString\\:\\:getShape\\(\\) has parameter \\$row_data with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -4446,12 +4456,12 @@ parameters:
|
||||
path: libraries/classes/Gis/GisMultiLineString.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiPoint\\:\\:generateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiPoint\\:\\:generateWkt\\(\\) has parameter \\$gis_data with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisMultiPoint.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiPoint\\:\\:generateWkt\\(\\) has parameter \\$gis_data with no value type specified in iterable type array\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiPoint\\:\\:getCoordinateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisMultiPoint.php
|
||||
|
||||
@ -4500,18 +4510,28 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisMultiPoint.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset int on non\\-empty\\-array\\<'no_of_lines'\\|int, array\\{no_of_points\\: int\\<0, max\\>, 0\\?\\: array\\{x\\: mixed, y\\: mixed\\}\\}\\|int\\<1, max\\>\\>\\|int\\<1, max\\>\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisMultiPolygon.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset int\\<0, max\\> on non\\-empty\\-array\\<'no_of_points'\\|int\\<0, max\\>, array\\{x\\: mixed, y\\: mixed\\}\\|int\\<0, max\\>\\>\\|int\\<1, max\\>\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisMultiPolygon.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiPolygon\\:\\:drawPath\\(\\) has parameter \\$scale_data with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisMultiPolygon.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiPolygon\\:\\:generateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiPolygon\\:\\:generateWkt\\(\\) has parameter \\$gis_data with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisMultiPolygon.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiPolygon\\:\\:generateWkt\\(\\) has parameter \\$gis_data with no value type specified in iterable type array\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisMultiPolygon\\:\\:getCoordinateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisMultiPolygon.php
|
||||
|
||||
@ -4561,12 +4581,12 @@ parameters:
|
||||
path: libraries/classes/Gis/GisMultiPolygon.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisPoint\\:\\:generateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisPoint\\:\\:generateWkt\\(\\) has parameter \\$gis_data with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisPoint.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisPoint\\:\\:generateWkt\\(\\) has parameter \\$gis_data with no value type specified in iterable type array\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisPoint\\:\\:getCoordinateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisPoint.php
|
||||
|
||||
@ -4610,6 +4630,11 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisPoint.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset int\\<0, max\\> on non\\-empty\\-array\\<'no_of_points'\\|int\\<0, max\\>, array\\{x\\: mixed, y\\: mixed\\}\\|int\\<0, max\\>\\>\\|int\\<1, max\\>\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisPolygon.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisPolygon\\:\\:area\\(\\) has parameter \\$ring with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -4621,12 +4646,12 @@ parameters:
|
||||
path: libraries/classes/Gis/GisPolygon.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisPolygon\\:\\:generateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisPolygon\\:\\:generateWkt\\(\\) has parameter \\$gis_data with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisPolygon.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisPolygon\\:\\:generateWkt\\(\\) has parameter \\$gis_data with no value type specified in iterable type array\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Gis\\\\GisPolygon\\:\\:getCoordinateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Gis/GisPolygon.php
|
||||
|
||||
@ -10330,11 +10355,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryTest\\:\\:providerForTestGenerateParams\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryTest\\:\\:providerForTestGetBoundsForOl\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10345,6 +10365,11 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryTest\\:\\:providerForTestParseWktAndSrid\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryTest\\:\\:providerForTestSetMinMax\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10360,11 +10385,6 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryTest\\:\\:testGenerateParams\\(\\) has parameter \\$output with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryTest\\:\\:testGetBoundsForOl\\(\\) has parameter \\$scale_data with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
@ -10375,6 +10395,11 @@ parameters:
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisGeometryTest\\:\\:testParseWktAndSrid\\(\\) has parameter \\$output with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: test/classes/Gis/GisGeometryTest.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Tests\\\\Gis\\\\GisLineStringTest\\:\\:providerForPrepareRowAsOl\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
|
||||
@ -7870,19 +7870,12 @@
|
||||
</PossiblyFalseOperand>
|
||||
</file>
|
||||
<file src="libraries/classes/Gis/GisGeometryCollection.php">
|
||||
<DocblockTypeContradiction>
|
||||
<code>! $gis_obj</code>
|
||||
<code>$gis_obj</code>
|
||||
</DocblockTypeContradiction>
|
||||
<MixedArgument>
|
||||
<code>$type</code>
|
||||
<code>$wkt</code>
|
||||
</MixedArgument>
|
||||
<MixedAssignment>
|
||||
<code>$geom_count</code>
|
||||
<code><![CDATA[$params['srid']]]></code>
|
||||
<code>$type</code>
|
||||
<code>$wkt</code>
|
||||
</MixedAssignment>
|
||||
<RedundantPropertyInitializationCheck>
|
||||
<code>isset(self::$instance)</code>
|
||||
@ -7902,7 +7895,6 @@
|
||||
<code>$temp_point[0]</code>
|
||||
<code>$temp_point[1]</code>
|
||||
<code>$temp_point[1]</code>
|
||||
<code>$wkt</code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$gis_data[$index]['LINESTRING']['no_of_points']]]></code>
|
||||
@ -7923,27 +7915,13 @@
|
||||
<code>$temp_point[1]</code>
|
||||
<code>$temp_point[1]</code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayAssignment>
|
||||
<code><![CDATA[$params[$index]['LINESTRING']]]></code>
|
||||
<code><![CDATA[$params[$index]['LINESTRING']]]></code>
|
||||
<code><![CDATA[$params[$index]['LINESTRING']]]></code>
|
||||
<code><![CDATA[$params[$index]['LINESTRING'][$i]]]></code>
|
||||
<code><![CDATA[$params[$index]['LINESTRING'][$i]]]></code>
|
||||
<code><![CDATA[$params[$index]['LINESTRING'][$i]['x']]]></code>
|
||||
<code><![CDATA[$params[$index]['LINESTRING'][$i]['y']]]></code>
|
||||
<code><![CDATA[$params[$index]['LINESTRING']['no_of_points']]]></code>
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment>
|
||||
<code>$no_of_points</code>
|
||||
<code><![CDATA[$params[$index]['LINESTRING'][$i]['x']]]></code>
|
||||
<code><![CDATA[$params[$index]['LINESTRING'][$i]['y']]]></code>
|
||||
<code><![CDATA[$params['srid']]]></code>
|
||||
<code>$point</code>
|
||||
<code>$point</code>
|
||||
<code>$point</code>
|
||||
<code>$temp_point</code>
|
||||
<code>$temp_point</code>
|
||||
<code>$wkt</code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand>
|
||||
<code>$point[0]</code>
|
||||
@ -7977,7 +7955,6 @@
|
||||
<code>$temp_point[0]</code>
|
||||
<code>$temp_point[1]</code>
|
||||
<code>$temp_point[1]</code>
|
||||
<code>$wkt</code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code>$data_row[$i]</code>
|
||||
@ -7992,8 +7969,8 @@
|
||||
<code>$point[1]</code>
|
||||
<code>$point[1]</code>
|
||||
<code>$point[1]</code>
|
||||
<code>$points_arr[$i][0]</code>
|
||||
<code>$points_arr[$i][1]</code>
|
||||
<code>$points[$i][0]</code>
|
||||
<code>$points[$i][1]</code>
|
||||
<code>$points_arr[1][0]</code>
|
||||
<code>$points_arr[1][0]</code>
|
||||
<code>$points_arr[1][1]</code>
|
||||
@ -8005,35 +7982,16 @@
|
||||
<code>$temp_point[1]</code>
|
||||
<code>$temp_point[1]</code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayAssignment>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING'][$j]]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING'][$j]]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING'][$j]]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING'][$j][$i]]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING'][$j][$i]]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING'][$j][$i]['x']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING'][$j][$i]['y']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING'][$j]['no_of_points']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING']['no_of_lines']]]></code>
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment>
|
||||
<code>$data_row</code>
|
||||
<code>$no_of_lines</code>
|
||||
<code>$no_of_points</code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING'][$j][$i]['x']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTILINESTRING'][$j][$i]['y']]]></code>
|
||||
<code><![CDATA[$params['srid']]]></code>
|
||||
<code>$point</code>
|
||||
<code>$point</code>
|
||||
<code>$point</code>
|
||||
<code>$point</code>
|
||||
<code>$temp_point</code>
|
||||
<code>$temp_point</code>
|
||||
<code>$wkt</code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand>
|
||||
<code><![CDATA[$point['x']]]></code>
|
||||
@ -8066,7 +8024,6 @@
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code>$wkt</code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$gis_data[$index]['MULTIPOINT']['no_of_points']]]></code>
|
||||
@ -8084,8 +8041,8 @@
|
||||
<code>$point[1]</code>
|
||||
<code>$point[1]</code>
|
||||
<code>$point[1]</code>
|
||||
<code>$points_arr[$i][0]</code>
|
||||
<code>$points_arr[$i][1]</code>
|
||||
<code>$points[$i][0]</code>
|
||||
<code>$points[$i][1]</code>
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
@ -8095,26 +8052,12 @@
|
||||
<code><![CDATA[$row_data['points'][$i]['x']]]></code>
|
||||
<code><![CDATA[$row_data['points'][$i]['y']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayAssignment>
|
||||
<code><![CDATA[$params[$index]['MULTIPOINT']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTIPOINT']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTIPOINT']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTIPOINT'][$i]]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTIPOINT'][$i]]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTIPOINT'][$i]['x']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTIPOINT'][$i]['y']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTIPOINT']['no_of_points']]]></code>
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment>
|
||||
<code>$no_of_points</code>
|
||||
<code><![CDATA[$params[$index]['MULTIPOINT'][$i]['x']]]></code>
|
||||
<code><![CDATA[$params[$index]['MULTIPOINT'][$i]['y']]]></code>
|
||||
<code><![CDATA[$params['srid']]]></code>
|
||||
<code>$point</code>
|
||||
<code>$point</code>
|
||||
<code>$point</code>
|
||||
<code>$point</code>
|
||||
<code>$wkt</code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand>
|
||||
<code>$point[0]</code>
|
||||
@ -8149,7 +8092,6 @@
|
||||
<code><![CDATA[$ring2['points']]]></code>
|
||||
<code><![CDATA[$ring['points']]]></code>
|
||||
<code><![CDATA[$ring['points']]]></code>
|
||||
<code>$wkt</code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code>$data_row[$k]</code>
|
||||
@ -8165,16 +8107,12 @@
|
||||
<code>$label_point[0]</code>
|
||||
<code>$label_point[1]</code>
|
||||
<code>$label_point[1]</code>
|
||||
<code>$param_row[$k]</code>
|
||||
<code>$param_row[$k][$j]</code>
|
||||
<code>$param_row[$k][$j][$i]</code>
|
||||
<code><![CDATA[$params[$index]['MULTIPOLYGON']]]></code>
|
||||
<code><![CDATA[$point['x']]]></code>
|
||||
<code><![CDATA[$point['y']]]></code>
|
||||
<code>$point[0]</code>
|
||||
<code>$point[1]</code>
|
||||
<code>$points_arr[$i][0]</code>
|
||||
<code>$points_arr[$i][1]</code>
|
||||
<code>$points[$i][0]</code>
|
||||
<code>$points[$i][1]</code>
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code><![CDATA[$ring1['isOuter']]]></code>
|
||||
@ -8191,20 +8129,6 @@
|
||||
<code><![CDATA[$row_data['parts'][$j]['points']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayAssignment>
|
||||
<code>$param_row[$k]</code>
|
||||
<code>$param_row[$k]</code>
|
||||
<code>$param_row[$k]</code>
|
||||
<code>$param_row[$k]</code>
|
||||
<code>$param_row[$k][$j]</code>
|
||||
<code>$param_row[$k][$j]</code>
|
||||
<code>$param_row[$k][$j]</code>
|
||||
<code>$param_row[$k][$j][$i]</code>
|
||||
<code>$param_row[$k][$j][$i]</code>
|
||||
<code><![CDATA[$param_row[$k][$j][$i]['x']]]></code>
|
||||
<code><![CDATA[$param_row[$k][$j][$i]['y']]]></code>
|
||||
<code><![CDATA[$param_row[$k][$j]['no_of_points']]]></code>
|
||||
<code><![CDATA[$param_row[$k]['no_of_lines']]]></code>
|
||||
<code><![CDATA[$param_row['no_of_polygons']]]></code>
|
||||
<code><![CDATA[$row_data['parts'][$i]]]></code>
|
||||
<code><![CDATA[$row_data['parts'][$i]]]></code>
|
||||
<code><![CDATA[$row_data['parts'][$i]['isOuter']]]></code>
|
||||
@ -8232,9 +8156,6 @@
|
||||
<code>$no_of_lines</code>
|
||||
<code>$no_of_points</code>
|
||||
<code>$no_of_polygons</code>
|
||||
<code><![CDATA[$param_row[$k][$j][$i]['x']]]></code>
|
||||
<code><![CDATA[$param_row[$k][$j][$i]['y']]]></code>
|
||||
<code><![CDATA[$params['srid']]]></code>
|
||||
<code>$point</code>
|
||||
<code>$point</code>
|
||||
<code>$ring</code>
|
||||
@ -8243,7 +8164,6 @@
|
||||
<code>$ring1</code>
|
||||
<code>$ring2</code>
|
||||
<code><![CDATA[$row_data['parts'][$k]['inner'][]]]></code>
|
||||
<code>$wkt</code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand>
|
||||
<code><![CDATA[$innerPoint['x']]]></code>
|
||||
@ -8280,38 +8200,25 @@
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code>$wkt</code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$gis_data[$index]['POINT']['x']]]></code>
|
||||
<code><![CDATA[$gis_data[$index]['POINT']['x']]]></code>
|
||||
<code><![CDATA[$gis_data[$index]['POINT']['y']]]></code>
|
||||
<code><![CDATA[$gis_data[$index]['POINT']['y']]]></code>
|
||||
<code>$points[0][0]</code>
|
||||
<code>$points[0][1]</code>
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayAssignment>
|
||||
<code><![CDATA[$params[$index]['POINT']]]></code>
|
||||
<code><![CDATA[$params[$index]['POINT']]]></code>
|
||||
<code><![CDATA[$params[$index]['POINT']['x']]]></code>
|
||||
<code><![CDATA[$params[$index]['POINT']['y']]]></code>
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$params[$index]['POINT']['x']]]></code>
|
||||
<code><![CDATA[$params[$index]['POINT']['y']]]></code>
|
||||
<code><![CDATA[$params['srid']]]></code>
|
||||
<code>$wkt</code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand>
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
@ -8341,7 +8248,6 @@
|
||||
<code>$points_arr[2]</code>
|
||||
<code>$points_arr[3]</code>
|
||||
<code>$points_arr[3]</code>
|
||||
<code>$wkt</code>
|
||||
<code>($y1 - $y0) ** 2 + ($x0 - $x1) ** 2</code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
@ -8367,8 +8273,8 @@
|
||||
<code><![CDATA[$p2['y']]]></code>
|
||||
<code>$point[0]</code>
|
||||
<code>$point[1]</code>
|
||||
<code>$points_arr[$i][0]</code>
|
||||
<code>$points_arr[$i][1]</code>
|
||||
<code>$points[$i][0]</code>
|
||||
<code>$points[$i][1]</code>
|
||||
<code>$points_arr[0][0]</code>
|
||||
<code>$points_arr[0][1]</code>
|
||||
<code><![CDATA[$polygon[$last]['x']]]></code>
|
||||
@ -8390,21 +8296,6 @@
|
||||
<code><![CDATA[$ring[0]['x']]]></code>
|
||||
<code><![CDATA[$ring[0]['y']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayAssignment>
|
||||
<code><![CDATA[$params[$index]['POLYGON']]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON']]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON']]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON']]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON'][$j]]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON'][$j]]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON'][$j]]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON'][$j][$i]]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON'][$j][$i]]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON'][$j][$i]['x']]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON'][$j][$i]['y']]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON'][$j]['no_of_points']]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON']['no_of_lines']]]></code>
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment>
|
||||
<code>$area</code>
|
||||
<code>$area</code>
|
||||
@ -8417,15 +8308,11 @@
|
||||
<code>$p1</code>
|
||||
<code>$p1</code>
|
||||
<code>$p2</code>
|
||||
<code><![CDATA[$params[$index]['POLYGON'][$j][$i]['x']]]></code>
|
||||
<code><![CDATA[$params[$index]['POLYGON'][$j][$i]['y']]]></code>
|
||||
<code><![CDATA[$params['srid']]]></code>
|
||||
<code>$point</code>
|
||||
<code><![CDATA[$pointA['x']]]></code>
|
||||
<code><![CDATA[$pointA['y']]]></code>
|
||||
<code><![CDATA[$pointB['x']]]></code>
|
||||
<code><![CDATA[$pointB['y']]]></code>
|
||||
<code>$wkt</code>
|
||||
<code>$x0</code>
|
||||
<code>$x1</code>
|
||||
<code>$x2</code>
|
||||
|
||||
@ -8,7 +8,6 @@ declare(strict_types=1);
|
||||
namespace PhpMyAdmin\Tests\Gis;
|
||||
|
||||
use PhpMyAdmin\Gis\GisGeometry;
|
||||
use PhpMyAdmin\Gis\GisPolygon;
|
||||
use PhpMyAdmin\Gis\ScaleData;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use ReflectionProperty;
|
||||
@ -50,28 +49,16 @@ abstract class GisGeomTestCase extends AbstractTestCase
|
||||
/**
|
||||
* test generateParams method
|
||||
*
|
||||
* @param string $wkt point in WKT form
|
||||
* @param int|null $index index
|
||||
* @param array $params expected output array
|
||||
* @param string $wkt point in WKT form
|
||||
* @param array $params expected output array
|
||||
*
|
||||
* @dataProvider providerForTestGenerateParams
|
||||
*/
|
||||
public function testGenerateParams(string $wkt, int|null $index, array $params): void
|
||||
public function testGenerateParams(string $wkt, array $params): void
|
||||
{
|
||||
if ($index === null) {
|
||||
$this->assertEquals(
|
||||
$params,
|
||||
$this->object->generateParams($wkt)
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var GisPolygon $obj or another GisGeometry that supports this definition */
|
||||
$obj = $this->object;
|
||||
$this->assertEquals(
|
||||
$params,
|
||||
$obj->generateParams($wkt, $index)
|
||||
$this->object->generateParams($wkt)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -115,25 +115,210 @@ class GisGeometryCollectionTest extends GisGeomTestCase
|
||||
{
|
||||
return [
|
||||
[
|
||||
'GEOMETRYCOLLECTION(LINESTRING(5.02 8.45,6.14 0.15))',
|
||||
0,
|
||||
'GEOMETRYCOLLECTION('
|
||||
. 'LINESTRING(5.02 8.45,6.14 0.15)'
|
||||
. ',MULTILINESTRING((36 14,47 23,62 75),(36 10,17 23,178 53))'
|
||||
. ',MULTIPOINT(5.02 8.45,6.14 0.15)'
|
||||
. ',MULTIPOLYGON(((35 10,10 20,15 40,45 45,35 10)'
|
||||
. ',(20 30,35 32,30 20,20 30)),((123 0,23 30,17 63,123 0)))'
|
||||
. ',POINT(5.02 8.45)'
|
||||
. ',POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 30))'
|
||||
. ')',
|
||||
[
|
||||
'srid' => 0,
|
||||
'GEOMETRYCOLLECTION' => ['geom_count' => 1],
|
||||
'0' => [
|
||||
'GEOMETRYCOLLECTION' => ['geom_count' => 6],
|
||||
0 => [
|
||||
'gis_type' => 'LINESTRING',
|
||||
'LINESTRING' => [
|
||||
'no_of_points' => 2,
|
||||
'0' => [
|
||||
0 => [
|
||||
'x' => 5.02,
|
||||
'y' => 8.45,
|
||||
],
|
||||
'1' => [
|
||||
1 => [
|
||||
'x' => 6.14,
|
||||
'y' => 0.15,
|
||||
],
|
||||
],
|
||||
],
|
||||
1 => [
|
||||
'gis_type' => 'MULTILINESTRING',
|
||||
'MULTILINESTRING' => [
|
||||
'no_of_lines' => 2,
|
||||
0 => [
|
||||
'no_of_points' => 3,
|
||||
0 => [
|
||||
'x' => 36.0,
|
||||
'y' => 14.0,
|
||||
],
|
||||
1 => [
|
||||
'x' => 47.0,
|
||||
'y' => 23.0,
|
||||
],
|
||||
2 => [
|
||||
'x' => 62.0,
|
||||
'y' => 75.0,
|
||||
],
|
||||
],
|
||||
1 => [
|
||||
'no_of_points' => 3,
|
||||
0 => [
|
||||
'x' => 36.0,
|
||||
'y' => 10.0,
|
||||
],
|
||||
1 => [
|
||||
'x' => 17.0,
|
||||
'y' => 23.0,
|
||||
],
|
||||
2 => [
|
||||
'x' => 178.0,
|
||||
'y' => 53.0,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
2 => [
|
||||
'gis_type' => 'MULTIPOINT',
|
||||
'MULTIPOINT' => [
|
||||
'no_of_points' => 2,
|
||||
0 => [
|
||||
'x' => 5.02,
|
||||
'y' => 8.45,
|
||||
],
|
||||
1 => [
|
||||
'x' => 6.14,
|
||||
'y' => 0.15,
|
||||
],
|
||||
],
|
||||
],
|
||||
3 => [
|
||||
'gis_type' => 'MULTIPOLYGON',
|
||||
'MULTIPOLYGON' => [
|
||||
'no_of_polygons' => 2,
|
||||
0 => [
|
||||
'no_of_lines' => 2,
|
||||
0 => [
|
||||
'no_of_points' => 5,
|
||||
0 => [
|
||||
'x' => 35.0,
|
||||
'y' => 10.0,
|
||||
],
|
||||
1 => [
|
||||
'x' => 10.0,
|
||||
'y' => 20.0,
|
||||
],
|
||||
2 => [
|
||||
'x' => 15.0,
|
||||
'y' => 40.0,
|
||||
],
|
||||
3 => [
|
||||
'x' => 45.0,
|
||||
'y' => 45.0,
|
||||
],
|
||||
4 => [
|
||||
'x' => 35.0,
|
||||
'y' => 10.0,
|
||||
],
|
||||
],
|
||||
1 => [
|
||||
'no_of_points' => 4,
|
||||
0 => [
|
||||
'x' => 20.0,
|
||||
'y' => 30.0,
|
||||
],
|
||||
1 => [
|
||||
'x' => 35.0,
|
||||
'y' => 32.0,
|
||||
],
|
||||
2 => [
|
||||
'x' => 30.0,
|
||||
'y' => 20.0,
|
||||
],
|
||||
3 => [
|
||||
'x' => 20.0,
|
||||
'y' => 30.0,
|
||||
],
|
||||
],
|
||||
],
|
||||
1 => [
|
||||
'no_of_lines' => 1,
|
||||
0 => [
|
||||
'no_of_points' => 4,
|
||||
0 => [
|
||||
'x' => 123.0,
|
||||
'y' => 0.0,
|
||||
],
|
||||
1 => [
|
||||
'x' => 23.0,
|
||||
'y' => 30.0,
|
||||
],
|
||||
2 => [
|
||||
'x' => 17.0,
|
||||
'y' => 63.0,
|
||||
],
|
||||
3 => [
|
||||
'x' => 123.0,
|
||||
'y' => 0.0,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
4 => [
|
||||
'gis_type' => 'POINT',
|
||||
'POINT' => [
|
||||
'x' => 5.02,
|
||||
'y' => 8.45,
|
||||
],
|
||||
],
|
||||
5 => [
|
||||
'gis_type' => 'POLYGON',
|
||||
'POLYGON' => [
|
||||
'no_of_lines' => 2,
|
||||
0 => [
|
||||
'no_of_points' => 5,
|
||||
0 => [
|
||||
'x' => 35.0,
|
||||
'y' => 10.0,
|
||||
],
|
||||
1 => [
|
||||
'x' => 10.0,
|
||||
'y' => 20.0,
|
||||
],
|
||||
2 => [
|
||||
'x' => 15.0,
|
||||
'y' => 40.0,
|
||||
],
|
||||
3 => [
|
||||
'x' => 45.0,
|
||||
'y' => 45.0,
|
||||
],
|
||||
4 => [
|
||||
'x' => 35.0,
|
||||
'y' => 10.0,
|
||||
],
|
||||
],
|
||||
1 => [
|
||||
'no_of_points' => 4,
|
||||
0 => [
|
||||
'x' => 20.0,
|
||||
'y' => 30.0,
|
||||
],
|
||||
1 => [
|
||||
'x' => 35.0,
|
||||
'y' => 32.0,
|
||||
],
|
||||
2 => [
|
||||
'x' => 30.0,
|
||||
'y' => 20.0,
|
||||
],
|
||||
3 => [
|
||||
'x' => 20.0,
|
||||
'y' => 30.0,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
@ -84,32 +84,32 @@ class GisGeometryTest extends AbstractTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* tests generateParams method
|
||||
* tests parseWktAndSrid method
|
||||
*
|
||||
* @param string $value Geometry data
|
||||
* @param array $output Expected output
|
||||
*
|
||||
* @dataProvider providerForTestGenerateParams
|
||||
* @dataProvider providerForTestParseWktAndSrid
|
||||
*/
|
||||
public function testGenerateParams(string $value, array $output): void
|
||||
public function testParseWktAndSrid(string $value, array $output): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
$output,
|
||||
$this->callFunction(
|
||||
$this->object,
|
||||
GisGeometry::class,
|
||||
'generateParams',
|
||||
'parseWktAndSrid',
|
||||
[$value]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for testGenerateParams
|
||||
* data provider for testParseWktAndSrid
|
||||
*
|
||||
* @return array data for testGenerateParams
|
||||
* @return array data for testParseWktAndSrid
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
public static function providerForTestParseWktAndSrid(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
|
||||
@ -111,36 +111,26 @@ class GisLineStringTest extends GisGeomTestCase
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
$temp = [
|
||||
'LINESTRING' => [
|
||||
'no_of_points' => 2,
|
||||
0 => [
|
||||
'x' => '5.02',
|
||||
'y' => '8.45',
|
||||
],
|
||||
1 => [
|
||||
'x' => '6.14',
|
||||
'y' => '0.15',
|
||||
],
|
||||
],
|
||||
];
|
||||
$temp1 = $temp;
|
||||
$temp1['gis_type'] = 'LINESTRING';
|
||||
|
||||
return [
|
||||
[
|
||||
"'LINESTRING(5.02 8.45,6.14 0.15)',124",
|
||||
null,
|
||||
[
|
||||
'srid' => 124,
|
||||
0 => $temp,
|
||||
0 => [
|
||||
'LINESTRING' => [
|
||||
'no_of_points' => 2,
|
||||
0 => [
|
||||
'x' => 5.02,
|
||||
'y' => 8.45,
|
||||
],
|
||||
1 => [
|
||||
'x' => 6.14,
|
||||
'y' => 0.15,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'LINESTRING(5.02 8.45,6.14 0.15)',
|
||||
2,
|
||||
[2 => $temp1],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -178,51 +178,40 @@ class GisMultiLineStringTest extends GisGeomTestCase
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
$temp = [
|
||||
'MULTILINESTRING' => [
|
||||
'no_of_lines' => 2,
|
||||
0 => [
|
||||
'no_of_points' => 2,
|
||||
0 => [
|
||||
'x' => 5.02,
|
||||
'y' => 8.45,
|
||||
],
|
||||
1 => [
|
||||
'x' => 6.14,
|
||||
'y' => 0.15,
|
||||
],
|
||||
],
|
||||
1 => [
|
||||
'no_of_points' => 2,
|
||||
0 => [
|
||||
'x' => 1.23,
|
||||
'y' => 4.25,
|
||||
],
|
||||
1 => [
|
||||
'x' => 9.15,
|
||||
'y' => 0.47,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$temp1 = $temp;
|
||||
$temp1['gis_type'] = 'MULTILINESTRING';
|
||||
|
||||
return [
|
||||
[
|
||||
"'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 0.47))',124",
|
||||
null,
|
||||
[
|
||||
'srid' => 124,
|
||||
0 => $temp,
|
||||
0 => [
|
||||
'MULTILINESTRING' => [
|
||||
'no_of_lines' => 2,
|
||||
0 => [
|
||||
'no_of_points' => 2,
|
||||
0 => [
|
||||
'x' => 5.02,
|
||||
'y' => 8.45,
|
||||
],
|
||||
1 => [
|
||||
'x' => 6.14,
|
||||
'y' => 0.15,
|
||||
],
|
||||
],
|
||||
1 => [
|
||||
'no_of_points' => 2,
|
||||
0 => [
|
||||
'x' => 1.23,
|
||||
'y' => 4.25,
|
||||
],
|
||||
1 => [
|
||||
'x' => 9.15,
|
||||
'y' => 0.47,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'MULTILINESTRING((5.02 8.45,6.14 0.15),(1.23 4.25,9.15 0.47))',
|
||||
2,
|
||||
[2 => $temp1],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -115,36 +115,26 @@ class GisMultiPointTest extends GisGeomTestCase
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
$temp1 = [
|
||||
'MULTIPOINT' => [
|
||||
'no_of_points' => 2,
|
||||
0 => [
|
||||
'x' => '5.02',
|
||||
'y' => '8.45',
|
||||
],
|
||||
1 => [
|
||||
'x' => '6.14',
|
||||
'y' => '0.15',
|
||||
],
|
||||
],
|
||||
];
|
||||
$temp2 = $temp1;
|
||||
$temp2['gis_type'] = 'MULTIPOINT';
|
||||
|
||||
return [
|
||||
[
|
||||
"'MULTIPOINT(5.02 8.45,6.14 0.15)',124",
|
||||
null,
|
||||
[
|
||||
'srid' => 124,
|
||||
0 => $temp1,
|
||||
0 => [
|
||||
'MULTIPOINT' => [
|
||||
'no_of_points' => 2,
|
||||
0 => [
|
||||
'x' => 5.02,
|
||||
'y' => 8.45,
|
||||
],
|
||||
1 => [
|
||||
'x' => 6.14,
|
||||
'y' => 0.15,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'MULTIPOINT(5.02 8.45,6.14 0.15)',
|
||||
2,
|
||||
[2 => $temp2],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -181,27 +181,15 @@ class GisMultiPolygonTest extends GisGeomTestCase
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
$temp = self::getData();
|
||||
|
||||
$temp1 = self::getData();
|
||||
$temp1['gis_type'] = 'MULTIPOLYGON';
|
||||
|
||||
return [
|
||||
[
|
||||
"'MULTIPOLYGON(((35 10,10 20,15 40,45 45,35 10),"
|
||||
. "(20 30,35 32,30 20,20 30)),((123 0,23 30,17 63,123 0)))',124",
|
||||
null,
|
||||
[
|
||||
'srid' => 124,
|
||||
0 => $temp,
|
||||
0 => self::getData(),
|
||||
],
|
||||
],
|
||||
[
|
||||
'MULTIPOLYGON(((35 10,10 20,15 40,45 45,35 10)'
|
||||
. ',(20 30,35 32,30 20,20 30)),((123 0,23 30,17 63,123 0)))',
|
||||
2,
|
||||
[2 => $temp1],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -137,26 +137,12 @@ class GisPointTest extends GisGeomTestCase
|
||||
return [
|
||||
[
|
||||
"'POINT(5.02 8.45)',124",
|
||||
null,
|
||||
[
|
||||
'srid' => 124,
|
||||
0 => [
|
||||
'POINT' => [
|
||||
'x' => '5.02',
|
||||
'y' => '8.45',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'POINT(5.02 8.45)',
|
||||
2,
|
||||
[
|
||||
2 => [
|
||||
'gis_type' => 'POINT',
|
||||
'POINT' => [
|
||||
'x' => '5.02',
|
||||
'y' => '8.45',
|
||||
'x' => 5.02,
|
||||
'y' => 8.45,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
@ -167,25 +167,14 @@ class GisPolygonTest extends GisGeomTestCase
|
||||
*/
|
||||
public static function providerForTestGenerateParams(): array
|
||||
{
|
||||
$temp = self::getData();
|
||||
|
||||
$temp1 = $temp;
|
||||
$temp1['gis_type'] = 'POLYGON';
|
||||
|
||||
return [
|
||||
[
|
||||
'\'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 30))\',124',
|
||||
null,
|
||||
[
|
||||
'srid' => 124,
|
||||
0 => $temp,
|
||||
0 => self::getData(),
|
||||
],
|
||||
],
|
||||
[
|
||||
'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 32,30 20,20 30))',
|
||||
2,
|
||||
[2 => $temp1],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user