@@ -112,7 +112,7 @@ |
||
112 | 112 | $response['report'] = Analytics::$plugin->getApis()->getAnalyticsReporting()->getReport($this, $toArray); |
113 | 113 | $response['success'] = true; |
114 | 114 | } |
115 | - catch(\Exception $e) |
|
115 | + catch (\Exception $e) |
|
116 | 116 | { |
117 | 117 | $response['error'] = true; |
118 | 118 | $response['errorMessage'] = $e->getMessage(); |
@@ -111,8 +111,7 @@ |
||
111 | 111 | { |
112 | 112 | $response['report'] = Analytics::$plugin->getApis()->getAnalyticsReporting()->getReport($this, $toArray); |
113 | 113 | $response['success'] = true; |
114 | - } |
|
115 | - catch(\Exception $e) |
|
114 | + } catch(\Exception $e) |
|
116 | 115 | { |
117 | 116 | $response['error'] = true; |
118 | 117 | $response['errorMessage'] = $e->getMessage(); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | Analytics::$plugin->cache->set($cacheId, $response, $cacheDuration); |
51 | 51 | } |
52 | 52 | |
53 | - return (array)$response; |
|
53 | + return (array) $response; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -57,7 +57,7 @@ |
||
57 | 57 | |
58 | 58 | // Make sure $forceConnect is going to be a boolean |
59 | 59 | if (is_string($this->forceConnect)) { |
60 | - $this->forceConnect = (bool)$this->forceConnect; |
|
60 | + $this->forceConnect = (bool) $this->forceConnect; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | if (is_string($this->token)) { |
@@ -209,7 +209,7 @@ |
||
209 | 209 | |
210 | 210 | $infoRowExists = false; |
211 | 211 | |
212 | - if(Craft::$app->getDb()->tableExists('{{%analytics_info}}', false)) { |
|
212 | + if (Craft::$app->getDb()->tableExists('{{%analytics_info}}', false)) { |
|
213 | 213 | $infoRowExists = (new Query()) |
214 | 214 | ->from(['{{%analytics_info}}']) |
215 | 215 | ->one(); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | try { |
38 | 38 | $response = Analytics::$plugin->getReports()->getEcommerceReport($viewId, $period); |
39 | - } catch(\Google_Service_Exception $e) { |
|
39 | + } catch (\Google_Service_Exception $e) { |
|
40 | 40 | return $this->handleGoogleServiceException($e); |
41 | 41 | } |
42 | 42 | |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | public function actionElement() |
55 | 55 | { |
56 | 56 | $elementId = Craft::$app->getRequest()->getRequiredParam('elementId'); |
57 | - $siteId = (int)Craft::$app->getRequest()->getRequiredParam('siteId'); |
|
57 | + $siteId = (int) Craft::$app->getRequest()->getRequiredParam('siteId'); |
|
58 | 58 | $metric = Craft::$app->getRequest()->getRequiredParam('metric'); |
59 | 59 | |
60 | 60 | try { |
61 | 61 | $response = Analytics::$plugin->getReports()->getElementReport($elementId, $siteId, $metric); |
62 | - } catch(\Google_Service_Exception $e) { |
|
62 | + } catch (\Google_Service_Exception $e) { |
|
63 | 63 | return $this->handleGoogleServiceException($e); |
64 | 64 | } |
65 | 65 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | try { |
99 | 99 | $response = Analytics::$plugin->getReports()->getRealtimeReport($request); |
100 | - } catch(\Google_Service_Exception $e) { |
|
100 | + } catch (\Google_Service_Exception $e) { |
|
101 | 101 | return $this->handleGoogleServiceException($e); |
102 | 102 | } |
103 | 103 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | |
191 | 191 | return $this->asJson($response); |
192 | - } catch(\Google_Service_Exception $e) { |
|
192 | + } catch (\Google_Service_Exception $e) { |
|
193 | 193 | return $this->handleGoogleServiceException($e); |
194 | 194 | } |
195 | 195 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | { |
209 | 209 | $errors = $e->getErrors(); |
210 | 210 | |
211 | - if(empty($errors)) { |
|
211 | + if (empty($errors)) { |
|
212 | 212 | throw $e; |
213 | 213 | } |
214 | 214 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | $totalRevenue = 0; |
349 | 349 | |
350 | - foreach($rows as $row) { |
|
350 | + foreach ($rows as $row) { |
|
351 | 351 | $totalRevenue += $row[1]; |
352 | 352 | } |
353 | 353 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | $reportsResponse = $this->getReportingReports($criterias); |
70 | 70 | |
71 | 71 | if ($toArray) { |
72 | - $reportsResponseArray = (array)$reportsResponse->toSimpleObject(); |
|
72 | + $reportsResponseArray = (array) $reportsResponse->toSimpleObject(); |
|
73 | 73 | |
74 | 74 | return $reportsResponseArray['reports']; |
75 | 75 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $items[] = $response->toSimpleObject()->items; |
138 | 138 | $index += count($response->toSimpleObject()->items); |
139 | 139 | |
140 | - while($index < $totalResults) { |
|
140 | + while ($index < $totalResults) { |
|
141 | 141 | $startIndex = $index + 1; |
142 | 142 | |
143 | 143 | $response = $managementAccounts->listManagementAccounts([ |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $items[] = $response->toSimpleObject()->items; |
180 | 180 | $index += count($response->toSimpleObject()->items); |
181 | 181 | |
182 | - while($index < $totalResults) { |
|
182 | + while ($index < $totalResults) { |
|
183 | 183 | $startIndex = $index + 1; |
184 | 184 | |
185 | 185 | $response = $managementWebProperties->listManagementWebproperties('~all', [ |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $items[] = $response->toSimpleObject()->items; |
222 | 222 | $index += count($response->toSimpleObject()->items); |
223 | 223 | |
224 | - while($index < $totalResults) { |
|
224 | + while ($index < $totalResults) { |
|
225 | 225 | $startIndex = $index + 1; |
226 | 226 | |
227 | 227 | $response = $managementWebProfiles->listManagementProfiles('~all', '~all', [ |
@@ -347,11 +347,11 @@ discard block |
||
347 | 347 | case 'float': |
348 | 348 | case 'time': |
349 | 349 | case 'percent': |
350 | - return (float)$value; |
|
350 | + return (float) $value; |
|
351 | 351 | break; |
352 | 352 | |
353 | 353 | default: |
354 | - return (string)$value; |
|
354 | + return (string) $value; |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | } |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | $settingsJson = $row['settings']; |
68 | 68 | $settings = Json::decode($settingsJson); |
69 | 69 | |
70 | - if($settings) { |
|
70 | + if ($settings) { |
|
71 | 71 | $forceConnect = $settings['forceConnect']; |
72 | 72 | |
73 | - if(isset($settings['token'])) { |
|
73 | + if (isset($settings['token'])) { |
|
74 | 74 | $token = $settings['token']; |
75 | 75 | } |
76 | 76 | } |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | |
86 | 86 | // Get rid of the old plugin settings |
87 | 87 | echo ' > remove old plugin settings ...'; |
88 | - if($settings) { |
|
88 | + if ($settings) { |
|
89 | 89 | unset($settings['forceConnect']); |
90 | 90 | |
91 | - if(isset($settings['token'])) { |
|
91 | + if (isset($settings['token'])) { |
|
92 | 92 | unset($settings['token']); |
93 | 93 | } |
94 | 94 |
@@ -115,7 +115,7 @@ |
||
115 | 115 | Craft::$app->getView()->registerAssetBundle(AnalyticsAsset::class); |
116 | 116 | } |
117 | 117 | |
118 | - Craft::setAlias('@analyticsLib', __DIR__ . '/../lib'); |
|
118 | + Craft::setAlias('@analyticsLib', __DIR__.'/../lib'); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |