where('auth_code', $code) ->where('expire_time', '>=', time()) ->get(); if (count($result) === 1) { $token = new AuthCodeEntity($this->server); $token->setToken($result[0]['auth_code']); return $token; } return null; } public function create($token, $$expireTime, $sessionId) { Capsule::table('oauth_auth_codes') ->insert([ 'auth_code' => $token, 'client_redirect_uri' => $redirectUri, 'session_id' => $sessionId, 'expire_time' => $expireTime ]); } /** * {@inheritdoc} */ public function getScopes(AuthCodeEntity $token) { die(var_dump(__METHOD__, func_get_args())); } /** * {@inheritdoc} */ public function associateScope(AuthCodeEntity $token, ScopeEntity $scope) { Capsule::table('oauth_auth_code_scopes') ->insert([ 'auth_code' => $token->getToken(), 'scope' => $scope->getId() ]); } /** * {@inheritdoc} */ public function delete(AuthCodeEntity $token) { die(var_dump(__METHOD__, func_get_args())); } }