GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( f92a7f...7a9465 )
by Brett
17:02 queued 04:26
created
src/LogTarget.php 1 patch
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,13 +36,15 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function export()
38 38
     {
39
-        if (!\Yii::$app)
40
-            // Things like this can happen in tests etc, but it is too late for us to do anything about that.
39
+        if (!\Yii::$app) {
40
+                    // Things like this can happen in tests etc, but it is too late for us to do anything about that.
41 41
             return;
42
+        }
42 43
 
43 44
         $module = $this->module;
44
-        if (!$module->entry || empty($module->panels))
45
-            return;
45
+        if (!$module->entry || empty($module->panels)) {
46
+                    return;
47
+        }
46 48
 
47 49
         $entry = $module->entry;
48 50
 
@@ -53,11 +55,12 @@  discard block
 block discarded – undo
53 55
         $records = array_filter($records);
54 56
 
55 57
         if (!empty($records)) {
56
-            if ($module->batchSave)
57
-                $entry->addBatchData($records, false);
58
-            else {
59
-                foreach ($records as $type => $record)
60
-                    $entry->addData($type, $record, false);
58
+            if ($module->batchSave) {
59
+                            $entry->addBatchData($records, false);
60
+            } else {
61
+                foreach ($records as $type => $record) {
62
+                                    $entry->addData($type, $record, false);
63
+                }
61 64
             }
62 65
         }
63 66
         $this->messages = [];
Please login to merge, or discard this patch.
src/components/Helper.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $data = ArrayHelper::toArray($data);
93 93
         if ($simplify)
94
-            array_walk($data, function (&$value) {
94
+            array_walk($data, function(&$value) {
95 95
                 if (is_array($value) && count($value) == 1) $value = reset($value);
96 96
             });
97 97
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             if (is_object($value)) {
168 168
                 $class = get_class($value);
169 169
                 // By default we just mention the object type
170
-                $args[$name] = 'Object(' . $class . ')';
170
+                $args[$name] = 'Object('.$class.')';
171 171
 
172 172
                 if ($recurseDepth > 0) {
173 173
                     // Make sure to limit the toArray to non recursive, it's much to easy to get stuck in an infinite loop
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $hash = bcadd(sprintf('%u', crc32($data)), 0x100000000);
199 199
         $str = '';
200 200
         do {
201
-            $str = $map[bcmod($hash, 62)] . $str;
201
+            $str = $map[bcmod($hash, 62)].$str;
202 202
             $hash = bcdiv($hash, 62);
203 203
         } while ($hash >= 1);
204 204
         return $str;
Please login to merge, or discard this patch.
Braces   +53 added lines, -35 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public static function serialize($data, $compact = true)
25 25
     {
26
-        if ($compact)
27
-            $data = self::compact($data);
26
+        if ($compact) {
27
+                    $data = self::compact($data);
28
+        }
28 29
 
29 30
         $data = serialize($data);
30 31
         $data = self::compress($data);
@@ -39,19 +40,22 @@  discard block
 block discarded – undo
39 40
      */
40 41
     public static function unserialize($data)
41 42
     {
42
-        if (is_resource($data))
43
-            // For some databases (like Postgres) binary columns return as a resource, fetch the content first
43
+        if (is_resource($data)) {
44
+                    // For some databases (like Postgres) binary columns return as a resource, fetch the content first
44 45
             $data = stream_get_contents($data, -1, 0);
46
+        }
45 47
 
46 48
         $originalData = $data;
47 49
         $data = self::uncompress($data);
48 50
 
49
-        if ($data === false)
50
-            $data = $originalData;
51
+        if ($data === false) {
52
+                    $data = $originalData;
53
+        }
51 54
 
52 55
         $data = @unserialize($data);
53
-        if ($data === false)
54
-            $data = $originalData;
56
+        if ($data === false) {
57
+                    $data = $originalData;
58
+        }
55 59
 
56 60
         return $data;
57 61
     }
@@ -63,8 +67,9 @@  discard block
 block discarded – undo
63 67
      */
64 68
     public static function compress($data)
65 69
     {
66
-        if (Audit::getInstance()->compressData)
67
-            $data = gzcompress($data);
70
+        if (Audit::getInstance()->compressData) {
71
+                    $data = gzcompress($data);
72
+        }
68 73
         return $data;
69 74
     }
70 75
 
@@ -90,15 +95,17 @@  discard block
 block discarded – undo
90 95
     public static function compact($data, $simplify = false, $threshold = 512)
91 96
     {
92 97
         $data = ArrayHelper::toArray($data);
93
-        if ($simplify)
94
-            array_walk($data, function (&$value) {
98
+        if ($simplify) {
99
+                    array_walk($data, function (&$value) {
95 100
                 if (is_array($value) && count($value) == 1) $value = reset($value);
101
+        }
96 102
             });
97 103
 
98 104
         $tooBig = [];
99
-        foreach ($data as $index => $value)
100
-            if (strlen(serialize($value)) > $threshold)
105
+        foreach ($data as $index => $value) {
106
+                    if (strlen(serialize($value)) > $threshold)
101 107
                 $tooBig[] = $index;
108
+        }
102 109
 
103 110
         if (count($tooBig)) {
104 111
             $data = array_diff_key($data, array_flip($tooBig));
@@ -117,8 +124,9 @@  discard block
 block discarded – undo
117 124
     {
118 125
         $trace = debug_backtrace();
119 126
         array_pop($trace); // remove the last trace since it would be the entry script, not very useful
120
-        if ($skip > 0)
121
-            $trace = array_slice($trace, $skip);
127
+        if ($skip > 0) {
128
+                    $trace = array_slice($trace, $skip);
129
+        }
122 130
         return self::cleanupTrace($trace);
123 131
     }
124 132
 
@@ -130,8 +138,9 @@  discard block
 block discarded – undo
130 138
      */
131 139
     public static function cleanupTrace($trace)
132 140
     {
133
-        if (!is_array($trace))
134
-            return [];
141
+        if (!is_array($trace)) {
142
+                    return [];
143
+        }
135 144
 
136 145
         foreach ($trace as $n => $call) {
137 146
             $call['file'] = isset($call['file']) ? $call['file'] : 'unknown';
@@ -140,14 +149,18 @@  discard block
 block discarded – undo
140 149
             $call['file'] = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $call['file']);
141 150
 
142 151
             // XDebug
143
-            if (isset($call['params'])) unset($call['params']);
152
+            if (isset($call['params'])) {
153
+                unset($call['params']);
154
+            }
144 155
 
145 156
             // Trace entry contains the class instance, also compact and include this
146
-            if (isset($call['object']))
147
-                $call['object'] = current(self::cleanupTraceArguments([$call['object']]));
157
+            if (isset($call['object'])) {
158
+                            $call['object'] = current(self::cleanupTraceArguments([$call['object']]));
159
+            }
148 160
 
149
-            if (isset($call['args']))
150
-                $call['args'] = self::cleanupTraceArguments($call['args']);
161
+            if (isset($call['args'])) {
162
+                            $call['args'] = self::cleanupTraceArguments($call['args']);
163
+            }
151 164
 
152 165
             $trace[$n] = $call;
153 166
         }
@@ -176,10 +189,11 @@  discard block
 block discarded – undo
176 189
                     $args[$name] = $object;
177 190
                 }
178 191
             } else if (is_array($value)) {
179
-                if ($recurseDepth > 0)
180
-                    $args[$name] = self::cleanupTraceArguments($value, $recurseDepth - 1);
181
-                else
182
-                    $args[$name] = 'Array';
192
+                if ($recurseDepth > 0) {
193
+                                    $args[$name] = self::cleanupTraceArguments($value, $recurseDepth - 1);
194
+                } else {
195
+                                    $args[$name] = 'Array';
196
+                }
183 197
             }
184 198
         }
185 199
         return $args;
@@ -212,8 +226,9 @@  discard block
 block discarded – undo
212 226
     public static function formatAsQuery($data)
213 227
     {
214 228
         $data = rawurldecode($data);
215
-        if (!preg_match('/^([\w\d\-\[\]]+(=[^&]*)?(&[\w\d\-\[\]]+(=[^&]*)?)*)?$/', $data))
216
-            return null;
229
+        if (!preg_match('/^([\w\d\-\[\]]+(=[^&]*)?(&[\w\d\-\[\]]+(=[^&]*)?)*)?$/', $data)) {
230
+                    return null;
231
+        }
217 232
 
218 233
         $result = [];
219 234
         parse_str($data, $result);
@@ -241,8 +256,9 @@  discard block
 block discarded – undo
241 256
         $doc = new \DOMDocument('1.0');
242 257
         $doc->preserveWhiteSpace = false;
243 258
         $doc->formatOutput = true;
244
-        if (@$doc->loadXML($data))
245
-            return htmlentities($doc->saveXML(), ENT_COMPAT, 'UTF-8');
259
+        if (@$doc->loadXML($data)) {
260
+                    return htmlentities($doc->saveXML(), ENT_COMPAT, 'UTF-8');
261
+        }
246 262
         return null;
247 263
     }
248 264
 
@@ -253,14 +269,16 @@  discard block
 block discarded – undo
253 269
      */
254 270
     public static function formatAsHTML($data)
255 271
     {
256
-        if ($data == strip_tags($data) || strtolower(substr(ltrim($data), 0, 5)) == '<?xml')
257
-            return null;
272
+        if ($data == strip_tags($data) || strtolower(substr(ltrim($data), 0, 5)) == '<?xml') {
273
+                    return null;
274
+        }
258 275
 
259 276
         $doc = new \DOMDocument('1.0');
260 277
         $doc->preserveWhiteSpace = false;
261 278
         $doc->formatOutput = true;
262
-        if (@$doc->loadHTML($data))
263
-            return htmlentities($doc->saveHTML(), ENT_COMPAT, 'UTF-8');
279
+        if (@$doc->loadHTML($data)) {
280
+                    return htmlentities($doc->saveHTML(), ENT_COMPAT, 'UTF-8');
281
+        }
264 282
         return null;
265 283
     }
266 284
 }
267 285
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/SoapClient.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
         return $this->_data['result'] = parent::__doRequest($request, $location, $action, $version, $one_way);
81 81
     }
82 82
 
83
-    public function __setCookie ($name, $value = null)
83
+    public function __setCookie($name, $value = null)
84 84
     {
85 85
         if (!isset($this->_data['cookies']))
86 86
             $this->_data['cookies'] = [];
Please login to merge, or discard this patch.
Braces   +17 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
         try {
16 16
             parent::__construct($wsdl, $options);
17
-        }
18
-        catch (\SoapFault $e) {
17
+        } catch (\SoapFault $e) {
19 18
             // Catches errors like being unable to read the WSDL and so on
20 19
             $this->logSoapFault($e);
21 20
             throw $e;
@@ -46,22 +45,24 @@  discard block
 block discarded – undo
46 45
         try {
47 46
             $result = parent::__soapCall($function_name, $arguments, $options, $input_headers, $output_headers);
48 47
             $this->_data['duration'] = microtime(true) - $started;
49
-            if ($output_headers)
50
-                $this->_data['output_headers'] = (array) $output_headers;
48
+            if ($output_headers) {
49
+                            $this->_data['output_headers'] = (array) $output_headers;
50
+            }
51 51
 
52
-            if (is_soap_fault($result))
53
-                // Cover non-exception variant
52
+            if (is_soap_fault($result)) {
53
+                            // Cover non-exception variant
54 54
                 return $this->logSoapFault($result);
55
+            }
55 56
 
56 57
             $this->_data['result_object'] = $result;
57 58
             $this->finalize();
58 59
 
59 60
             return $result;
60
-        }
61
-        catch (\Exception $error) {
61
+        } catch (\Exception $error) {
62 62
             $this->_data['duration'] = microtime(true) - $started;
63
-            if ($output_headers)
64
-                $this->_data['output_headers'] = (array) $output_headers;
63
+            if ($output_headers) {
64
+                            $this->_data['output_headers'] = (array) $output_headers;
65
+            }
65 66
 
66 67
             $this->logSoapFault($error);
67 68
             throw $error;
@@ -82,8 +83,9 @@  discard block
 block discarded – undo
82 83
 
83 84
     public function __setCookie ($name, $value = null)
84 85
     {
85
-        if (!isset($this->_data['cookies']))
86
-            $this->_data['cookies'] = [];
86
+        if (!isset($this->_data['cookies'])) {
87
+                    $this->_data['cookies'] = [];
88
+        }
87 89
         $this->_data['cookies'][$name] = $value;
88 90
 
89 91
         parent::__setCookie($name, $value);
@@ -99,7 +101,8 @@  discard block
 block discarded – undo
99 101
     protected function finalize()
100 102
     {
101 103
         $_panel = Audit::getInstance()->getPanel('audit/soap');
102
-        if ($_panel)
103
-            $_panel->logSoapRequest($this->_data);
104
+        if ($_panel) {
105
+                    $_panel->logSoapRequest($this->_data);
106
+        }
104 107
     }
105 108
 }
106 109
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/db/ActiveRecord.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,13 +37,15 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function beforeSave($insert)
39 39
     {
40
-        if ($insert && $this->hasAttribute('created'))
41
-            $this->created = date('Y-m-d H:i:s');
40
+        if ($insert && $this->hasAttribute('created')) {
41
+                    $this->created = date('Y-m-d H:i:s');
42
+        }
42 43
 
43
-        if ($this->autoSerialize)
44
-            foreach ($this->serializeAttributes as $attribute)
44
+        if ($this->autoSerialize) {
45
+                    foreach ($this->serializeAttributes as $attribute)
45 46
                 if ($this->hasAttribute($attribute))
46 47
                     $this->$attribute = [Helper::serialize($this->$attribute, false), \PDO::PARAM_LOB];
48
+        }
47 49
 
48 50
         return parent::beforeSave($insert);
49 51
     }
@@ -56,12 +58,13 @@  discard block
 block discarded – undo
56 58
     {
57 59
         parent::afterSave($insert, $changedAttributes);
58 60
 
59
-        if ($this->autoSerialize)
60
-            foreach ($this->serializeAttributes as $attribute)
61
+        if ($this->autoSerialize) {
62
+                    foreach ($this->serializeAttributes as $attribute)
61 63
                 if ($this->hasAttribute($attribute)) {
62 64
                     if (is_array($this->$attribute)) {
63 65
                         // Get rid of the extra PDO parameter type if needed
64 66
                         $array = $this->$attribute;
67
+        }
65 68
                         $this->$attribute = $array[0];
66 69
                     }
67 70
                     $this->$attribute = Helper::unserialize($this->$attribute);
@@ -75,9 +78,10 @@  discard block
 block discarded – undo
75 78
     {
76 79
         parent::afterFind();
77 80
 
78
-        if ($this->autoSerialize)
79
-            foreach ($this->serializeAttributes as $attribute)
81
+        if ($this->autoSerialize) {
82
+                    foreach ($this->serializeAttributes as $attribute)
80 83
                 if ($this->hasAttribute($attribute))
81 84
                     $this->$attribute = Helper::unserialize($this->$attribute);
85
+        }
82 86
     }
83 87
 }
84 88
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/panels/PanelTrait.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,8 +101,9 @@
 block discarded – undo
101 101
     public function cleanup($maxAge = null)
102 102
     {
103 103
         $maxAge = $maxAge !== null ? $maxAge : $this->maxAge;
104
-        if ($maxAge === null)
105
-            return false;
104
+        if ($maxAge === null) {
105
+                    return false;
106
+        }
106 107
         return AuditData::deleteAll('type = :type AND created <= :created', [
107 108
             ':type' => $this->id,
108 109
             ':created' => date('Y-m-d 23:59:59', strtotime("-$maxAge days")),
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function getLabel()
38 38
     {
39
-        return $this->getName() . ' <small>(' . count($this->data) . ')</small>';
39
+        return $this->getName().' <small>('.count($this->data).')</small>';
40 40
     }
41 41
 
42 42
     /**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function getUrl($additionalParams = NULL)
82 82
     {
83
-        return Url::toRoute(['/' . $this->module->id . '/entry/view',
83
+        return Url::toRoute(['/'.$this->module->id.'/entry/view',
84 84
             'panel' => $this->id,
85 85
             'id' => $this->tag,
86 86
         ]);
Please login to merge, or discard this patch.
src/controllers/EntryController.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
     public function actionView($id, $panel = '')
47 47
     {
48 48
         list($model, $panels) = $this->loadData($id);
49
-        if (isset($panels[$panel]))
50
-            $activePanel = $panel;
51
-        else {
49
+        if (isset($panels[$panel])) {
50
+                    $activePanel = $panel;
51
+        } else {
52 52
             reset($panels);
53 53
             $activePanel = key($panels);
54 54
         }
@@ -97,9 +97,10 @@  discard block
 block discarded – undo
97 97
         $panels = $this->module->loadPanels($this->module->getPanelIdentifiers());
98 98
         $activePanels = [];
99 99
         $data = ArrayHelper::getColumn($model->data, 'data');
100
-        foreach ($panels as $panelId => $panel)
101
-            if ($panel->hasEntryData($model)) {
100
+        foreach ($panels as $panelId => $panel) {
101
+                    if ($panel->hasEntryData($model)) {
102 102
                 $panel->tag = $id;
103
+        }
103 104
                 $panel->model = $model;
104 105
                 $panel->load(isset($data[$panelId]) ? $data[$panelId] : null);
105 106
                 $activePanels[$panelId] = $panel;
Please login to merge, or discard this patch.
src/controllers/JsLogController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@
 block discarded – undo
44 44
             'message'    => 'message',
45 45
             'type'       => 'type',
46 46
             'file'       => 'origin',
47
-            'line'       => function ($value) use ($javascript) {
48
-                $javascript->origin .= ':' . $value;
47
+            'line'       => function($value) use ($javascript) {
48
+                $javascript->origin .= ':'.$value;
49 49
             },
50
-            'col'        => function ($value) use ($javascript) {
51
-                $javascript->origin .= ':' . $value;
50
+            'col'        => function($value) use ($javascript) {
51
+                $javascript->origin .= ':'.$value;
52 52
             },
53
-            'data'       => function ($value) use ($javascript) {
53
+            'data'       => function($value) use ($javascript) {
54 54
                 if (count($value)) $javascript->data = $value;
55 55
             },
56 56
         ];
Please login to merge, or discard this patch.
Braces   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,21 +51,28 @@
 block discarded – undo
51 51
                 $javascript->origin .= ':' . $value;
52 52
             },
53 53
             'data'       => function ($value) use ($javascript) {
54
-                if (count($value)) $javascript->data = $value;
54
+                if (count($value)) {
55
+                    $javascript->data = $value;
56
+                }
55 57
             },
56 58
         ];
57 59
 
58
-        foreach ($map as $key => $target)
59
-            if (isset($data[$key])) {
60
+        foreach ($map as $key => $target) {
61
+                    if (isset($data[$key])) {
60 62
                 if (is_callable($target)) $target($data[$key]);
61
-                else $javascript->$target = $data[$key];
63
+        }
64
+                else {
65
+                    $javascript->$target = $data[$key];
66
+                }
62 67
             }
63 68
 
64
-        if (!$javascript->type)
65
-            $javascript->type = 'unknown';
69
+        if (!$javascript->type) {
70
+                    $javascript->type = 'unknown';
71
+        }
66 72
 
67
-        if ($javascript->save())
68
-            return ['result' => 'ok', 'entry' => $data['auditEntry']];
73
+        if ($javascript->save()) {
74
+                    return ['result' => 'ok', 'entry' => $data['auditEntry']];
75
+        }
69 76
 
70 77
         return ['result' => 'error', 'errors' => $javascript->getErrors()];
71 78
     }
Please login to merge, or discard this patch.
src/controllers/MailController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,6 +58,6 @@
 block discarded – undo
58 58
         if (!$model) {
59 59
             throw new NotFoundHttpException('The requested mail does not exist.');
60 60
         }
61
-        Yii::$app->response->sendContentAsFile(Helper::uncompress($model->data), $model->id . '.eml');
61
+        Yii::$app->response->sendContentAsFile(Helper::uncompress($model->data), $model->id.'.eml');
62 62
     }
63 63
 }
Please login to merge, or discard this patch.
src/messages/config.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     // and the '.svn' will match all files and directories named exactly '.svn'.
27 27
     // Note, the '/' characters in a pattern matches both '/' and '\'.
28 28
     // See helpers/FileHelper::findFiles() description for more details on pattern matching rules.
29
-     'only' => ['*.php', '*.js'],
29
+        'only' => ['*.php', '*.js'],
30 30
     // array, list of patterns that specify which files (not directories) should be processed.
31 31
     // If empty or not set, all files will be processed.
32 32
     // Please refer to "except" for details about the patterns.
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
     // string, required, root directory of all source files
5
-    'sourcePath' => __DIR__ . '/..',
5
+    'sourcePath' => __DIR__.'/..',
6 6
     // array, required, list of language codes that the extracted messages
7 7
     // should be translated to. For example, ['zh-CN', 'de'].
8 8
     'languages' => ['en', 'nl', 'ru', 'es', 'tr'],
Please login to merge, or discard this patch.