private static function createNewURLSearchParamsObject($query, $init)
    {
        if (!$query) {
            $query = new static();
        }
        if ($init instanceof URLSearchParams) {
            $query->list = $init->list;
        } elseif (is_array($init)) {
            foreach ($init as $pair) {
                if (count($pair) !== 2) {
                    throw new TypeError(
                        'URLSearchParams require name/value tuples when being initialized by a sequence.'
                    );
                }
            }
            $query->list = $init;
        } elseif ($init instanceof \esperecyan\webidl\Record) {
            foreach ($init as $name => $value) {
                $query->list[] = [$name, $value];
            }
        } else {
            $query->list = lib\URLencoding::parseURLencodedString($init);
        }
        return $query;
    }
private static function createNewURLSearchParamsObject($query, $init)
    {
        if (!$query) {
            $query = new static();
        }
        if ($init instanceof URLSearchParams) {
            $query->list = $init->list;
        } elseif (is_array($init)) {
            foreach ($init as $pair) {
                if (count($pair) !== 2) {
                    throw new TypeError(
                        'URLSearchParams require name/value tuples when being initialized by a sequence.'
                    );
                }
            }
            $query->list = $init;
        } elseif ($init instanceof \esperecyan\webidl\Record) {
            foreach ($init as $name => $value) {
                $query->list[] = [$name, $value];
            }
        } else {
            $query->list = lib\URLencoding::parseURLencodedString($init);
        }
        return $query;
    }
private static function createNewURLSearchParamsObject ( $ query , $ init ) { if ( ! $ query ) { $ query = new static ( ) ; } if ( $ init instanceof URLSearchParams ) { $ query -> list = $ init -> list ; } elseif ( is_array ( $ init ) ) { foreach ( $ init as $ pair ) { if ( count ( $ pair ) !== 2 ) { throw new TypeError ( 'URLSearchParams require name/value tuples when being initialized by a sequence.' ) ; } } $ query -> list = $ init ; } elseif ( $ init instanceof \ esperecyan \ webidl \ Record ) { foreach ( $ init as $ name => $ value ) { $ query -> list [ ] = [ $ name , $ value ] ; } } else { $ query -> list = lib \ URLencoding :: parseURLencodedString ( $ init ) ; } return $ query ; }
Creates a new URLSearchParams object.
@link https://url.spec.whatwg.org/#concept-urlsearchparams-new URL Standard
@param $query self|null
@param $init string[][]|string[]|string|URLSearchParams|null
@throws TypeError
@return self
Creates a new URLSearchParams object .