@@ -8,8 +8,8 @@ |
||
| 8 | 8 | |
| 9 | 9 | use Yii; |
| 10 | 10 | use bedezign\yii2\audit\components\panels\DataStoragePanel; |
| 11 | -use yii\grid\GridViewAsset; |
|
| 12 | 11 | use yii\data\ArrayDataProvider; |
| 12 | +use yii\grid\GridViewAsset; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * Class CurlPanel |
@@ -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); |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace bedezign\yii2\audit\panels; |
| 4 | 4 | |
| 5 | -use bedezign\yii2\audit\components\panels\DataStoragePanelTrait; |
|
| 6 | 5 | use Yii; |
| 6 | +use bedezign\yii2\audit\components\panels\DataStoragePanelTrait; |
|
| 7 | 7 | use yii\debug\models\search\Db; |
| 8 | 8 | use yii\grid\GridViewAsset; |
| 9 | 9 | |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace bedezign\yii2\audit\panels; |
| 4 | 4 | |
| 5 | -use bedezign\yii2\audit\components\panels\DataStoragePanelTrait; |
|
| 6 | 5 | use Yii; |
| 6 | +use bedezign\yii2\audit\components\panels\DataStoragePanelTrait; |
|
| 7 | 7 | use yii\debug\models\search\Log; |
| 8 | 8 | use yii\grid\GridViewAsset; |
| 9 | 9 | |
@@ -2,14 +2,14 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace bedezign\yii2\audit\panels; |
| 4 | 4 | |
| 5 | -use bedezign\yii2\audit\Audit; |
|
| 6 | -use bedezign\yii2\audit\components\panels\Panel; |
|
| 7 | -use bedezign\yii2\audit\models\AuditMail; |
|
| 8 | -use bedezign\yii2\audit\models\AuditMailSearch; |
|
| 9 | 5 | use Swift_Message; |
| 10 | 6 | use Swift_Mime_Attachment; |
| 11 | 7 | use Swift_Mime_MimePart; |
| 12 | 8 | use Yii; |
| 9 | +use bedezign\yii2\audit\Audit; |
|
| 10 | +use bedezign\yii2\audit\components\panels\Panel; |
|
| 11 | +use bedezign\yii2\audit\models\AuditMail; |
|
| 12 | +use bedezign\yii2\audit\models\AuditMailSearch; |
|
| 13 | 13 | use yii\base\Event; |
| 14 | 14 | use yii\grid\GridViewAsset; |
| 15 | 15 | use yii\mail\BaseMailer; |
@@ -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 | ]); |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace bedezign\yii2\audit\panels; |
| 4 | 4 | |
| 5 | -use bedezign\yii2\audit\components\panels\DataStoragePanelTrait; |
|
| 6 | 5 | use Yii; |
| 6 | +use bedezign\yii2\audit\components\panels\DataStoragePanelTrait; |
|
| 7 | 7 | use yii\debug\models\search\Profile; |
| 8 | 8 | use yii\grid\GridViewAsset; |
| 9 | 9 | |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace bedezign\yii2\audit\panels; |
| 3 | 3 | |
| 4 | 4 | use Yii; |
| 5 | -use bedezign\yii2\audit\models\AuditError; |
|
| 6 | 5 | use bedezign\yii2\audit\components\panels\DataStoragePanel; |
| 7 | 6 | use yii\data\ArrayDataProvider; |
| 8 | 7 | |
@@ -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']); |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /* @var $panel bedezign\yii2\audit\panels\SoapPanel */ |
| 3 | 3 | |
| 4 | -use yii\bootstrap\Tabs; |
|
| 5 | -use yii\helpers\Html; |
|
| 6 | 4 | use bedezign\yii2\audit\components\Helper; |
| 5 | +use yii\bootstrap\Tabs; |
|
| 7 | 6 | use yii\helpers\ArrayHelper; |
| 7 | +use yii\helpers\Html; |
|
| 8 | 8 | use yii\helpers\VarDumper; |
| 9 | 9 | |
| 10 | 10 | $preformatted = ['class' => 'well', 'style' => 'overflow: auto; white-space: pre']; |
@@ -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'), |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | use yii\helpers\Html; |
| 4 | 4 | use yii\helpers\VarDumper; |
| 5 | -use yii\helpers\Url; |
|
| 6 | 5 | |
| 7 | 6 | |
| 8 | 7 | |
@@ -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> |
@@ -36,13 +36,15 @@ discard block |
||
| 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 |
||
| 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 = []; |