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 ;
1614use OAuth \Common \Consumer \Credentials ;
15+ use OAuth \Common \Storage \Session ;
16+ use OAuth \OAuth2 \Service \Dailymotion ;
1717
1818/**
1919 * Bootstrap the example
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
3737if ($ 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+ }
0 commit comments