phpmyadmin/libraries/classes/Gis/GisFactory.php
Maximilian Krög f6a850f1fb
Remove redundant @static annotations
Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
2023-02-17 23:03:20 +01:00

38 lines
1.1 KiB
PHP

<?php
/**
* Contains the factory class that handles the creation of geometric objects
*/
declare(strict_types=1);
namespace PhpMyAdmin\Gis;
use function strtoupper;
/**
* Factory class that handles the creation of geometric objects.
*/
class GisFactory
{
/**
* Returns the singleton instance of geometric class of the given type.
*
* @param string $type type of the geometric object
*
* @return GisGeometry|false the singleton instance of geometric class of the given type
*/
public static function factory($type): GisGeometry|false
{
return match (strtoupper($type)) {
'MULTIPOLYGON' => GisMultiPolygon::singleton(),
'POLYGON' => GisPolygon::singleton(),
'MULTIPOINT' => GisMultiPoint::singleton(),
'POINT' => GisPoint::singleton(),
'MULTILINESTRING' => GisMultiLineString::singleton(),
'LINESTRING' => GisLineString::singleton(),
'GEOMETRYCOLLECTION' => GisGeometryCollection::singleton(),
default => false,
};
}
}