From fd90e76c9122be2483b40a656d3396d530b27ce3 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Fri, 6 Jul 2012 19:20:53 +0100 Subject: [PATCH] Added redirectUri function --- src/oauth2server/Server.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/oauth2server/Server.php b/src/oauth2server/Server.php index 2d9103f4..d70620b0 100644 --- a/src/oauth2server/Server.php +++ b/src/oauth2server/Server.php @@ -173,4 +173,32 @@ class Server return $params; } + /** + * Generates the redirect uri with appended params + * + * @param string $redirect_uri The redirect URI + * @param array $params The parameters to be appended to the URL + * @param string $query_delimeter The delimiter between the variables and the URL + * + * @access public + * @return string + */ + public function redirectUri(string $redirectUri, $params = array(), + $queryDelimeter = '?') { + + if (strstr($redirectUri, $queryDelimeter)) { + + $redirectUri = $redirectUri . '&' . http_build_query($params); + + } else { + + $redirectUri = $redirectUri . $queryDelimeter . + http_build_query($params); + + } + + return $redirectUri; + + } + } \ No newline at end of file