public function near($x, $y = null) : self
    {
        if ($x instanceof Point) {
            $x = $x->jsonSerialize();
        }

        $this->near      = is_array($x) ? $x : [$x, $y];
        $this->spherical = is_array($x) && isset($x['type']);

        return $this;
    }
public function near($x, $y = null) : self
    {
        if ($x instanceof Point) {
            $x = $x->jsonSerialize();
        }

        $this->near      = is_array($x) ? $x : [$x, $y];
        $this->spherical = is_array($x) && isset($x['type']);

        return $this;
    }
public function near ( $ x , $ y = null ) : self { if ( $ x instanceof Point ) { $ x = $ x -> jsonSerialize ( ) ; } $ this -> near = is_array ( $ x ) ? $ x : [ $ x , $ y ] ; $ this -> spherical = is_array ( $ x ) && isset ( $ x [ 'type' ] ) ; return $ this ; }
The point for which to find the closest documents.

A GeoJSON point may be provided as the first and only argument for
2dsphere queries. This single parameter may be a GeoJSON point object or
an array corresponding to the point's JSON representation. If GeoJSON is
used, the "spherical" option will default to true.

@param float|array|Point $x
@param float             $y
The point for which to find the closest documents .