@@ -84,14 +84,18 @@ discard block |
||
| 84 | 84 | public function setValueFromDefault() |
| 85 | 85 | { |
| 86 | 86 | foreach (array_keys($this->options) as $key) { |
| 87 | - if (isset($this->default[$key])) $this->values[$key] = $this->default[$key] ? true : false; |
|
| 87 | + if (isset($this->default[$key])) { |
|
| 88 | + $this->values[$key] = $this->default[$key] ? true : false; |
|
| 89 | + } |
|
| 88 | 90 | } |
| 89 | 91 | } |
| 90 | 92 | |
| 91 | 93 | public function setValueFromModel($model) |
| 92 | 94 | { |
| 93 | 95 | foreach (array_keys($this->options) as $key) { |
| 94 | - if (property_exists($model, $this->name.'_'.$key)) $this->values[$key] = $model->{$this->name.'_'.$key} ? true : false; |
|
| 96 | + if (property_exists($model, $this->name.'_'.$key)) { |
|
| 97 | + $this->values[$key] = $model->{$this->name.'_'.$key} ? true : false; |
|
| 98 | + } |
|
| 95 | 99 | } |
| 96 | 100 | |
| 97 | 101 | } |
@@ -106,7 +110,9 @@ discard block |
||
| 106 | 110 | public function fillModelWithValue($model) |
| 107 | 111 | { |
| 108 | 112 | foreach (array_keys($this->options) as $key) { |
| 109 | - if (property_exists($model, $this->name.'_'.$key)) $model->{$this->name.'_'.$key} = $this->values[$key] ? 1 : 0; |
|
| 113 | + if (property_exists($model, $this->name.'_'.$key)) { |
|
| 114 | + $model->{$this->name.'_'.$key} = $this->values[$key] ? 1 : 0; |
|
| 115 | + } |
|
| 110 | 116 | } |
| 111 | 117 | } |
| 112 | 118 | |
@@ -115,7 +121,9 @@ discard block |
||
| 115 | 121 | $checked = false; |
| 116 | 122 | |
| 117 | 123 | foreach (array_keys($this->options) as $key) { |
| 118 | - if ($this->values[$key]) $checked = true; |
|
| 124 | + if ($this->values[$key]) { |
|
| 125 | + $checked = true; |
|
| 126 | + } |
|
| 119 | 127 | } |
| 120 | 128 | |
| 121 | 129 | return $checked; |
@@ -38,15 +38,23 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function setValueFromDefault() |
| 40 | 40 | { |
| 41 | - if (isset($this->default['first'])) $this->value_first = $this->default['first']; |
|
| 42 | - if (isset($this->default['surname'])) $this->value_surname = $this->default['surname']; |
|
| 41 | + if (isset($this->default['first'])) { |
|
| 42 | + $this->value_first = $this->default['first']; |
|
| 43 | + } |
|
| 44 | + if (isset($this->default['surname'])) { |
|
| 45 | + $this->value_surname = $this->default['surname']; |
|
| 46 | + } |
|
| 43 | 47 | $this->value = trim($this->value_first.' '.$this->value_surname); |
| 44 | 48 | } |
| 45 | 49 | |
| 46 | 50 | public function setValueFromModel($model) |
| 47 | 51 | { |
| 48 | - if (property_exists($model, $this->name.'_first')) $this->value_first = $model->{$this->name.'_first'}; |
|
| 49 | - if (property_exists($model, $this->name.'_surname')) $this->value_surname = $model->{$this->name.'_surname'}; |
|
| 52 | + if (property_exists($model, $this->name.'_first')) { |
|
| 53 | + $this->value_first = $model->{$this->name.'_first'}; |
|
| 54 | + } |
|
| 55 | + if (property_exists($model, $this->name.'_surname')) { |
|
| 56 | + $this->value_surname = $model->{$this->name.'_surname'}; |
|
| 57 | + } |
|
| 50 | 58 | $this->value = trim($this->value_first.' '.$this->value_surname); |
| 51 | 59 | } |
| 52 | 60 | |
@@ -59,9 +67,15 @@ discard block |
||
| 59 | 67 | |
| 60 | 68 | public function fillModelWithValue($model) |
| 61 | 69 | { |
| 62 | - if (property_exists($model, $this->name.'_first')) $model->{$this->name.'_first'} = $this->value_first; |
|
| 63 | - if (property_exists($model, $this->name.'_surname')) $model->{$this->name.'_surname'} = $this->value_surname; |
|
| 64 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 70 | + if (property_exists($model, $this->name.'_first')) { |
|
| 71 | + $model->{$this->name.'_first'} = $this->value_first; |
|
| 72 | + } |
|
| 73 | + if (property_exists($model, $this->name.'_surname')) { |
|
| 74 | + $model->{$this->name.'_surname'} = $this->value_surname; |
|
| 75 | + } |
|
| 76 | + if (property_exists($model, $this->name)) { |
|
| 77 | + $model->{$this->name} = $this->value; |
|
| 78 | + } |
|
| 65 | 79 | } |
| 66 | 80 | |
| 67 | 81 | public function validateRequired() |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function setValueFromModel($model) |
| 43 | 43 | { |
| 44 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 44 | + if (property_exists($model, $this->name)) { |
|
| 45 | + $this->value = $model->{$this->name}; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | public function setValueFromRequest($request) |
@@ -51,7 +53,9 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | public function fillModelWithValue($model) |
| 53 | 55 | { |
| 54 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 56 | + if (property_exists($model, $this->name)) { |
|
| 57 | + $model->{$this->name} = $this->value; |
|
| 58 | + } |
|
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | public function validateRequired() |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function setValueFromModel($model) |
| 43 | 43 | { |
| 44 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 44 | + if (property_exists($model, $this->name)) { |
|
| 45 | + $this->value = $model->{$this->name}; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | public function setValueFromRequest($request) |
@@ -51,7 +53,9 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | public function fillModelWithValue($model) |
| 53 | 55 | { |
| 54 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 56 | + if (property_exists($model, $this->name)) { |
|
| 57 | + $model->{$this->name} = $this->value; |
|
| 58 | + } |
|
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | public function validateRequired() |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function setValueFromModel($model) |
| 43 | 43 | { |
| 44 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 44 | + if (property_exists($model, $this->name)) { |
|
| 45 | + $this->value = $model->{$this->name}; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | public function setValueFromRequest($request) |
@@ -51,7 +53,9 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | public function fillModelWithValue($model) |
| 53 | 55 | { |
| 54 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 56 | + if (property_exists($model, $this->name)) { |
|
| 57 | + $model->{$this->name} = $this->value; |
|
| 58 | + } |
|
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | public function validateRequired() |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function setValueFromModel($model) |
| 43 | 43 | { |
| 44 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 44 | + if (property_exists($model, $this->name)) { |
|
| 45 | + $this->value = $model->{$this->name}; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | public function setValueFromRequest($request) |
@@ -51,7 +53,9 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | public function fillModelWithValue($model) |
| 53 | 55 | { |
| 54 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 56 | + if (property_exists($model, $this->name)) { |
|
| 57 | + $model->{$this->name} = $this->value; |
|
| 58 | + } |
|
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | public function validateRequired() |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function setValueFromModel($model) |
| 43 | 43 | { |
| 44 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 44 | + if (property_exists($model, $this->name)) { |
|
| 45 | + $this->value = $model->{$this->name}; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | public function setValueFromRequest($request) |
@@ -51,7 +53,9 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | public function fillModelWithValue($model) |
| 53 | 55 | { |
| 54 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 56 | + if (property_exists($model, $this->name)) { |
|
| 57 | + $model->{$this->name} = $this->value; |
|
| 58 | + } |
|
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | public function validateRequired() |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function setValueFromModel($model) |
| 43 | 43 | { |
| 44 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 44 | + if (property_exists($model, $this->name)) { |
|
| 45 | + $this->value = $model->{$this->name}; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | public function setValueFromRequest($request) |
@@ -51,7 +53,9 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | public function fillModelWithValue($model) |
| 53 | 55 | { |
| 54 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 56 | + if (property_exists($model, $this->name)) { |
|
| 57 | + $model->{$this->name} = $this->value; |
|
| 58 | + } |
|
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | public function validateRequired() |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | */ |
| 352 | 352 | public function completed($name = null) |
| 353 | 353 | { |
| 354 | - if($this->submitted($name) && $this->valid()) { |
|
| 354 | + if ($this->submitted($name) && $this->valid()) { |
|
| 355 | 355 | $this->broadcast('completed'); |
| 356 | 356 | return true; |
| 357 | 357 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | $errors = []; |
| 494 | 494 | |
| 495 | 495 | foreach ($this->fields as $field) { |
| 496 | - foreach($field->errors() as $error) { |
|
| 496 | + foreach ($field->errors() as $error) { |
|
| 497 | 497 | $errors[] = $error; |
| 498 | 498 | } |
| 499 | 499 | } |
@@ -615,8 +615,8 @@ discard block |
||
| 615 | 615 | { |
| 616 | 616 | $config = $this->templateConfig($template); |
| 617 | 617 | |
| 618 | - if ( isset($config['plugins']) && is_array($config['plugins'])) { |
|
| 619 | - foreach($config['plugins'] as $key => $plugin) { |
|
| 618 | + if (isset($config['plugins']) && is_array($config['plugins'])) { |
|
| 619 | + foreach ($config['plugins'] as $key => $plugin) { |
|
| 620 | 620 | if (is_array($plugin)) { |
| 621 | 621 | $this->addPlugin($key, $plugin); |
| 622 | 622 | } else { |
@@ -636,8 +636,8 @@ discard block |
||
| 636 | 636 | { |
| 637 | 637 | $config = $this->templateConfig($template); |
| 638 | 638 | |
| 639 | - if ( isset($config['plugins']) && is_array($config['plugins'])) { |
|
| 640 | - foreach($config['plugins'] as $plugin) { |
|
| 639 | + if (isset($config['plugins']) && is_array($config['plugins'])) { |
|
| 640 | + foreach ($config['plugins'] as $plugin) { |
|
| 641 | 641 | $this->removePlugin($plugin); |
| 642 | 642 | } |
| 643 | 643 | } |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | foreach ($field->errors() as $error => $parameters) { |
| 675 | 675 | |
| 676 | 676 | if ($error == 'userDefined') { |
| 677 | - foreach($parameters as $message) { |
|
| 677 | + foreach ($parameters as $message) { |
|
| 678 | 678 | $properties['errors'][] = ['error' => $message]; |
| 679 | 679 | } |
| 680 | 680 | } else { |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | |
| 684 | 684 | $message = $this->translate($error, $field); |
| 685 | 685 | |
| 686 | - foreach($parameters as $key => $value) { |
|
| 686 | + foreach ($parameters as $key => $value) { |
|
| 687 | 687 | if (is_object($value) && method_exists($value, '__toString')) $value = (string) $value; |
| 688 | 688 | if (is_array($value)) $value = implode(', ', $value); |
| 689 | 689 | $message = str_replace('['.$key.']', $value, $message); |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | */ |
| 950 | 950 | private function broadcast($event, $params = []) |
| 951 | 951 | { |
| 952 | - foreach($this->plugins as $plugin) { |
|
| 952 | + foreach ($this->plugins as $plugin) { |
|
| 953 | 953 | $plugin->event($this, $event, $params); |
| 954 | 954 | } |
| 955 | 955 | } |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | { |
| 1091 | 1091 | if ( ! method_exists($this, $method)) |
| 1092 | 1092 | { |
| 1093 | - if ( $this->typeExists($method)) { |
|
| 1093 | + if ($this->typeExists($method)) { |
|
| 1094 | 1094 | return $this->addField($method, array_shift($parameters)); |
| 1095 | 1095 | } |
| 1096 | 1096 | } |