Passed
Push — master ( 054586...a82a12 )
by Anton
03:12
created
engine/System/Classes/Modules/Entitizer/Utils/Definition/Item/Param/Id.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 
31 31
 		public function getStatement() : string {
32 32
 
33
-			return ("`" . $this->name . "` int(10) UNSIGNED NOT NULL" . ($this->auto_increment ? " AUTO_INCREMENT" : ""));
33
+			return ("`".$this->name."` int(10) UNSIGNED NOT NULL".($this->auto_increment ? " AUTO_INCREMENT" : ""));
34 34
 		}
35 35
 
36 36
 		/**
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Definition/Item/Index.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@
 block discarded – undo
45 45
 
46 46
 		public function getStatement() : string {
47 47
 
48
-			return ((null !== $this->type) ? ($this->type . " ") : "") .
48
+			return ((null !== $this->type) ? ($this->type." ") : "").
49 49
 
50
-			       ("KEY `" . $this->name . "` (`" . $this->name . "`)");
50
+			       ("KEY `".$this->name."` (`".$this->name."`)");
51 51
 		}
52 52
 	}
53 53
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
36 36
 
37 37
 			$this->name = $name;
38 38
 
39
-			if (null !== $type) $this->type = $this->validateType($type);
39
+			if (null !== $type) {
40
+				$this->type = $this->validateType($type);
41
+			}
40 42
 		}
41 43
 
42 44
 		/**
Please login to merge, or discard this patch.
engine/System/Classes/Modules/Entitizer/Utils/Definition/Group/Foreigns.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@
 block discarded – undo
19 19
 
20 20
 		public function add(string $name, string $table, string $field, string $delete = null, string $update = null) {
21 21
 
22
-			if ((false === $this->definition->getParam($name)) || isset($this->list[$name])) return;
22
+			if ((false === $this->definition->getParam($name)) || isset($this->list[$name])) {
23
+				return;
24
+			}
23 25
 
24 26
 			$this->list[$name] = new Definition\Item\Foreign($name, $table, $field, $delete, $update);
25 27
 		}
Please login to merge, or discard this patch.
engine/System/Classes/Modules/Entitizer/Utils/Definition/Group/Indexes.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@
 block discarded – undo
30 30
 
31 31
 		public function add(string $name, string $type = null) {
32 32
 
33
-			if ((false === $this->definition->getParam($name)) || isset($this->list[$name])) return;
33
+			if ((false === $this->definition->getParam($name)) || isset($this->list[$name])) {
34
+				return;
35
+			}
34 36
 
35 37
 			$this->list[$name] = new Definition\Item\Index($name, $type);
36 38
 		}
Please login to merge, or discard this patch.
engine/System/Classes/Modules/Entitizer/Utils/Definition/Group/Params.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,11 +28,15 @@
 block discarded – undo
28 28
 
29 29
 		private function add(string $type, string $name, array $args) {
30 30
 
31
-			if (('' === $name) || isset($this->list[$name])) return;
31
+			if (('' === $name) || isset($this->list[$name])) {
32
+				return;
33
+			}
32 34
 
33 35
 			$this->list[$name] = new $this->types[$type](...$args);
34 36
 
35
-			if (($type !== 'textual') || $this->list[$name]->short) $this->secure[] = $name;
37
+			if (($type !== 'textual') || $this->list[$name]->short) {
38
+				$this->secure[] = $name;
39
+			}
36 40
 		}
37 41
 
38 42
 		/**
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Collection.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 			$selection = [];
47 47
 
48
-			foreach ($this->definition->getParamsSecure() as $field) $selection[] = ('ent.' . $field);
48
+			foreach ($this->definition->getParamsSecure() as $field) $selection[] = ('ent.'.$field);
49 49
 
50 50
 			# ------------------------
51 51
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 			$order_by = [];
62 62
 
63
-			foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.' . $field . ' ' . $direction);
63
+			foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.'.$field.' '.$direction);
64 64
 
65 65
 			# ------------------------
66 66
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 
28 28
 			foreach ($data as $field => $direction) {
29 29
 
30
-				if (false === ($param = $this->definition->getParam($field))) continue;
30
+				if (false === ($param = $this->definition->getParam($field))) {
31
+					continue;
32
+				}
31 33
 
32 34
 				$order_by[$param->name] = ((strtoupper($direction) !== 'DESC') ? 'ASC' : 'DESC');
33 35
 			}
@@ -45,7 +47,9 @@  discard block
 block discarded – undo
45 47
 
46 48
 			$selection = [];
47 49
 
48
-			foreach ($this->definition->getParamsSecure() as $field) $selection[] = ('ent.' . $field);
50
+			foreach ($this->definition->getParamsSecure() as $field) {
51
+				$selection[] = ('ent.' . $field);
52
+			}
49 53
 
50 54
 			# ------------------------
51 55
 
@@ -60,7 +64,9 @@  discard block
 block discarded – undo
60 64
 
61 65
 			$order_by = [];
62 66
 
63
-			foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.' . $field . ' ' . $direction);
67
+			foreach ($this->castOrderBy($data) as $field => $direction) {
68
+				$order_by[] = ('ent.' . $field . ' ' . $direction);
69
+			}
64 70
 
65 71
 			# ------------------------
66 72
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Definition.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
 		private function createMainTable() : bool {
43 43
 
44
-			$query = ("CREATE TABLE IF NOT EXISTS `" . static::$table . "` (") .
44
+			$query = ("CREATE TABLE IF NOT EXISTS `".static::$table."` (").
45 45
 
46
-			         implode(", ", $this->getStatements()) .
46
+			         implode(", ", $this->getStatements()).
47 47
 
48 48
 			         (") ENGINE=InnoDB DEFAULT CHARSET=utf8");
49 49
 
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
 
61 61
 		private function createRelationsTable() : bool {
62 62
 
63
-			$query = ("CREATE TABLE IF NOT EXISTS `" . static::$table_relations . "` (") .
63
+			$query = ("CREATE TABLE IF NOT EXISTS `".static::$table_relations."` (").
64 64
 
65
-					 ("`ancestor` int(10) UNSIGNED NOT NULL, `descendant` int(10) UNSIGNED NOT NULL, ") .
65
+					 ("`ancestor` int(10) UNSIGNED NOT NULL, `descendant` int(10) UNSIGNED NOT NULL, ").
66 66
 
67
-					 ("`depth` int(10) UNSIGNED NOT NULL, ") .
67
+					 ("`depth` int(10) UNSIGNED NOT NULL, ").
68 68
 
69
-					 ("PRIMARY KEY (`ancestor`, `descendant`), KEY (`ancestor`), KEY (`descendant`), KEY (`depth`), ") .
69
+					 ("PRIMARY KEY (`ancestor`, `descendant`), KEY (`ancestor`), KEY (`descendant`), KEY (`depth`), ").
70 70
 
71
-					 ("FOREIGN KEY (`ancestor`) REFERENCES `" . static::$table . "` (`id`) ON DELETE CASCADE, ") .
71
+					 ("FOREIGN KEY (`ancestor`) REFERENCES `".static::$table."` (`id`) ON DELETE CASCADE, ").
72 72
 
73
-					 ("FOREIGN KEY (`descendant`) REFERENCES `" . static::$table . "` (`id`) ON DELETE CASCADE ") .
73
+					 ("FOREIGN KEY (`descendant`) REFERENCES `".static::$table."` (`id`) ON DELETE CASCADE ").
74 74
 
75 75
 					 (") ENGINE=InnoDB DEFAULT CHARSET=utf8");
76 76
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 		private function removeMainTable() : bool {
89 89
 
90
-			$query = ("DROP TABLE IF EXISTS `" . static::$table  . "`");
90
+			$query = ("DROP TABLE IF EXISTS `".static::$table."`");
91 91
 
92 92
 			return (DB::send($query) && DB::getLast()->status);
93 93
 		}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
 		private function removeRelationsTable() : bool {
102 102
 
103
-			$query = ("DROP TABLE IF EXISTS `" . static::$table_relations  . "`");
103
+			$query = ("DROP TABLE IF EXISTS `".static::$table_relations."`");
104 104
 
105 105
 			return (DB::send($query) && DB::getLast()->status);
106 106
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@
 block discarded – undo
25 25
 
26 26
 			foreach ([$this->params, $this->indexes, $this->foreigns] as $group) {
27 27
 
28
-				foreach ($group->getList() as $item) $statements[] = $item->getStatement();
28
+				foreach ($group->getList() as $item) {
29
+					$statements[] = $item->getStatement();
30
+				}
29 31
 			}
30 32
 
31 33
 			# ------------------------
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Dataset.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
 
22 22
 		protected function addVirtual(string $name, callable $virtual) {
23 23
 
24
-			if (isset($this->params[$name]) || isset($this->virtuals[$name])) return;
24
+			if (isset($this->params[$name]) || isset($this->virtuals[$name])) {
25
+				return;
26
+			}
25 27
 
26 28
 			$this->virtuals[$name] = $virtual;
27 29
 		}
@@ -34,7 +36,9 @@  discard block
 block discarded – undo
34 36
 
35 37
 			$this->params = Entitizer::getDefinition(static::$table)->getParams();
36 38
 
37
-			if (static::$nesting) $this->params['parent_id'] = $this->params['id'];
39
+			if (static::$nesting) {
40
+				$this->params['parent_id'] = $this->params['id'];
41
+			}
38 42
 
39 43
 			$this->init(); $this->reset();
40 44
 		}
@@ -49,11 +53,15 @@  discard block
 block discarded – undo
49 53
 
50 54
 			# Reset params
51 55
 
52
-			foreach ($this->params as $name => $param) $this->data[$name] = $param->cast(null);
56
+			foreach ($this->params as $name => $param) {
57
+				$this->data[$name] = $param->cast(null);
58
+			}
53 59
 
54 60
 			# Reset virtuals
55 61
 
56
-			foreach ($this->virtuals as $name => $virtual) $this->data[$name] = $virtual($this->data);
62
+			foreach ($this->virtuals as $name => $virtual) {
63
+				$this->data[$name] = $virtual($this->data);
64
+			}
57 65
 
58 66
 			# ------------------------
59 67
 
@@ -72,12 +80,16 @@  discard block
 block discarded – undo
72 80
 
73 81
 			foreach ($data as $name => $value) {
74 82
 
75
-				if (isset($this->params[$name])) $this->data[$name] = $this->params[$name]->cast($value);
83
+				if (isset($this->params[$name])) {
84
+					$this->data[$name] = $this->params[$name]->cast($value);
85
+				}
76 86
 			}
77 87
 
78 88
 			# Update extras
79 89
 
80
-			foreach ($this->virtuals as $name => $virtual) $this->data[$name] = $virtual($this->data);
90
+			foreach ($this->virtuals as $name => $virtual) {
91
+				$this->data[$name] = $virtual($this->data);
92
+			}
81 93
 
82 94
 			# ------------------------
83 95
 
@@ -94,7 +106,9 @@  discard block
 block discarded – undo
94 106
 
95 107
 			foreach ($data as $name => $value) {
96 108
 
97
-				if (isset($this->params[$name])) $cast[$name] = $this->params[$name]->cast($value);
109
+				if (isset($this->params[$name])) {
110
+					$cast[$name] = $this->params[$name]->cast($value);
111
+				}
98 112
 			}
99 113
 
100 114
 			# ------------------------
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Handler.php 1 patch
Braces   +37 added lines, -15 removed lines patch added patch discarded remove patch
@@ -56,7 +56,9 @@  discard block
 block discarded – undo
56 56
 
57 57
 		private function processSelector(Template\Block $selector) {
58 58
 
59
-			if ($this->create) return $selector->disable();
59
+			if ($this->create) {
60
+				return $selector->disable();
61
+			}
60 62
 
61 63
 			$selector->parent_id = $this->entity->parent_id;
62 64
 
@@ -81,25 +83,33 @@  discard block
 block discarded – undo
81 83
 
82 84
 			# Set path / title
83 85
 
84
-			if (static::$nesting) $contents->path = $this->path;
85
-
86
-			else $contents->title = ($this->create ? Language::get(static::$naming_new) : $this->entity->get(static::$naming));
86
+			if (static::$nesting) {
87
+				$contents->path = $this->path;
88
+			} else {
89
+				$contents->title = ($this->create ? Language::get(static::$naming_new) : $this->entity->get(static::$naming));
90
+			}
87 91
 
88 92
 			# Process parent block
89 93
 
90
-			if (static::$nesting) $this->processParent($contents->getBlock('parent'));
94
+			if (static::$nesting) {
95
+				$this->processParent($contents->getBlock('parent'));
96
+			}
91 97
 
92 98
 			# Set link
93 99
 
94 100
 			$link = (INSTALL_PATH . static::$link . '/');
95 101
 
96
-			if (static::$nesting) $contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id);
97
-
98
-			else $contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id)));
102
+			if (static::$nesting) {
103
+				$contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id);
104
+			} else {
105
+				$contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id)));
106
+			}
99 107
 
100 108
 			# Process selector block
101 109
 
102
-			if (static::$nesting) $this->processSelector($contents->getBlock('selector'));
110
+			if (static::$nesting) {
111
+				$this->processSelector($contents->getBlock('selector'));
112
+			}
103 113
 
104 114
 			# Implement form
105 115
 
@@ -134,11 +144,15 @@  discard block
 block discarded – undo
134 144
 
135 145
 				$parent_id = Number::forceInt(Request::post('parent_id'));
136 146
 
137
-				if (!$this->entity->move($parent_id)) return $ajax->setError(Language::get(static::$message_error_move));
147
+				if (!$this->entity->move($parent_id)) {
148
+					return $ajax->setError(Language::get(static::$message_error_move));
149
+				}
138 150
 
139 151
 			} else if (Request::post('action') === 'remove') {
140 152
 
141
-				if (!$this->entity->remove()) return $ajax->setError(Language::get(static::$message_error_remove));
153
+				if (!$this->entity->remove()) {
154
+					return $ajax->setError(Language::get(static::$message_error_remove));
155
+				}
142 156
 			}
143 157
 
144 158
 			# ------------------------
@@ -154,7 +168,9 @@  discard block
 block discarded – undo
154 168
 
155 169
 		protected function handle(bool $ajax = false) {
156 170
 
157
-			if (!$this->create && $ajax) return $this->handleAjax();
171
+			if (!$this->create && $ajax) {
172
+				return $this->handleAjax();
173
+			}
158 174
 
159 175
 			# Create entity
160 176
 
@@ -162,7 +178,9 @@  discard block
 block discarded – undo
162 178
 
163 179
 			$this->entity = Entitizer::get(static::$table, (!$this->create ? $id : 0));
164 180
 
165
-			if (!$this->create && (0 === $this->entity->id)) return Request::redirect(INSTALL_PATH . static::$link);
181
+			if (!$this->create && (0 === $this->entity->id)) {
182
+				return Request::redirect(INSTALL_PATH . static::$link);
183
+			}
166 184
 
167 185
 			# Create parent entity
168 186
 
@@ -170,7 +188,9 @@  discard block
 block discarded – undo
170 188
 
171 189
 			# Get path
172 190
 
173
-			if (false !== ($path = $this->parent->getPath())) $this->path = $path;
191
+			if (false !== ($path = $this->parent->getPath())) {
192
+				$this->path = $path;
193
+			}
174 194
 
175 195
 			# Create form
176 196
 
@@ -180,7 +200,9 @@  discard block
 block discarded – undo
180 200
 
181 201
 			if ($this->form->handle(new static::$controller_class($this->entity), true)) {
182 202
 
183
-				if ($this->create && (0 !== $this->parent->id)) $this->entity->move($this->parent->id);
203
+				if ($this->create && (0 !== $this->parent->id)) {
204
+					$this->entity->move($this->parent->id);
205
+				}
184 206
 
185 207
 				Request::redirect(INSTALL_PATH . static::$link . '/edit?id=' . $this->entity->id . '&submitted');
186 208
 			}
Please login to merge, or discard this patch.