@@ -64,14 +64,14 @@ |
||
64 | 64 | */ |
65 | 65 | public function getDiffHtml() |
66 | 66 | { |
67 | - $old = explode("\n", (string)$this->old_value); |
|
68 | - $new = explode("\n", (string)$this->new_value); |
|
67 | + $old = explode("\n", (string) $this->old_value); |
|
68 | + $new = explode("\n", (string) $this->new_value); |
|
69 | 69 | |
70 | 70 | foreach ($old as $i => $line) { |
71 | - $old[$i] = rtrim((string)$line, "\r\n"); |
|
71 | + $old[$i] = rtrim((string) $line, "\r\n"); |
|
72 | 72 | } |
73 | 73 | foreach ($new as $i => $line) { |
74 | - $new[$i] = rtrim((string)$line, "\r\n"); |
|
74 | + $new[$i] = rtrim((string) $line, "\r\n"); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $diff = new \Diff($old, $new); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | // for batch inserts the same way. This code adds a number of literals instead of the actual values |
123 | 123 | // so that they can be bound right before insert and still get escaped correctly |
124 | 124 | foreach ($batchData as $type => $data) { |
125 | - $param = ':data_' . str_replace('/', '_', $type); |
|
125 | + $param = ':data_'.str_replace('/', '_', $type); |
|
126 | 126 | $rows[] = [$this->id, $type, $date, new Expression($param)]; |
127 | 127 | $params[$param] = [Helper::serialize($data, $compact), \PDO::PARAM_LOB]; |
128 | 128 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | if ($this->getRequestMethodIsCli()) { |
233 | 233 | $route = $this->route; |
234 | 234 | } else { |
235 | - $route = '/' . $this->route; |
|
235 | + $route = '/'.$this->route; |
|
236 | 236 | } |
237 | 237 | return Url::to([$route ?: '/'], 'https'); |
238 | 238 | } |
@@ -291,8 +291,9 @@ discard block |
||
291 | 291 | */ |
292 | 292 | public function registerFunction($name, $callback) |
293 | 293 | { |
294 | - if (isset($this->_panelFunctions[$name])) |
|
295 | - throw new InvalidParamException("The '$name'-function has already been defined."); |
|
294 | + if (isset($this->_panelFunctions[$name])) { |
|
295 | + throw new InvalidParamException("The '$name'-function has already been defined."); |
|
296 | + } |
|
296 | 297 | |
297 | 298 | $this->_panelFunctions[$name] = $callback; |
298 | 299 | } |
@@ -320,8 +321,9 @@ discard block |
||
320 | 321 | */ |
321 | 322 | public function __call($name, $params) |
322 | 323 | { |
323 | - if (!isset($this->_panelFunctions[$name])) |
|
324 | - throw new \yii\base\InvalidCallException("Unknown panel function '$name'"); |
|
324 | + if (!isset($this->_panelFunctions[$name])) { |
|
325 | + throw new \yii\base\InvalidCallException("Unknown panel function '$name'"); |
|
326 | + } |
|
325 | 327 | |
326 | 328 | return call_user_func_array($this->_panelFunctions[$name], $params); |
327 | 329 | } |
@@ -459,13 +461,15 @@ discard block |
||
459 | 461 | public function getPanel($identifier) |
460 | 462 | { |
461 | 463 | $config = null; |
462 | - if (isset($this->panels[$identifier])) |
|
463 | - $config = $this->panels[$identifier]; |
|
464 | - elseif (isset($this->_corePanels[$identifier])) |
|
465 | - $config = $this->_corePanels[$identifier]; |
|
464 | + if (isset($this->panels[$identifier])) { |
|
465 | + $config = $this->panels[$identifier]; |
|
466 | + } elseif (isset($this->_corePanels[$identifier])) { |
|
467 | + $config = $this->_corePanels[$identifier]; |
|
468 | + } |
|
466 | 469 | |
467 | - if (!$config) |
|
468 | - throw new InvalidConfigException("'$identifier' is not a valid panel identifier"); |
|
470 | + if (!$config) { |
|
471 | + throw new InvalidConfigException("'$identifier' is not a valid panel identifier"); |
|
472 | + } |
|
469 | 473 | |
470 | 474 | if (is_array($config)) { |
471 | 475 | $config['module'] = $this; |
@@ -486,11 +490,11 @@ discard block |
||
486 | 490 | foreach ($this->panels as $key => $value) { |
487 | 491 | if (is_numeric($key)) { |
488 | 492 | // The $value contains the identifier of a core panel |
489 | - if (!isset($this->_corePanels[$value])) |
|
490 | - throw new InvalidConfigException("'$value' is not a valid panel identifier"); |
|
493 | + if (!isset($this->_corePanels[$value])) { |
|
494 | + throw new InvalidConfigException("'$value' is not a valid panel identifier"); |
|
495 | + } |
|
491 | 496 | $panels[$value] = $this->_corePanels[$value]; |
492 | - } |
|
493 | - else { |
|
497 | + } else { |
|
494 | 498 | // The key contains the identifier and the value is either a class name or a full array |
495 | 499 | $panels[$key] = is_string($value) ? ['class' => $value] : $value; |
496 | 500 | } |
@@ -500,10 +504,11 @@ discard block |
||
500 | 504 | // We now need one more iteration to add core classes to the panels added via the merge, if needed |
501 | 505 | array_walk($this->panels, function(&$value, $key) { |
502 | 506 | if (!isset($value['class'])) { |
503 | - if (isset($this->_corePanels[$key])) |
|
504 | - $value = ArrayHelper::merge($value, $this->_corePanels[$key]); |
|
505 | - else |
|
506 | - throw new InvalidConfigException("Invalid configuration for '$key'. No 'class' specified."); |
|
507 | + if (isset($this->_corePanels[$key])) { |
|
508 | + $value = ArrayHelper::merge($value, $this->_corePanels[$key]); |
|
509 | + } else { |
|
510 | + throw new InvalidConfigException("Invalid configuration for '$key'. No 'class' specified."); |
|
511 | + } |
|
507 | 512 | } |
508 | 513 | }); |
509 | 514 | } |
@@ -515,18 +520,21 @@ discard block |
||
515 | 520 | { |
516 | 521 | foreach (Yii::$app->modules as $name => $module) { |
517 | 522 | $class = null; |
518 | - if (is_string($module)) |
|
519 | - $class = $module; |
|
520 | - elseif (is_array($module)) { |
|
521 | - if (isset($module['class'])) |
|
522 | - $class = $module['class']; |
|
523 | - } else |
|
524 | - /** @var Module $module */ |
|
523 | + if (is_string($module)) { |
|
524 | + $class = $module; |
|
525 | + } elseif (is_array($module)) { |
|
526 | + if (isset($module['class'])) { |
|
527 | + $class = $module['class']; |
|
528 | + } |
|
529 | + } else { |
|
530 | + /** @var Module $module */ |
|
525 | 531 | $class = $module::className(); |
532 | + } |
|
526 | 533 | |
527 | 534 | $parts = explode('\\', $class); |
528 | - if ($class && strtolower(end($parts)) == 'audit') |
|
529 | - return $name; |
|
535 | + if ($class && strtolower(end($parts)) == 'audit') { |
|
536 | + return $name; |
|
537 | + } |
|
530 | 538 | } |
531 | 539 | return null; |
532 | 540 | } |
@@ -562,18 +570,21 @@ discard block |
||
562 | 570 | $len = strlen($compare); |
563 | 571 | if ($compare[$len - 1] == '*') { |
564 | 572 | $compare = rtrim($compare, '*'); |
565 | - if (substr($route, 0, $len - 1) === $compare) |
|
566 | - return true; |
|
573 | + if (substr($route, 0, $len - 1) === $compare) { |
|
574 | + return true; |
|
575 | + } |
|
567 | 576 | } |
568 | 577 | |
569 | 578 | if ($compare[0] == '*') { |
570 | 579 | $compare = ltrim($compare, '*'); |
571 | - if (substr($route, - ($len - 1)) === $compare) |
|
572 | - return true; |
|
580 | + if (substr($route, - ($len - 1)) === $compare) { |
|
581 | + return true; |
|
582 | + } |
|
573 | 583 | } |
574 | 584 | |
575 | - if ($route === $compare) |
|
576 | - return true; |
|
585 | + if ($route === $compare) { |
|
586 | + return true; |
|
587 | + } |
|
577 | 588 | } |
578 | 589 | return false; |
579 | 590 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $this->title = Yii::t('audit', 'Entry #{id}', ['id' => $model->id]); |
22 | 22 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Audit'), 'url' => ['default/index']]; |
23 | 23 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Entries'), 'url' => ['index']]; |
24 | -$this->params['breadcrumbs'][] = '#' . $model->id; |
|
24 | +$this->params['breadcrumbs'][] = '#'.$model->id; |
|
25 | 25 | |
26 | 26 | ?> |
27 | 27 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | <div class="list-group"> |
88 | 88 | <?php |
89 | 89 | foreach ($panels as $id => $panel) { |
90 | - $label = '<i class="glyphicon glyphicon-chevron-right"></i>' . $panel->getLabel(); |
|
90 | + $label = '<i class="glyphicon glyphicon-chevron-right"></i>'.$panel->getLabel(); |
|
91 | 91 | echo Html::a($label, ['view', 'id' => $model->id, 'panel' => $id], [ |
92 | 92 | 'class' => $panel === $activePanel ? 'list-group-item active' : 'list-group-item', |
93 | 93 | ]); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'attribute' => 'user_id', |
28 | 28 | 'label' => Yii::t('audit', 'User'), |
29 | 29 | 'class' => 'yii\grid\DataColumn', |
30 | - 'value' => function ($data) { |
|
30 | + 'value' => function($data) { |
|
31 | 31 | return Audit::getInstance()->getUserIdentifier($data->user_id); |
32 | 32 | }, |
33 | 33 | 'format' => 'raw', |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | 'attribute' => 'route', |
50 | 50 | 'filter' => AuditEntrySearch::routeFilter(), |
51 | 51 | 'format' => 'html', |
52 | - 'value' => function ($data) { |
|
52 | + 'value' => function($data) { |
|
53 | 53 | return HTML::tag('span', '', [ |
54 | 54 | 'title' => \yii\helpers\Url::to([$data->route]), |
55 | 55 | 'class' => 'glyphicon glyphicon-link' |
56 | - ]) . ' ' . $data->route; |
|
56 | + ]).' '.$data->route; |
|
57 | 57 | }, |
58 | 58 | ], |
59 | 59 | [ |
@@ -68,28 +68,28 @@ discard block |
||
68 | 68 | ], |
69 | 69 | [ |
70 | 70 | 'attribute' => 'trails', |
71 | - 'value' => function ($data) { |
|
71 | + 'value' => function($data) { |
|
72 | 72 | return $data->getTrails()->count(); |
73 | 73 | }, |
74 | 74 | 'contentOptions' => ['class' => 'text-right'], |
75 | 75 | ], |
76 | 76 | [ |
77 | 77 | 'attribute' => 'mails', |
78 | - 'value' => function ($data) { |
|
78 | + 'value' => function($data) { |
|
79 | 79 | return $data->getMails()->count(); |
80 | 80 | }, |
81 | 81 | 'contentOptions' => ['class' => 'text-right'], |
82 | 82 | ], |
83 | 83 | [ |
84 | 84 | 'attribute' => 'javascripts', |
85 | - 'value' => function ($data) { |
|
85 | + 'value' => function($data) { |
|
86 | 86 | return $data->getJavascripts()->count(); |
87 | 87 | }, |
88 | 88 | 'contentOptions' => ['class' => 'text-right'], |
89 | 89 | ], |
90 | 90 | [ |
91 | 91 | 'attribute' => 'errors', |
92 | - 'value' => function ($data) { |
|
92 | + 'value' => function($data) { |
|
93 | 93 | return $data->getLinkedErrors()->count(); |
94 | 94 | }, |
95 | 95 | 'contentOptions' => ['class' => 'text-right'], |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | 'class' => 'yii\grid\ActionColumn', |
21 | 21 | 'template' => '{view}', |
22 | 22 | 'buttons' => [ |
23 | - 'view' => function ($url, $model) { |
|
23 | + 'view' => function($url, $model) { |
|
24 | 24 | return Html::a( |
25 | 25 | Html::tag('span', '', ['class' => 'glyphicon glyphicon-eye-open']), ['trail/view', 'id' => $model->id] |
26 | 26 | ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'attribute' => 'user_id', |
41 | 41 | 'label' => Yii::t('audit', 'User ID'), |
42 | 42 | 'class' => 'yii\grid\DataColumn', |
43 | - 'value' => function ($data) { |
|
43 | + 'value' => function($data) { |
|
44 | 44 | return Audit::getInstance()->getUserIdentifier($data->user_id); |
45 | 45 | }, |
46 | 46 | 'options' => [ |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ], |
76 | 76 | [ |
77 | 77 | 'label' => Yii::t('audit', 'Diff'), |
78 | - 'value' => function (AuditTrailSearch $model) { |
|
78 | + 'value' => function(AuditTrailSearch $model) { |
|
79 | 79 | return $model->getDiffHtml(); |
80 | 80 | }, |
81 | 81 | 'format' => 'raw', |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function init() |
39 | 39 | { |
40 | 40 | parent::init(); |
41 | - Event::on(BaseMailer::className(), BaseMailer::EVENT_AFTER_SEND, function ($event) { |
|
41 | + Event::on(BaseMailer::className(), BaseMailer::EVENT_AFTER_SEND, function($event) { |
|
42 | 42 | $this->record($event); |
43 | 43 | }); |
44 | 44 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function getLabel() |
129 | 129 | { |
130 | - return $this->getName() . ' <small>(' . $this->_model->getMails()->count() . ')</small>'; |
|
130 | + return $this->getName().' <small>('.$this->_model->getMails()->count().')</small>'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | public function getLabel() |
32 | 32 | { |
33 | - return $this->getName() . ' <small>(' . $this->_model->getJavascripts()->count() . ')</small>'; |
|
33 | + return $this->getName().' <small>('.$this->_model->getJavascripts()->count().')</small>'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | return $entry ? $this->log($entry->id, $e) : null; |
32 | 32 | }); |
33 | 33 | |
34 | - $this->module->registerFunction('errorMessage', function ($message, $code = 0, $file = '', $line = 0, $trace = []) { |
|
34 | + $this->module->registerFunction('errorMessage', function($message, $code = 0, $file = '', $line = 0, $trace = []) { |
|
35 | 35 | $entry = $this->module->getEntry(true); |
36 | 36 | return $entry ? $this->logMessage($entry->id, $message, $code, $file, $line, $trace) : null; |
37 | 37 | }); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $error->file = $exception->getFile(); |
64 | 64 | $error->line = $exception->getLine(); |
65 | 65 | $error->trace = Helper::cleanupTrace($exception->getTrace()); |
66 | - $error->hash = Helper::hash($error->message . $error->file . $error->line); |
|
66 | + $error->hash = Helper::hash($error->message.$error->file.$error->line); |
|
67 | 67 | |
68 | 68 | $this->_exceptions[] = $exceptionId; |
69 | 69 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $error->file = $file; |
91 | 91 | $error->line = $line; |
92 | 92 | $error->trace = Helper::cleanupTrace($trace); |
93 | - $error->hash = Helper::hash($error->message . $error->file . $error->line); |
|
93 | + $error->hash = Helper::hash($error->message.$error->file.$error->line); |
|
94 | 94 | return $error->save(false) ? $error : null; |
95 | 95 | } |
96 | 96 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function getLabel() |
117 | 117 | { |
118 | - return $this->getName() . ' <small>(' . $this->_model->getLinkedErrors()->count() . ')</small>'; |
|
118 | + return $this->getName().' <small>('.$this->_model->getLinkedErrors()->count().')</small>'; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |