@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | * @var $event Event |
| 33 | 33 | */ |
| 34 | 34 | $key = $event->country . $event->city; |
| 35 | - if(isset($reportAccumulator[$key])) { |
|
| 36 | - $reportAccumulator[$key]['count']+=1; |
|
| 35 | + if (isset($reportAccumulator[$key])) { |
|
| 36 | + $reportAccumulator[$key]['count'] += 1; |
|
| 37 | 37 | return $reportAccumulator; |
| 38 | 38 | } |
| 39 | 39 | $reportAccumulator[$key] = [ |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | return $reportAccumulator; |
| 45 | 45 | }); |
| 46 | 46 | |
| 47 | - usort($report, function($a, $b){ |
|
| 48 | - if ($a['count'] == $b['count']){ |
|
| 47 | + usort($report, function($a, $b) { |
|
| 48 | + if ($a['count'] == $b['count']) { |
|
| 49 | 49 | return 0; |
| 50 | 50 | } |
| 51 | - return ($a['count'] > $b['count'])? -1 : 1; |
|
| 51 | + return ($a['count'] > $b['count']) ? -1 : 1; |
|
| 52 | 52 | }); |
| 53 | 53 | |
| 54 | 54 | return $report; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | // @todo Implement a middleware |
| 47 | 47 | $logged = $this->storeManager->has('token'); |
| 48 | - if($logged === true) { |
|
| 48 | + if ($logged === true) { |
|
| 49 | 49 | header('Location: /report'); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | // @todo Implement a middleware |
| 61 | 61 | $logged = $this->storeManager->has('token'); |
| 62 | - if($logged !== true) { |
|
| 62 | + if ($logged !== true) { |
|
| 63 | 63 | header('Location: /'); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | getenv('SONGKICK_API_KEY'), $artist->name); |
| 80 | 80 | $artistEvents = $this->songkickService->getArtistUpcomingEvents( |
| 81 | 81 | getenv('SONGKICK_API_KEY'), $artist->songkickId); |
| 82 | - if($artistEvents) { |
|
| 82 | + if ($artistEvents) { |
|
| 83 | 83 | $count += count($artistEvents); |
| 84 | 84 | $events = array_merge($events, $artistEvents); |
| 85 | 85 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | { |
| 44 | 44 | // @todo check state against SPOTIFY_CALLBACK_STATE using a middleware |
| 45 | 45 | |
| 46 | - if($error !== null) { |
|
| 46 | + if ($error !== null) { |
|
| 47 | 47 | header('Location: /'); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | $routeInfo = $dispatcher->dispatch( |
| 25 | 25 | $_SERVER['REQUEST_METHOD'], |
| 26 | - rawurldecode( extractAction($_SERVER['REQUEST_URI'])) |
|
| 26 | + rawurldecode(extractAction($_SERVER['REQUEST_URI'])) |
|
| 27 | 27 | ); |
| 28 | 28 | callController($routeInfo, $_SERVER['QUERY_STRING']); |
| 29 | 29 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | base64_encode("$spotifyClientId:$spotifyClientSecret") |
| 77 | 77 | ] |
| 78 | 78 | ]; |
| 79 | - $response = $client->request('POST', self::TOKEN_URI, $requestBody, self::TOKEN_URI . \json_encode($requestBody) ); |
|
| 79 | + $response = $client->request('POST', self::TOKEN_URI, $requestBody, self::TOKEN_URI . \json_encode($requestBody)); |
|
| 80 | 80 | |
| 81 | 81 | // @todo use guzzle options |
| 82 | 82 | $responseBody = \json_decode($response->getBody()->getContents(), true); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | 'headers' => [ |
| 102 | 102 | 'Authorization' => 'Bearer ' . $token->getAccessToken() |
| 103 | 103 | ] |
| 104 | - ], $uri . $token->getAccessToken() ); |
|
| 104 | + ], $uri . $token->getAccessToken()); |
|
| 105 | 105 | return new SpotifyMe( |
| 106 | 106 | $response['country'], |
| 107 | 107 | $response['display_name'], |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | 'headers' => [ |
| 117 | 117 | 'Authorization' => 'Bearer ' . $token->getAccessToken() |
| 118 | 118 | ] |
| 119 | - ], $uri . $token->getAccessToken() ); |
|
| 119 | + ], $uri . $token->getAccessToken()); |
|
| 120 | 120 | $topArtists = []; |
| 121 | 121 | foreach ($response['items'] as $artist) { |
| 122 | 122 | $topArtists[] = new Artist($artist['name'], $artist['images'][1]['url']); |
@@ -35,14 +35,14 @@ |
||
| 35 | 35 | * @return mixed |
| 36 | 36 | */ |
| 37 | 37 | public function requestContent($method, $uri = '', array $options = [], $salt = '') { |
| 38 | - $cacheKey = md5($method.$uri.$salt); |
|
| 38 | + $cacheKey = md5($method . $uri . $salt); |
|
| 39 | 39 | |
| 40 | 40 | $cachedString = $this->instanceCache->getItem($cacheKey); |
| 41 | 41 | |
| 42 | 42 | if (is_null($cachedString->get())) { |
| 43 | 43 | $client = new Client(); |
| 44 | - $res = $client->request($method, $uri , $options); |
|
| 45 | - $content = json_decode( $res->getBody()->getContents(), true); |
|
| 44 | + $res = $client->request($method, $uri, $options); |
|
| 45 | + $content = json_decode($res->getBody()->getContents(), true); |
|
| 46 | 46 | |
| 47 | 47 | //in seconds, also accepts Datetime |
| 48 | 48 | $cachedString->set($content)->expiresAfter(30 * 24 * 3600); |