@@ -47,12 +47,14 @@ discard block |
||
47 | 47 | { |
48 | 48 | // Only log each exception once |
49 | 49 | $exceptionId = spl_object_hash($exception); |
50 | - if (in_array($exceptionId, $this->_exceptions)) |
|
51 | - return true; |
|
50 | + if (in_array($exceptionId, $this->_exceptions)) { |
|
51 | + return true; |
|
52 | + } |
|
52 | 53 | |
53 | 54 | // If this is a follow up exception, make sure to log the base exception first |
54 | - if ($exception->getPrevious()) |
|
55 | - $this->log($entry_id, $exception->getPrevious()); |
|
55 | + if ($exception->getPrevious()) { |
|
56 | + $this->log($entry_id, $exception->getPrevious()); |
|
57 | + } |
|
56 | 58 | |
57 | 59 | $error = new AuditError(); |
58 | 60 | $error->entry_id = $entry_id; |
@@ -165,8 +167,9 @@ discard block |
||
165 | 167 | public function cleanup($maxAge = null) |
166 | 168 | { |
167 | 169 | $maxAge = $maxAge !== null ? $maxAge : $this->maxAge; |
168 | - if ($maxAge === null) |
|
169 | - return false; |
|
170 | + if ($maxAge === null) { |
|
171 | + return false; |
|
172 | + } |
|
170 | 173 | return AuditError::deleteAll([ |
171 | 174 | '<=', 'created', date('Y-m-d 23:59:59', strtotime("-$maxAge days")) |
172 | 175 | ]); |
@@ -35,8 +35,9 @@ |
||
35 | 35 | { |
36 | 36 | $this->module->registerPanel($this); |
37 | 37 | |
38 | - if (!is_array($this->data)) |
|
39 | - $this->data = []; |
|
38 | + if (!is_array($this->data)) { |
|
39 | + $this->data = []; |
|
40 | + } |
|
40 | 41 | |
41 | 42 | if (isset($data['error'])) { |
42 | 43 | $error = $this->module->exception($data['error']); |
@@ -87,8 +87,9 @@ |
||
87 | 87 | public function cleanup($maxAge = null) |
88 | 88 | { |
89 | 89 | $maxAge = $maxAge !== null ? $maxAge : $this->maxAge; |
90 | - if ($maxAge === null) |
|
91 | - return false; |
|
90 | + if ($maxAge === null) { |
|
91 | + return false; |
|
92 | + } |
|
92 | 93 | return AuditTrail::deleteAll([ |
93 | 94 | '<=', 'created', date('Y-m-d 23:59:59', strtotime("-$maxAge days")) |
94 | 95 | ]); |
@@ -38,11 +38,12 @@ discard block |
||
38 | 38 | ); |
39 | 39 | } |
40 | 40 | |
41 | -if ($headers) |
|
41 | +if ($headers) { |
|
42 | 42 | $tabs[] = [ |
43 | 43 | 'label' => \Yii::t('audit', 'Headers'), |
44 | 44 | 'content' => Html::tag('div', $formatter->asNtext(implode('', $headers)), ['class' => 'well']) |
45 | 45 | ]; |
46 | +} |
|
46 | 47 | |
47 | 48 | if ($content) { |
48 | 49 | $tabs[] = [ |
@@ -56,11 +57,12 @@ discard block |
||
56 | 57 | ); |
57 | 58 | } |
58 | 59 | |
59 | -if ($log) |
|
60 | +if ($log) { |
|
60 | 61 | $tabs[] = [ |
61 | 62 | 'label' => \Yii::t('audit', 'Log'), |
62 | 63 | 'content' => Html::tag('div', $formatter->asText($log), $preformatted) |
63 | 64 | ]; |
65 | +} |
|
64 | 66 | |
65 | 67 | |
66 | 68 | echo Html::tag('h2', \Yii::t('audit', 'Request #{id}', ['id' => $index])), |
@@ -23,23 +23,24 @@ |
||
23 | 23 | <td> |
24 | 24 | <?php |
25 | 25 | |
26 | - if (preg_match('/_{0,1}(size|length)_{0,1}/', $name)) |
|
27 | - echo $formatter->asSize($value); |
|
28 | - else if (strpos($name, 'speed') !== false) |
|
29 | - echo $formatter->asSize($value) . '/s'; |
|
30 | - else if (strpos($name, 'time') !== false && is_numeric($value) && $value >= 0) |
|
31 | - echo number_format($value, 2) . 's'; |
|
32 | - else if ($name == 'http_code') { |
|
26 | + if (preg_match('/_{0,1}(size|length)_{0,1}/', $name)) { |
|
27 | + echo $formatter->asSize($value); |
|
28 | + } else if (strpos($name, 'speed') !== false) { |
|
29 | + echo $formatter->asSize($value) . '/s'; |
|
30 | + } else if (strpos($name, 'time') !== false && is_numeric($value) && $value >= 0) { |
|
31 | + echo number_format($value, 2) . 's'; |
|
32 | + } else if ($name == 'http_code') { |
|
33 | 33 | $type = substr($value, 0, 1); |
34 | 34 | echo Html::tag('span', $value . (isset(Response::$httpStatuses[$value]) ? (' (' . Response::$httpStatuses[$value] . ')') : ''), |
35 | 35 | ['style' => 'color: '. ($type == 2 ? 'green' : ($type == 4 || $type == 5 ? 'red' : 'orange'))]); |
36 | - } |
|
37 | - else |
|
38 | - echo htmlspecialchars(VarDumper::dumpAsString($value), ENT_QUOTES|ENT_SUBSTITUTE, \Yii::$app->charset, true) |
|
36 | + } else { |
|
37 | + echo htmlspecialchars(VarDumper::dumpAsString($value), ENT_QUOTES|ENT_SUBSTITUTE, \Yii::$app->charset, true) |
|
39 | 38 | ?> |
40 | 39 | </td> |
41 | 40 | </tr> |
42 | - <?php endforeach; ?> |
|
41 | + <?php endforeach; |
|
42 | + } |
|
43 | + ?> |
|
43 | 44 | </tbody> |
44 | 45 | </table> |
45 | 46 | </div> |
@@ -24,11 +24,12 @@ |
||
24 | 24 | |
25 | 25 | if (isset($request['result'])) { |
26 | 26 | $xml = Helper::formatAsXML($request['result']); |
27 | - if ($xml) |
|
28 | - $tabs[] = [ |
|
27 | + if ($xml) { |
|
28 | + $tabs[] = [ |
|
29 | 29 | 'label' => \Yii::t('audit', 'Result - XML'), |
30 | 30 | 'content' => Html::tag('div', $xml, $preformatted) |
31 | 31 | ]; |
32 | + } |
|
32 | 33 | |
33 | 34 | $tabs[] = [ |
34 | 35 | 'label' => \Yii::t('audit', 'Result'), |
@@ -6,5 +6,6 @@ |
||
6 | 6 | |
7 | 7 | echo Html::tag('h1', $panel->name); |
8 | 8 | |
9 | -foreach ($dataProvider->allModels as $index => $request) |
|
9 | +foreach ($dataProvider->allModels as $index => $request) { |
|
10 | 10 | echo $this->render('detail', ['panel' => $panel, 'request' => $request, 'index' => $index + 1]); |
11 | +} |
@@ -28,10 +28,11 @@ |
||
28 | 28 | <th><?= Html::encode(\yii\helpers\Inflector::humanize($name)) ?></th> |
29 | 29 | <td> |
30 | 30 | <?php |
31 | - if (is_array($value) || is_object($value)) |
|
32 | - $value = \yii\helpers\ArrayHelper::toArray($value); |
|
33 | - elseif ($name == 'duration') |
|
34 | - $value = number_format($value, 2) . 's'; |
|
31 | + if (is_array($value) || is_object($value)) { |
|
32 | + $value = \yii\helpers\ArrayHelper::toArray($value); |
|
33 | + } elseif ($name == 'duration') { |
|
34 | + $value = number_format($value, 2) . 's'; |
|
35 | + } |
|
35 | 36 | echo $name == 'error' ? $value : $formatter->asText(is_scalar($value) ? $value : VarDumper::dumpAsString($value)); |
36 | 37 | ?> |
37 | 38 | </td> |
@@ -87,8 +87,9 @@ |
||
87 | 87 | public function cleanup($maxAge = null) |
88 | 88 | { |
89 | 89 | $maxAge = $maxAge !== null ? $maxAge : $this->maxAge; |
90 | - if ($maxAge === null) |
|
91 | - return false; |
|
90 | + if ($maxAge === null) { |
|
91 | + return false; |
|
92 | + } |
|
92 | 93 | return AuditTrail::deleteAll([ |
93 | 94 | '<=', 'created', date('Y-m-d 23:59:59', strtotime("-$maxAge days")) |
94 | 95 | ]); |