public function matchQueryParam($name, $pattern = null)
    {
        if (isset($this->getQueryParams()[$name])) {
            if (!empty($pattern)) {
                if ($this->matchValue($this->getQueryParams()[$name], $pattern)) {
                    return $this->getQueryParams()[$name];
                }
            } else {
                if (empty($this->getQueryParams()[$name])) {
                    return true;
                } else {
                    return $this->getQueryParams()[$name];
                }
            }
        } elseif ($pattern == '?') {
            // in case of optional pattern we just return true
            return true;
        }

        return false;
    }
public function matchQueryParam($name, $pattern = null)
    {
        if (isset($this->getQueryParams()[$name])) {
            if (!empty($pattern)) {
                if ($this->matchValue($this->getQueryParams()[$name], $pattern)) {
                    return $this->getQueryParams()[$name];
                }
            } else {
                if (empty($this->getQueryParams()[$name])) {
                    return true;
                } else {
                    return $this->getQueryParams()[$name];
                }
            }
        } elseif ($pattern == '?') {
            // in case of optional pattern we just return true
            return true;
        }

        return false;
    }
public function matchQueryParam ( $ name , $ pattern = null ) { if ( isset ( $ this -> getQueryParams ( ) [ $ name ] ) ) { if ( ! empty ( $ pattern ) ) { if ( $ this -> matchValue ( $ this -> getQueryParams ( ) [ $ name ] , $ pattern ) ) { return $ this -> getQueryParams ( ) [ $ name ] ; } } else { if ( empty ( $ this -> getQueryParams ( ) [ $ name ] ) ) { return true ; } else { return $ this -> getQueryParams ( ) [ $ name ] ; } } } elseif ( $ pattern == '?' ) { // in case of optional pattern we just return true return true ; } return false ; }
Check if the given query param exists, and optionally if the pattern matches the query param value.

@param string      $name Query param name to match.
@param string|null $pattern Optional pattern that needs to match the query param value.

@return bool|string  False if the query param doesn't exist, or the pattern doesn't match.
If the query param exists and pattern matched, the query param value is returned.
Check if the given query param exists and optionally if the pattern matches the query param value .