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,7 +11,6 @@
namespace League\OAuth2\Server; namespace League\OAuth2\Server;
use League\OAuth2\Server\Exception;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
@@ -41,6 +40,7 @@ abstract class AbstractServer
public function setRequest(Request $request) public function setRequest(Request $request)
{ {
$this->request = $request; $this->request = $request;
return $this; return $this;
} }
@@ -69,6 +69,7 @@ abstract class AbstractServer
'The `'.$obj.'` storage interface has not been registered with the server' 'The `'.$obj.'` storage interface has not been registered with the server'
); );
} }
return $this->storages[$obj]; return $this->storages[$obj];
} }
} }

View File

@@ -11,10 +11,7 @@
namespace League\OAuth2\Server; namespace League\OAuth2\Server;
use League\OAuth2\Server\Util\SecureKey;
use League\OAuth2\Server\Grant\GrantTypeInterface; use League\OAuth2\Server\Grant\GrantTypeInterface;
use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Storage\StorageWrapper;
use League\OAuth2\Server\Storage\ClientInterface; use League\OAuth2\Server\Storage\ClientInterface;
use League\OAuth2\Server\Storage\AccessTokenInterface; use League\OAuth2\Server\Storage\AccessTokenInterface;
use League\OAuth2\Server\Storage\AuthCodeInterface; use League\OAuth2\Server\Storage\AuthCodeInterface;
@@ -78,6 +75,7 @@ class AuthorizationServer extends AbstractServer
public function __construct() public function __construct()
{ {
$this->storages = []; $this->storages = [];
return $this; return $this;
} }
@@ -90,6 +88,7 @@ class AuthorizationServer extends AbstractServer
{ {
$storage->setServer($this); $storage->setServer($this);
$this->storages['client'] = $storage; $this->storages['client'] = $storage;
return $this; return $this;
} }
@@ -102,6 +101,7 @@ class AuthorizationServer extends AbstractServer
{ {
$storage->setServer($this); $storage->setServer($this);
$this->storages['session'] = $storage; $this->storages['session'] = $storage;
return $this; return $this;
} }
@@ -114,6 +114,7 @@ class AuthorizationServer extends AbstractServer
{ {
$storage->setServer($this); $storage->setServer($this);
$this->storages['access_token'] = $storage; $this->storages['access_token'] = $storage;
return $this; return $this;
} }
@@ -126,6 +127,7 @@ class AuthorizationServer extends AbstractServer
{ {
$storage->setServer($this); $storage->setServer($this);
$this->storages['refresh_token'] = $storage; $this->storages['refresh_token'] = $storage;
return $this; return $this;
} }
@@ -138,6 +140,7 @@ class AuthorizationServer extends AbstractServer
{ {
$storage->setServer($this); $storage->setServer($this);
$this->storages['auth_code'] = $storage; $this->storages['auth_code'] = $storage;
return $this; return $this;
} }
@@ -150,6 +153,7 @@ class AuthorizationServer extends AbstractServer
{ {
$storage->setServer($this); $storage->setServer($this);
$this->storages['scope'] = $storage; $this->storages['scope'] = $storage;
return $this; return $this;
} }
@@ -204,6 +208,7 @@ class AuthorizationServer extends AbstractServer
public function requireScopeParam($require = true) public function requireScopeParam($require = true)
{ {
$this->requireScopeParam = $require; $this->requireScopeParam = $require;
return $this; return $this;
} }
@@ -224,6 +229,7 @@ class AuthorizationServer extends AbstractServer
public function setDefaultScope($default = null) public function setDefaultScope($default = null)
{ {
$this->defaultScope = $default; $this->defaultScope = $default;
return $this; return $this;
} }
@@ -254,6 +260,7 @@ class AuthorizationServer extends AbstractServer
public function requireStateParam($require = true) public function requireStateParam($require = true)
{ {
$this->requireStateParam = $require; $this->requireStateParam = $require;
return $this; return $this;
} }
@@ -273,6 +280,7 @@ class AuthorizationServer extends AbstractServer
public function setScopeDelimeter($scopeDelimeter = ' ') public function setScopeDelimeter($scopeDelimeter = ' ')
{ {
$this->scopeDelimeter = $scopeDelimeter; $this->scopeDelimeter = $scopeDelimeter;
return $this; return $this;
} }
@@ -292,6 +300,7 @@ class AuthorizationServer extends AbstractServer
public function setAccessTokenTTL($accessTokenTTL = 3600) public function setAccessTokenTTL($accessTokenTTL = 3600)
{ {
$this->accessTokenTTL = $accessTokenTTL; $this->accessTokenTTL = $accessTokenTTL;
return $this; return $this;
} }

View File

@@ -11,9 +11,7 @@
namespace League\OAuth2\Server\Entity; namespace League\OAuth2\Server\Entity;
use League\OAuth2\Server\Storage\SessionStorageInterface;
use League\OAuth2\Server\Util\SecureKey; use League\OAuth2\Server\Util\SecureKey;
use League\OAuth2\Server\Exception\ServerException;
use League\OAuth2\Server\AbstractServer; use League\OAuth2\Server\AbstractServer;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
@@ -60,6 +58,7 @@ abstract class AbstractTokenEntity
public function __construct(AbstractServer $server) public function __construct(AbstractServer $server)
{ {
$this->server = $server; $this->server = $server;
return $this; return $this;
} }
@@ -71,6 +70,7 @@ abstract class AbstractTokenEntity
public function setSession(SessionEntity $session) public function setSession(SessionEntity $session)
{ {
$this->session = $session; $this->session = $session;
return $this; return $this;
} }
@@ -82,6 +82,7 @@ abstract class AbstractTokenEntity
public function setExpireTime($expireTime) public function setExpireTime($expireTime)
{ {
$this->expireTime = $expireTime; $this->expireTime = $expireTime;
return $this; return $this;
} }
@@ -102,6 +103,7 @@ abstract class AbstractTokenEntity
public function setToken($token = null) public function setToken($token = null)
{ {
$this->token = ($token !== null) ? $token : SecureKey::generate(); $this->token = ($token !== null) ? $token : SecureKey::generate();
return $this; return $this;
} }
@@ -141,6 +143,7 @@ abstract class AbstractTokenEntity
$scopes[$scope->getId()] = $scope; $scopes[$scope->getId()] = $scope;
} }
} }
return $scopes; return $scopes;
} }

View File

@@ -11,12 +11,6 @@
namespace League\OAuth2\Server\Entity; 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 * Access token entity class
*/ */
@@ -33,6 +27,7 @@ class AccessTokenEntity extends AbstractTokenEntity
} }
$this->session = $this->server->getStorage('session')->getByAccessToken($this); $this->session = $this->server->getStorage('session')->getByAccessToken($this);
return $this->session; return $this->session;
} }

View File

@@ -11,12 +11,6 @@
namespace League\OAuth2\Server\Entity; 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 * Access token entity class
*/ */
@@ -36,6 +30,7 @@ class AuthCodeEntity extends AbstractTokenEntity
public function setRedirectUri($redirectUri) public function setRedirectUri($redirectUri)
{ {
$this->redirectUri = $redirectUri; $this->redirectUri = $redirectUri;
return $this; return $this;
} }
@@ -58,6 +53,7 @@ class AuthCodeEntity extends AbstractTokenEntity
{ {
$uri = $this->getRedirectUri(); $uri = $this->getRedirectUri();
$uri .= (strstr($this->getRedirectUri(), $queryDelimeter) === false) ? $queryDelimeter : '&'; $uri .= (strstr($this->getRedirectUri(), $queryDelimeter) === false) ? $queryDelimeter : '&';
return $uri.http_build_query([ return $uri.http_build_query([
'code' => $this->getToken(), 'code' => $this->getToken(),
'state' => $state 'state' => $state
@@ -74,6 +70,7 @@ class AuthCodeEntity extends AbstractTokenEntity
} }
$this->session = $this->server->getStorage('session')->getByAuthCode($this); $this->session = $this->server->getStorage('session')->getByAuthCode($this);
return $this->session; return $this->session;
} }

View File

@@ -11,7 +11,6 @@
namespace League\OAuth2\Server\Entity; namespace League\OAuth2\Server\Entity;
use League\OAuth2\Server\Exception\ServerException;
use League\OAuth2\Server\AbstractServer; use League\OAuth2\Server\AbstractServer;
/** /**
@@ -57,6 +56,7 @@ class ClientEntity
public function __construct(AbstractServer $server) public function __construct(AbstractServer $server)
{ {
$this->server = $server; $this->server = $server;
return $this; return $this;
} }
@@ -68,6 +68,7 @@ class ClientEntity
public function setId($id) public function setId($id)
{ {
$this->id = $id; $this->id = $id;
return $this; return $this;
} }
@@ -88,6 +89,7 @@ class ClientEntity
public function setSecret($secret) public function setSecret($secret)
{ {
$this->secret = $secret; $this->secret = $secret;
return $this; return $this;
} }
@@ -108,6 +110,7 @@ class ClientEntity
public function setName($name) public function setName($name)
{ {
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
@@ -128,6 +131,7 @@ class ClientEntity
public function setRedirectUri($redirectUri) public function setRedirectUri($redirectUri)
{ {
$this->redirectUri = $redirectUri; $this->redirectUri = $redirectUri;
return $this; return $this;
} }

View File

@@ -11,12 +11,6 @@
namespace League\OAuth2\Server\Entity; 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 * Refresh token entity class
*/ */
@@ -36,6 +30,7 @@ class RefreshTokenEntity extends AbstractTokenEntity
public function setAccessToken(AccessTokenEntity $accessToken) public function setAccessToken(AccessTokenEntity $accessToken)
{ {
$this->accessToken = $accessToken; $this->accessToken = $accessToken;
return $this; return $this;
} }
@@ -48,6 +43,7 @@ class RefreshTokenEntity extends AbstractTokenEntity
if (! $this->accessToken instanceof AccessTokenEntity) { if (! $this->accessToken instanceof AccessTokenEntity) {
$this->accessToken = $this->server->getStorage('access_token')->getByRefreshToken($this); $this->accessToken = $this->server->getStorage('access_token')->getByRefreshToken($this);
} }
return $this->accessToken; return $this->accessToken;
} }

View File

@@ -11,7 +11,6 @@
namespace League\OAuth2\Server\Entity; namespace League\OAuth2\Server\Entity;
use League\OAuth2\Server\Exception\ServerException;
use League\OAuth2\Server\AbstractServer; use League\OAuth2\Server\AbstractServer;
/** /**
@@ -45,6 +44,7 @@ class ScopeEntity
public function __construct(AbstractServer $server) public function __construct(AbstractServer $server)
{ {
$this->server = $server; $this->server = $server;
return $this; return $this;
} }
@@ -56,6 +56,7 @@ class ScopeEntity
public function setId($id) public function setId($id)
{ {
$this->id = $id; $this->id = $id;
return $this; return $this;
} }
@@ -76,6 +77,7 @@ class ScopeEntity
public function setDescription($description) public function setDescription($description)
{ {
$this->description = $description; $this->description = $description;
return $this; return $this;
} }

View File

@@ -11,9 +11,6 @@
namespace League\OAuth2\Server\Entity; 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 League\OAuth2\Server\AbstractServer;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
@@ -84,6 +81,7 @@ class SessionEntity
public function __construct(AbstractServer $server) public function __construct(AbstractServer $server)
{ {
$this->server = $server; $this->server = $server;
return $this; return $this;
} }
@@ -95,6 +93,7 @@ class SessionEntity
public function setId($id) public function setId($id)
{ {
$this->id = $id; $this->id = $id;
return $this; return $this;
} }
@@ -163,6 +162,7 @@ class SessionEntity
} }
} }
} }
return $scopes; return $scopes;
} }
@@ -174,6 +174,7 @@ class SessionEntity
public function associateAccessToken(AccessTokenEntity $accessToken) public function associateAccessToken(AccessTokenEntity $accessToken)
{ {
$this->accessToken = $accessToken; $this->accessToken = $accessToken;
return $this; return $this;
} }
@@ -185,6 +186,7 @@ class SessionEntity
public function associateRefreshToken(RefreshTokenEntity $refreshToken) public function associateRefreshToken(RefreshTokenEntity $refreshToken)
{ {
$this->refreshToken = $refreshToken; $this->refreshToken = $refreshToken;
return $this; return $this;
} }
@@ -196,6 +198,7 @@ class SessionEntity
public function associateClient(ClientEntity $client) public function associateClient(ClientEntity $client)
{ {
$this->client = $client; $this->client = $client;
return $this; return $this;
} }
@@ -210,6 +213,7 @@ class SessionEntity
} }
$this->client = $this->server->getStorage('client')->getBySession($this); $this->client = $this->server->getStorage('client')->getBySession($this);
return $this->client; return $this->client;
} }

View File

@@ -86,7 +86,6 @@ class OAuthException extends \Exception
} }
} }
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
return $headers; return $headers;
} }
} }

View File

@@ -67,6 +67,7 @@ abstract class AbstractGrant implements GrantTypeInterface
public function setIdentifier($identifier) public function setIdentifier($identifier)
{ {
$this->identifier = $identifier; $this->identifier = $identifier;
return $this; return $this;
} }
@@ -87,6 +88,7 @@ abstract class AbstractGrant implements GrantTypeInterface
public function setAccessTokenTTL($accessTokenTTL) public function setAccessTokenTTL($accessTokenTTL)
{ {
$this->accessTokenTTL = $accessTokenTTL; $this->accessTokenTTL = $accessTokenTTL;
return $this; return $this;
} }
@@ -98,6 +100,7 @@ abstract class AbstractGrant implements GrantTypeInterface
public function setAuthorizationServer(AuthorizationServer $server) public function setAuthorizationServer(AuthorizationServer $server)
{ {
$this->server = $server; $this->server = $server;
return $this; return $this;
} }
@@ -161,6 +164,7 @@ abstract class AbstractGrant implements GrantTypeInterface
$scopes[$scope->getId()] = $scope; $scopes[$scope->getId()] = $scope;
} }
} }
return $scopes; return $scopes;
} }

View File

@@ -11,19 +11,14 @@
namespace League\OAuth2\Server\Grant; namespace League\OAuth2\Server\Grant;
use League\OAuth2\Server\AuthorizationServer;
use League\OAuth2\Server\Request; use League\OAuth2\Server\Request;
use League\OAuth2\Server\Exception; use League\OAuth2\Server\Exception;
use League\OAuth2\Server\Entity\ClientEntity; use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\RefreshTokenEntity; use League\OAuth2\Server\Entity\RefreshTokenEntity;
use League\OAuth2\Server\Entity\SessionEntity; use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Entity\AccessTokenEntity; use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\Entity\AuthCodeEntity; use League\OAuth2\Server\Entity\AuthCodeEntity;
use League\OAuth2\Server\Util\SecureKey; use League\OAuth2\Server\Util\SecureKey;
use League\OAuth2\Server\Storage\SessionInterface;
use League\OAuth2\Server\Storage\ClientInterface;
use League\OAuth2\Server\Storage\ScopeInterface;
/** /**
* Auth code grant class * Auth code grant class