Completed
Push — master ( b4dc82...1ae937 )
by Helmut
02:39
created
src/Fields/Checkbox/Checkbox.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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()
Please login to merge, or discard this patch.
src/Fields/Password/Password.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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()
Please login to merge, or discard this patch.
src/Engines/Blade.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
src/Engines/Mustache.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
      */
22 22
 	public function compiler()
23 23
 	{
24
-		if ( ! $this->compiler) $this->compiler = new Mustache_Engine;
24
+		if ( ! $this->compiler) {
25
+		    $this->compiler = new Mustache_Engine;
26
+		}
25 27
 
26 28
 		return $this->compiler;
27 29
 	}
Please login to merge, or discard this patch.
src/Form.php 1 patch
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -253,7 +253,9 @@  discard block
 block discarded – undo
253 253
      */
254 254
     public function fields($names = null)
255 255
     {
256
-        if (is_null($names)) return $this->fields;
256
+        if (is_null($names)) {
257
+            return $this->fields;
258
+        }
257 259
 
258 260
         return array_filter($this->fields, function($field) use ($names) {
259 261
             return array_key_exists($field->name, $names);
@@ -473,7 +475,9 @@  discard block
 block discarded – undo
473 475
         $class = '\\Fields\\'.ucwords($class).'\\'.ucwords($class);
474 476
 
475 477
         foreach ($this->namespaces as $namespace) {
476
-            if (class_exists($namespace.$class)) return $namespace.$class;
478
+            if (class_exists($namespace.$class)) {
479
+                return $namespace.$class;
480
+            }
477 481
         }
478 482
     }
479 483
 
@@ -486,9 +490,13 @@  discard block
 block discarded – undo
486 490
      */
487 491
     public function errors($name = null)
488 492
     {
489
-        if ($this->submitted()) $this->validate();
493
+        if ($this->submitted()) {
494
+            $this->validate();
495
+        }
490 496
 
491
-        if ( ! is_null($name)) return $this->field($name)->errors();
497
+        if ( ! is_null($name)) {
498
+            return $this->field($name)->errors();
499
+        }
492 500
 
493 501
         $errors = [];
494 502
 
@@ -680,8 +688,12 @@  discard block
 block discarded – undo
680 688
                     $message = $this->translate($error, $field);
681 689
 
682 690
                     foreach($parameters as $key => $value) {
683
-                        if (is_object($value) && method_exists($value, '__toString')) $value = (string) $value;
684
-                        if (is_array($value)) $value = implode(', ', $value);
691
+                        if (is_object($value) && method_exists($value, '__toString')) {
692
+                            $value = (string) $value;
693
+                        }
694
+                        if (is_array($value)) {
695
+                            $value = implode(', ', $value);
696
+                        }
685 697
                         $message = str_replace('['.$key.']', $value, $message);
686 698
                     }
687 699
                     $properties['errors'][] = ['error' => $message];
@@ -701,7 +713,9 @@  discard block
 block discarded – undo
701 713
      */
702 714
     public function renderField($field, $properties = null) 
703 715
     {   
704
-        if (is_null($properties)) $properties = $this->fieldProperties($field);
716
+        if (is_null($properties)) {
717
+            $properties = $this->fieldProperties($field);
718
+        }
705 719
 
706 720
         return $this->renderTemplate($field->type, $properties, $field);
707 721
     }
@@ -715,7 +729,9 @@  discard block
 block discarded – undo
715 729
      */
716 730
     public function renderFieldErrors($field, $properties = null) 
717 731
     {   
718
-        if (is_null($properties)) $properties = $this->fieldProperties($field);
732
+        if (is_null($properties)) {
733
+            $properties = $this->fieldProperties($field);
734
+        }
719 735
 
720 736
         return $this->renderTemplate('errors', $properties, $field);
721 737
     }   
@@ -732,9 +748,13 @@  discard block
 block discarded – undo
732 748
 
733 749
         $this->setValues();
734 750
 
735
-        if ($this->submitted()) $this->validate();
751
+        if ($this->submitted()) {
752
+            $this->validate();
753
+        }
736 754
 
737
-        if ( ! is_null($template)) $this->setTemplate($template);
755
+        if ( ! is_null($template)) {
756
+            $this->setTemplate($template);
757
+        }
738 758
 
739 759
         $properties = [];
740 760
         $properties['id'] = $this->id;
Please login to merge, or discard this patch.
src/Utility/Validate.php 1 patch
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,11 @@  discard block
 block discarded – undo
6 6
     
7 7
     public static 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
 block discarded – undo
28 31
 
29 32
     public static 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 static 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
 
Please login to merge, or discard this patch.
src/Fields/Checkboxes/Checkboxes.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,14 +84,18 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Fields/Name/Name.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,15 +38,23 @@  discard block
 block discarded – undo
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
 block discarded – undo
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()
Please login to merge, or discard this patch.
src/Fields/Text/Text.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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()
Please login to merge, or discard this patch.