Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tidying up a bit

  • Loading branch information...
commit 85d3c67a8563bf443874255d51a0be59672ab4fa 1 parent ef667c9
Amal Raghav authored
Showing with 24 additions and 24 deletions.
  1. +24 −24 Services/Twitter.php
View
48 Services/Twitter.php
@@ -22,30 +22,30 @@ public function __construct(TwitterOAuth $twitter, Session $session, Request $re
public function getLoginUrl()
{
- /* Get temporary credentials. */
- $requestToken = $this->callbackURL ? $this->twitter->getRequestToken($this->callbackURL) : $this->twitter->getRequestToken();
+ /* Get temporary credentials. */
+ $requestToken = $this->callbackURL ? $this->twitter->getRequestToken($this->callbackURL) : $this->twitter->getRequestToken();
/* Save temporary credentials to session. */
$this->session->set('oauth_token', $requestToken['oauth_token']);
$this->session->set('oauth_token_secret', $requestToken['oauth_token_secret']);
- /* If last connection failed don't display authorization link. */
- switch ($this->twitter->http_code)
+ /* If last connection failed don't display authorization link. */
+ switch ($this->twitter->http_code)
{
- case 200:
- /* Build authorize URL and redirect user to Twitter. */
- $redirectURL = $this->twitter->getAuthorizeURL($requestToken);
- return $redirectURL;
- break;
- default:
- /* return null if something went wrong. */
- return null;
- }
+ case 200:
+ /* Build authorize URL and redirect user to Twitter. */
+ $redirectURL = $this->twitter->getAuthorizeURL($requestToken);
+ return $redirectURL;
+ break;
+ default:
+ /* return null if something went wrong. */
+ return null;
+ }
}
public function getAccessToken()
{
- /* Check if the oauth_token is old */
+ /* Check if the oauth_token is old */
if($this->session->has('oauth_token'))
{
if ($this->session->get('oauth_token') && ($this->session->get('oauth_token') !== $this->request->get('oauth_token')))
@@ -55,8 +55,8 @@ public function getAccessToken()
}
}
- /* Request access tokens from twitter */
- $accessToken = $this->twitter->getAccessToken($this->request->get('oauth_verifier'));
+ /* Request access tokens from twitter */
+ $accessToken = $this->twitter->getAccessToken($this->request->get('oauth_verifier'));
/* Save the access tokens. Normally these would be saved in a database for future use. */
$this->session->set('access_token', $accessToken['oauth_token']);
@@ -66,14 +66,14 @@ public function getAccessToken()
!$this->session->has('oauth_token') ?: $this->session->remove('oauth_token', null);
!$this->session->has('oauth_token_secret') ?: $this->session->remove('oauth_token_secret', null);
- /* If HTTP response is 200 continue otherwise send to connect page to retry */
- if (200 == $this->twitter->http_code)
+ /* If HTTP response is 200 continue otherwise send to connect page to retry */
+ if (200 == $this->twitter->http_code)
{
- /* The user has been verified and the access tokens can be saved for future use */
- return $accessToken;
- }
-
- /* Return null for failure */
- return null;
+ /* The user has been verified and the access tokens can be saved for future use */
+ return $accessToken;
+ }
+
+ /* Return null for failure */
+ return null;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.