Skip to content

Commit ec1bffc

Browse files
committed
PSR-2 code style applied over all code (#23)
1 parent 7ae49ce commit ec1bffc

File tree

211 files changed

+21580
-20224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+21580
-20224
lines changed

examples/amazon.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* @license http://www.opensource.org/licenses/mit-license.html MIT License
1212
*/
1313

14-
use OAuth\OAuth2\Service\Amazon;
15-
use OAuth\Common\Storage\Session;
1614
use OAuth\Common\Consumer\Credentials;
15+
use OAuth\Common\Storage\Session;
16+
use OAuth\OAuth2\Service\Amazon;
1717

1818
/**
1919
* Bootstrap the example
@@ -25,23 +25,22 @@
2525

2626
// Setup the credentials for the requests
2727
$credentials = new Credentials(
28-
$servicesCredentials['amazon']['key'],
29-
$servicesCredentials['amazon']['secret'],
28+
$servicesCredentials[ 'amazon' ][ 'key' ],
29+
$servicesCredentials[ 'amazon' ][ 'secret' ],
3030
$currentUri
3131
);
3232

3333
// Instantiate the Amazon service using the credentials, http client, storage mechanism for the token and profile scope
34-
$amazonService = $serviceFactory->createService('amazon', $credentials, $storage, array(Amazon::SCOPE_PROFILE));
34+
$amazonService = $serviceFactory->createService('amazon', $credentials, $storage, [Amazon::SCOPE_PROFILE]);
3535

3636
if ($amazonService->isGlobalRequestArgumentsPassed()) {
37-
// Retrieve a token and send a request
37+
// Retrieve a token and send a request
3838
$result = $amazonService->retrieveAccessTokenByGlobReqArgs()->requestJSON('/user/profile');
3939

4040
// Show some of the resultant data
41-
echo 'Your unique Amazon user id is: ' . $result['user_id'] . ' and your name is ' . $result['name'];
42-
43-
} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') {
44-
$amazonService->redirectToAuthorizationUri();
41+
echo 'Your unique Amazon user id is: ' . $result[ 'user_id' ] . ' and your name is ' . $result[ 'name' ];
42+
} elseif (!empty($_GET[ 'go' ]) && $_GET[ 'go' ] === 'go') {
43+
$amazonService->redirectToAuthorizationUri();
4544
} else {
46-
echo "<a href='$currentUri?go=go'>Login with Amazon!</a>";
45+
echo "<a href='$currentUri?go=go'>Login with Amazon!</a>";
4746
}

examples/bitbucket.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Example of retrieving an authentication token from the BitBucket service
55
*
66
* PHP version 5.4
7+
*
78
* @author And <and.webdev@gmail.com>
89
* @author Ændrew Rininsland <me@aendrew.com>
910
*
@@ -14,9 +15,9 @@
1415
* @license http://www.opensource.org/licenses/mit-license.html MIT License
1516
*/
1617

17-
use OAuth\OAuth1\Service\BitBucket;
18-
use OAuth\Common\Storage\Session;
1918
use OAuth\Common\Consumer\Credentials;
19+
use OAuth\Common\Storage\Session;
20+
use OAuth\OAuth1\Service\BitBucket;
2021

2122
/**
2223
* Bootstrap the example
@@ -29,8 +30,8 @@
2930

3031
// Setup the credentials for the requests
3132
$credentials = new Credentials(
32-
$servicesCredentials['bitbucket']['key'],
33-
$servicesCredentials['bitbucket']['secret'],
33+
$servicesCredentials[ 'bitbucket' ][ 'key' ],
34+
$servicesCredentials[ 'bitbucket' ][ 'secret' ],
3435
$currentUri
3536
);
3637

@@ -39,12 +40,11 @@
3940
$bbService = $serviceFactory->createService('BitBucket', $credentials, $storage);
4041

4142
if ($bbService->isGlobalRequestArgumentsPassed()) {
42-
$result = $bbService->retrieveAccessTokenByGlobReqArgs()->requestJSON('user/repositories');
43-
44-
echo('The first repo in the list is ' . $result[0]['name']);
43+
$result = $bbService->retrieveAccessTokenByGlobReqArgs()->requestJSON('user/repositories');
4544

46-
} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') {
47-
$bbService->redirectToAuthorizationUri();
45+
echo('The first repo in the list is ' . $result[ 0 ][ 'name' ]);
46+
} elseif (!empty($_GET[ 'go' ]) && $_GET[ 'go' ] === 'go') {
47+
$bbService->redirectToAuthorizationUri();
4848
} else {
49-
echo "<a href='$currentUri?go=go'>Login with BitBucket!</a>";
50-
}
49+
echo "<a href='$currentUri?go=go'>Login with BitBucket!</a>";
50+
}

examples/bitly.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
* @license http://www.opensource.org/licenses/mit-license.html MIT License
1313
*/
1414

15-
use OAuth\OAuth2\Service\Bitly;
16-
use OAuth\Common\Storage\Session;
1715
use OAuth\Common\Consumer\Credentials;
16+
use OAuth\Common\Storage\Session;
17+
use OAuth\OAuth2\Service\Bitly;
1818

1919
/**
2020
* Bootstrap the example
@@ -26,8 +26,8 @@
2626

2727
// Setup the credentials for the requests
2828
$credentials = new Credentials(
29-
$servicesCredentials['bitly']['key'],
30-
$servicesCredentials['bitly']['secret'],
29+
$servicesCredentials[ 'bitly' ][ 'key' ],
30+
$servicesCredentials[ 'bitly' ][ 'secret' ],
3131
$currentUri
3232
);
3333

@@ -36,13 +36,15 @@
3636
$bitlyService = $serviceFactory->createService('bitly', $credentials, $storage);
3737

3838
if ($bitlyService->isGlobalRequestArgumentsPassed()) {
39-
// Retrieve a token and send a request
39+
// Retrieve a token and send a request
4040
$result = $bitlyService->retrieveAccessTokenByGlobReqArgs()->requestJSON('user/info');
4141

4242
// Show some of the resultant data
43-
echo 'Your unique user id is: ' . $result['data']['login'] . ' and your name is ' . $result['data']['display_name'];
44-
45-
} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') {
43+
echo 'Your unique user id is: ' .
44+
$result[ 'data' ][ 'login' ] .
45+
' and your name is ' .
46+
$result[ 'data' ][ 'display_name' ];
47+
} elseif (!empty($_GET[ 'go' ]) && $_GET[ 'go' ] === 'go') {
4648
$bitlyService->redirectToAuthorizationUri();
4749
} else {
4850
echo "<a href='$currentUri?go=go'>Login with Bitly!</a>";

examples/bootstrap.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
function inline_image($rawData)
2626
{
27-
return '<img src="' .
28-
'data:image/'. Gregwar\Image\Image::fromData($rawData)->guessType() .';' .
29-
'base64,' . base64_encode($rawData) .
30-
'">';
27+
return '<img src="' .
28+
'data:image/' . Gregwar\Image\Image::fromData($rawData)->guessType() . ';' .
29+
'base64,' . base64_encode($rawData) .
30+
'">';
3131
}
3232

3333
/**

examples/box.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
* @license http://www.opensource.org/licenses/mit-license.html MIT License
1414
*/
1515

16-
use OAuth\OAuth2\Service\Box;
17-
use OAuth\Common\Storage\Session;
1816
use OAuth\Common\Consumer\Credentials;
17+
use OAuth\Common\Storage\Session;
18+
use OAuth\OAuth2\Service\Box;
1919

2020
/**
2121
* Bootstrap the example
@@ -27,8 +27,8 @@
2727

2828
// Setup the credentials for the requests
2929
$credentials = new Credentials(
30-
$servicesCredentials['box']['key'],
31-
$servicesCredentials['box']['secret'],
30+
$servicesCredentials[ 'box' ][ 'key' ],
31+
$servicesCredentials[ 'box' ][ 'secret' ],
3232
$currentUri
3333
);
3434

@@ -37,14 +37,13 @@
3737
$boxService = $serviceFactory->createService('box', $credentials, $storage);
3838

3939
if ($boxService->isGlobalRequestArgumentsPassed()) {
40-
// Retrieve a token and send a request
41-
$result = $boxService->retrieveAccessTokenByGlobReqArgs()->requestJSON('/users/me');
42-
43-
// Show some of the resultant data
44-
echo 'Your Box name is ' . $result['name'] . ' and your email is ' . $result['login'];
40+
// Retrieve a token and send a request
41+
$result = $boxService->retrieveAccessTokenByGlobReqArgs()->requestJSON('/users/me');
4542

46-
} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') {
47-
$boxService->redirectToAuthorizationUri();
43+
// Show some of the resultant data
44+
echo 'Your Box name is ' . $result[ 'name' ] . ' and your email is ' . $result[ 'login' ];
45+
} elseif (!empty($_GET[ 'go' ]) && $_GET[ 'go' ] === 'go') {
46+
$boxService->redirectToAuthorizationUri();
4847
} else {
49-
echo "<a href='$currentUri?go=go'>Login with Box!</a>";
48+
echo "<a href='$currentUri?go=go'>Login with Box!</a>";
5049
}

examples/buffer.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
* @license http://www.opensource.org/licenses/mit-license.html MIT License
1313
*/
1414

15-
use OAuth\OAuth2\Service\Buffer;
16-
use OAuth\Common\Storage\Session;
1715
use OAuth\Common\Consumer\Credentials;
16+
use OAuth\Common\Storage\Session;
17+
use OAuth\OAuth2\Service\Buffer;
1818

1919
/**
2020
* Bootstrap the example
@@ -26,24 +26,23 @@
2626

2727
// Setup the credentials for the requests
2828
$credentials = new Credentials(
29-
$servicesCredentials['buffer']['key'],
30-
$servicesCredentials['buffer']['secret'],
31-
$currentUri
29+
$servicesCredentials[ 'buffer' ][ 'key' ],
30+
$servicesCredentials[ 'buffer' ][ 'secret' ],
31+
$currentUri
3232
);
3333

3434
// Instantiate the buffer service using the credentials, http client and storage mechanism for the token
3535
/** @var $bufferService buffer */
3636
$bufferService = $serviceFactory->createService('buffer', $credentials, $storage);
3737

3838
if ($bufferService->isGlobalRequestArgumentsPassed()) {
39-
// Retrieve a token and send a request
40-
$result = $bufferService->retrieveAccessTokenByGlobReqArgs()->requestJSON('user.json');
41-
42-
// Show some of the resultant data
43-
echo 'Your unique user id is: ' . $result['id'] . ' and your plan is ' . $result['plan'];
39+
// Retrieve a token and send a request
40+
$result = $bufferService->retrieveAccessTokenByGlobReqArgs()->requestJSON('user.json');
4441

45-
} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') {
46-
$bufferService->redirectToAuthorizationUri();
42+
// Show some of the resultant data
43+
echo 'Your unique user id is: ' . $result[ 'id' ] . ' and your plan is ' . $result[ 'plan' ];
44+
} elseif (!empty($_GET[ 'go' ]) && $_GET[ 'go' ] === 'go') {
45+
$bufferService->redirectToAuthorizationUri();
4746
} else {
48-
echo "<a href='$currentUri?go=go'>Login with buffer!</a>";
47+
echo "<a href='$currentUri?go=go'>Login with buffer!</a>";
4948
}

examples/dailymotion.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* @license http://www.opensource.org/licenses/mit-license.html MIT License
1212
*/
1313

14-
use OAuth\OAuth2\Service\Dailymotion;
15-
use OAuth\Common\Storage\Session;
1614
use OAuth\Common\Consumer\Credentials;
15+
use OAuth\Common\Storage\Session;
16+
use OAuth\OAuth2\Service\Dailymotion;
1717

1818
/**
1919
* Bootstrap the example
@@ -25,24 +25,23 @@
2525

2626
// Setup the credentials for the requests
2727
$credentials = new Credentials(
28-
$servicesCredentials['dailymotion']['key'],
29-
$servicesCredentials['dailymotion']['secret'],
28+
$servicesCredentials[ 'dailymotion' ][ 'key' ],
29+
$servicesCredentials[ 'dailymotion' ][ 'secret' ],
3030
$currentUri->getAbsoluteUri()
3131
);
3232

3333
// Instantiate the Dailymotion service using the credentials, http client, storage mechanism for the token and email scope
3434
/** @var $dailymotionService Dailymotion */
35-
$dailymotionService = $serviceFactory->createService('dailymotion', $credentials, $storage, array(Dailymotion::SCOPE_EMAIL));
35+
$dailymotionService = $serviceFactory->createService('dailymotion', $credentials, $storage, [Dailymotion::SCOPE_EMAIL]);
3636

3737
if ($dailymotionService->isGlobalRequestArgumentsPassed()) {
38-
// Retrieve a token and send a request
39-
$result = $dailymotionService->retrieveAccessTokenByGlobReqArgs()->requestJSON('/me?fields=email,id');
40-
41-
// Show some of the resultant data
42-
echo 'Your unique Dailymotion user id is: ' . $result['id'] . ' and your email is ' . $result['email'];
38+
// Retrieve a token and send a request
39+
$result = $dailymotionService->retrieveAccessTokenByGlobReqArgs()->requestJSON('/me?fields=email,id');
4340

44-
} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') {
45-
$dailymotionService->redirectToAuthorizationUri();
41+
// Show some of the resultant data
42+
echo 'Your unique Dailymotion user id is: ' . $result[ 'id' ] . ' and your email is ' . $result[ 'email' ];
43+
} elseif (!empty($_GET[ 'go' ]) && $_GET[ 'go' ] === 'go') {
44+
$dailymotionService->redirectToAuthorizationUri();
4645
} else {
47-
echo "<a href='$currentUri?go=go'>Login with Dailymotion!</a>";
48-
}
46+
echo "<a href='$currentUri?go=go'>Login with Dailymotion!</a>";
47+
}

examples/devianart.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* @license http://www.opensource.org/licenses/mit-license.html MIT License
1212
*/
1313

14-
use OAuth\OAuth2\Service\DeviantArt;
15-
use OAuth\Common\Storage\Session;
1614
use OAuth\Common\Consumer\Credentials;
15+
use OAuth\Common\Storage\Session;
16+
use OAuth\OAuth2\Service\DeviantArt;
1717

1818
/**
1919
* Bootstrap the example
@@ -25,8 +25,8 @@
2525

2626
// Setup the credentials for the requests
2727
$credentials = new Credentials(
28-
$servicesCredentials['devianart']['key'],
29-
$servicesCredentials['devianart']['secret'],
28+
$servicesCredentials[ 'devianart' ][ 'key' ],
29+
$servicesCredentials[ 'devianart' ][ 'secret' ],
3030
$currentUri
3131
);
3232

@@ -35,14 +35,13 @@
3535
$devianArtService = $serviceFactory->createService('DevianArt', $credentials, $storage, []);
3636

3737
if ($devianArtService->isGlobalRequestArgumentsPassed()) {
38-
// Retrieve a token and send a request
39-
$result = $devianArtService->retrieveAccessTokenByGlobReqArgs()->requestJSON('/user/whoami');
40-
41-
// Show some of the resultant data
42-
echo 'Your DeviantArt username is: ' . $result['username'];
38+
// Retrieve a token and send a request
39+
$result = $devianArtService->retrieveAccessTokenByGlobReqArgs()->requestJSON('/user/whoami');
4340

44-
} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') {
45-
$devianArtService->redirectToAuthorizationUri();
41+
// Show some of the resultant data
42+
echo 'Your DeviantArt username is: ' . $result[ 'username' ];
43+
} elseif (!empty($_GET[ 'go' ]) && $_GET[ 'go' ] === 'go') {
44+
$devianArtService->redirectToAuthorizationUri();
4645
} else {
47-
echo "<a href='$currentUri?go=go'>Login with DeviantArt!</a>";
48-
}
46+
echo "<a href='$currentUri?go=go'>Login with DeviantArt!</a>";
47+
}

examples/dropbox.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* @license http://www.opensource.org/licenses/mit-license.html MIT License
1212
*/
1313

14-
use OAuth\OAuth2\Service\Dropbox;
15-
use OAuth\Common\Storage\Session;
1614
use OAuth\Common\Consumer\Credentials;
15+
use OAuth\Common\Storage\Session;
16+
use OAuth\OAuth2\Service\Dropbox;
1717

1818
/**
1919
* Bootstrap the example
@@ -25,24 +25,23 @@
2525

2626
// Setup the credentials for the requests
2727
$credentials = new Credentials(
28-
$servicesCredentials['dropbox']['key'],
29-
$servicesCredentials['dropbox']['secret'],
28+
$servicesCredentials[ 'dropbox' ][ 'key' ],
29+
$servicesCredentials[ 'dropbox' ][ 'secret' ],
3030
$currentUri
3131
);
3232

3333
// Instantiate the Dropbox service using the credentials, http client and storage mechanism for the token
3434
/** @var $dropboxService Dropbox */
35-
$dropboxService = $serviceFactory->createService('dropbox', $credentials, $storage, array());
35+
$dropboxService = $serviceFactory->createService('dropbox', $credentials, $storage, []);
3636

3737
if ($dropboxService->isGlobalRequestArgumentsPassed()) {
38-
// Retrieve a token and send a request
39-
$result = $dropboxService->retrieveAccessTokenByGlobReqArgs()->requestJSON('/account/info');
40-
41-
// Show some of the resultant data
42-
echo 'Your unique Dropbox user id is: ' . $result['uid'] . ' and your name is ' . $result['display_name'];
38+
// Retrieve a token and send a request
39+
$result = $dropboxService->retrieveAccessTokenByGlobReqArgs()->requestJSON('/account/info');
4340

44-
} elseif (!empty($_GET['go']) && $_GET['go'] === 'go') {
45-
$dropboxService->redirectToAuthorizationUri();
41+
// Show some of the resultant data
42+
echo 'Your unique Dropbox user id is: ' . $result[ 'uid' ] . ' and your name is ' . $result[ 'display_name' ];
43+
} elseif (!empty($_GET[ 'go' ]) && $_GET[ 'go' ] === 'go') {
44+
$dropboxService->redirectToAuthorizationUri();
4645
} else {
47-
echo "<a href='$currentUri?go=go'>Login with Dropbox!</a>";
48-
}
46+
echo "<a href='$currentUri?go=go'>Login with Dropbox!</a>";
47+
}

0 commit comments

Comments
 (0)