Skip to content

Commit

Permalink
Clean up indentation
Browse files Browse the repository at this point in the history
>
> Various text editor switches later I noticed that indentation had become slightly irregular in some places.
> I have cleaned up all space based indentation in favour of tabs (Cake style)
  • Loading branch information
thomseddon committed Nov 29, 2012
1 parent a5cd180 commit 585b39e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 44 deletions.
82 changes: 41 additions & 41 deletions Controller/Component/OAuthComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ class OAuthComponent extends Component implements IOAuth2Storage, IOAuth2Refresh
* @var array
*/
protected $_authDefaults = array(
'userModel' => 'User',
'fields' => array('username' => 'username', 'password' => 'password')
);
'userModel' => 'User',
'fields' => array('username' => 'username', 'password' => 'password')
);

/**
* AuthCode object.
Expand Down Expand Up @@ -179,8 +179,8 @@ public function startup(Controller $controller) {

$this->authenticate = Hash::merge($this->_authDefaults, $this->authenticate);
$this->User = ClassRegistry::init(array(
'class' => $this->authenticate['userModel'],
'alias' => $this->authenticate['userModel']
'class' => $this->authenticate['userModel'],
'alias' => $this->authenticate['userModel']
));

$isMissingAction = (
Expand Down Expand Up @@ -297,13 +297,13 @@ public function deny($action = null) {
public function user($field = null, $token = null) {
if (!$this->_user) {
$this->AccessToken->bindModel(array(
'belongsTo' => array(
'belongsTo' => array(
'User' => array(
'className' => $this->authenticate['userModel'],
'foreignKey' => 'user_id'
)
'className' => $this->authenticate['userModel'],
'foreignKey' => 'user_id'
)
)
));
));
$token = empty($token) ? $this->getBearerToken() : $token;
$data = $this->AccessToken->find('first', array(
'conditions' => array('oauth_token' => self::hash($token)),
Expand Down Expand Up @@ -403,8 +403,8 @@ public function checkClientCredentials($client_id, $client_secret = NULL) {
$conditions['client_secret'] = self::hash($client_secret);
}
$client = $this->Client->find('first', array(
'conditions' => $conditions,
'recursive' => -1
'conditions' => $conditions,
'recursive' => -1
));
if ($client){
return $client['Client'];
Expand All @@ -423,9 +423,9 @@ public function checkClientCredentials($client_id, $client_secret = NULL) {
*/
public function getClientDetails($client_id) {
$client = $this->Client->find('first', array(
'conditions' => array('client_id' => $client_id),
'fields' => array('client_id', 'redirect_uri'),
'recursive' => -1
'conditions' => array('client_id' => $client_id),
'fields' => array('client_id', 'redirect_uri'),
'recursive' => -1
));
if ($client) {
return $client['Client'];
Expand All @@ -444,8 +444,8 @@ public function getClientDetails($client_id) {
*/
public function getAccessToken($oauth_token) {
$accessToken = $this->AccessToken->find('first', array(
'conditions' => array('oauth_token' => self::hash($oauth_token)),
'recursive' => -1,
'conditions' => array('oauth_token' => self::hash($oauth_token)),
'recursive' => -1,
));
if ($accessToken) {
return $accessToken['AccessToken'];
Expand All @@ -467,11 +467,11 @@ public function getAccessToken($oauth_token) {
*/
public function setAccessToken($oauth_token, $client_id, $user_id, $expires, $scope = NULL) {
$data = array(
'oauth_token' => $oauth_token,
'client_id' => $client_id,
'user_id' => $user_id,
'expires' => $expires,
'scope' => $scope
'oauth_token' => $oauth_token,
'client_id' => $client_id,
'user_id' => $user_id,
'expires' => $expires,
'scope' => $scope
);
$this->AccessToken->create();
return $this->AccessToken->save(array('AccessToken' => $data));
Expand Down Expand Up @@ -500,8 +500,8 @@ public function checkRestrictedGrantType($client_id, $grant_type) {
*/
public function getRefreshToken($refresh_token) {
$refreshToken = $this->RefreshToken->find('first', array(
'conditions' => array('refresh_token' => self::hash($refresh_token)),
'recursive' => -1
'conditions' => array('refresh_token' => self::hash($refresh_token)),
'recursive' => -1
));
if ($refreshToken) {
return $refreshToken['RefreshToken'];
Expand All @@ -524,11 +524,11 @@ public function getRefreshToken($refresh_token) {
*/
public function setRefreshToken($refresh_token, $client_id, $user_id, $expires, $scope = NULL) {
$data = array(
'refresh_token' => $refresh_token,
'client_id' => $client_id,
'user_id' => $user_id,
'expires' => $expires,
'scope' => $scope
'refresh_token' => $refresh_token,
'client_id' => $client_id,
'user_id' => $user_id,
'expires' => $expires,
'scope' => $scope
);
$this->RefreshToken->create();
return $this->RefreshToken->save(array('RefreshToken' => $data));
Expand Down Expand Up @@ -557,11 +557,11 @@ public function unsetRefreshToken($refresh_token) {
*/
public function checkUserCredentials($client_id, $username, $password) {
$user = $this->User->find('first', array(
'conditions' => array(
$this->authenticate['fields']['username'] => $username,
$this->authenticate['fields']['password'] => AuthComponent::password($password)
'conditions' => array(
$this->authenticate['fields']['username'] => $username,
$this->authenticate['fields']['password'] => AuthComponent::password($password)
),
'recursive' => -1
'recursive' => -1
));
if ($user) {
return array('user_id' => $user['User'][$this->User->primaryKey]);
Expand All @@ -579,8 +579,8 @@ public function checkUserCredentials($client_id, $username, $password) {
*/
public function getAuthCode($code) {
$authCode = $this->AuthCode->find('first', array(
'conditions' => array('code' => self::hash($code)),
'recursive' => -1
'conditions' => array('code' => self::hash($code)),
'recursive' => -1
));
if ($authCode) {
return $authCode['AuthCode'];
Expand All @@ -603,12 +603,12 @@ public function getAuthCode($code) {
*/
public function setAuthCode($code, $client_id, $user_id, $redirect_uri, $expires, $scope = NULL) {
$data = array(
'code' => $code,
'client_id' => $client_id,
'user_id' => $user_id,
'redirect_uri' => $redirect_uri,
'expires' => $expires,
'scope' => $scope
'code' => $code,
'client_id' => $client_id,
'user_id' => $user_id,
'redirect_uri' => $redirect_uri,
'expires' => $expires,
'scope' => $scope
);
$this->AuthCode->create();
return $this->AuthCode->save(array('AuthCode' => $data));
Expand Down
2 changes: 1 addition & 1 deletion Controller/OAuthAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @author Thom
*/
class OAuthAppController extends AppController {
//put your code here
//put your code here
}

?>
3 changes: 1 addition & 2 deletions Model/OAuthAppModel.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?php


/**
* Description of OAuthAppModel
*
* @author Thom
*/
class OAuthAppModel extends AppModel {
//put your code here
//put your code here
}

?>

0 comments on commit 585b39e

Please sign in to comment.