@@ -96,19 +96,22 @@ discard block |
||
96 | 96 | curl_setopt($handle, CURLOPT_URL, $url); |
97 | 97 | } |
98 | 98 | |
99 | - if ($postData) |
|
100 | - $this->data[$id]['post'] = $postData; |
|
99 | + if ($postData) { |
|
100 | + $this->data[$id]['post'] = $postData; |
|
101 | + } |
|
101 | 102 | |
102 | - if ($this->headers) |
|
103 | - curl_setopt($handle, CURLOPT_HEADERFUNCTION, [$this, 'captureHeader']); |
|
103 | + if ($this->headers) { |
|
104 | + curl_setopt($handle, CURLOPT_HEADERFUNCTION, [$this, 'captureHeader']); |
|
105 | + } |
|
104 | 106 | |
105 | 107 | if ($this->log) { |
106 | 108 | curl_setopt($handle, CURLOPT_VERBOSE, true); |
107 | 109 | curl_setopt($handle, CURLOPT_STDERR, $this->_logHandles[$id] = fopen('php://temp', 'rw+')); |
108 | 110 | } |
109 | 111 | |
110 | - if ($this->content) |
|
111 | - curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1); |
|
112 | + if ($this->content) { |
|
113 | + curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1); |
|
114 | + } |
|
112 | 115 | |
113 | 116 | return true; |
114 | 117 | } |
@@ -136,8 +139,9 @@ discard block |
||
136 | 139 | unset($this->_logHandles[$id]); |
137 | 140 | } |
138 | 141 | |
139 | - if ($this->content) |
|
140 | - $this->data[$id]['content']= curl_multi_getcontent($handle); |
|
142 | + if ($this->content) { |
|
143 | + $this->data[$id]['content']= curl_multi_getcontent($handle); |
|
144 | + } |
|
141 | 145 | |
142 | 146 | // Cleanup empty things |
143 | 147 | $this->data[$id] = array_filter($this->data[$id]); |
@@ -192,8 +196,9 @@ discard block |
||
192 | 196 | public function captureHeader($handle, $header) |
193 | 197 | { |
194 | 198 | $id = $this->id($handle); |
195 | - if (!isset($this->data[$id]['headers'])) |
|
196 | - $this->data[$id]['headers'] = []; |
|
199 | + if (!isset($this->data[$id]['headers'])) { |
|
200 | + $this->data[$id]['headers'] = []; |
|
201 | + } |
|
197 | 202 | |
198 | 203 | $this->data[$id]['headers'][] = $header; |
199 | 204 | return strlen($header); |
@@ -205,8 +210,9 @@ discard block |
||
205 | 210 | */ |
206 | 211 | protected function id($resource) |
207 | 212 | { |
208 | - if (!is_resource($resource)) |
|
209 | - return false; |
|
213 | + if (!is_resource($resource)) { |
|
214 | + return false; |
|
215 | + } |
|
210 | 216 | |
211 | 217 | $parts = explode('#', (string)$resource); |
212 | 218 | return array_pop($parts); |
@@ -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 | ]); |
@@ -46,8 +46,9 @@ |
||
46 | 46 | public function trackData($type, $data) |
47 | 47 | { |
48 | 48 | $this->module->getEntry(true); |
49 | - if (!is_array($this->data)) |
|
50 | - $this->data = []; |
|
49 | + if (!is_array($this->data)) { |
|
50 | + $this->data = []; |
|
51 | + } |
|
51 | 52 | |
52 | 53 | $this->data[] = ['type' => $type, 'data' => $data]; |
53 | 54 | } |
@@ -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 AuditJavascript::deleteAll([ |
93 | 94 | '<=', 'created', date('Y-m-d 23:59:59', strtotime("-$maxAge days")) |
94 | 95 | ]); |
@@ -167,8 +167,9 @@ |
||
167 | 167 | public function cleanup($maxAge = null) |
168 | 168 | { |
169 | 169 | $maxAge = $maxAge !== null ? $maxAge : $this->maxAge; |
170 | - if ($maxAge === null) |
|
171 | - return false; |
|
170 | + if ($maxAge === null) { |
|
171 | + return false; |
|
172 | + } |
|
172 | 173 | return AuditMail::deleteAll([ |
173 | 174 | '<=', 'created', date('Y-m-d 23:59:59', strtotime("-$maxAge days")) |
174 | 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])), |
@@ -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 | +} |