Skip to content

Commit

Permalink
Using function instead of class object (#3)
Browse files Browse the repository at this point in the history
* Using array instead of class

* Removed unused PhalconConf class
  • Loading branch information
lucasantarella authored Jul 6, 2016
1 parent fa994c1 commit 5d1cf4b
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 290 deletions.
4 changes: 2 additions & 2 deletions src/OAuth2/Storage/Phalcon/Models/OauthAccessTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function findFirst($parameters = null)
*/
public function initialize()
{
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getAccessTokenTable() . "'");
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['access_token_table'] . "'");
$this->belongsTo('user_id', 'OAuth2\Storage\Phalcon\Models\OauthUsers', 'username', array("alias" => "User"));
$this->belongsTo('client_id', 'OAuth2\Storage\Phalcon\Models\OauthClients', 'client_id', array("alias" => "Client"));
}
Expand All @@ -75,7 +75,7 @@ public function initialize()
*/
public function getSource()
{
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getAccessTokenTable();
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['access_token_table'];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class OauthAuthorizationCodes extends \Phalcon\Mvc\Model
*/
public function getSource()
{
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getCodeTable();
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['code_table'];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/OAuth2/Storage/Phalcon/Models/OauthClients.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static function findFirst($parameters = null)
*/
public function initialize()
{
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getClientTable() . "'");
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['client_table'] . "'");
$this->belongsTo('user_id', 'OAuth2\Storage\Phalcon\Models\OauthUsers', 'username', array("alias" => "User"));
}

Expand All @@ -81,7 +81,7 @@ public function initialize()
*/
public function getSource()
{
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getClientTable();
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['client_table'];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/OAuth2/Storage/Phalcon/Models/OauthJti.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class OauthJti extends \Phalcon\Mvc\Model
*/
public function getSource()
{
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getJtiTable();
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['jti_table'];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/OAuth2/Storage/Phalcon/Models/OauthJwt.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function findFirst($parameters = null)
*/
public function initialize()
{
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getJwtTable() . "'");
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['jwt_table'] . "'");
$this->belongsTo('client_id', 'OAuth2\Storage\Phalcon\Models\OauthClients', 'client_id', array("alias" => "Client"));
}

Expand All @@ -63,7 +63,7 @@ public function initialize()
*/
public function getSource()
{
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getJwtTable();
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['jwt_table'];
}

public function getClient($parameters = null)
Expand Down
4 changes: 2 additions & 2 deletions src/OAuth2/Storage/Phalcon/Models/OauthPublicKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static function findFirst($parameters = null)
*/
public function initialize()
{
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getPublicKeyTable() . "'");
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['public_key_table'] . "'");
$this->belongsTo('client_id', 'OAuth2\Storage\Phalcon\Models\OauthClients', 'client_id', array("alias" => "Client"));
}

Expand All @@ -69,7 +69,7 @@ public function initialize()
*/
public function getSource()
{
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getPublicKeyTable();
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['public_key_table'];
}


Expand Down
4 changes: 2 additions & 2 deletions src/OAuth2/Storage/Phalcon/Models/OauthRefreshTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function findFirst($parameters = null)
*/
public function initialize()
{
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getRefreshTokenTable() . "'");
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['refresh_token_table'] . "'");
$this->belongsTo('user_id', 'OAuth2\Storage\Phalcon\Models\OauthUsers', 'username');
$this->belongsTo('client_id', 'OAuth2\Storage\Phalcon\Models\OauthClients', 'client_id');
}
Expand All @@ -75,6 +75,6 @@ public function initialize()
*/
public function getSource()
{
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getRefreshTokenTable();
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['refresh_token_table'];
}
}
2 changes: 1 addition & 1 deletion src/OAuth2/Storage/Phalcon/Models/OauthScopes.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class OauthScopes extends \Phalcon\Mvc\Model
*/
public function getSource()
{
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getScopeTable();
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['scope_table'];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/OAuth2/Storage/Phalcon/Models/OauthUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static function findFirst($parameters = null)
public function initialize()
{
$this->keepSnapshots(true);
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getUserTable() . "'");
$this->setSource("'" . $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['user_table'] . "'");
$this->hasMany('username', 'OAuth2\Storage\Phalcon\Models\OauthAccessTokens', 'user_id', array("alias" => "AccessTokens"));
$this->hasMany('username', 'OAuth2\Storage\Phalcon\Models\OauthRefreshTokens', 'user_id', array("alias" => "RefreshTokens"));
}
Expand Down Expand Up @@ -113,7 +113,7 @@ public function validation()
*/
public function getSource()
{
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)->getUserTable();
return $this->getDI()->get(Phalcon::KEY_PHALCON_CONFIG_ARRAY)['user_table'];
}

/**
Expand Down
Loading

0 comments on commit 5d1cf4b

Please sign in to comment.