CS fixer changes

This commit is contained in:
Alex Bilbie
2014-05-03 10:53:43 +01:00
parent 193018aecf
commit 97e7a00bca
12 changed files with 96 additions and 87 deletions

View File

@@ -11,9 +11,7 @@
namespace League\OAuth2\Server\Entity;
use League\OAuth2\Server\Storage\SessionStorageInterface;
use League\OAuth2\Server\Util\SecureKey;
use League\OAuth2\Server\Exception\ServerException;
use League\OAuth2\Server\AbstractServer;
use Symfony\Component\HttpFoundation\ParameterBag;
@@ -54,34 +52,37 @@ abstract class AbstractTokenEntity
/**
* __construct
* @param \League\OAuth2\Server\AbstractServer $server
* @param \League\OAuth2\Server\AbstractServer $server
* @return self
*/
public function __construct(AbstractServer $server)
{
$this->server = $server;
return $this;
}
/**
* Set session
* @param \League\OAuth2\Server\SessionEntity $session
* @param \League\OAuth2\Server\SessionEntity $session
* @return self
*/
public function setSession(SessionEntity $session)
{
$this->session = $session;
return $this;
}
/**
* Set the expire time of the token
* @param integer $expireTime Unix time stamp
* @param integer $expireTime Unix time stamp
* @return self
*/
public function setExpireTime($expireTime)
{
$this->expireTime = $expireTime;
return $this;
}
@@ -96,12 +97,13 @@ abstract class AbstractTokenEntity
/**
* Set access token ID
* @param string $token Token ID
* @param string $token Token ID
* @return self
*/
public function setToken($token = null)
{
$this->token = ($token !== null) ? $token : SecureKey::generate();
return $this;
}
@@ -116,7 +118,7 @@ abstract class AbstractTokenEntity
/**
* Associate a scope
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope
* @return self
*/
public function associateScope(ScopeEntity $scope)
@@ -141,6 +143,7 @@ abstract class AbstractTokenEntity
$scopes[$scope->getId()] = $scope;
}
}
return $scopes;
}

View File

@@ -11,12 +11,6 @@
namespace League\OAuth2\Server\Entity;
use League\OAuth2\Server\Storage\SessionStorageInterface;
use League\OAuth2\Server\Storage\AccessTokenInterface;
use League\OAuth2\Server\Util\SecureKey;
use League\OAuth2\Server\Exception\InvalidAccessTokenException;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
* Access token entity class
*/
@@ -33,12 +27,13 @@ class AccessTokenEntity extends AbstractTokenEntity
}
$this->session = $this->server->getStorage('session')->getByAccessToken($this);
return $this->session;
}
/**
* Check if access token has an associated scope
* @param string $scope Scope to check
* @param string $scope Scope to check
* @return bool
*/
public function hasScope($scope)

View File

@@ -11,12 +11,6 @@
namespace League\OAuth2\Server\Entity;
use League\OAuth2\Server\Storage\SessionStorageInterface;
use League\OAuth2\Server\Storage\AccessTokenInterface;
use League\OAuth2\Server\Util\SecureKey;
use League\OAuth2\Server\Exception\InvalidAccessTokenException;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
* Access token entity class
*/
@@ -30,18 +24,19 @@ class AuthCodeEntity extends AbstractTokenEntity
/**
* Set the redirect URI for the authorization request
* @param string $redirectUri
* @return self
* @param string $redirectUri
* @return self
*/
public function setRedirectUri($redirectUri)
{
$this->redirectUri = $redirectUri;
return $this;
}
/**
* Get the redirect URI
* @return string
* @return string
*/
public function getRedirectUri()
{
@@ -58,6 +53,7 @@ class AuthCodeEntity extends AbstractTokenEntity
{
$uri = $this->getRedirectUri();
$uri .= (strstr($this->getRedirectUri(), $queryDelimeter) === false) ? $queryDelimeter : '&';
return $uri.http_build_query([
'code' => $this->getToken(),
'state' => $state
@@ -74,6 +70,7 @@ class AuthCodeEntity extends AbstractTokenEntity
}
$this->session = $this->server->getStorage('session')->getByAuthCode($this);
return $this->session;
}

View File

@@ -11,7 +11,6 @@
namespace League\OAuth2\Server\Entity;
use League\OAuth2\Server\Exception\ServerException;
use League\OAuth2\Server\AbstractServer;
/**
@@ -51,23 +50,25 @@ class ClientEntity
/**
* __construct
* @param \League\OAuth2\Server\AbstractServer $server
* @param \League\OAuth2\Server\AbstractServer $server
* @return self
*/
public function __construct(AbstractServer $server)
{
$this->server = $server;
return $this;
}
/**
* Set the client identifier
* @param string $id
* @param string $id
* @return self
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
@@ -82,12 +83,13 @@ class ClientEntity
/**
* Set the client secret
* @param string $secret
* @param string $secret
* @return self
*/
public function setSecret($secret)
{
$this->secret = $secret;
return $this;
}
@@ -102,12 +104,13 @@ class ClientEntity
/**
* Set the client name
* @param string $name
* @param string $name
* @return self
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
@@ -122,12 +125,13 @@ class ClientEntity
/**
* Set the client redirect URI
* @param string $redirectUri
* @param string $redirectUri
* @return self
*/
public function setRedirectUri($redirectUri)
{
$this->redirectUri = $redirectUri;
return $this;
}

View File

@@ -11,12 +11,6 @@
namespace League\OAuth2\Server\Entity;
use League\OAuth2\Server\Storage\SessionStorageInterface;
use League\OAuth2\Server\Storage\RefreshTokenInterface;
use League\OAuth2\Server\Util\SecureKey;
use League\OAuth2\Server\Exception\InvalidAccessTokenException;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
* Refresh token entity class
*/
@@ -30,12 +24,13 @@ class RefreshTokenEntity extends AbstractTokenEntity
/**
* Associate an access token
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken
* @return self
*/
public function setAccessToken(AccessTokenEntity $accessToken)
{
$this->accessToken = $accessToken;
return $this;
}
@@ -48,6 +43,7 @@ class RefreshTokenEntity extends AbstractTokenEntity
if (! $this->accessToken instanceof AccessTokenEntity) {
$this->accessToken = $this->server->getStorage('access_token')->getByRefreshToken($this);
}
return $this->accessToken;
}

View File

@@ -11,7 +11,6 @@
namespace League\OAuth2\Server\Entity;
use League\OAuth2\Server\Exception\ServerException;
use League\OAuth2\Server\AbstractServer;
/**
@@ -39,23 +38,25 @@ class ScopeEntity
/**
* __construct
* @param \League\OAuth2\Server\AbstractServer $server
* @param \League\OAuth2\Server\AbstractServer $server
* @return self
*/
public function __construct(AbstractServer $server)
{
$this->server = $server;
return $this;
}
/**
* Set the scope identifer
* @param string $id The scope identifier
* @param string $id The scope identifier
* @return self
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
@@ -70,12 +71,13 @@ class ScopeEntity
/**
* Set the scope's descripton
* @param string $description
* @param string $description
* @return self
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
@@ -87,4 +89,4 @@ class ScopeEntity
{
return $this->description;
}
}
}

View File

@@ -11,9 +11,6 @@
namespace League\OAuth2\Server\Entity;
use League\OAuth2\Server\Exception\OAuth2Exception;
use League\OAuth2\Server\Storage\SessionInterface;
use League\OAuth2\Server\Exception\ServerException;
use League\OAuth2\Server\AbstractServer;
use Symfony\Component\HttpFoundation\ParameterBag;
@@ -78,23 +75,25 @@ class SessionEntity
/**
* __construct
* @param \League\OAuth2\Server\AbstractServer $server
* @param \League\OAuth2\Server\AbstractServer $server
* @return self
*/
public function __construct(AbstractServer $server)
{
$this->server = $server;
return $this;
}
/**
* Set the session identifier
* @param string $id
* @param string $id
* @return self
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
@@ -109,7 +108,7 @@ class SessionEntity
/**
* Associate a scope
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope
* @return self
*/
public function associateScope(ScopeEntity $scope)
@@ -123,7 +122,7 @@ class SessionEntity
/**
* Check if access token has an associated scope
* @param string $scope Scope to check
* @param string $scope Scope to check
* @return bool
*/
public function hasScope($scope)
@@ -163,6 +162,7 @@ class SessionEntity
}
}
}
return $scopes;
}
@@ -174,6 +174,7 @@ class SessionEntity
public function associateAccessToken(AccessTokenEntity $accessToken)
{
$this->accessToken = $accessToken;
return $this;
}
@@ -185,6 +186,7 @@ class SessionEntity
public function associateRefreshToken(RefreshTokenEntity $refreshToken)
{
$this->refreshToken = $refreshToken;
return $this;
}
@@ -196,6 +198,7 @@ class SessionEntity
public function associateClient(ClientEntity $client)
{
$this->client = $client;
return $this;
}
@@ -210,13 +213,14 @@ class SessionEntity
}
$this->client = $this->server->getStorage('client')->getBySession($this);
return $this->client;
}
/**
* Set the session owner
* @param string $type The type of the owner (e.g. user, app)
* @param string $id The identifier of the owner
* @param string $type The type of the owner (e.g. user, app)
* @param string $id The identifier of the owner
* @return self
*/
public function setOwner($type, $id)