Passed
Pull Request — master (#11)
by Anton
03:24
created
www/engine/System/Classes/Modules/Entitizer/Definition/User/Secret.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@
 block discarded – undo
14 14
 
15 15
 			# Add params
16 16
 
17
-			$this->params->textual      ('code',                true, 40, true, '');
18
-			$this->params->textual      ('ip',                  true, 255, false, '');
19
-			$this->params->integer      ('time',                false, 10, true, 0);
17
+			$this->params->textual('code', true, 40, true, '');
18
+			$this->params->textual('ip', true, 255, false, '');
19
+			$this->params->integer('time', false, 10, true, 0);
20 20
 
21 21
 			# Add indexes
22 22
 
23
-			$this->indexes->add         ('code',                'UNIQUE');
24
-			$this->indexes->add         ('ip');
25
-			$this->indexes->add         ('time');
23
+			$this->indexes->add('code', 'UNIQUE');
24
+			$this->indexes->add('ip');
25
+			$this->indexes->add('time');
26 26
 
27 27
 			# Add foreign keys
28 28
 
29
-			$this->foreigns->add        ('id',                  TABLE_USERS, 'id', 'CASCADE', 'RESTRICT');
29
+			$this->foreigns->add('id', TABLE_USERS, 'id', 'CASCADE', 'RESTRICT');
30 30
 		}
31 31
 	}
32 32
 }
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Entity/Modify.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 
28 28
 			$query = ("DELETE rla FROM " . static::$table_relations . " rla ") .
29 29
 
30
-			         ("JOIN "  . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") .
30
+					 ("JOIN "  . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") .
31 31
 
32
-			         ("LEFT JOIN " . static::$table_relations . " rlx ") .
32
+					 ("LEFT JOIN " . static::$table_relations . " rlx ") .
33 33
 
34
-			         ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") .
34
+					 ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") .
35 35
 
36
-			         ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
36
+					 ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
37 37
 
38 38
 			if (!(DB::send($query) && DB::last()->status)) return false;
39 39
 
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 
53 53
 			$query = ("INSERT INTO " . static::$table_relations . " (ancestor, descendant, depth) ") .
54 54
 
55
-			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") .
55
+					 ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") .
56 56
 
57
-			         ("FROM " . static::$table_relations . " sup ") .
57
+					 ("FROM " . static::$table_relations . " sup ") .
58 58
 
59
-			         ("JOIN " . static::$table_relations . " sub ") .
59
+					 ("JOIN " . static::$table_relations . " sub ") .
60 60
 
61
-			         ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
61
+					 ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
62 62
 
63 63
 			if (!(DB::send($query) && DB::last()->status)) return false;
64 64
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 		private function disconnectSubtree() {
27 27
 
28
-			$query = ("DELETE rla FROM " . static::$table_relations . " rla ") .
28
+			$query = ("DELETE rla FROM ".static::$table_relations." rla ").
29 29
 
30
-			         ("JOIN "  . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") .
30
+			         ("JOIN ".static::$table_relations." rlb ON rlb.descendant = rla.descendant ").
31 31
 
32
-			         ("LEFT JOIN " . static::$table_relations . " rlx ") .
32
+			         ("LEFT JOIN ".static::$table_relations." rlx ").
33 33
 
34
-			         ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") .
34
+			         ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ").
35 35
 
36
-			         ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
36
+			         ("WHERE rlb.ancestor = ".$this->id." AND rlx.ancestor IS NULL");
37 37
 
38 38
 			if (!(DB::send($query) && DB::last()->status)) return false;
39 39
 
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 
51 51
 		private function connectSubtree(int $parent_id) {
52 52
 
53
-			$query = ("INSERT INTO " . static::$table_relations . " (ancestor, descendant, depth) ") .
53
+			$query = ("INSERT INTO ".static::$table_relations." (ancestor, descendant, depth) ").
54 54
 
55
-			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") .
55
+			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ").
56 56
 
57
-			         ("FROM " . static::$table_relations . " sup ") .
57
+			         ("FROM ".static::$table_relations." sup ").
58 58
 
59
-			         ("JOIN " . static::$table_relations . " sub ") .
59
+			         ("JOIN ".static::$table_relations." sub ").
60 60
 
61
-			         ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
61
+			         ("WHERE sub.ancestor = ".$this->id." AND sup.descendant = ".$parent_id);
62 62
 
63 63
 			if (!(DB::send($query) && DB::last()->status)) return false;
64 64
 
Please login to merge, or discard this patch.
Braces   +66 added lines, -22 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 
36 36
 			         ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
37 37
 
38
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
38
+			if (!(DB::send($query) && DB::getLast()->status)) {
39
+				return false;
40
+			}
39 41
 
40 42
 			# Set path
41 43
 
@@ -60,7 +62,9 @@  discard block
 block discarded – undo
60 62
 
61 63
 			         ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
62 64
 
63
-			if (!(DB::send($query) && (DB::getLast()->rows > 0))) return false;
65
+			if (!(DB::send($query) && (DB::getLast()->rows > 0))) {
66
+				return false;
67
+			}
64 68
 
65 69
 			# Set path
66 70
 
@@ -75,27 +79,37 @@  discard block
 block discarded – undo
75 79
 
76 80
 		public function create(array $data) {
77 81
 
78
-			if (0 !== $this->id) return false;
82
+			if (0 !== $this->id) {
83
+				return false;
84
+			}
79 85
 
80 86
 			$data = $this->dataset->cast($data);
81 87
 
82
-			if (static::$auto_increment && isset($data['id'])) $data['id'] = 0;
88
+			if (static::$auto_increment && isset($data['id'])) {
89
+				$data['id'] = 0;
90
+			}
83 91
 
84 92
 			# Insert entity
85 93
 
86 94
 			DB::insert(static::$table, $data);
87 95
 
88
-			if (!(DB::getLast() && DB::getLast()->status)) return false;
96
+			if (!(DB::getLast() && DB::getLast()->status)) {
97
+				return false;
98
+			}
89 99
 
90 100
 			# Update data
91 101
 
92
-			if (static::$auto_increment) $data['id'] = DB::getLast()->id;
102
+			if (static::$auto_increment) {
103
+				$data['id'] = DB::getLast()->id;
104
+			}
93 105
 
94 106
 			$this->dataset->update($data);
95 107
 
96 108
 			# Init subtreee
97 109
 
98
-			if (static::$nesting) $this->initSubtree();
110
+			if (static::$nesting) {
111
+				$this->initSubtree();
112
+			}
99 113
 
100 114
 			# Cache entity
101 115
 
@@ -110,17 +124,23 @@  discard block
 block discarded – undo
110 124
 
111 125
 		public function edit(array $data) {
112 126
 
113
-			if (0 === $this->id) return false;
127
+			if (0 === $this->id) {
128
+				return false;
129
+			}
114 130
 
115 131
 			$data = $this->dataset->cast($data);
116 132
 
117
-			if (isset($data['id'])) unset($data['id']);
133
+			if (isset($data['id'])) {
134
+				unset($data['id']);
135
+			}
118 136
 
119 137
 			# Update entity
120 138
 
121 139
 			DB::update(static::$table, $data, ['id' => $this->id]);
122 140
 
123
-			if (!(DB::getLast() && DB::getLast()->status)) return false;
141
+			if (!(DB::getLast() && DB::getLast()->status)) {
142
+				return false;
143
+			}
124 144
 
125 145
 			# Update data
126 146
 
@@ -128,7 +148,9 @@  discard block
 block discarded – undo
128 148
 
129 149
 			# Init subtreee
130 150
 
131
-			if (static::$nesting) $this->initSubtree();
151
+			if (static::$nesting) {
152
+				$this->initSubtree();
153
+			}
132 154
 
133 155
 			# ------------------------
134 156
 
@@ -139,30 +161,44 @@  discard block
 block discarded – undo
139 161
 
140 162
 		public function move(int $parent_id) {
141 163
 
142
-			if (0 === $this->id) return false;
164
+			if (0 === $this->id) {
165
+				return false;
166
+			}
143 167
 
144 168
 			# Re-connect entity if not in tree
145 169
 
146
-			if (!$this->initSubtree()) return false;
170
+			if (!$this->initSubtree()) {
171
+				return false;
172
+			}
147 173
 
148 174
 			# Create parent entity
149 175
 
150 176
 			if (0 !== ($parent = Entitizer::get(static::$table, $parent_id))->id) {
151 177
 
152
-				if (false === ($path = $parent->path())) return false;
178
+				if (false === ($path = $parent->path())) {
179
+					return false;
180
+				}
153 181
 
154
-				if (false === ($depth = $this->subtreeDepth())) return false;
182
+				if (false === ($depth = $this->subtreeDepth())) {
183
+					return false;
184
+				}
155 185
 
156
-				if ((count($path) + $depth + 1) > CONFIG_ENTITIZER_MAX_DEPTH) return false;
186
+				if ((count($path) + $depth + 1) > CONFIG_ENTITIZER_MAX_DEPTH) {
187
+					return false;
188
+				}
157 189
 			}
158 190
 
159 191
 			# Disconnect subtree from current position
160 192
 
161
-			if (!$this->disconnectSubtree()) return false;
193
+			if (!$this->disconnectSubtree()) {
194
+				return false;
195
+			}
162 196
 
163 197
 			# Connect subtree under new position
164 198
 
165
-		 	if (0 !== $parent->id) $this->connectSubtree($parent->id);
199
+		 	if (0 !== $parent->id) {
200
+		 		$this->connectSubtree($parent->id);
201
+		 	}
166 202
 
167 203
 			# ------------------------
168 204
 
@@ -173,19 +209,27 @@  discard block
 block discarded – undo
173 209
 
174 210
 		public function remove() {
175 211
 
176
-			if (0 === $this->id) return false;
212
+			if (0 === $this->id) {
213
+				return false;
214
+			}
177 215
 
178 216
 			# Check if entity is removable
179 217
 
180
-			if (static::$super && ($this->id === 1)) return false;
218
+			if (static::$super && ($this->id === 1)) {
219
+				return false;
220
+			}
181 221
 
182
-			if (static::$nesting && (0 !== $this->subtreeCount())) return false;
222
+			if (static::$nesting && (0 !== $this->subtreeCount())) {
223
+				return false;
224
+			}
183 225
 
184 226
 			# Remove entity
185 227
 
186 228
 			DB::delete(static::$table, ['id' => $this->id]);
187 229
 
188
-			if (!(DB::getLast() && DB::getLast()->status)) return false;
230
+			if (!(DB::getLast() && DB::getLast()->status)) {
231
+				return false;
232
+			}
189 233
 
190 234
 			# Uncache entity
191 235
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Dataset/Page.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,14 +19,18 @@
 block discarded – undo
19 19
 
20 20
 			$this->addHandler('link', function (array $data) {
21 21
 
22
-				if ('' === $data['slug']) return '';
22
+				if ('' === $data['slug']) {
23
+					return '';
24
+				}
23 25
 
24 26
 				return (INSTALL_PATH . '/' . $data['slug']);
25 27
 			});
26 28
 
27 29
 			$this->addHandler('canonical', function (array $data) {
28 30
 
29
-				if ('' === $data['slug']) return '';
31
+				if ('' === $data['slug']) {
32
+					return '';
33
+				}
30 34
 
31 35
 				return (Settings::get('system_url') . (($data['id'] !== 1) ? ('/' . $data['slug']) : ''));
32 36
 			});
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,23 +12,23 @@
 block discarded – undo
12 12
 
13 13
 		protected function init() {
14 14
 
15
-			$this->addWorker('active', function (array $data) {
15
+			$this->addWorker('active', function(array $data) {
16 16
 
17 17
 				return (($data['visibility'] === VISIBILITY_PUBLISHED) && !$data['locked']);
18 18
 			});
19 19
 
20
-			$this->addWorker('link', function (array $data) {
20
+			$this->addWorker('link', function(array $data) {
21 21
 
22 22
 				if ('' === $data['slug']) return '';
23 23
 
24
-				return (INSTALL_PATH . '/' . $data['slug']);
24
+				return (INSTALL_PATH.'/'.$data['slug']);
25 25
 			});
26 26
 
27
-			$this->addWorker('canonical', function (array $data) {
27
+			$this->addWorker('canonical', function(array $data) {
28 28
 
29 29
 				if ('' === $data['slug']) return '';
30 30
 
31
-				return (Settings::get('system_url') . (($data['id'] !== 1) ? ('/' . $data['slug']) : ''));
31
+				return (Settings::get('system_url').(($data['id'] !== 1) ? ('/'.$data['slug']) : ''));
32 32
 			});
33 33
 		}
34 34
 	}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Dataset/Menuitem.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,9 +14,13 @@
 block discarded – undo
14 14
 
15 15
 			$this->addHandler('link', function (array $data) {
16 16
 
17
-				if ('' === $data['slug']) return '';
17
+				if ('' === $data['slug']) {
18
+					return '';
19
+				}
18 20
 
19
-				if (false !== Validate::url($data['slug'])) return $data['slug'];
21
+				if (false !== Validate::url($data['slug'])) {
22
+					return $data['slug'];
23
+				}
20 24
 
21 25
 				return (INSTALL_PATH . '/' . $data['slug']);
22 26
 			});
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
 
13 13
 		protected function init() {
14 14
 
15
-			$this->addWorker('link', function (array $data) {
15
+			$this->addWorker('link', function(array $data) {
16 16
 
17 17
 				if ('' === $data['slug']) return '';
18 18
 
19 19
 				if (false !== Validate::url($data['slug'])) return $data['slug'];
20 20
 
21
-				return (INSTALL_PATH . '/' . $data['slug']);
21
+				return (INSTALL_PATH.'/'.$data['slug']);
22 22
 			});
23 23
 		}
24 24
 	}
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
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 			$selection = [];
34 34
 
35
-			foreach ($this->definition->paramsSecure() as $field) $selection[] = ('ent.' . $field);
35
+			foreach ($this->definition->paramsSecure() as $field) $selection[] = ('ent.'.$field);
36 36
 
37 37
 			# ------------------------
38 38
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 			$order_by = [];
47 47
 
48
-			foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.' . $field . ' ' . $direction);
48
+			foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.'.$field.' '.$direction);
49 49
 
50 50
 			# ------------------------
51 51
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
 			foreach ($data as $field => $direction) {
18 18
 
19
-				if (false === ($param = $this->definition->param($field))) continue;
19
+				if (false === ($param = $this->definition->param($field))) {
20
+					continue;
21
+				}
20 22
 
21 23
 				$order_by[$param->name] = ((strtoupper($direction) !== 'DESC') ? 'ASC' : 'DESC');
22 24
 			}
@@ -32,7 +34,9 @@  discard block
 block discarded – undo
32 34
 
33 35
 			$selection = [];
34 36
 
35
-			foreach ($this->definition->paramsSecure() as $field) $selection[] = ('ent.' . $field);
37
+			foreach ($this->definition->paramsSecure() as $field) {
38
+				$selection[] = ('ent.' . $field);
39
+			}
36 40
 
37 41
 			# ------------------------
38 42
 
@@ -45,7 +49,9 @@  discard block
 block discarded – undo
45 49
 
46 50
 			$order_by = [];
47 51
 
48
-			foreach ($this->castOrderBy($data) as $field => $direction) $order_by[] = ('ent.' . $field . ' ' . $direction);
52
+			foreach ($this->castOrderBy($data) as $field => $direction) {
53
+				$order_by[] = ('ent.' . $field . ' ' . $direction);
54
+			}
49 55
 
50 56
 			# ------------------------
51 57
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Treeview.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 			return (0 !== $parent_id) ? (("JOIN " . static::$table_relations . " rel ") .
14 14
 
15
-			       ("ON rel.ancestor = " . $parent_id . " AND rel.descendant = ent.id AND rel.depth >= 1")) :
15
+				   ("ON rel.ancestor = " . $parent_id . " AND rel.descendant = ent.id AND rel.depth >= 1")) :
16 16
 
17 17
 				   ("JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id");
18 18
 		}
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 
24 24
 			return ("SELECT " . $this->getSelection() . ", COALESCE(par.ancestor, 0) as parent_id ") .
25 25
 
26
-			       ("FROM " . static::$table . " ent " . $this->getQueryJoin($parent_id) . " ") .
26
+				   ("FROM " . static::$table . " ent " . $this->getQueryJoin($parent_id) . " ") .
27 27
 
28
-			       ("LEFT JOIN " . static::$table_relations . " par ON par.descendant = ent.id AND par.depth = 1 ") .
28
+				   ("LEFT JOIN " . static::$table_relations . " par ON par.descendant = ent.id AND par.depth = 1 ") .
29 29
 
30
-			       (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") .
30
+				   (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") .
31 31
 
32
-			       ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, " . $this->getOrderBy($order_by));
32
+				   ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, " . $this->getOrderBy($order_by));
33 33
 		}
34 34
 
35 35
 		# Get count query
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 			return ("SELECT COUNT(DISTINCT ent.id) as count FROM " . static::$table . " ent ") .
40 40
 
41
-			       $this->getQueryJoin($parent_id);
41
+				   $this->getQueryJoin($parent_id);
42 42
 		}
43 43
 
44 44
 		# Get depth query
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 			$query = ("SELECT COUNT(DISTINCT rel.depth) as depth FROM " . static::$table . " ent ") .
49 49
 
50
-			         $this->getQueryJoin($parent_id);
50
+					 $this->getQueryJoin($parent_id);
51 51
 
52 52
 			# ------------------------
53 53
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
 			$query = ("SELECT " . $this->getSelection() . " FROM " . static::$table . " ent ") .
130 130
 
131
-			         ("JOIN " . static::$table_relations . " rel ON rel.ancestor = ent.id ") .
131
+					 ("JOIN " . static::$table_relations . " rel ON rel.ancestor = ent.id ") .
132 132
 
133 133
 					 ("WHERE rel.descendant = " . $parent_id . " ORDER BY rel.depth DESC");
134 134
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,33 +10,31 @@  discard block
 block discarded – undo
10 10
 
11 11
 		protected function getQueryJoin(int $parent_id) {
12 12
 
13
-			return (0 !== $parent_id) ? (("JOIN " . static::$table_relations . " rel ") .
13
+			return (0 !== $parent_id) ? (("JOIN ".static::$table_relations." rel ").
14 14
 
15
-			       ("ON rel.ancestor = " . $parent_id . " AND rel.descendant = ent.id AND rel.depth >= 1")) :
16
-
17
-				   ("JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id");
15
+			       ("ON rel.ancestor = ".$parent_id." AND rel.descendant = ent.id AND rel.depth >= 1")) : ("JOIN ".static::$table_relations." rel ON rel.descendant = ent.id");
18 16
 		}
19 17
 
20 18
 		# Get select query
21 19
 
22 20
 		private function getSelectQuery(int $parent_id, array $config, array $order_by) {
23 21
 
24
-			return ("SELECT " . $this->getSelection() . ", COALESCE(par.ancestor, 0) as parent_id ") .
22
+			return ("SELECT ".$this->getSelection().", COALESCE(par.ancestor, 0) as parent_id ").
25 23
 
26
-			       ("FROM " . static::$table . " ent " . $this->getQueryJoin($parent_id) . " ") .
24
+			       ("FROM ".static::$table." ent ".$this->getQueryJoin($parent_id)." ").
27 25
 
28
-			       ("LEFT JOIN " . static::$table_relations . " par ON par.descendant = ent.id AND par.depth = 1 ") .
26
+			       ("LEFT JOIN ".static::$table_relations." par ON par.descendant = ent.id AND par.depth = 1 ").
29 27
 
30
-			       (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") .
28
+			       (('' !== ($condition = $this->getCondition($config))) ? ("WHERE ".$condition." ") : "").
31 29
 
32
-			       ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, " . $this->getOrderBy($order_by));
30
+			       ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, ".$this->getOrderBy($order_by));
33 31
 		}
34 32
 
35 33
 		# Get count query
36 34
 
37 35
 		private function getCountQuery(int $parent_id) {
38 36
 
39
-			return ("SELECT COUNT(DISTINCT ent.id) as count FROM " . static::$table . " ent ") .
37
+			return ("SELECT COUNT(DISTINCT ent.id) as count FROM ".static::$table." ent ").
40 38
 
41 39
 			       $this->getQueryJoin($parent_id);
42 40
 		}
@@ -45,7 +43,7 @@  discard block
 block discarded – undo
45 43
 
46 44
 		private function getDepthQuery(int $parent_id) {
47 45
 
48
-			$query = ("SELECT COUNT(DISTINCT rel.depth) as depth FROM " . static::$table . " ent ") .
46
+			$query = ("SELECT COUNT(DISTINCT rel.depth) as depth FROM ".static::$table." ent ").
49 47
 
50 48
 			         $this->getQueryJoin($parent_id);
51 49
 
@@ -126,11 +124,11 @@  discard block
 block discarded – undo
126 124
 
127 125
 			# Process query
128 126
 
129
-			$query = ("SELECT " . $this->getSelection() . " FROM " . static::$table . " ent ") .
127
+			$query = ("SELECT ".$this->getSelection()." FROM ".static::$table." ent ").
130 128
 
131
-			         ("JOIN " . static::$table_relations . " rel ON rel.ancestor = ent.id ") .
129
+			         ("JOIN ".static::$table_relations." rel ON rel.ancestor = ent.id ").
132 130
 
133
-					 ("WHERE rel.descendant = " . $parent_id . " ORDER BY rel.depth DESC");
131
+					 ("WHERE rel.descendant = ".$parent_id." ORDER BY rel.depth DESC");
134 132
 
135 133
 			# Select path
136 134
 
Please login to merge, or discard this patch.
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,13 +58,17 @@  discard block
 block discarded – undo
58 58
 
59 59
 		public function subtree(int $parent_id = 0, array $config = [], array $order_by = []) {
60 60
 
61
-			if (!(static::$nesting && ($parent_id >= 0))) return false;
61
+			if (!(static::$nesting && ($parent_id >= 0))) {
62
+				return false;
63
+			}
62 64
 
63 65
 			# Select entities
64 66
 
65 67
 			$query = $this->getSelectQuery($parent_id, $config, $order_by);
66 68
 
67
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
69
+			if (!(DB::send($query) && DB::getLast()->status)) {
70
+				return false;
71
+			}
68 72
 
69 73
 			# Process results
70 74
 
@@ -88,13 +92,17 @@  discard block
 block discarded – undo
88 92
 
89 93
 		public function subtreeCount(int $parent_id = 0) {
90 94
 
91
-			if (!(static::$nesting && ($parent_id >= 0))) return false;
95
+			if (!(static::$nesting && ($parent_id >= 0))) {
96
+				return false;
97
+			}
92 98
 
93 99
 			# Get count
94 100
 
95 101
 			$query = $this->getCountQuery($parent_id);
96 102
 
97
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
103
+			if (!(DB::send($query) && DB::getLast()->status)) {
104
+				return false;
105
+			}
98 106
 
99 107
 			# ------------------------
100 108
 
@@ -105,13 +113,17 @@  discard block
 block discarded – undo
105 113
 
106 114
 		public function subtreeDepth(int $parent_id = 0) {
107 115
 
108
-			if (!(static::$nesting && ($parent_id >= 0))) return false;
116
+			if (!(static::$nesting && ($parent_id >= 0))) {
117
+				return false;
118
+			}
109 119
 
110 120
 			# Get depth
111 121
 
112 122
 			$query = $this->getDepthQuery($parent_id);
113 123
 
114
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
124
+			if (!(DB::send($query) && DB::getLast()->status)) {
125
+				return false;
126
+			}
115 127
 
116 128
 			# ------------------------
117 129
 
@@ -122,7 +134,9 @@  discard block
 block discarded – undo
122 134
 
123 135
 		public function path(int $parent_id = 0) {
124 136
 
125
-			if (!(static::$nesting && ($parent_id >= 0))) return false;
137
+			if (!(static::$nesting && ($parent_id >= 0))) {
138
+				return false;
139
+			}
126 140
 
127 141
 			# Process query
128 142
 
@@ -134,13 +148,17 @@  discard block
 block discarded – undo
134 148
 
135 149
 			# Select path
136 150
 
137
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
151
+			if (!(DB::send($query) && DB::getLast()->status)) {
152
+				return false;
153
+			}
138 154
 
139 155
 			# Process results
140 156
 
141 157
 			$path = [];
142 158
 
143
-			while (null !== ($data = DB::getLast()->getRow())) $path[] = Entitizer::dataset(static::$table, $data)->data();
159
+			while (null !== ($data = DB::getLast()->getRow())) {
160
+				$path[] = Entitizer::dataset(static::$table, $data)->data();
161
+			}
144 162
 
145 163
 			# ------------------------
146 164
 
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
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
 
11 11
 		public function add(string $name, string $table, string $field, string $delete = null, string $update = null) {
12 12
 
13
-			if ((false === $this->definition->param($name)) || isset($this->list[$name])) return;
13
+			if ((false === $this->definition->param($name)) || isset($this->list[$name])) {
14
+				return;
15
+			}
14 16
 
15 17
 			$this->list[$name] = new Definition\Item\Foreign($name, $table, $field, $delete, $update);
16 18
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Factory.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,9 +12,13 @@
 block discarded – undo
12 12
 
13 13
 		public static function get(string $table) {
14 14
 
15
-			if (!isset(static::$classes[$table])) throw new Exception\General(static::$error_message);
15
+			if (!isset(static::$classes[$table])) {
16
+				throw new Exception\General(static::$error_message);
17
+			}
16 18
 
17
-			if (!isset(static::$cache[$table])) static::$cache[$table] = new static::$classes[$table];
19
+			if (!isset(static::$cache[$table])) {
20
+				static::$cache[$table] = new static::$classes[$table];
21
+			}
18 22
 
19 23
 			# ------------------------
20 24
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Entitizer.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,9 +25,13 @@
 block discarded – undo
25 25
 
26 26
 		public static function get(string $table, int $id = 0) {
27 27
 
28
-			if (!isset(self::$classes[$table])) throw new Exception\General(self::$error_message);
28
+			if (!isset(self::$classes[$table])) {
29
+				throw new Exception\General(self::$error_message);
30
+			}
29 31
 
30
-			if (isset(self::$cache[$table][$id])) return self::$cache[$table][$id];
32
+			if (isset(self::$cache[$table][$id])) {
33
+				return self::$cache[$table][$id];
34
+			}
31 35
 
32 36
 			$entity = new self::$classes[$table]; $entity->init($id);
33 37
 
Please login to merge, or discard this patch.