@@ -186,7 +186,7 @@ |
||
| 186 | 186 | |
| 187 | 187 | /** |
| 188 | 188 | * Controls whether the diff output for trails will be pretty printed if the value is json or not |
| 189 | - */ |
|
| 189 | + */ |
|
| 190 | 190 | public $enablePrettyDiffForTrails = false; |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | $this->title = Yii::t('audit', 'Trail #{id}', ['id' => $model->id]); |
| 11 | 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Audit'), 'url' => ['default/index']]; |
| 12 | 12 | $this->params['breadcrumbs'][] = ['label' => Yii::t('audit', 'Trails'), 'url' => ['trail/index']]; |
| 13 | -$this->params['breadcrumbs'][] = '#' . $model->id; |
|
| 13 | +$this->params['breadcrumbs'][] = '#'.$model->id; |
|
| 14 | 14 | |
| 15 | 15 | echo Html::tag('h1', $this->title); |
| 16 | 16 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | 'created', |
| 36 | 36 | [ |
| 37 | 37 | 'label' => Yii::t('audit', 'Difference'), |
| 38 | - 'value' => function ($model) { |
|
| 38 | + 'value' => function($model) { |
|
| 39 | 39 | return $model->getDiffHtml(); |
| 40 | 40 | }, |
| 41 | 41 | 'format' => 'raw', |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - return (string)$value; |
|
| 75 | + return (string) $value; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -81,21 +81,21 @@ discard block |
||
| 81 | 81 | public function getDiffHtml() |
| 82 | 82 | { |
| 83 | 83 | if (Audit::getInstance()->enablePrettyDiffForTrails) { |
| 84 | - $oldValue = self::prettyPrintIfValueIsJson((string)$this->old_value); |
|
| 85 | - $newValue = self::prettyPrintIfValueIsJson((string)$this->new_value); |
|
| 84 | + $oldValue = self::prettyPrintIfValueIsJson((string) $this->old_value); |
|
| 85 | + $newValue = self::prettyPrintIfValueIsJson((string) $this->new_value); |
|
| 86 | 86 | } else { |
| 87 | - $oldValue = (string)$this->old_value; |
|
| 88 | - $newValue = (string)$this->new_value; |
|
| 87 | + $oldValue = (string) $this->old_value; |
|
| 88 | + $newValue = (string) $this->new_value; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $old = explode("\n", $oldValue); |
| 92 | 92 | $new = explode("\n", $newValue); |
| 93 | 93 | |
| 94 | 94 | foreach ($old as $i => $line) { |
| 95 | - $old[$i] = rtrim((string)$line, "\r\n"); |
|
| 95 | + $old[$i] = rtrim((string) $line, "\r\n"); |
|
| 96 | 96 | } |
| 97 | 97 | foreach ($new as $i => $line) { |
| 98 | - $new[$i] = rtrim((string)$line, "\r\n"); |
|
| 98 | + $new[$i] = rtrim((string) $line, "\r\n"); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $diff = new \Diff($old, $new); |