@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function typeFilter() |
70 | 70 | { |
71 | - $types = AuditJavascript::getDb()->cache(function () { |
|
71 | + $types = AuditJavascript::getDb()->cache(function() { |
|
72 | 72 | return AuditJavascript::find()->distinct(true) |
73 | 73 | ->select('type') |
74 | 74 | ->where(['entry_id' => $this->entry_id]) |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function originFilter() |
85 | 85 | { |
86 | - $origin = AuditJavascript::getDb()->cache(function () { |
|
86 | + $origin = AuditJavascript::getDb()->cache(function() { |
|
87 | 87 | return AuditJavascript::find()->distinct(true) |
88 | 88 | ->select('origin') |
89 | 89 | ->where(['entry_id' => $this->entry_id]) |
@@ -57,8 +57,9 @@ |
||
57 | 57 | |
58 | 58 | // adjust the query by adding the filters |
59 | 59 | $userId = $this->user_id; |
60 | - if (strlen($this->user_id)) |
|
61 | - $userId = intval($this->user_id) ?: 0; |
|
60 | + if (strlen($this->user_id)) { |
|
61 | + $userId = intval($this->user_id) ?: 0; |
|
62 | + } |
|
62 | 63 | |
63 | 64 | $query->andFilterWhere(['id' => $this->id]); |
64 | 65 | $query->andFilterWhere(['entry_id' => $this->entry_id]); |
@@ -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\Profile; |
8 | 8 | use yii\grid\GridViewAsset; |
9 | 9 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | public function getLabel() |
29 | 29 | { |
30 | - return $this->getName() . ' <small>(' . count($this->_model->javascripts) . ')</small>'; |
|
30 | + return $this->getName().' <small>('.count($this->_model->javascripts).')</small>'; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -2,10 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace bedezign\yii2\audit\panels; |
4 | 4 | |
5 | +use Yii; |
|
5 | 6 | use bedezign\yii2\audit\components\panels\Panel; |
6 | 7 | use bedezign\yii2\audit\models\AuditTrail; |
7 | 8 | use bedezign\yii2\audit\models\AuditTrailSearch; |
8 | -use Yii; |
|
9 | 9 | use yii\grid\GridViewAsset; |
10 | 10 | |
11 | 11 | /** |
@@ -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 | ]); |
@@ -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 | /** |
@@ -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 |
@@ -63,9 +63,9 @@ |
||
63 | 63 | { |
64 | 64 | if (Yii::$app->requestedAction) { |
65 | 65 | if (Yii::$app->requestedAction instanceof InlineAction) { |
66 | - return get_class(Yii::$app->requestedAction->controller) . '::' . Yii::$app->requestedAction->actionMethod . '()'; |
|
66 | + return get_class(Yii::$app->requestedAction->controller).'::'.Yii::$app->requestedAction->actionMethod.'()'; |
|
67 | 67 | } |
68 | - return get_class(Yii::$app->requestedAction) . '::run()'; |
|
68 | + return get_class(Yii::$app->requestedAction).'::run()'; |
|
69 | 69 | } |
70 | 70 | return null; |
71 | 71 | } |
@@ -12,8 +12,8 @@ |
||
12 | 12 | $style = YII_DEBUG ? '' : 'color:transparent;'; |
13 | 13 | } |
14 | 14 | if (Access::checkAccess()) { |
15 | - echo Html::a('audit-' . $auditEntry->id, ['/audit/entry/view', 'id' => $auditEntry->id], ['style' => $style]); |
|
15 | + echo Html::a('audit-'.$auditEntry->id, ['/audit/entry/view', 'id' => $auditEntry->id], ['style' => $style]); |
|
16 | 16 | } else { |
17 | - echo Html::tag('span', 'audit-' . $auditEntry->id, ['style' => $style]); |
|
17 | + echo Html::tag('span', 'audit-'.$auditEntry->id, ['style' => $style]); |
|
18 | 18 | } |
19 | 19 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | if (empty($columns) || in_array('user_id', $columns)) { |
38 | 38 | $_columns[] = [ |
39 | 39 | 'attribute' => 'user_id', |
40 | - 'value' => function ($data) { |
|
40 | + 'value' => function($data) { |
|
41 | 41 | return Audit::getInstance()->getUserIdentifier($data->user_id); |
42 | 42 | }, |
43 | 43 | 'format' => 'raw', |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | if (empty($columns) || in_array('entry_id', $columns)) { |
47 | 47 | $_columns[] = [ |
48 | 48 | 'attribute' => 'entry_id', |
49 | - 'value' => function ($model) { |
|
49 | + 'value' => function($model) { |
|
50 | 50 | /** @var AuditTrail $model */ |
51 | 51 | if (Access::checkAccess()) { |
52 | 52 | return Html::a($model->entry_id, ['/audit/entry/view', 'id' => $model->entry_id]); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if (empty($columns) || in_array('diff', $columns)) { |
78 | 78 | $_columns[] = [ |
79 | 79 | 'label' => Yii::t('audit', 'Diff'), |
80 | - 'value' => function ($model) { |
|
80 | + 'value' => function($model) { |
|
81 | 81 | /** @var AuditTrail $model */ |
82 | 82 | return $model->getDiffHtml(); |
83 | 83 | }, |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | 'linkSelector' => '#pjax-AuditTrails ul.pagination a, th a', |
95 | 95 | ]); |
96 | 96 | |
97 | -echo '<div class="table-responsive">' . GridView::widget([ |
|
97 | +echo '<div class="table-responsive">'.GridView::widget([ |
|
98 | 98 | 'layout' => '{summary}{pager}<br/>{items}{pager}', |
99 | 99 | 'dataProvider' => $auditTrailDataProvider, |
100 | 100 | 'filterModel' => $filter ? $auditTrailSearch : null, |
101 | 101 | 'columns' => $_columns, |
102 | - ]) . '</div>'; |
|
102 | + ]).'</div>'; |
|
103 | 103 | |
104 | 104 | Pjax::end(); |
105 | 105 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $days = []; |
28 | 28 | $count = []; |
29 | 29 | foreach (range(-6, 0) as $day) { |
30 | - $date = strtotime($day . 'days'); |
|
30 | + $date = strtotime($day.'days'); |
|
31 | 31 | $days[] = date('D: Y-m-d', $date); |
32 | 32 | $count[] = AuditEntry::find()->where(['between', 'created', date('Y-m-d 00:00:00', $date), date('Y-m-d 23:59:59', $date)])->count(); |
33 | 33 | } |