@@ -237,13 +237,15 @@ |
||
237 | 237 | $oldAttributes = $this->cleanAttributes($this->getOldAttributes()); |
238 | 238 | |
239 | 239 | // ensure to handle serialized attributes properly |
240 | - foreach($newAttributes as $key => $value) |
|
241 | - if(is_array($newAttributes[$key])) |
|
240 | + foreach($newAttributes as $key => $value) { |
|
241 | + if(is_array($newAttributes[$key])) |
|
242 | 242 | $newAttributes[$key] = Json::encode($newAttributes[$key]); |
243 | + } |
|
243 | 244 | |
244 | - foreach($oldAttributes as $key => $value) |
|
245 | - if(is_array($oldAttributes[$key])) |
|
245 | + foreach($oldAttributes as $key => $value) { |
|
246 | + if(is_array($oldAttributes[$key])) |
|
246 | 247 | $oldAttributes[$key] = Json::encode($oldAttributes[$key]); |
248 | + } |
|
247 | 249 | |
248 | 250 | // If no difference then get out of here |
249 | 251 | if (count(array_diff_assoc($newAttributes, $oldAttributes)) <= 0) { |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | |
13 | 13 | <p>Empty.</p> |
14 | 14 | |
15 | -<?php else: ?> |
|
15 | +<?php else { |
|
16 | + : ?> |
|
16 | 17 | |
17 | 18 | <div class="table-responsive"> |
18 | 19 | <table class="table table-condensed table-bordered table-striped table-hover request-table" |
@@ -30,7 +31,9 @@ discard block |
||
30 | 31 | <td><?= htmlspecialchars(VarDumper::dumpAsString($value), ENT_QUOTES | ENT_SUBSTITUTE, |
31 | 32 | \Yii::$app->charset, true) ?></td> |
32 | 33 | </tr> |
33 | - <?php endforeach; ?> |
|
34 | + <?php endforeach; |
|
35 | +} |
|
36 | +?> |
|
34 | 37 | </tbody> |
35 | 38 | </table> |
36 | 39 | </div> |
@@ -15,8 +15,7 @@ |
||
15 | 15 | |
16 | 16 | if (Audit::getInstance()->hasMethod('renderEmail')) { |
17 | 17 | Audit::getInstance()->renderEmail($this, $model); |
18 | -} |
|
19 | -elseif (class_exists('\PhpMimeMailParser\Parser')) { |
|
18 | +} elseif (class_exists('\PhpMimeMailParser\Parser')) { |
|
20 | 19 | $parser = new \PhpMimeMailParser\Parser(); |
21 | 20 | $parser->setText($model->data); |
22 | 21 | echo $parser->getMessageBody('htmlEmbedded'); |
@@ -43,13 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function export() |
45 | 45 | { |
46 | - if (!\Yii::$app) |
|
47 | - // Things like this can happen in tests etc, but it is too late for us to do anything about that. |
|
46 | + if (!\Yii::$app) { |
|
47 | + // Things like this can happen in tests etc, but it is too late for us to do anything about that. |
|
48 | 48 | return; |
49 | + } |
|
49 | 50 | |
50 | 51 | $module = $this->module; |
51 | - if (!$module->entry || empty($module->panels)) |
|
52 | - return; |
|
52 | + if (!$module->entry || empty($module->panels)) { |
|
53 | + return; |
|
54 | + } |
|
53 | 55 | |
54 | 56 | $entry = $module->entry; |
55 | 57 | |
@@ -60,11 +62,12 @@ discard block |
||
60 | 62 | $records = array_filter($records); |
61 | 63 | |
62 | 64 | if (!empty($records)) { |
63 | - if ($module->batchSave) |
|
64 | - $entry->addBatchData($records, false); |
|
65 | - else { |
|
66 | - foreach ($records as $type => $record) |
|
67 | - $entry->addData($type, $record, false); |
|
65 | + if ($module->batchSave) { |
|
66 | + $entry->addBatchData($records, false); |
|
67 | + } else { |
|
68 | + foreach ($records as $type => $record) { |
|
69 | + $entry->addData($type, $record, false); |
|
70 | + } |
|
68 | 71 | } |
69 | 72 | } |
70 | 73 | } |
@@ -77,8 +80,7 @@ discard block |
||
77 | 80 | { |
78 | 81 | if ($this->exportAtIntervals) { |
79 | 82 | parent::collect($messages, $final); |
80 | - } |
|
81 | - else { |
|
83 | + } else { |
|
82 | 84 | $this->messages = array_merge($this->messages, static::filterMessages($messages, $this->getLevels(), $this->categories, $this->except)); |
83 | 85 | if ($final) { |
84 | 86 | $this->export(); |
@@ -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 | } |