Skip to content

Commit

Permalink
Fix PSR-2 compliance / Make comments less grating
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgraham committed Sep 23, 2020
1 parent 9b9d80e commit 485ff49
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 112 deletions.
6 changes: 3 additions & 3 deletions developer-ref-extend-hybridauth.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ final class MyCustomProvider extends OAuth2

/* optional: determine how exchange Authorization Code with an Access Token */
$this->tokenExchangeParameters = [
'client_id' => $this->clientId,
'grant_type' => 'authorization_code',
'redirect_uri' => $this->endpoint
'client_id' => $this->clientId,
'grant_type' => 'authorization_code',
'redirect_uri' => $this->endpoint
];
$this->tokenExchangeMethod = 'POST';
$this->tokenExchangeHeaders = ['Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret)];
Expand Down
24 changes: 12 additions & 12 deletions developer-ref-migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ $config = [
'Twitter' => [
'enabled' => true,
'keys' => [
'key' => '...',
'key' => '...',
'secret' => '...',
],
],
'Google' => ['enabled' => true, 'keys' => ['id' => '...', 'secret' => '...']],
'Facebook' => ['enabled' => true, 'keys' => ['id' => '...', 'secret' => '...']],
'Google' => ['enabled' => true, 'keys' => ['id' => '...', 'secret' => '...']],
'Facebook' => ['enabled' => true, 'keys' => ['id' => '...', 'secret' => '...']],
],
];
</pre>
Expand All @@ -52,12 +52,12 @@ $config = [
'Twitter' => [
'enabled' => true,
'keys' => [
'key' => '...',
'key' => '...',
'secret' => '...',
],
],
'Google' => ['enabled' => true, 'keys' => ['id' => '...', 'secret' => '...']],
'Facebook' => ['enabled' => true, 'keys' => ['id' => '...', 'secret' => '...']],
'Google' => ['enabled' => true, 'keys' => ['id' => '...', 'secret' => '...']],
'Facebook' => ['enabled' => true, 'keys' => ['id' => '...', 'secret' => '...']],
],
];
</pre>
Expand Down Expand Up @@ -101,11 +101,11 @@ $userProfile = $adapter->getUserProfile();
$hybridauth = new Hybrid_Auth($config);
$adapter = $hybridauth->authenticate('GitHub');

//Access GitHub API to retrieve the user's public gists.
//See: https://developer.github.com/v3/gists/
// Access GitHub API to retrieve the user's public gists.
// See: https://developer.github.com/v3/gists/
$apiResponse = $adapter->api()->get('gists'); // or absolute url: https://api.github.com/gists

//Inspect API's response.
// Inspect API's response.
var_dump($apiResponse);
</pre>

Expand All @@ -116,11 +116,11 @@ var_dump($apiResponse);
$hybridauth = new Hybridauth\Hybridauth($config);
$adapter = $hybridauth->authenticate('GitHub');

//Access GitHub API to retrieve the user's public gists.
//See: https://developer.github.com/v3/gists/
// Access GitHub API to retrieve the user's public gists.
// See: https://developer.github.com/v3/gists/
$apiResponse = $adapter->apiRequest('gists'); // or absolute url: https://api.github.com/gists

//Inspect API's response.
// Inspect API's response.
var_dump($apiResponse);
</pre>

Expand Down
34 changes: 17 additions & 17 deletions developer-ref-providers-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ Parameter | Type | Description
Below is a simple example of how to access GitHub's API.

<pre>
//Instantiate GitHub's adapter
// Instantiate GitHub's adapter
$github = new Hybridauth\Provider\GitHub($config);

//Authenticate the user
// Authenticate the user
$github->authenticate();

//Access GitHub API to retrieve the user's public gists.
//See: https://developer.github.com/v3/gists/
// Access GitHub API to retrieve the user's public gists.
// See: https://developer.github.com/v3/gists/
$apiResponse = $github->apiRequest('gists'); // or absolute url: https://api.github.com/gists

//Inspect API's response.
// Inspect API's response.
var_dump($apiResponse);
</pre>

Expand All @@ -50,17 +50,17 @@ var_dump($apiResponse);
Another simple example of how to access Twitter's API.

<pre>
//Instantiate Twitter's adapter
// Instantiate Twitter's adapter
$twitter = new Hybridauth\Provider\Twitter($config);

//Authenticate the user
// Authenticate the user
$twitter->authenticate();

//Access Twitter's API to post a status update
//See: https://dev.twitter.com/rest/reference/post/statuses/update
// Access Twitter's API to post a status update
// See: https://dev.twitter.com/rest/reference/post/statuses/update
$apiResponse = $twitter->apiRequest('statuses/update.json', 'POST', ['status' => 'This is tests!']);

//Inspect API's response.
// Inspect API's response.
var_dump($apiResponse);
</pre>

Expand All @@ -69,25 +69,25 @@ var_dump($apiResponse);
Below is an example for uploading a video to a Facebook Page.

<pre>
//Instantiate Facebook's adapter
// Instantiate Facebook's adapter
$facebook = new Hybridauth\Provider\Facebook($config);

//Authenticate the user
// Authenticate the user
$facebook->authenticate();

//Access Facebook's API to post a video
//See: https://developers.facebook.com/docs/graph-api/video-uploads/
// Access Facebook's API to post a video
// See: https://developers.facebook.com/docs/graph-api/video-uploads/
$facebook->apiRequest('https://graph-video.facebook.com/PAGE_ID/videos',
'POST',
[
'title' => $videoTitle,
'title' => $videoTitle,
'description' => $videoDescription,
'source' => new \CURLFile($videoPath),
'source' => new \CURLFile($videoPath),
],
[],
true
);

//Inspect API's response.
// Inspect API's response.
var_dump($apiResponse);
</pre>
10 changes: 5 additions & 5 deletions developer-ref-user-activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ To know more about providers capabilities, refer to [Supported Providers](provid
**Usage :**

<pre>
//Instantiate Twitter Adapter
// Instantiate Twitter Adapter
$twitter = new Hybridauth\Provider\Twitter($config);

//Sign in with twitter.
// Sign in with twitter.
$twitter->authenticate();

//Retrieve User's latest tweets.
$timeline = $adapter->getUserActivity('me'); //Returns an array of Hybridauth\User\Activity objects.
// Retrieve User's latest tweets.
$timeline = $adapter->getUserActivity('me'); // Returns an array of Hybridauth\User\Activity objects.

//Iterate over the user's timeline.
// Iterate over the user's timeline.
foreach ($timeline as $item) {
echo $item->user->displayName . ': ' . $item->text . "\n";
}
Expand Down
36 changes: 18 additions & 18 deletions developer-ref-user-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ $config = [
* these you'll have to register an application on provider's site. In the case of Google for instance you can refer to
* https://support.google.com/cloud/answer/6158849
*/
'keys' => [
'id' => 'your-google-client-id',
'keys' => [
'id' => 'your-google-client-id',
'secret' => 'your-google-client-secret'
],

Expand Down Expand Up @@ -73,10 +73,10 @@ $config = [
*/
'authorize_url_parameters' => [
'approval_prompt' => 'force',
'access_type' => 'offline',
'hd' => ..,
'state' => ..,
//And so on.
'access_type' => 'offline',
'hd' => ..,
'state' => ..,
// And so on.
],

/**
Expand All @@ -96,17 +96,17 @@ $config = [
* For more information, refer to: http://www.php.net/manual/function.curl-setopt.php
*/
'curl_options' => [
//Set a custom certificate
// Set a custom certificate
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_CAINFO => '/path/to/your/certificate.crt',
CURLOPT_CAINFO => '/path/to/your/certificate.crt',

//Set a valid proxy address
CURLOPT_PROXY => '8.8.8.8',
// Set a valid proxy address
CURLOPT_PROXY => '8.8.8.8',

//Set a custom user agent
CURLOPT_USERAGENT => 'User Agent String'
// Set a custom user agent
CURLOPT_USERAGENT => 'User Agent String'

//And so on.
// And so on.
]
];

Expand Down Expand Up @@ -155,14 +155,14 @@ Authenticating a user using access tokens is a similar to normal way of signing
*/
$config = [
/**
* Location where to redirect users once they authenticate with Google
*/
* Location where to redirect users once they authenticate with Google
*/
'callback' => 'http://localhost/path/to/this/script.php',

/**
* Your Google application credentials
*/
'keys' => [ 'id' => 'your-google-client-id', 'secret' => 'your-google-client-secret' ],
* Your Google application credentials
*/
'keys' => ['id' => 'your-google-client-id', 'secret' => 'your-google-client-secret'],
];

/**
Expand Down
10 changes: 5 additions & 5 deletions developer-ref-user-contacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ To know more about providers capabilities, refer to [Supported Providers](provid
**Usage :**

<pre>
//Instantiate Google Adapter.
// Instantiate Google Adapter.
$google = new Hybridauth\Provider\Google($config);

//Sign in with google.
// Sign in with google.
$google->authenticate();

//Retrieve User's contacts.
$userContacts = $google->getUserContacts(); //Returns an array of Hybridauth\User\Contact objects.
// Retrieve User's contacts.
$userContacts = $google->getUserContacts(); // Returns an array of Hybridauth\User\Contact objects.

//Iterate over the user contacts list.
// Iterate over the user contacts list.
foreach ($userContacts as $contact) {
echo $contact->displayName . ' ' . $contact->profileURL . "\n";
}
Expand Down
10 changes: 5 additions & 5 deletions developer-ref-user-profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ Hybridauth was able to pull from the given API or authentication provider.
**Sample :**

<pre>
//Instantiate Github Adapter.
// Instantiate Github Adapter.
$github = new Hybridauth\Provider\GitHub($config);

//Authenticate using Github.
// Authenticate using Github.
$github->authenticate();

//Retrieve User's profile.
$userProfile = $github->getUserProfile(); //Returns an instance of class Hybridauth\User\Profile.
// Retrieve User's profile.
$userProfile = $github->getUserProfile(); // Returns an instance of class Hybridauth\User\Profile.

//Access User's dispaly name.
// Access User's dispaly name.
echo 'Hi ' . $userProfile->displayName;
</pre>

Expand Down
2 changes: 1 addition & 1 deletion developer-ref-user-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ $facebook->authenticate();
// Update the user status.
$facebook->setUserStatus([
'message' => 'Hello world!',
'link' => 'https://example.com/link/to/page',
'link' => 'https://example.com/link/to/page',
]);
</pre>

Expand Down
12 changes: 6 additions & 6 deletions install.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ class files can be loaded automatically.
In case you're using Composer, include its autoloader `vendor/autoload.php` at the top of your script. That autoloader script is generated by Composer for your project and it should be able to locate Hybridauth source code and auto-load all the required classes.

<pre>
//Include Composer's autoloader
// Include Composer's autoloader
include 'vendor/autoload.php';

//Import Hybridauth's namespace
// Import Hybridauth's namespace
use Hybridauth\Hybridauth;

//Now we may proceed and instantiate Hybridauth's classes
// Now we may proceed and instantiate Hybridauth's classes
$instance = new Hybridauth([ /* ... */ ]);
</pre>

Expand All @@ -78,11 +78,11 @@ $instance = new Hybridauth([ /* ... */ ]);
Alternatively, and in case you opted to install Hybridauth manually, the library comes bundled with a basic autoloader which can be found inside its source folder `src/autoload.php` and it should function in a similar way to Composer's.

<pre>
//Include Hybridauth's basic autoloader
// Include Hybridauth's basic autoloader
include 'hybridauth/src/autoload.php';

//Import Hybridauth's namespace
// Import Hybridauth's namespace
use Hybridauth\Hybridauth;

//And so on
// And so on
</pre>
Loading

0 comments on commit 485ff49

Please sign in to comment.