Adding a few Getters to the Resource, moving Exceptions and adding some new ones.

This commit is contained in:
Daniel Horrigan 2013-01-17 15:19:01 -05:00
parent c12472857b
commit 2727ba0078
5 changed files with 46 additions and 10 deletions

View File

@ -0,0 +1,8 @@
<?php
namespace OAuth2\Exception;
class InvalidGrantTypeException extends OAuth2Exception
{
}

View File

@ -0,0 +1,8 @@
<?php
namespace OAuth2\Exception;
class MissingAccessTokenException extends OAuth2Exception
{
}

View File

@ -0,0 +1,8 @@
<?php
namespace OAuth2\Exception;
class OAuth2Exception extends \Exception
{
}

View File

@ -1,8 +0,0 @@
<?php
namespace OAuth2;
class MissingAccessTokenException extends \Exception
{
}

View File

@ -60,6 +60,26 @@ class Resource
return $this->request; return $this->request;
} }
/**
* Gets the Owner ID.
*
* @return int
*/
public function getOwnerId()
{
return $this->ownerId;
}
/**
* Gets the Owner Type.
*
* @return string
*/
public function getOwnerType()
{
return $this->ownerId;
}
/** /**
* Checks if the Access Token is valid or not. * Checks if the Access Token is valid or not.
* *
@ -113,7 +133,7 @@ class Resource
* Reads in the Access Token from the headers. * Reads in the Access Token from the headers.
* *
* @return string * @return string
* @throws MissingAccessTokenException * @throws Exception\MissingAccessTokenException
*/ */
protected function determineAccessToken() protected function determineAccessToken()
{ {
@ -125,7 +145,7 @@ class Resource
} }
if (empty($access_token)) { if (empty($access_token)) {
throw new MissingAccessTokenException('Access Token is Missing'); throw new Exception\MissingAccessTokenException('Access Token is Missing');
} }
return $access_token; return $access_token;