Completed
Branch 0.2.1 (e70612)
by Anton
09:15
created
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/Block.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
 				$toggle = (($matches[1][$key] === '!') ? 'disable' : 'enable');
22 22
 
23
-				$type = $matches[2][$key]; $name = $matches[3][$key]; $contents = ($matches[4][$key] ?? '');
23
+				$type = $matches[2][$key]; $name = $matches[3][$key]; $contents = ($matches[4][$key] ? ? '');
24 24
 
25 25
 				if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) continue;
26 26
 
Please login to merge, or discard this patch.
Braces   +44 added lines, -20 removed lines patch added patch discarded remove patch
@@ -22,15 +22,19 @@  discard block
 block discarded – undo
22 22
 
23 23
 				$type = $matches[2][$key]; $name = $matches[3][$key]; $contents = ($matches[4][$key] ?? '');
24 24
 
25
-				if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) continue;
25
+				if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) {
26
+					continue;
27
+				}
26 28
 
27 29
 				$this->contents = str_replace($match, ('{ ' . $type . ':' . $name . ' / }'), $this->contents);
28 30
 
29
-				if ($type === 'block') $this->blocks[$name] = (new Block($contents))->$toggle();
30
-
31
-				else if ($type === 'for') $this->loops[$name] = new Loop($contents);
32
-
33
-				else if ($type === 'widget') $this->widgets[] = $name;
31
+				if ($type === 'block') {
32
+					$this->blocks[$name] = (new Block($contents))->$toggle();
33
+				} else if ($type === 'for') {
34
+					$this->loops[$name] = new Loop($contents);
35
+				} else if ($type === 'widget') {
36
+					$this->widgets[] = $name;
37
+				}
34 38
 			}
35 39
 		}
36 40
 
@@ -48,7 +52,9 @@  discard block
 block discarded – undo
48 52
 
49 53
 				foreach ($matches[1] as $index => $name) {
50 54
 
51
-					if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) continue;
55
+					if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) {
56
+						continue;
57
+					}
52 58
 
53 59
 					$elementaries['stack'][$name] = false;
54 60
 				}
@@ -68,29 +74,39 @@  discard block
 block discarded – undo
68 74
 
69 75
 		public function __clone() {
70 76
 
71
-			foreach ($this->blocks as $name => $block) $this->blocks[$name] = clone $block;
77
+			foreach ($this->blocks as $name => $block) {
78
+				$this->blocks[$name] = clone $block;
79
+			}
72 80
 
73
-			foreach ($this->loops as $name => $loop) $this->loops[$name] = clone $loop;
81
+			foreach ($this->loops as $name => $loop) {
82
+				$this->loops[$name] = clone $loop;
83
+			}
74 84
 		}
75 85
 
76 86
 		# Setter
77 87
 
78 88
 		public function __set(string $name, $value) {
79 89
 
80
-			if ($value instanceof Block) $this->block($name, $value);
81
-
82
-			else if (is_array($value)) $this->loop($name, $value);
83
-
84
-			else if (is_scalar($value)) $this->set($name, $value);
90
+			if ($value instanceof Block) {
91
+				$this->block($name, $value);
92
+			} else if (is_array($value)) {
93
+				$this->loop($name, $value);
94
+			} else if (is_scalar($value)) {
95
+				$this->set($name, $value);
96
+			}
85 97
 		}
86 98
 
87 99
 		# Set block
88 100
 
89 101
 		public function block(string $name, Block $block = null) {
90 102
 
91
-			if (!isset($this->blocks[$name])) return ((null === $block) ? new Block() : $this);
103
+			if (!isset($this->blocks[$name])) {
104
+				return ((null === $block) ? new Block() : $this);
105
+			}
92 106
 
93
-			if (null === $block) return $this->blocks[$name];
107
+			if (null === $block) {
108
+				return $this->blocks[$name];
109
+			}
94 110
 
95 111
 			$this->blocks[$name] = $block;
96 112
 
@@ -103,9 +119,13 @@  discard block
 block discarded – undo
103 119
 
104 120
 		public function loop(string $name, array $range = null) {
105 121
 
106
-			if (!isset($this->loops[$name])) return ((null === $range) ? new Loop() : $this);
122
+			if (!isset($this->loops[$name])) {
123
+				return ((null === $range) ? new Loop() : $this);
124
+			}
107 125
 
108
-			if (null === $range) return $this->loops[$name];
126
+			if (null === $range) {
127
+				return $this->loops[$name];
128
+			}
109 129
 
110 130
 			$this->loops[$name]->range($range);
111 131
 
@@ -118,7 +138,9 @@  discard block
 block discarded – undo
118 138
 
119 139
 		public function set(string $name, string $value) {
120 140
 
121
-			if (isset($this->variables[$name])) $this->variables[$name] = $value;
141
+			if (isset($this->variables[$name])) {
142
+				$this->variables[$name] = $value;
143
+			}
122 144
 
123 145
 			return $this;
124 146
 		}
@@ -127,7 +149,9 @@  discard block
 block discarded – undo
127 149
 
128 150
 		public function contents() {
129 151
 
130
-			if (!$this->enabled) return '';
152
+			if (!$this->enabled) {
153
+				return '';
154
+			}
131 155
 
132 156
 			$this->enabled = false; $insertions = [];
133 157
 
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/Arr/Arr.php 1 patch
Braces   +20 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,7 +10,12 @@  discard block
 block discarded – undo
10 10
 
11 11
 			$value = false;
12 12
 
13
-			foreach ($path as $item) if (isset($array[$item])) $value = ($array = $array[$item]); else return false;
13
+			foreach ($path as $item) {
14
+				if (isset($array[$item])) $value = ($array = $array[$item]);
15
+			}
16
+			else {
17
+				return false;
18
+			}
14 19
 
15 20
 			# ------------------------
16 21
 
@@ -23,7 +28,9 @@  discard block
 block discarded – undo
23 28
 
24 29
 			$result = [];
25 30
 
26
-			foreach ($keys as $key) if (is_scalar($key)) $result[$key] = (isset($array[$key]) ? $array[$key] : false);
31
+			foreach ($keys as $key) {
32
+				if (is_scalar($key)) $result[$key] = (isset($array[$key]) ? $array[$key] : false);
33
+			}
27 34
 
28 35
 			# ------------------------
29 36
 
@@ -36,7 +43,9 @@  discard block
 block discarded – undo
36 43
 
37 44
 			$result = [];
38 45
 
39
-			foreach ($array as $key => $value) $result[] = [$key_name => $key, $value_name => $value];
46
+			foreach ($array as $key => $value) {
47
+				$result[] = [$key_name => $key, $value_name => $value];
48
+			}
40 49
 
41 50
 			# ------------------------
42 51
 
@@ -54,9 +63,15 @@  discard block
 block discarded – undo
54 63
 
55 64
 			$column = array_map($select_key, $array);
56 65
 
57
-			if (!$descending) asort($column); else arsort($column);
66
+			if (!$descending) {
67
+				asort($column);
68
+			} else {
69
+				arsort($column);
70
+			}
58 71
 
59
-			$result = []; foreach (array_keys($column) as $key) $result[$key] = $array[$key];
72
+			$result = []; foreach (array_keys($column) as $key) {
73
+				$result[$key] = $array[$key];
74
+			}
60 75
 
61 76
 			# ------------------------
62 77
 
Please login to merge, or discard this patch.