Completed
Pull Request — master (#7)
by Anton
04:49
created
www/engine/Framework/Classes/Form/Field/Text.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
 
106 106
 		public function __construct(Form $form, string $key, string $value = '',
107 107
 
108
-		    string $type = FORM_FIELD_TEXT, int $maxlength = 0, array $config = []) {
108
+			string $type = FORM_FIELD_TEXT, int $maxlength = 0, array $config = []) {
109 109
 
110 110
 			# Init field
111 111
 
Please login to merge, or discard this patch.
Braces   +53 added lines, -27 removed lines patch added patch discarded remove patch
@@ -65,9 +65,13 @@  discard block
 block discarded – undo
65 65
 
66 66
 			$tag = $this->getTag('textarea', [], $this->value);
67 67
 
68
-			if ($this->config['rows'] > 0) $tag->set('rows', $this->config['rows']);
68
+			if ($this->config['rows'] > 0) {
69
+				$tag->set('rows', $this->config['rows']);
70
+			}
69 71
 
70
-			if ($this->config['cols'] > 0) $tag->set('cols', $this->config['cols']);
72
+			if ($this->config['cols'] > 0) {
73
+				$tag->set('cols', $this->config['cols']);
74
+			}
71 75
 
72 76
 			# ------------------------
73 77
 
@@ -78,27 +82,33 @@  discard block
 block discarded – undo
78 82
 
79 83
 		private function processSpaces() {
80 84
 
81
-			if ($this->config['spaces'] === 'strip') $this->value = Str::stripSpaces($this->value);
82
-
83
-			else if ($this->config['spaces'] === 'single') $this->value = Str::singleSpaces($this->value);
85
+			if ($this->config['spaces'] === 'strip') {
86
+				$this->value = Str::stripSpaces($this->value);
87
+			} else if ($this->config['spaces'] === 'single') {
88
+				$this->value = Str::singleSpaces($this->value);
89
+			}
84 90
 		}
85 91
 
86 92
 		# Process convert
87 93
 
88 94
 		private function processConvert() {
89 95
 
90
-			if ($this->config['convert'] === 'url') $this->value = Str::toUrl($this->value, $this->maxlength);
91
-
92
-			else if ($this->config['convert'] === 'var') $this->value = Str::toVar($this->value, $this->maxlength);
96
+			if ($this->config['convert'] === 'url') {
97
+				$this->value = Str::toUrl($this->value, $this->maxlength);
98
+			} else if ($this->config['convert'] === 'var') {
99
+				$this->value = Str::toVar($this->value, $this->maxlength);
100
+			}
93 101
 		}
94 102
 
95 103
 		# Process transform
96 104
 
97 105
 		private function processTransform() {
98 106
 
99
-			if ($this->config['transform'] === 'lower') $this->value = Str::toLower($this->value);
100
-
101
-			else if ($this->config['transform'] === 'upper') $this->value = Str::toUpper($this->value);
107
+			if ($this->config['transform'] === 'lower') {
108
+				$this->value = Str::toLower($this->value);
109
+			} else if ($this->config['transform'] === 'upper') {
110
+				$this->value = Str::toUpper($this->value);
111
+			}
102 112
 		}
103 113
 
104 114
 		# Constructor
@@ -164,7 +174,9 @@  discard block
 block discarded – undo
164 174
 
165 175
 		public function spaces(string $value) {
166 176
 
167
-			if (!in_array($value, ['strip', 'single'], true)) $value = '';
177
+			if (!in_array($value, ['strip', 'single'], true)) {
178
+				$value = '';
179
+			}
168 180
 
169 181
 			$this->config['spaces'] = $value;
170 182
 		}
@@ -173,7 +185,9 @@  discard block
 block discarded – undo
173 185
 
174 186
 		public function convert(string $value) {
175 187
 
176
-			if (!in_array($value, ['url', 'var'], true)) $value = '';
188
+			if (!in_array($value, ['url', 'var'], true)) {
189
+				$value = '';
190
+			}
177 191
 
178 192
 			$this->config['convert'] = $value;
179 193
 		}
@@ -182,7 +196,9 @@  discard block
 block discarded – undo
182 196
 
183 197
 		public function transform(string $value) {
184 198
 
185
-			if (!in_array($value, ['upper', 'lower'], true)) $value = '';
199
+			if (!in_array($value, ['upper', 'lower'], true)) {
200
+				$value = '';
201
+			}
186 202
 
187 203
 			$this->config['transform'] = $value;
188 204
 		}
@@ -226,25 +242,35 @@  discard block
 block discarded – undo
226 242
 
227 243
 		public function block() {
228 244
 
229
-			if ($this->type === FORM_FIELD_HIDDEN) return $this->getHidden()->block();
230
-
231
-			else if ($this->type === FORM_FIELD_PASSWORD) $tag = $this->getPassword();
232
-
233
-			else if ($this->type === FORM_FIELD_CAPTCHA) $tag = $this->getCaptcha();
234
-
235
-			else if ($this->type === FORM_FIELD_TEXTAREA) $tag = $this->getTextarea();
236
-
237
-			else $tag = $this->getText();
245
+			if ($this->type === FORM_FIELD_HIDDEN) {
246
+				return $this->getHidden()->block();
247
+			} else if ($this->type === FORM_FIELD_PASSWORD) {
248
+				$tag = $this->getPassword();
249
+			} else if ($this->type === FORM_FIELD_CAPTCHA) {
250
+				$tag = $this->getCaptcha();
251
+			} else if ($this->type === FORM_FIELD_TEXTAREA) {
252
+				$tag = $this->getTextarea();
253
+			} else {
254
+				$tag = $this->getText();
255
+			}
238 256
 
239 257
 			# Set appearance
240 258
 
241
-			if ($this->maxlength > 0) $tag->set('maxlength', $this->maxlength);
259
+			if ($this->maxlength > 0) {
260
+				$tag->set('maxlength', $this->maxlength);
261
+			}
242 262
 
243
-			if ('' !== $this->config['placeholder']) $tag->set('placeholder', $this->config['placeholder']);
263
+			if ('' !== $this->config['placeholder']) {
264
+				$tag->set('placeholder', $this->config['placeholder']);
265
+			}
244 266
 
245
-			if ($this->config['readonly']) $tag->set('readonly', 'readonly');
267
+			if ($this->config['readonly']) {
268
+				$tag->set('readonly', 'readonly');
269
+			}
246 270
 
247
-			if ($this->config['autofocus']) $tag->set('autofocus', 'autofocus');
271
+			if ($this->config['autofocus']) {
272
+				$tag->set('autofocus', 'autofocus');
273
+			}
248 274
 
249 275
 			# ------------------------
250 276
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Form/Utils/Field.php 1 patch
Braces   +24 added lines, -8 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,15 @@  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 66
 				$checker = ((0 === $default) ? 'is_numeric' : 'is_scalar');
67
+			}
60 68
 
61
-				if ($checker($config[$name])) $this->$name($config[$name]);
69
+				if ($checker($config[$name])) {
70
+					$this->$name($config[$name]);
71
+				}
62 72
 			}
63 73
 		}
64 74
 
@@ -66,7 +76,9 @@  discard block
 block discarded – undo
66 76
 
67 77
 		public function post() {
68 78
 
69
-			if ($this->posted || $this->disabled || ('' === $this->key)) return false;
79
+			if ($this->posted || $this->disabled || ('' === $this->key)) {
80
+				return false;
81
+			}
70 82
 
71 83
 			$this->error = (!$this->set(Request::post($this->name)) && $this->required);
72 84
 
@@ -100,7 +112,9 @@  discard block
 block discarded – undo
100 112
 
101 113
 		public function disabled(bool $value = null) {
102 114
 
103
-			if (null === $value) return $this->disabled;
115
+			if (null === $value) {
116
+				return $this->disabled;
117
+			}
104 118
 
105 119
 			$this->disabled = $value;
106 120
 		}
@@ -109,7 +123,9 @@  discard block
 block discarded – undo
109 123
 
110 124
 		public function required(bool $value = null) {
111 125
 
112
-			if (null === $value) return $this->required;
126
+			if (null === $value) {
127
+				return $this->required;
128
+			}
113 129
 
114 130
 			$this->required = $value;
115 131
 		}
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Tag/Tag.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 			$this->name = $name;
25 25
 
26
-			foreach ($attributes as $name => $value) $this->set($name, $value);
26
+			foreach ($attributes as $name => $value) {
27
+				$this->set($name, $value);
28
+			}
27 29
 
28 30
 			$this->contents($contents);
29 31
 		}
@@ -41,9 +43,11 @@  discard block
 block discarded – undo
41 43
 
42 44
 		public function contents($contents) {
43 45
 
44
-			if ((null === $contents) || Template::isBlock($contents)) $this->contents = $contents;
45
-
46
-			else if (is_scalar($contents)) $this->contents = Template::block('$contents$')->set('contents', $contents);
46
+			if ((null === $contents) || Template::isBlock($contents)) {
47
+				$this->contents = $contents;
48
+			} else if (is_scalar($contents)) {
49
+				$this->contents = Template::block('$contents$')->set('contents', $contents);
50
+			}
47 51
 
48 52
 			# ------------------------
49 53
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Date/Date.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,9 +8,13 @@  discard block
 block discarded – undo
8 8
 
9 9
 		public static function validate(string $date, string $format) {
10 10
 
11
-			if (false === ($date_object = date_create_from_format($format, $date))) return false;
11
+			if (false === ($date_object = date_create_from_format($format, $date))) {
12
+				return false;
13
+			}
12 14
 
13
-			if (false === ($date_formatted = $date_object->format($format))) return false;
15
+			if (false === ($date_formatted = $date_object->format($format))) {
16
+				return false;
17
+			}
14 18
 
15 19
 			# ------------------------
16 20
 
@@ -35,7 +39,9 @@  discard block
 block discarded – undo
35 39
 
36 40
 		public static function validateYear(int $year) {
37 41
 
38
-			if (false === ($year = self::validate($year, 'Y'))) return false;
42
+			if (false === ($year = self::validate($year, 'Y'))) {
43
+				return false;
44
+			}
39 45
 
40 46
 			return (($year > '1900') ? (($year > self::year()) ? self::year() : $year) : '1900');
41 47
 		}
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Template/Asset/Loop.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@
 block discarded – undo
37 37
 
38 38
 				$group->add($block = clone($this->block));
39 39
 
40
-				if (is_array($item)) foreach ($item as $name => $value) if (is_scalar($value)) $block->set($name, $value);
40
+				if (is_array($item)) {
41
+					foreach ($item as $name => $value) if (is_scalar($value)) $block->set($name, $value);
42
+				}
41 43
 			}
42 44
 
43 45
 			# ------------------------
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Template/Asset/Group.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 
24 24
 			$contents = '';
25 25
 
26
-			foreach ($this->items as $block) $contents .= $block->contents();
26
+			foreach ($this->items as $block) {
27
+				$contents .= $block->contents();
28
+			}
27 29
 
28 30
 			# ------------------------
29 31
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Session/Session.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 
9 9
 		public static function start(string $name, int $lifetime) {
10 10
 
11
-			if (session_id()) return true;
11
+			if (session_id()) {
12
+				return true;
13
+			}
12 14
 
13 15
 			ini_set('session.gc_maxlifetime', $lifetime);
14 16
 
@@ -46,14 +48,18 @@  discard block
 block discarded – undo
46 48
 
47 49
 		public static function set(string $name, $value) {
48 50
 
49
-			if (session_id()) $_SESSION[$name] = $value;
51
+			if (session_id()) {
52
+				$_SESSION[$name] = $value;
53
+			}
50 54
 		}
51 55
 
52 56
 		# Delete variable
53 57
 
54 58
 		public static function delete(string $name) {
55 59
 
56
-			if (session_id() && isset($_SESSION[$name])) unset($_SESSION[$name]);
60
+			if (session_id() && isset($_SESSION[$name])) {
61
+				unset($_SESSION[$name]);
62
+			}
57 63
 		}
58 64
 	}
59 65
 }
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Cookie/Cookie.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@
 block discarded – undo
31 31
 
32 32
 		public static function delete(string $name) {
33 33
 
34
-			if (isset($_COOKIE[$name])) unset($_COOKIE[$name]);
34
+			if (isset($_COOKIE[$name])) {
35
+				unset($_COOKIE[$name]);
36
+			}
35 37
 		}
36 38
 	}
37 39
 }
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Lister/Lister.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
 
11 11
 		protected static function init(string $file_name) {
12 12
 
13
-			if (is_array($list = Explorer::php($file_name))) static::$list = $list;
13
+			if (is_array($list = Explorer::php($file_name))) {
14
+				static::$list = $list;
15
+			}
14 16
 		}
15 17
 
16 18
 		# Check if item exists
Please login to merge, or discard this patch.