@@ -347,7 +347,9 @@ discard block |
||
| 347 | 347 | return false; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if (isset($this->errors[$method])) unset($this->errors[$method]); |
|
| 350 | + if (isset($this->errors[$method])) { |
|
| 351 | + unset($this->errors[$method]); |
|
| 352 | + } |
|
| 351 | 353 | |
| 352 | 354 | return true; |
| 353 | 355 | } |
@@ -389,7 +391,9 @@ discard block |
||
| 389 | 391 | */ |
| 390 | 392 | public function error($message) |
| 391 | 393 | { |
| 392 | - if ( ! isset($this->errors['userDefined'])) $this->errors['userDefined'] = []; |
|
| 394 | + if ( ! isset($this->errors['userDefined'])) { |
|
| 395 | + $this->errors['userDefined'] = []; |
|
| 396 | + } |
|
| 393 | 397 | |
| 394 | 398 | $this->errors['userDefined'][] = $message; |
| 395 | 399 | } |
@@ -32,12 +32,16 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function setValuesFromDefaults($defaults) |
| 34 | 34 | { |
| 35 | - if (count($this->defaults)) $this->value = array_shift($this->defaults); |
|
| 35 | + if (count($this->defaults)) { |
|
| 36 | + $this->value = array_shift($this->defaults); |
|
| 37 | + } |
|
| 36 | 38 | } |
| 37 | 39 | |
| 38 | 40 | public function setValuesFromModel($model) |
| 39 | 41 | { |
| 40 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 42 | + if (property_exists($model, $this->name)) { |
|
| 43 | + $this->value = $model->{$this->name}; |
|
| 44 | + } |
|
| 41 | 45 | } |
| 42 | 46 | |
| 43 | 47 | public function setValuesFromRequest($request) |
@@ -47,7 +51,9 @@ discard block |
||
| 47 | 51 | |
| 48 | 52 | public function fillModelWithValues($model) |
| 49 | 53 | { |
| 50 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 54 | + if (property_exists($model, $this->name)) { |
|
| 55 | + $model->{$this->name} = $this->value; |
|
| 56 | + } |
|
| 51 | 57 | } |
| 52 | 58 | |
| 53 | 59 | public function validate() |
@@ -35,15 +35,23 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function setValuesFromDefaults($defaults) |
| 37 | 37 | { |
| 38 | - if (isset($defaults['first'])) $this->value_first = $defaults['first']; |
|
| 39 | - if (isset($defaults['surname'])) $this->value_surname = $defaults['surname']; |
|
| 38 | + if (isset($defaults['first'])) { |
|
| 39 | + $this->value_first = $defaults['first']; |
|
| 40 | + } |
|
| 41 | + if (isset($defaults['surname'])) { |
|
| 42 | + $this->value_surname = $defaults['surname']; |
|
| 43 | + } |
|
| 40 | 44 | $this->value = trim($this->value_first.' '.$this->value_surname); |
| 41 | 45 | } |
| 42 | 46 | |
| 43 | 47 | public function setValuesFromModel($model) |
| 44 | 48 | { |
| 45 | - if (property_exists($model, $this->name.'_first')) $this->value_first = $model->{$this->name.'_first'}; |
|
| 46 | - if (property_exists($model, $this->name.'_surname')) $this->value_surname = $model->{$this->name.'_surname'}; |
|
| 49 | + if (property_exists($model, $this->name.'_first')) { |
|
| 50 | + $this->value_first = $model->{$this->name.'_first'}; |
|
| 51 | + } |
|
| 52 | + if (property_exists($model, $this->name.'_surname')) { |
|
| 53 | + $this->value_surname = $model->{$this->name.'_surname'}; |
|
| 54 | + } |
|
| 47 | 55 | $this->value = trim($this->value_first.' '.$this->value_surname); |
| 48 | 56 | } |
| 49 | 57 | |
@@ -56,9 +64,15 @@ discard block |
||
| 56 | 64 | |
| 57 | 65 | public function fillModelWithValues($model) |
| 58 | 66 | { |
| 59 | - if (property_exists($model, $this->name.'_first')) $model->{$this->name.'_first'} = $this->value_first; |
|
| 60 | - if (property_exists($model, $this->name.'_surname')) $model->{$this->name.'_surname'} = $this->value_surname; |
|
| 61 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 67 | + if (property_exists($model, $this->name.'_first')) { |
|
| 68 | + $model->{$this->name.'_first'} = $this->value_first; |
|
| 69 | + } |
|
| 70 | + if (property_exists($model, $this->name.'_surname')) { |
|
| 71 | + $model->{$this->name.'_surname'} = $this->value_surname; |
|
| 72 | + } |
|
| 73 | + if (property_exists($model, $this->name)) { |
|
| 74 | + $model->{$this->name} = $this->value; |
|
| 75 | + } |
|
| 62 | 76 | } |
| 63 | 77 | |
| 64 | 78 | public function validateRequired() |
@@ -82,14 +82,18 @@ discard block |
||
| 82 | 82 | public function setValuesFromDefaults($defaults) |
| 83 | 83 | { |
| 84 | 84 | foreach (array_keys($this->options) as $key) { |
| 85 | - if (isset($defaults[$key])) $this->values[$key] = $defaults[$key] ? true : false; |
|
| 85 | + if (isset($defaults[$key])) { |
|
| 86 | + $this->values[$key] = $defaults[$key] ? true : false; |
|
| 87 | + } |
|
| 86 | 88 | } |
| 87 | 89 | } |
| 88 | 90 | |
| 89 | 91 | public function setValuesFromModel($model) |
| 90 | 92 | { |
| 91 | 93 | foreach (array_keys($this->options) as $key) { |
| 92 | - if (property_exists($model, $this->name.'_'.$key)) $this->values[$key] = $model->{$this->name.'_'.$key} ? true : false; |
|
| 94 | + if (property_exists($model, $this->name.'_'.$key)) { |
|
| 95 | + $this->values[$key] = $model->{$this->name.'_'.$key} ? true : false; |
|
| 96 | + } |
|
| 93 | 97 | } |
| 94 | 98 | |
| 95 | 99 | } |
@@ -104,7 +108,9 @@ discard block |
||
| 104 | 108 | public function fillModelWithValues($model) |
| 105 | 109 | { |
| 106 | 110 | foreach (array_keys($this->options) as $key) { |
| 107 | - if (property_exists($model, $this->name.'_'.$key)) $model->{$this->name.'_'.$key} = $this->values[$key] ? 1 : 0; |
|
| 111 | + if (property_exists($model, $this->name.'_'.$key)) { |
|
| 112 | + $model->{$this->name.'_'.$key} = $this->values[$key] ? 1 : 0; |
|
| 113 | + } |
|
| 108 | 114 | } |
| 109 | 115 | } |
| 110 | 116 | |
@@ -113,7 +119,9 @@ discard block |
||
| 113 | 119 | $checked = false; |
| 114 | 120 | |
| 115 | 121 | foreach (array_keys($this->options) as $key) { |
| 116 | - if ($this->values[$key]) $checked = true; |
|
| 122 | + if ($this->values[$key]) { |
|
| 123 | + $checked = true; |
|
| 124 | + } |
|
| 117 | 125 | } |
| 118 | 126 | |
| 119 | 127 | return $checked; |
@@ -42,7 +42,9 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function setValuesFromModel($model) |
| 44 | 44 | { |
| 45 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name} ? true : false; |
|
| 45 | + if (property_exists($model, $this->name)) { |
|
| 46 | + $this->value = $model->{$this->name} ? true : false; |
|
| 47 | + } |
|
| 46 | 48 | } |
| 47 | 49 | |
| 48 | 50 | public function setValuesFromRequest($request) |
@@ -52,7 +54,9 @@ discard block |
||
| 52 | 54 | |
| 53 | 55 | public function fillModelWithValues($model) |
| 54 | 56 | { |
| 55 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value ? 1 : 0; |
|
| 57 | + if (property_exists($model, $this->name)) { |
|
| 58 | + $model->{$this->name} = $this->value ? 1 : 0; |
|
| 59 | + } |
|
| 56 | 60 | } |
| 57 | 61 | |
| 58 | 62 | public function validateRequired() |
@@ -19,7 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function needsRehash($hash = null) |
| 21 | 21 | { |
| 22 | - if (is_null($hash)) $hash = $this->value; |
|
| 22 | + if (is_null($hash)) { |
|
| 23 | + $hash = $this->value; |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | 26 | return password_needs_rehash($hash, PASSWORD_BCRYPT, ['cost' => 10]); |
| 25 | 27 | } |
@@ -57,7 +59,9 @@ discard block |
||
| 57 | 59 | |
| 58 | 60 | public function setValuesFromModel($model) |
| 59 | 61 | { |
| 60 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 62 | + if (property_exists($model, $this->name)) { |
|
| 63 | + $this->value = $model->{$this->name}; |
|
| 64 | + } |
|
| 61 | 65 | } |
| 62 | 66 | |
| 63 | 67 | public function setValuesFromRequest($request) |
@@ -67,7 +71,9 @@ discard block |
||
| 67 | 71 | |
| 68 | 72 | public function fillModelWithValues($model) |
| 69 | 73 | { |
| 70 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 74 | + if (property_exists($model, $this->name)) { |
|
| 75 | + $model->{$this->name} = $this->value; |
|
| 76 | + } |
|
| 71 | 77 | } |
| 72 | 78 | |
| 73 | 79 | public function validateRequired() |
@@ -25,12 +25,16 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function setValuesFromDefaults($defaults) |
| 27 | 27 | { |
| 28 | - if (count($defaults)) $this->value = array_shift($defaults); |
|
| 28 | + if (count($defaults)) { |
|
| 29 | + $this->value = array_shift($defaults); |
|
| 30 | + } |
|
| 29 | 31 | } |
| 30 | 32 | |
| 31 | 33 | public function setValuesFromModel($model) |
| 32 | 34 | { |
| 33 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 35 | + if (property_exists($model, $this->name)) { |
|
| 36 | + $this->value = $model->{$this->name}; |
|
| 37 | + } |
|
| 34 | 38 | } |
| 35 | 39 | |
| 36 | 40 | public function setValuesFromRequest($request) |
@@ -40,7 +44,9 @@ discard block |
||
| 40 | 44 | |
| 41 | 45 | public function fillModelWithValues($model) |
| 42 | 46 | { |
| 43 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 47 | + if (property_exists($model, $this->name)) { |
|
| 48 | + $model->{$this->name} = $this->value; |
|
| 49 | + } |
|
| 44 | 50 | } |
| 45 | 51 | |
| 46 | 52 | public function validateRequired() |
@@ -6,8 +6,11 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | public function required($var) |
| 8 | 8 | { |
| 9 | - if (is_null($var)) return false; |
|
| 10 | - else if (is_string($var) && trim($var) === '') return false; |
|
| 9 | + if (is_null($var)) { |
|
| 10 | + return false; |
|
| 11 | + } else if (is_string($var) && trim($var) === '') { |
|
| 12 | + return false; |
|
| 13 | + } |
|
| 11 | 14 | return true; |
| 12 | 15 | } |
| 13 | 16 | |
@@ -28,13 +31,17 @@ discard block |
||
| 28 | 31 | |
| 29 | 32 | public function alphaNum($var) |
| 30 | 33 | { |
| 31 | - if (! is_string($var) && ! is_numeric($var)) return false; |
|
| 34 | + if (! is_string($var) && ! is_numeric($var)) { |
|
| 35 | + return false; |
|
| 36 | + } |
|
| 32 | 37 | return preg_match('/^[\pL\pM\pN]+$/u', $var); |
| 33 | 38 | } |
| 34 | 39 | |
| 35 | 40 | public function alphaDash($var) |
| 36 | 41 | { |
| 37 | - if (! is_string($var) && ! is_numeric($var)) return false; |
|
| 42 | + if (! is_string($var) && ! is_numeric($var)) { |
|
| 43 | + return false; |
|
| 44 | + } |
|
| 38 | 45 | return preg_match('/^[\pL\pM\pN_-]+$/u', $var); |
| 39 | 46 | } |
| 40 | 47 | |
@@ -15,7 +15,9 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function render($path, $properties = []) |
| 17 | 17 | { |
| 18 | - if ( ! function_exists('app')) throw new \Exception('Laravel required for blade rendering engine.'); |
|
| 18 | + if ( ! function_exists('app')) { |
|
| 19 | + throw new \Exception('Laravel required for blade rendering engine.'); |
|
| 20 | + } |
|
| 19 | 21 | |
| 20 | 22 | return app()->make('view')->file($path, $properties); |
| 21 | 23 | } |