public function decodePair(string $keyValuePair): array
    {
        # more than a handful of clients like to use '+' characters
        # when encoding data that is (almost) compliant with rfc 3986
        # this is a hack that allows for it
        if (strpos($keyValuePair, "+") !== false) {
            $keyValuePair = str_replace("+", " ", $keyValuePair);
        }

        $parts = explode("=", $keyValuePair, 2);
        $key = rawurldecode($parts[0]);

        # interpret a key with an empty value as `null`
        $value = (count($parts) === 1) ? null : rawurldecode($parts[1]);
        return [$key, $value];
    }
public function decodePair(string $keyValuePair): array
    {
        # more than a handful of clients like to use '+' characters
        # when encoding data that is (almost) compliant with rfc 3986
        # this is a hack that allows for it
        if (strpos($keyValuePair, "+") !== false) {
            $keyValuePair = str_replace("+", " ", $keyValuePair);
        }

        $parts = explode("=", $keyValuePair, 2);
        $key = rawurldecode($parts[0]);

        # interpret a key with an empty value as `null`
        $value = (count($parts) === 1) ? null : rawurldecode($parts[1]);
        return [$key, $value];
    }
public function decodePair ( string $ keyValuePair ) : array { # more than a handful of clients like to use '+' characters # when encoding data that is (almost) compliant with rfc 3986 # this is a hack that allows for it if ( strpos ( $ keyValuePair , "+" ) !== false ) { $ keyValuePair = str_replace ( "+" , " " , $ keyValuePair ) ; } $ parts = explode ( "=" , $ keyValuePair , 2 ) ; $ key = rawurldecode ( $ parts [ 0 ] ) ; # interpret a key with an empty value as `null` $ value = ( count ( $ parts ) === 1 ) ? null : rawurldecode ( $ parts [ 1 ] ) ; return [ $ key , $ value ] ; }
Decode a urlencoded parameter key value pair

@param string $keyValuePair
@return array<string> The decoded key and value
Decode a urlencoded parameter key value pair