Passed
Branch v4 (12362e)
by Benjamin
07:43
created
src/services/Views.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $result = ViewRecord::findOne($id);
61 61
 
62
-        if($result) {
62
+        if ($result) {
63 63
             return new View($result->toArray([
64 64
                 'id',
65 65
                 'name',
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             'siteId' => $id
110 110
         ]);
111 111
 
112
-        if($result) {
112
+        if ($result) {
113 113
             return new SiteView($result->toArray([
114 114
                 'id',
115 115
                 'siteId',
Please login to merge, or discard this patch.
src/services/Analytics.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         $localeDefinition = json_decode(file_get_contents($formatLocalePath), true);
122 122
 
123
-        if(isset($options['currency'])) {
123
+        if (isset($options['currency'])) {
124 124
             $localeDefinition['currency'] = $this->getD3LocaleDefinitionCurrency($options['currency']);
125 125
         }
126 126
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     {
137 137
         $chartLanguage = Craft::t('analytics', 'analyticsChartLanguage');
138 138
 
139
-        if($chartLanguage == 'analyticsChartLanguage') {
139
+        if ($chartLanguage == 'analyticsChartLanguage') {
140 140
             $chartLanguage = 'en';
141 141
         }
142 142
 
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
 
229 229
         $currencyDefinition = $localeDefinition['currency'];
230 230
 
231
-        foreach($currencyDefinition as $key => $row) {
232
-            if(!empty($row)) {
231
+        foreach ($currencyDefinition as $key => $row) {
232
+            if (!empty($row)) {
233 233
                 // Todo: Check currency symbol replacement with arabic
234 234
 
235 235
                 $pattern = '/[^\s]+/u';
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
             $gclid = $_GET['gclid'];
272 272
             if (!empty($gclid))
273 273
             {
274
-                setcookie("gclid", $gclid, time() + (10 * 365 * 24 * 60 * 60),  "/");
274
+                setcookie("gclid", $gclid, time() + (10 * 365 * 24 * 60 * 60), "/");
275 275
             }
276 276
         }
277 277
         return $gclid;
@@ -286,17 +286,17 @@  discard block
 block discarded – undo
286 286
         if (isset($_COOKIE['_ga']))
287 287
         {
288 288
             list($version, $domainDepth, $cid1, $cid2) = preg_split('[\.]', $_COOKIE["_ga"], 4);
289
-            $contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' => $cid1 . '.' . $cid2);
289
+            $contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' => $cid1.'.'.$cid2);
290 290
             $cid = $contents['cid'];
291 291
         }
292 292
         else
293 293
         {
294
-            if (isset($_COOKIE['_ia']) && $_COOKIE['_ia'] !='' )
294
+            if (isset($_COOKIE['_ia']) && $_COOKIE['_ia'] != '')
295 295
                 $cid = $_COOKIE['_ia'];
296 296
             else
297 297
                 $cid = $this->_gaGenUUID();
298 298
         }
299
-        setcookie('_ia', $cid, time()+60*60*24*730, "/"); // Two years
299
+        setcookie('_ia', $cid, time() + 60 * 60 * 24 * 730, "/"); // Two years
300 300
         return $cid;
301 301
     } /* -- _gaParseCookie */
302 302
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -288,13 +288,13 @@
 block discarded – undo
288 288
             list($version, $domainDepth, $cid1, $cid2) = preg_split('[\.]', $_COOKIE["_ga"], 4);
289 289
             $contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' => $cid1 . '.' . $cid2);
290 290
             $cid = $contents['cid'];
291
-        }
292
-        else
291
+        } else
293 292
         {
294
-            if (isset($_COOKIE['_ia']) && $_COOKIE['_ia'] !='' )
295
-                $cid = $_COOKIE['_ia'];
296
-            else
297
-                $cid = $this->_gaGenUUID();
293
+            if (isset($_COOKIE['_ia']) && $_COOKIE['_ia'] !='' ) {
294
+                            $cid = $_COOKIE['_ia'];
295
+            } else {
296
+                            $cid = $this->_gaGenUUID();
297
+            }
298 298
         }
299 299
         setcookie('_ia', $cid, time()+60*60*24*730, "/"); // Two years
300 300
         return $cid;
Please login to merge, or discard this patch.
src/services/Reports.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
         $tableId = null;
35 35
 
36
-        if($view) {
36
+        if ($view) {
37 37
             $tableId = 'ga:'.$view->gaViewId;
38 38
         }
39 39
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $cacheId = ['reports.getRealtimeReport', $tableId, $metrics, $optParams];
44 44
         $response = Analytics::$plugin->cache->get($cacheId);
45 45
 
46
-        if(!$response)
46
+        if (!$response)
47 47
         {
48 48
             $response = Analytics::$plugin->getApis()->getAnalytics()->getService()->data_realtime->get($tableId, $metrics, $optParams);
49 49
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         $viewId = null;
82 82
 
83
-        if($siteView) {
83
+        if ($siteView) {
84 84
             $viewId = $siteView->viewId;
85 85
         }
86 86
 
Please login to merge, or discard this patch.
src/migrations/m161021_000001_force_connect.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
             ->where(['handle' => 'analytics'])
25 25
             ->one();
26 26
 
27
-        if($row)
27
+        if ($row)
28 28
         {
29 29
             $settingsJson = $row['settings'];
30 30
 
Please login to merge, or discard this patch.
src/migrations/m141009_105954_analytics_reportsWidgetToExplorerWidget.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
                 $settings = Json::decode($result['settings']);
30 30
                 $newSettings = [];
31 31
 
32
-                if(!empty($settings['type'])) {
32
+                if (!empty($settings['type'])) {
33 33
                     switch ($settings['type']) {
34 34
                         case 'visits':
35 35
                             $newSettings = [
Please login to merge, or discard this patch.
src/migrations/m170324_000003_fix_widget_options.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@
 block discarded – undo
24 24
             ->orWhere(['type' => 'dukt\analytics\widgets\Report'])
25 25
             ->all();
26 26
 
27
-        if($widgetResults) {
27
+        if ($widgetResults) {
28 28
             foreach ($widgetResults as $result) {
29 29
                 $settings = Json::decode($result['settings']);
30 30
                 
31
-                if(isset($settings['options']['metric'])) {
31
+                if (isset($settings['options']['metric'])) {
32 32
                     $settings['options'] = [
33 33
                         $settings['chart'] => $settings['options']
34 34
                     ];
Please login to merge, or discard this patch.
src/migrations/m161117_000001_remove_account_explorer_data_setting.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@
 block discarded – undo
25 25
             ->where(['handle' => 'analytics'])
26 26
             ->one();
27 27
 
28
-        if($row)
28
+        if ($row)
29 29
         {
30 30
             $settingsJson = $row['settings'];
31 31
 
32 32
             $settings = Json::decode($settingsJson);
33 33
 
34
-            if(isset($settings['accountExplorerData']))
34
+            if (isset($settings['accountExplorerData']))
35 35
             {
36 36
                 unset($settings['accountExplorerData']);
37 37
             }
Please login to merge, or discard this patch.
src/migrations/m150921_000001_explorer_widget_to_realtime_and_reports.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
             ->where(['type' => 'Analytics_Explorer'])
24 24
             ->all();
25 25
 
26
-        if($widgetResults)
26
+        if ($widgetResults)
27 27
         {
28
-            foreach($widgetResults as $result)
28
+            foreach ($widgetResults as $result)
29 29
             {
30 30
                 $oldSettings = Json::decode($result['settings']);
31 31
 
@@ -34,36 +34,36 @@  discard block
 block discarded – undo
34 34
 
35 35
                 $newSettings = [];
36 36
 
37
-                if(isset($oldSettings['chart']))
37
+                if (isset($oldSettings['chart']))
38 38
                 {
39 39
                     $newSettings['chart'] = $oldSettings['chart'];
40 40
                 }
41 41
 
42
-                if(isset($oldSettings['period']))
42
+                if (isset($oldSettings['period']))
43 43
                 {
44 44
                     $newSettings['period'] = $oldSettings['period'];
45 45
                 }
46 46
 
47 47
                 $newSettings['options'] = [];
48 48
 
49
-                if(isset($oldSettings['dimension']))
49
+                if (isset($oldSettings['dimension']))
50 50
                 {
51 51
                     $newSettings['options']['dimension'] = $oldSettings['dimension'];
52 52
                 }
53 53
 
54
-                if(isset($oldSettings['metric']))
54
+                if (isset($oldSettings['metric']))
55 55
                 {
56 56
                     $newSettings['options']['metric'] = $oldSettings['metric'];
57 57
                 }
58 58
 
59
-                switch($oldSettings['menu'])
59
+                switch ($oldSettings['menu'])
60 60
                 {
61 61
                     case 'realtimeVisitors':
62
-                        $type='Analytics_Realtime';
62
+                        $type = 'Analytics_Realtime';
63 63
                         break;
64 64
 
65 65
                     default:
66
-                        $type='Analytics_Report';
66
+                        $type = 'Analytics_Report';
67 67
                 }
68 68
 
69 69
 
Please login to merge, or discard this patch.
src/controllers/UtilsController.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -107,23 +107,23 @@  discard block
 block discarded – undo
107 107
 
108 108
         $items = Analytics::$plugin->getApis()->getAnalytics()->getColumns();
109 109
 
110
-        if($items)
110
+        if ($items)
111 111
         {
112
-            foreach($items as $item)
112
+            foreach ($items as $item)
113 113
             {
114
-                if($item->attributes['status'] == 'DEPRECATED')
114
+                if ($item->attributes['status'] == 'DEPRECATED')
115 115
                 {
116 116
                     continue;
117 117
                 }
118 118
 
119
-                if($item->attributes['addedInApiVersion'] > $this->addedInApiVersion)
119
+                if ($item->attributes['addedInApiVersion'] > $this->addedInApiVersion)
120 120
                 {
121 121
                     continue;
122 122
                 }
123 123
 
124
-                if(isset($item->attributes['minTemplateIndex']))
124
+                if (isset($item->attributes['minTemplateIndex']))
125 125
                 {
126
-                    for($i = $item->attributes['minTemplateIndex']; $i <= $item->attributes['maxTemplateIndex']; $i++)
126
+                    for ($i = $item->attributes['minTemplateIndex']; $i <= $item->attributes['maxTemplateIndex']; $i++)
127 127
                     {
128 128
                         $column = [];
129 129
                         $column['id'] = str_replace('XX', $i, $item->id);
@@ -167,12 +167,12 @@  discard block
 block discarded – undo
167 167
         $column['group'] = $item->attributes['group'];
168 168
         $column['status'] = $item->attributes['status'];
169 169
 
170
-        if(isset($item->attributes['allowInSegments']))
170
+        if (isset($item->attributes['allowInSegments']))
171 171
         {
172 172
             $column['allowInSegments'] = $item->attributes['allowInSegments'];
173 173
         }
174 174
 
175
-        if(isset($item->attributes['addedInApiVersion']))
175
+        if (isset($item->attributes['addedInApiVersion']))
176 176
         {
177 177
             $column['addedInApiVersion'] = $item->attributes['addedInApiVersion'];
178 178
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,8 +132,7 @@
 block discarded – undo
132 132
 
133 133
                         $columns[$column['id']] = $this->populateColumnAttributes($column, $item);
134 134
                     }
135
-                }
136
-                else
135
+                } else
137 136
                 {
138 137
                     $column = [];
139 138
                     $column['id'] = $item->id;
Please login to merge, or discard this patch.