@@ -38,8 +38,8 @@ |
||
38 | 38 | $tracks = array_slice($this->getTopTracks(), 0, 10); |
39 | 39 | |
40 | 40 | return view('api.lastfm')->withDetails($details) |
41 | - ->withAlbums($albums) |
|
42 | - ->withTracks($tracks); |
|
41 | + ->withAlbums($albums) |
|
42 | + ->withTracks($tracks); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * @var array |
12 | 12 | */ |
13 | - protected $sampleArtist = ['artist' => 'The Pierces']; |
|
13 | + protected $sampleArtist = [ 'artist' => 'The Pierces' ]; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * LastFm Object |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | */ |
50 | 50 | private function getArtistInfo() |
51 | 51 | { |
52 | - $result = (array)$this->lastfm->artist_getInfo($this->sampleArtist); |
|
52 | + $result = (array) $this->lastfm->artist_getInfo($this->sampleArtist); |
|
53 | 53 | |
54 | - return $result['artist']; |
|
54 | + return $result[ 'artist' ]; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | */ |
61 | 61 | private function getTopAlbums() |
62 | 62 | { |
63 | - $result = (array)$this->lastfm->artist_getTopAlbums($this->sampleArtist); |
|
63 | + $result = (array) $this->lastfm->artist_getTopAlbums($this->sampleArtist); |
|
64 | 64 | |
65 | - return $result['topalbums']->album; |
|
65 | + return $result[ 'topalbums' ]->album; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | */ |
72 | 72 | private function getTopTracks() |
73 | 73 | { |
74 | - $result = (array)$this->lastfm->artist_getTopTracks($this->sampleArtist); |
|
74 | + $result = (array) $this->lastfm->artist_getTopTracks($this->sampleArtist); |
|
75 | 75 | |
76 | - return $result['toptracks']->track; |
|
76 | + return $result[ 'toptracks' ]->track; |
|
77 | 77 | } |
78 | 78 | } |
@@ -27,8 +27,8 @@ |
||
27 | 27 | |
28 | 28 | public function getAvatarUrl() |
29 | 29 | { |
30 | - if(is_null($this->avatar)) { |
|
31 | - return "http://www.gravatar.com/avatar/" . md5(strtolower(trim($this->email))) . "?d=mm&s=40"; |
|
30 | + if (is_null($this->avatar)) { |
|
31 | + return "http://www.gravatar.com/avatar/".md5(strtolower(trim($this->email)))."?d=mm&s=40"; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | return $this->avatar; |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | public function updateProfile(Request $request) |
35 | 35 | { |
36 | 36 | $this->validate($request, [ |
37 | - 'email' => 'required|email|min:3|unique:users,email,'. $this->id, |
|
37 | + 'email' => 'required|email|min:3|unique:users,email,'.$this->id, |
|
38 | 38 | 'fullname' => 'required|min:3' |
39 | 39 | ]); |
40 | 40 | |
41 | 41 | $values = $request->all(); |
42 | 42 | $this->user->fill($values)->save(); |
43 | 43 | |
44 | - return redirect()->back()->with('info','Your Profile has been updated successfully'); |
|
44 | + return redirect()->back()->with('info', 'Your Profile has been updated successfully'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function updateAvatar(Request $request) |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | 'file_name' => 'required|mimes:jpeg,bmp,png|between:1,7000', |
51 | 51 | ]); |
52 | 52 | |
53 | - $filename = $request->file('file_name')->getRealPath(); |
|
53 | + $filename = $request->file('file_name')->getRealPath(); |
|
54 | 54 | |
55 | 55 | Cloudder::upload($filename, null); |
56 | 56 | list($width, $height) = getimagesize($filename); |
57 | 57 | |
58 | - $fileUrl = Cloudder::show(Cloudder::getPublicId(), ["width" => $width, "height" => $height]); |
|
58 | + $fileUrl = Cloudder::show(Cloudder::getPublicId(), [ "width" => $width, "height" => $height ]); |
|
59 | 59 | |
60 | - $this->user->update(['avatar' => $fileUrl]); |
|
60 | + $this->user->update([ 'avatar' => $fileUrl ]); |
|
61 | 61 | |
62 | 62 | return redirect()->back()->with('info', 'Your Avatar has been updated Successfully'); |
63 | 63 | } |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace App\Http\Controllers; |
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | -use App\Http\Requests; |
|
7 | 6 | use MJErwin\Clockwork\ClockworkClient; |
8 | 7 | use MJErwin\Clockwork\Message; |
9 | 8 |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace App\Http\Controllers; |
4 | 4 | |
5 | 5 | use GuzzleHttp\Client; |
6 | -use App\Http\Requests; |
|
7 | 6 | |
8 | 7 | class NytController extends Controller |
9 | 8 | { |
@@ -27,9 +27,9 @@ |
||
27 | 27 | */ |
28 | 28 | public function __construct() |
29 | 29 | { |
30 | - $this->baseUrl = self::API_URL; |
|
31 | - $this->client = new Client(['base_uri' => $this->baseUrl]); |
|
32 | - $this->setGetResponse($this->getRelativeUrl()); |
|
30 | + $this->baseUrl = self::API_URL; |
|
31 | + $this->client = new Client(['base_uri' => $this->baseUrl]); |
|
32 | + $this->setGetResponse($this->getRelativeUrl()); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function __construct() |
29 | 29 | { |
30 | 30 | $this->baseUrl = self::API_URL; |
31 | - $this->client = new Client(['base_uri' => $this->baseUrl]); |
|
31 | + $this->client = new Client([ 'base_uri' => $this->baseUrl ]); |
|
32 | 32 | $this->setGetResponse($this->getRelativeUrl()); |
33 | 33 | } |
34 | 34 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | private function setGetResponse($relativeUrl) |
50 | 50 | { |
51 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
51 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, [ ]); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | private function getData() |
68 | 68 | { |
69 | - return $this->getResponse()['results']['lists'][0]['books']; |
|
69 | + return $this->getResponse()[ 'results' ][ 'lists' ][ 0 ][ 'books' ]; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -25,6 +25,9 @@ discard block |
||
25 | 25 | return $this->execute(($request->has('code') || $request->has('oauth_token')), $provider); |
26 | 26 | } |
27 | 27 | |
28 | + /** |
|
29 | + * @param boolean $request |
|
30 | + */ |
|
28 | 31 | public function execute($request, $provider) |
29 | 32 | { |
30 | 33 | if (! $request) { |
@@ -40,7 +43,7 @@ discard block |
||
40 | 43 | /** |
41 | 44 | * Find a user by username or create a new user |
42 | 45 | * |
43 | - * @param $userData |
|
46 | + * @param \Laravel\Socialite\Contracts\User $userData |
|
44 | 47 | * @param $provider |
45 | 48 | * |
46 | 49 | * @return \App\User |
@@ -130,7 +133,7 @@ discard block |
||
130 | 133 | /** |
131 | 134 | * Get Data from Social Media Account |
132 | 135 | * @param string $provider |
133 | - * @return collection |
|
136 | + * @return \Laravel\Socialite\Contracts\User |
|
134 | 137 | */ |
135 | 138 | private function getSocialUser($provider) |
136 | 139 | { |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | 6 | use App\User; |
7 | -use App\Http\Requests; |
|
8 | 7 | use Illuminate\Contracts\Auth\Guard; |
9 | 8 | use Laravel\Socialite\Contracts\Factory as Socialite; |
10 | 9 | use Session; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function execute($request, $provider) |
29 | 29 | { |
30 | - if (! $request) { |
|
30 | + if (!$request) { |
|
31 | 31 | return $this->getAuthorizationFirst($provider); |
32 | 32 | } |
33 | 33 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | $tokenSecret = property_exists($userData, "tokenSecret") ? $userData->tokenSecret : null; |
59 | 59 | |
60 | - if (empty($user)) { |
|
60 | + if (empty($user)) { |
|
61 | 61 | |
62 | 62 | $user = User::create([ |
63 | 63 | 'fullname' => $userData->getName(), |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | |
79 | 79 | private function isUsernameExists($username = null) |
80 | 80 | { |
81 | - $username = User::whereUsername($username)->first()['username']; |
|
81 | + $username = User::whereUsername($username)->first()[ 'username' ]; |
|
82 | 82 | |
83 | - return (! is_null($username)) ? true : false; |
|
83 | + return (!is_null($username)) ? true : false; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | private function isEmailExists($email = null) |
87 | 87 | { |
88 | - $email = User::whereEmail($email)->first()['email']; |
|
88 | + $email = User::whereEmail($email)->first()[ 'email' ]; |
|
89 | 89 | |
90 | - return (! is_null($email)) ? true : false; |
|
90 | + return (!is_null($email)) ? true : false; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'username' => $user->username, |
110 | 110 | ]; |
111 | 111 | |
112 | - if (! empty(array_diff($dbData, $socialData))) { |
|
112 | + if (!empty(array_diff($dbData, $socialData))) { |
|
113 | 113 | $user->avatar = $userData->getAvatar(); |
114 | 114 | $user->fullname = $userData->getName(); |
115 | 115 | $user->username = $userData->getNickName(); |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace App\Http\Controllers; |
4 | 4 | |
5 | 5 | use GuzzleHttp\Client; |
6 | -use App\Http\Requests; |
|
7 | 6 | |
8 | 7 | class YahooController extends Controller |
9 | 8 | { |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct() |
27 | 27 | { |
28 | - $this->baseUrl = self::YAHOO_API; |
|
29 | - $this->client = new Client(['base_uri' => $this->baseUrl]); |
|
28 | + $this->baseUrl = self::YAHOO_API; |
|
29 | + $this->client = new Client(['base_uri' => $this->baseUrl]); |
|
30 | 30 | |
31 | - $query = "SELECT * FROM weather.forecast WHERE (location = 10007)"; |
|
31 | + $query = "SELECT * FROM weather.forecast WHERE (location = 10007)"; |
|
32 | 32 | |
33 | - $relativeUrl = '?q=' . $query . '&format=json'; |
|
34 | - $this->setGetResponse($relativeUrl); |
|
33 | + $relativeUrl = '?q=' . $query . '&format=json'; |
|
34 | + $this->setGetResponse($relativeUrl); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | - /** |
|
66 | - * Return all data to the Yahoo API dashboard |
|
67 | - * @return mixed |
|
68 | - */ |
|
65 | + /** |
|
66 | + * Return all data to the Yahoo API dashboard |
|
67 | + * @return mixed |
|
68 | + */ |
|
69 | 69 | public function getPage() |
70 | 70 | { |
71 | 71 | $data = $this->getData(); |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | public function __construct() |
27 | 27 | { |
28 | 28 | $this->baseUrl = self::YAHOO_API; |
29 | - $this->client = new Client(['base_uri' => $this->baseUrl]); |
|
29 | + $this->client = new Client([ 'base_uri' => $this->baseUrl ]); |
|
30 | 30 | |
31 | 31 | $query = "SELECT * FROM weather.forecast WHERE (location = 10007)"; |
32 | 32 | |
33 | - $relativeUrl = '?q=' . $query . '&format=json'; |
|
33 | + $relativeUrl = '?q='.$query.'&format=json'; |
|
34 | 34 | $this->setGetResponse($relativeUrl); |
35 | 35 | } |
36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | private function setGetResponse($relativeUrl) |
42 | 42 | { |
43 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
43 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, [ ]); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | private function getData() |
60 | 60 | { |
61 | - return $this->getResponse()['query']['results']['channel']; |
|
61 | + return $this->getResponse()[ 'query' ][ 'results' ][ 'channel' ]; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 |
@@ -29,19 +29,19 @@ |
||
29 | 29 | */ |
30 | 30 | protected $response; |
31 | 31 | |
32 | - /** |
|
33 | - * Initialize the Controller with necessary arguments |
|
34 | - */ |
|
32 | + /** |
|
33 | + * Initialize the Controller with necessary arguments |
|
34 | + */ |
|
35 | 35 | public function __construct() |
36 | 36 | { |
37 | 37 | $this->baseUrl = self::LINKEDIN_API; |
38 | 38 | $this->client = new Client(['base_uri' => $this->baseUrl]); |
39 | 39 | } |
40 | 40 | |
41 | - /** |
|
42 | - * Set options for making the Client request |
|
43 | - * @return void |
|
44 | - */ |
|
41 | + /** |
|
42 | + * Set options for making the Client request |
|
43 | + * @return void |
|
44 | + */ |
|
45 | 45 | private function setRequestOptions() |
46 | 46 | { |
47 | 47 | $authBearer = 'Bearer '. Auth::user()->getAccessToken(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function __construct() |
36 | 36 | { |
37 | 37 | $this->baseUrl = self::LINKEDIN_API; |
38 | - $this->client = new Client(['base_uri' => $this->baseUrl]); |
|
38 | + $this->client = new Client([ 'base_uri' => $this->baseUrl ]); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | */ |
45 | 45 | private function setRequestOptions() |
46 | 46 | { |
47 | - $authBearer = 'Bearer '. Auth::user()->getAccessToken(); |
|
48 | - $this->client = new Client(['base_uri' => $this->baseUrl, |
|
47 | + $authBearer = 'Bearer '.Auth::user()->getAccessToken(); |
|
48 | + $this->client = new Client([ 'base_uri' => $this->baseUrl, |
|
49 | 49 | 'headers' => [ |
50 | 50 | 'Authorization' => $authBearer, |
51 | 51 | 'Content-Type' => 'application/json', |
52 | 52 | 'Accept' => 'application/json' |
53 | - ]]); |
|
53 | + ] ]); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | private function setGetResponse($relativeUrl) |
61 | 61 | { |
62 | - $this->response = $this->client->get($this->baseUrl . $relativeUrl, []); |
|
62 | + $this->response = $this->client->get($this->baseUrl.$relativeUrl, [ ]); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function getPage() |
32 | 32 | { |
33 | - if( Session::get('provider') !== 'twitter') { |
|
33 | + if (Session::get('provider') !== 'twitter') { |
|
34 | 34 | Auth::logout(); |
35 | 35 | |
36 | 36 | Session::flush(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | $searchedTweets = json_decode($this->searchForTweets($this->searchItem), true); |
42 | 42 | |
43 | - return view('api.twitter')->withTweets($searchedTweets['statuses']); |
|
43 | + return view('api.twitter')->withTweets($searchedTweets[ 'statuses' ]); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | private function getLatestTweets() |
51 | 51 | { |
52 | - return Twitter::getHomeTimeline(['count' => 2, 'format' => 'json']); |
|
52 | + return Twitter::getHomeTimeline([ 'count' => 2, 'format' => 'json' ]); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | private function searchForTweets($item) |
61 | 61 | { |
62 | - return Twitter::getSearch(['q' => $item, 'count' => 4, 'format' => 'json']); |
|
62 | + return Twitter::getSearch([ 'q' => $item, 'count' => 4, 'format' => 'json' ]); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | 'tweet' => 'required', |
74 | 74 | ]); |
75 | 75 | |
76 | - $tweet = $request->input('tweet') . ' #LaravelHackathonStarter'; |
|
76 | + $tweet = $request->input('tweet').' #LaravelHackathonStarter'; |
|
77 | 77 | |
78 | - Twitter::reconfig(['token' => Auth::user()->getAccessToken(), 'secret' => Auth::user()->getAccessTokenSecret()]); |
|
78 | + Twitter::reconfig([ 'token' => Auth::user()->getAccessToken(), 'secret' => Auth::user()->getAccessTokenSecret() ]); |
|
79 | 79 | |
80 | - Twitter::postTweet(['status' => $tweet, 'format' => 'json']); |
|
80 | + Twitter::postTweet([ 'status' => $tweet, 'format' => 'json' ]); |
|
81 | 81 | |
82 | 82 | return redirect()->back()->with('info', trans('texts.twitter.success')); |
83 | 83 | } |