@@ -82,7 +82,7 @@ |
||
| 82 | 82 | * @param $id |
| 83 | 83 | * @param $attribute |
| 84 | 84 | * @param $version |
| 85 | - * @return null|integer|float|string |
|
| 85 | + * @return string|null |
|
| 86 | 86 | */ |
| 87 | 87 | public static function findAttribute($class, $id, $attribute, $version) |
| 88 | 88 | { |
@@ -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 |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function getLabel() |
| 63 | 63 | { |
| 64 | - return $this->getName() . ' <small>(' . count($this->data) . ')</small>'; |
|
| 64 | + return $this->getName().' <small>('.count($this->data).')</small>'; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if ($this->content) |
| 140 | - $this->data[$id]['content']= curl_multi_getcontent($handle); |
|
| 140 | + $this->data[$id]['content'] = curl_multi_getcontent($handle); |
|
| 141 | 141 | |
| 142 | 142 | // Cleanup empty things |
| 143 | 143 | $this->data[$id] = array_filter($this->data[$id]); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | if (!is_resource($resource)) |
| 209 | 209 | return false; |
| 210 | 210 | |
| 211 | - $parts = explode('#', (string)$resource); |
|
| 211 | + $parts = explode('#', (string) $resource); |
|
| 212 | 212 | return array_pop($parts); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -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 | |
@@ -29,8 +29,8 @@ |
||
| 29 | 29 | { |
| 30 | 30 | $timings = $this->calculateTimings(); |
| 31 | 31 | $queryCount = count($timings); |
| 32 | - $queryTime = number_format($this->getTotalQueryTime($timings) * 1000) . ' ms'; |
|
| 33 | - return $this->getName() . ' <small>(' . $queryCount . ' / ' . $queryTime . ')</small>'; |
|
| 32 | + $queryTime = number_format($this->getTotalQueryTime($timings) * 1000).' ms'; |
|
| 33 | + return $this->getName().' <small>('.$queryCount.' / '.$queryTime.')</small>'; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -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 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public function getLabel() |
| 22 | 22 | { |
| 23 | 23 | $messageCount = isset($this->data['messages']) ? count($this->data['messages']) : 0; |
| 24 | - return $this->getName() . ($messageCount ? ' <small>(' . $messageCount . ')</small>' : ''); |
|
| 24 | + return $this->getName().($messageCount ? ' <small>('.$messageCount.')</small>' : ''); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @param Event $event |
| 39 | - * @return null|static |
|
| 39 | + * @return AuditMail|null |
|
| 40 | 40 | */ |
| 41 | 41 | public function record($event) |
| 42 | 42 | { |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function init() |
| 30 | 30 | { |
| 31 | 31 | parent::init(); |
| 32 | - Event::on(BaseMailer::className(), BaseMailer::EVENT_AFTER_SEND, function ($event) { |
|
| 32 | + Event::on(BaseMailer::className(), BaseMailer::EVENT_AFTER_SEND, function($event) { |
|
| 33 | 33 | $this->record($event); |
| 34 | 34 | }); |
| 35 | 35 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function getLabel() |
| 117 | 117 | { |
| 118 | - return $this->getName() . ' <small>(' . count($this->_model->mails) . ')</small>'; |
|
| 118 | + return $this->getName().' <small>('.count($this->_model->mails).')</small>'; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -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,15 +2,15 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace bedezign\yii2\audit\panels; |
| 4 | 4 | |
| 5 | +use Swift_Message; |
|
| 6 | +use Swift_Mime_Attachment; |
|
| 7 | +use Swift_Mime_MimePart; |
|
| 8 | +use Yii; |
|
| 5 | 9 | use bedezign\yii2\audit\Audit; |
| 6 | 10 | use bedezign\yii2\audit\components\panels\Panel; |
| 7 | 11 | use bedezign\yii2\audit\components\panels\RendersSummaryChartTrait; |
| 8 | 12 | use bedezign\yii2\audit\models\AuditMail; |
| 9 | 13 | use bedezign\yii2\audit\models\AuditMailSearch; |
| 10 | -use Swift_Message; |
|
| 11 | -use Swift_Mime_Attachment; |
|
| 12 | -use Swift_Mime_MimePart; |
|
| 13 | -use Yii; |
|
| 14 | 14 | use yii\base\Event; |
| 15 | 15 | use yii\grid\GridViewAsset; |
| 16 | 16 | use yii\mail\BaseMailer; |
@@ -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 | |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | public function getLabel() |
| 22 | 22 | { |
| 23 | 23 | $memory = isset($this->data['memory']) ? sprintf('%.1f MB', $this->data['memory'] / 1048576) : ''; |
| 24 | - $time = isset($this->data['time']) ? number_format($this->data['time'] * 1000) . ' ms' : ''; |
|
| 25 | - return $this->getName() . ' <small>(' . $memory . ' / ' . $time . ')</small>'; |
|
| 24 | + $time = isset($this->data['time']) ? number_format($this->data['time'] * 1000).' ms' : ''; |
|
| 25 | + return $this->getName().' <small>('.$memory.' / '.$time.')</small>'; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | 'dataProvider' => $dataProvider, |
| 39 | 39 | 'searchModel' => $searchModel, |
| 40 | 40 | 'memory' => isset($this->data['memory']) ? sprintf('%.1f MB', $this->data['memory'] / 1048576) : '', |
| 41 | - 'time' => isset($this->data['time']) ? number_format($this->data['time'] * 1000) . ' ms' : '', |
|
| 41 | + 'time' => isset($this->data['time']) ? number_format($this->data['time'] * 1000).' ms' : '', |
|
| 42 | 42 | ]); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -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']); |
@@ -36,7 +36,7 @@ |
||
| 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 | /** |
@@ -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']; |
@@ -38,6 +38,6 @@ |
||
| 38 | 38 | unset($request['result']); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -$tabs[] = [ 'label' => \Yii::t('audit', 'Info'), 'content' => $this->render('info_table', ['request' => $request]), 'active' => true ]; |
|
| 41 | +$tabs[] = ['label' => \Yii::t('audit', 'Info'), 'content' => $this->render('info_table', ['request' => $request]), 'active' => true]; |
|
| 42 | 42 | |
| 43 | 43 | echo Html::tag('h2', \Yii::t('audit', 'Request #{id}', ['id' => $index])), Tabs::widget(['items' => array_reverse($tabs)]); |
@@ -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 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | if (isset($request['error']) && isset($request['error'][1])) { |
| 12 | 12 | $error = \bedezign\yii2\audit\models\AuditError::findOne($request['error'][1]); |
| 13 | - $request['error'] = Html::a('[' . $request['error'][0] . '] ' . $error->message, ['error/view', 'id' => $error->id]); |
|
| 13 | + $request['error'] = Html::a('['.$request['error'][0].'] '.$error->message, ['error/view', 'id' => $error->id]); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | ?> |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | if (is_array($value) || is_object($value)) |
| 32 | 32 | $value = \yii\helpers\ArrayHelper::toArray($value); |
| 33 | 33 | elseif ($name == 'duration') |
| 34 | - $value = number_format($value, 2) . 's'; |
|
| 34 | + $value = number_format($value, 2).'s'; |
|
| 35 | 35 | echo $name == 'error' ? $value : $formatter->asText(is_scalar($value) ? $value : VarDumper::dumpAsString($value)); |
| 36 | 36 | ?> |
| 37 | 37 | </td> |
@@ -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> |