From a73322fb43eaa2c28047c64dcaa1c863490628ae Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 4 Apr 2015 15:42:12 +0100 Subject: [PATCH] Renamed namespace Util > Utils --- .../KeyAlgorithm/DefaultAlgorithm.php | 2 +- .../KeyAlgorithm/KeyAlgorithmInterface.php | 2 +- src/{Util => Utils}/RedirectUri.php | 10 ++--- src/{Util => Utils}/SecureKey.php | 9 +++-- src/Utils/ServerAwareTrait.php | 38 +++++++++++++++++++ 5 files changed, 51 insertions(+), 10 deletions(-) rename src/{Util => Utils}/KeyAlgorithm/DefaultAlgorithm.php (95%) rename src/{Util => Utils}/KeyAlgorithm/KeyAlgorithmInterface.php (90%) rename src/{Util => Utils}/RedirectUri.php (66%) rename src/{Util => Utils}/SecureKey.php (83%) create mode 100644 src/Utils/ServerAwareTrait.php diff --git a/src/Util/KeyAlgorithm/DefaultAlgorithm.php b/src/Utils/KeyAlgorithm/DefaultAlgorithm.php similarity index 95% rename from src/Util/KeyAlgorithm/DefaultAlgorithm.php rename to src/Utils/KeyAlgorithm/DefaultAlgorithm.php index 70fecb14..cdbe20bf 100644 --- a/src/Util/KeyAlgorithm/DefaultAlgorithm.php +++ b/src/Utils/KeyAlgorithm/DefaultAlgorithm.php @@ -9,7 +9,7 @@ * @link https://github.com/thephpleague/oauth2-server */ -namespace League\OAuth2\Server\Util\KeyAlgorithm; +namespace League\OAuth2\Server\Utils\KeyAlgorithm; class DefaultAlgorithm implements KeyAlgorithmInterface { diff --git a/src/Util/KeyAlgorithm/KeyAlgorithmInterface.php b/src/Utils/KeyAlgorithm/KeyAlgorithmInterface.php similarity index 90% rename from src/Util/KeyAlgorithm/KeyAlgorithmInterface.php rename to src/Utils/KeyAlgorithm/KeyAlgorithmInterface.php index c1237f91..c0f38ad1 100644 --- a/src/Util/KeyAlgorithm/KeyAlgorithmInterface.php +++ b/src/Utils/KeyAlgorithm/KeyAlgorithmInterface.php @@ -9,7 +9,7 @@ * @link https://github.com/thephpleague/oauth2-server */ -namespace League\OAuth2\Server\Util\KeyAlgorithm; +namespace League\OAuth2\Server\Utils\KeyAlgorithm; interface KeyAlgorithmInterface { diff --git a/src/Util/RedirectUri.php b/src/Utils/RedirectUri.php similarity index 66% rename from src/Util/RedirectUri.php rename to src/Utils/RedirectUri.php index 848e854a..d00f29cc 100644 --- a/src/Util/RedirectUri.php +++ b/src/Utils/RedirectUri.php @@ -9,7 +9,7 @@ * @link https://github.com/thephpleague/oauth2-server */ -namespace League\OAuth2\Server\Util; +namespace League\OAuth2\Server\Utils; /** * RedirectUri class @@ -21,14 +21,14 @@ class RedirectUri * * @param string $uri The base URI * @param array $params The query string parameters - * @param string $queryDelimeter The query string delimeter (default: "?") + * @param string $queryDelimiter The query string delimiter (default: "?") * * @return string The updated URI */ - public static function make($uri, $params = [], $queryDelimeter = '?') + public static function make($uri, $params = [], $queryDelimiter = '?') { - $uri .= (strstr($uri, $queryDelimeter) === false) ? $queryDelimeter : '&'; + $uri .= (strstr($uri, $queryDelimiter) === false) ? $queryDelimiter : '&'; - return $uri.http_build_query($params); + return $uri . http_build_query($params); } } diff --git a/src/Util/SecureKey.php b/src/Utils/SecureKey.php similarity index 83% rename from src/Util/SecureKey.php rename to src/Utils/SecureKey.php index 95ca56b0..16dc367e 100644 --- a/src/Util/SecureKey.php +++ b/src/Utils/SecureKey.php @@ -9,16 +9,19 @@ * @link http://github.com/php-loep/oauth2-server */ -namespace League\OAuth2\Server\Util; +namespace League\OAuth2\Server\Utils; -use League\OAuth2\Server\Util\KeyAlgorithm\DefaultAlgorithm; -use League\OAuth2\Server\Util\KeyAlgorithm\KeyAlgorithmInterface; +use League\OAuth2\Server\Utils\KeyAlgorithm\DefaultAlgorithm; +use League\OAuth2\Server\Utils\KeyAlgorithm\KeyAlgorithmInterface; /** * SecureKey class */ class SecureKey { + /** + * @var KeyAlgorithmInterface + */ protected static $algorithm; /** diff --git a/src/Utils/ServerAwareTrait.php b/src/Utils/ServerAwareTrait.php new file mode 100644 index 00000000..b25f6379 --- /dev/null +++ b/src/Utils/ServerAwareTrait.php @@ -0,0 +1,38 @@ +server = $server; + + return $this; + } + + /** + * Return the server + * + * @return \League\OAuth2\Server\AbstractServer + */ + protected function getServer() + { + return $this->server; + } +} \ No newline at end of file