Passed
Push — 0.3.0 ( b16461...7b15ee )
by Anton
03:55
created
www/engine/Framework/Classes/Form/Utils/Field.php 1 patch
Braces   +26 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,11 +24,17 @@  discard block
 block discarded – undo
24 24
 
25 25
 			# Set config
26 26
 
27
-			if ($this->disabled) $tag->set('disabled', 'disabled');
27
+			if ($this->disabled) {
28
+				$tag->set('disabled', 'disabled');
29
+			}
28 30
 
29
-			if ($this->required) $tag->set('data-required', 'required');
31
+			if ($this->required) {
32
+				$tag->set('data-required', 'required');
33
+			}
30 34
 
31
-			if ($this->error) $tag->set('data-error', 'error');
35
+			if ($this->error) {
36
+				$tag->set('data-error', 'error');
37
+			}
32 38
 
33 39
 			# ------------------------
34 40
 
@@ -54,11 +60,12 @@  discard block
 block discarded – undo
54 60
 
55 61
 			$params = array_merge(['disabled' => false, 'required' => false], $this->config);
56 62
 
57
-			foreach ($params as $name => $default) if (isset($config[$name])) {
63
+			foreach ($params as $name => $default) {
64
+				if (isset($config[$name])) {
58 65
 
59
-				try { $this->$name($config[$name]); }
60
-
61
-				catch (\TypeError $e) { /* Ignore setting value of illegal type */ }
66
+				try { $this->$name($config[$name]);
67
+			}
68
+			} catch (\TypeError $e) { /* Ignore setting value of illegal type */ }
62 69
 			}
63 70
 		}
64 71
 
@@ -66,7 +73,9 @@  discard block
 block discarded – undo
66 73
 
67 74
 		public function post() {
68 75
 
69
-			if ($this->posted || $this->disabled || ('' === $this->key)) return false;
76
+			if ($this->posted || $this->disabled || ('' === $this->key)) {
77
+				return false;
78
+			}
70 79
 
71 80
 			$this->error = (!$this->set(Request::post($this->name)) && $this->required);
72 81
 
@@ -100,7 +109,9 @@  discard block
 block discarded – undo
100 109
 
101 110
 		public function disabled(bool $value = null) {
102 111
 
103
-			if (null === $value) return $this->disabled;
112
+			if (null === $value) {
113
+				return $this->disabled;
114
+			}
104 115
 
105 116
 			$this->disabled = $value;
106 117
 		}
@@ -109,7 +120,9 @@  discard block
 block discarded – undo
109 120
 
110 121
 		public function required(bool $value = null) {
111 122
 
112
-			if (null === $value) return $this->required;
123
+			if (null === $value) {
124
+				return $this->required;
125
+			}
113 126
 
114 127
 			$this->required = $value;
115 128
 		}
@@ -118,7 +131,9 @@  discard block
 block discarded – undo
118 131
 
119 132
 		public function error(bool $value = null) {
120 133
 
121
-			if (null === $value) return $this->error;
134
+			if (null === $value) {
135
+				return $this->error;
136
+			}
122 137
 
123 138
 			$this->error = $value;
124 139
 		}
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Config/Config.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
 
11 11
 		public function add(string $name, $default, callable $handler) {
12 12
 
13
-			if ('' === $name) return;
13
+			if ('' === $name) {
14
+				return;
15
+			}
14 16
 
15 17
 			$this->config[$name] = $handler; $this->values[$name] = null;
16 18
 
@@ -23,11 +25,11 @@  discard block
 block discarded – undo
23 25
 
24 26
 			foreach ($data as $name => $value) {
25 27
 
26
-				if (!isset($this->config[$name])) continue;
27
-
28
-				try { $this->values[$name] = $this->config[$name]($value); }
28
+				if (!isset($this->config[$name])) {
29
+					continue;
30
+				}
29 31
 
30
-				catch (\TypeError $e) { /* Ignore setting value of illegal type */ }
32
+				try { $this->values[$name] = $this->config[$name]($value); } catch (\TypeError $e) { /* Ignore setting value of illegal type */ }
31 33
 			}
32 34
 		}
33 35
 
@@ -39,11 +41,11 @@  discard block
 block discarded – undo
39 41
 
40 42
 			foreach ($this->config as $name => $handler) {
41 43
 
42
-				if (!($isset = isset($data[$name])) && !$process_all) continue;
44
+				if (!($isset = isset($data[$name])) && !$process_all) {
45
+					continue;
46
+				}
43 47
 
44
-				try { $cast[$name] = ($isset ? $handler($data[$name]) : $this->values[$name]); }
45
-
46
-				catch (\TypeError $e) { $cast[$name] = $this->values[$name]; }
48
+				try { $cast[$name] = ($isset ? $handler($data[$name]) : $this->values[$name]); } catch (\TypeError $e) { $cast[$name] = $this->values[$name]; }
47 49
 			}
48 50
 
49 51
 			# ------------------------
@@ -55,7 +57,9 @@  discard block
 block discarded – undo
55 57
 
56 58
 		public function get(string $name = null) {
57 59
 
58
-			if (null === $name) return $this->values;
60
+			if (null === $name) {
61
+				return $this->values;
62
+			}
59 63
 
60 64
 			return ($this->values[$name] ?? null);
61 65
 		}
Please login to merge, or discard this patch.