From a561a9d98a20695147361d75deb16252d5016aa5 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 6 May 2013 13:57:46 -0700 Subject: [PATCH] Throw an exception if a grant can't be loaded when called in getGrantType --- src/OAuth2/AuthServer.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/OAuth2/AuthServer.php b/src/OAuth2/AuthServer.php index 24787c6a..e9e302f5 100644 --- a/src/OAuth2/AuthServer.php +++ b/src/OAuth2/AuthServer.php @@ -430,8 +430,12 @@ class AuthServer */ public function getGrantType($grantType) { - return $this->grantTypes[$grantType]; - } + if (isset($this->grantTypes[$grantType])) { + return $this->grantTypes[$grantType]; + } + + throw new Exception\InvalidGrantTypeException(sprintf(self::$exceptionMessages['unsupported_grant_type'], $grantType), 9); + } /** * Get a parameter from passed input parameters or the Request class