public static function fromText(string $wkt, int $srid = 0) : Geometry
    {
        static $wktReader;

        if ($wktReader === null) {
            $wktReader = new WKTReader();
        }

        $geometry = $wktReader->read($wkt, $srid);

        if (! $geometry instanceof static) {
            throw UnexpectedGeometryException::unexpectedGeometryType(static::class, $geometry);
        }

        return $geometry;
    }
public static function fromText(string $wkt, int $srid = 0) : Geometry
    {
        static $wktReader;

        if ($wktReader === null) {
            $wktReader = new WKTReader();
        }

        $geometry = $wktReader->read($wkt, $srid);

        if (! $geometry instanceof static) {
            throw UnexpectedGeometryException::unexpectedGeometryType(static::class, $geometry);
        }

        return $geometry;
    }
public static function fromText ( string $ wkt , int $ srid = 0 ) : Geometry { static $ wktReader ; if ( $ wktReader === null ) { $ wktReader = new WKTReader ( ) ; } $ geometry = $ wktReader -> read ( $ wkt , $ srid ) ; if ( ! $ geometry instanceof static ) { throw UnexpectedGeometryException :: unexpectedGeometryType ( static :: class , $ geometry ) ; } return $ geometry ; }
Builds a Geometry from a WKT representation.

If the resulting geometry is valid but is not an instance of the class this method is called on,
for example passing a Polygon WKT to Point::fromText(), an exception is thrown.

@param string $wkt  The Well-Known Text representation.
@param int    $srid The optional SRID to use.

@return static

@throws GeometryIOException         If the given string is not a valid WKT representation.
@throws CoordinateSystemException   If the WKT contains mixed coordinate systems.
@throws InvalidGeometryException    If the WKT represents an invalid geometry.
@throws UnexpectedGeometryException If the resulting geometry is not an instance of the current class.
Builds a Geometry from a WKT representation .