Passed
Push — master ( 054586...a82a12 )
by Anton
03:12
created
www/engine/System/Classes/Modules/Entitizer/Utils/Treeview.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 			return (0 !== $parent_id) ? (("JOIN " . static::$table_relations . " rel ") .
23 23
 
24
-			       ("ON rel.ancestor = " . $parent_id . " AND rel.descendant = ent.id AND rel.depth >= 1")) :
24
+				   ("ON rel.ancestor = " . $parent_id . " AND rel.descendant = ent.id AND rel.depth >= 1")) :
25 25
 
26 26
 				   ("JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id");
27 27
 		}
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 
35 35
 			return ("SELECT " . $this->getSelection() . ", COALESCE(par.ancestor, 0) as parent_id ") .
36 36
 
37
-			       ("FROM " . static::$table . " ent " . $this->getQueryJoin($parent_id) . " ") .
37
+				   ("FROM " . static::$table . " ent " . $this->getQueryJoin($parent_id) . " ") .
38 38
 
39
-			       ("LEFT JOIN " . static::$table_relations . " par ON par.descendant = ent.id AND par.depth = 1 ") .
39
+				   ("LEFT JOIN " . static::$table_relations . " par ON par.descendant = ent.id AND par.depth = 1 ") .
40 40
 
41
-			       (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") .
41
+				   (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") .
42 42
 
43
-			       ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, " . $this->getOrderBy($order_by));
43
+				   ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, " . $this->getOrderBy($order_by));
44 44
 		}
45 45
 
46 46
 		/**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 			return ("SELECT COUNT(DISTINCT ent.id) as count FROM " . static::$table . " ent ") .
53 53
 
54
-			       $this->getQueryJoin($parent_id);
54
+				   $this->getQueryJoin($parent_id);
55 55
 		}
56 56
 
57 57
 		/**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 			$query = ("SELECT COUNT(DISTINCT rel.depth) as depth FROM " . static::$table . " ent ") .
64 64
 
65
-			         $this->getQueryJoin($parent_id);
65
+					 $this->getQueryJoin($parent_id);
66 66
 
67 67
 			# ------------------------
68 68
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
 			$query = ("SELECT " . $this->getSelection() . " FROM " . static::$table . " ent ") .
171 171
 
172
-			         ("JOIN " . static::$table_relations . " rel ON rel.ancestor = ent.id ") .
172
+					 ("JOIN " . static::$table_relations . " rel ON rel.ancestor = ent.id ") .
173 173
 
174 174
 					 ("WHERE rel.descendant = " . $parent_id . " ORDER BY rel.depth DESC");
175 175
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,11 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 		protected function getQueryJoin(int $parent_id) : string {
21 21
 
22
-			return (0 !== $parent_id) ? (("JOIN " . static::$table_relations . " rel ") .
22
+			return (0 !== $parent_id) ? (("JOIN ".static::$table_relations." rel ").
23 23
 
24
-			       ("ON rel.ancestor = " . $parent_id . " AND rel.descendant = ent.id AND rel.depth >= 1")) :
25
-
26
-				   ("JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id");
24
+			       ("ON rel.ancestor = ".$parent_id." AND rel.descendant = ent.id AND rel.depth >= 1")) : ("JOIN ".static::$table_relations." rel ON rel.descendant = ent.id");
27 25
 		}
28 26
 
29 27
 		/**
@@ -32,15 +30,15 @@  discard block
 block discarded – undo
32 30
 
33 31
 		private function getSelectQuery(int $parent_id, array $config, array $order_by) : string {
34 32
 
35
-			return ("SELECT " . $this->getSelection() . ", COALESCE(par.ancestor, 0) as parent_id ") .
33
+			return ("SELECT ".$this->getSelection().", COALESCE(par.ancestor, 0) as parent_id ").
36 34
 
37
-			       ("FROM " . static::$table . " ent " . $this->getQueryJoin($parent_id) . " ") .
35
+			       ("FROM ".static::$table." ent ".$this->getQueryJoin($parent_id)." ").
38 36
 
39
-			       ("LEFT JOIN " . static::$table_relations . " par ON par.descendant = ent.id AND par.depth = 1 ") .
37
+			       ("LEFT JOIN ".static::$table_relations." par ON par.descendant = ent.id AND par.depth = 1 ").
40 38
 
41
-			       (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") .
39
+			       (('' !== ($condition = $this->getCondition($config))) ? ("WHERE ".$condition." ") : "").
42 40
 
43
-			       ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, " . $this->getOrderBy($order_by));
41
+			       ("GROUP BY ent.id ORDER BY MAX(rel.depth) ASC, ".$this->getOrderBy($order_by));
44 42
 		}
45 43
 
46 44
 		/**
@@ -49,7 +47,7 @@  discard block
 block discarded – undo
49 47
 
50 48
 		private function getCountQuery(int $parent_id) : string {
51 49
 
52
-			return ("SELECT COUNT(DISTINCT ent.id) as count FROM " . static::$table . " ent ") .
50
+			return ("SELECT COUNT(DISTINCT ent.id) as count FROM ".static::$table." ent ").
53 51
 
54 52
 			       $this->getQueryJoin($parent_id);
55 53
 		}
@@ -60,7 +58,7 @@  discard block
 block discarded – undo
60 58
 
61 59
 		private function getDepthQuery(int $parent_id) : string {
62 60
 
63
-			$query = ("SELECT COUNT(DISTINCT rel.depth) as depth FROM " . static::$table . " ent ") .
61
+			$query = ("SELECT COUNT(DISTINCT rel.depth) as depth FROM ".static::$table." ent ").
64 62
 
65 63
 			         $this->getQueryJoin($parent_id);
66 64
 
@@ -167,11 +165,11 @@  discard block
 block discarded – undo
167 165
 
168 166
 			# Process query
169 167
 
170
-			$query = ("SELECT " . $this->getSelection() . " FROM " . static::$table . " ent ") .
168
+			$query = ("SELECT ".$this->getSelection()." FROM ".static::$table." ent ").
171 169
 
172
-			         ("JOIN " . static::$table_relations . " rel ON rel.ancestor = ent.id ") .
170
+			         ("JOIN ".static::$table_relations." rel ON rel.ancestor = ent.id ").
173 171
 
174
-					 ("WHERE rel.descendant = " . $parent_id . " ORDER BY rel.depth DESC");
172
+					 ("WHERE rel.descendant = ".$parent_id." ORDER BY rel.depth DESC");
175 173
 
176 174
 			# Select path
177 175
 
Please login to merge, or discard this patch.
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -81,13 +81,17 @@  discard block
 block discarded – undo
81 81
 
82 82
 		public function getSubtree(int $parent_id = 0, array $config = [], array $order_by = []) {
83 83
 
84
-			if (!(static::$nesting && ($parent_id >= 0))) return false;
84
+			if (!(static::$nesting && ($parent_id >= 0))) {
85
+				return false;
86
+			}
85 87
 
86 88
 			# Select entities
87 89
 
88 90
 			$query = $this->getSelectQuery($parent_id, $config, $order_by);
89 91
 
90
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
92
+			if (!(DB::send($query) && DB::getLast()->status)) {
93
+				return false;
94
+			}
91 95
 
92 96
 			# Process results
93 97
 
@@ -117,13 +121,17 @@  discard block
 block discarded – undo
117 121
 
118 122
 		public function getSubtreeCount(int $parent_id = 0) {
119 123
 
120
-			if (!(static::$nesting && ($parent_id >= 0))) return false;
124
+			if (!(static::$nesting && ($parent_id >= 0))) {
125
+				return false;
126
+			}
121 127
 
122 128
 			# Get count
123 129
 
124 130
 			$query = $this->getCountQuery($parent_id);
125 131
 
126
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
132
+			if (!(DB::send($query) && DB::getLast()->status)) {
133
+				return false;
134
+			}
127 135
 
128 136
 			# ------------------------
129 137
 
@@ -140,13 +148,17 @@  discard block
 block discarded – undo
140 148
 
141 149
 		public function getSubtreeDepth(int $parent_id = 0) {
142 150
 
143
-			if (!(static::$nesting && ($parent_id >= 0))) return false;
151
+			if (!(static::$nesting && ($parent_id >= 0))) {
152
+				return false;
153
+			}
144 154
 
145 155
 			# Get depth
146 156
 
147 157
 			$query = $this->getDepthQuery($parent_id);
148 158
 
149
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
159
+			if (!(DB::send($query) && DB::getLast()->status)) {
160
+				return false;
161
+			}
150 162
 
151 163
 			# ------------------------
152 164
 
@@ -163,7 +175,9 @@  discard block
 block discarded – undo
163 175
 
164 176
 		public function getPath(int $parent_id = 0) {
165 177
 
166
-			if (!(static::$nesting && ($parent_id >= 0))) return false;
178
+			if (!(static::$nesting && ($parent_id >= 0))) {
179
+				return false;
180
+			}
167 181
 
168 182
 			# Process query
169 183
 
@@ -175,13 +189,17 @@  discard block
 block discarded – undo
175 189
 
176 190
 			# Select path
177 191
 
178
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
192
+			if (!(DB::send($query) && DB::getLast()->status)) {
193
+				return false;
194
+			}
179 195
 
180 196
 			# Process results
181 197
 
182 198
 			$path = [];
183 199
 
184
-			while (null !== ($data = DB::getLast()->getRow())) $path[] = Entitizer::getDataset(static::$table, $data)->getData();
200
+			while (null !== ($data = DB::getLast()->getRow())) {
201
+				$path[] = Entitizer::getDataset(static::$table, $data)->getData();
202
+			}
185 203
 
186 204
 			# ------------------------
187 205
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Entity/Modify.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 
41 41
 		private function disconnectSubtree() : bool {
42 42
 
43
-			$query = ("DELETE rla FROM " . static::$table_relations . " rla ") .
43
+			$query = ("DELETE rla FROM ".static::$table_relations." rla ").
44 44
 
45
-			         ("JOIN "  . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") .
45
+			         ("JOIN ".static::$table_relations." rlb ON rlb.descendant = rla.descendant ").
46 46
 
47
-			         ("LEFT JOIN " . static::$table_relations . " rlx ") .
47
+			         ("LEFT JOIN ".static::$table_relations." rlx ").
48 48
 
49
-			         ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") .
49
+			         ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ").
50 50
 
51
-			         ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
51
+			         ("WHERE rlb.ancestor = ".$this->id." AND rlx.ancestor IS NULL");
52 52
 
53 53
 			if (!(DB::send($query) && DB::getLast()->status)) return false;
54 54
 
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 
70 70
 		private function connectSubtree(int $parent_id) : bool {
71 71
 
72
-			$query = ("INSERT INTO " . static::$table_relations . " (ancestor, descendant, depth) ") .
72
+			$query = ("INSERT INTO ".static::$table_relations." (ancestor, descendant, depth) ").
73 73
 
74
-			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") .
74
+			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ").
75 75
 
76
-			         ("FROM " . static::$table_relations . " sup ") .
76
+			         ("FROM ".static::$table_relations." sup ").
77 77
 
78
-			         ("JOIN " . static::$table_relations . " sub ") .
78
+			         ("JOIN ".static::$table_relations." sub ").
79 79
 
80
-			         ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
80
+			         ("WHERE sub.ancestor = ".$this->id." AND sup.descendant = ".$parent_id);
81 81
 
82 82
 			if (!(DB::send($query) && (DB::getLast()->rows > 0))) return false;
83 83
 
Please login to merge, or discard this patch.
Braces   +66 added lines, -22 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@  discard block
 block discarded – undo
50 50
 
51 51
 			         ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
52 52
 
53
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
53
+			if (!(DB::send($query) && DB::getLast()->status)) {
54
+				return false;
55
+			}
54 56
 
55 57
 			# Set path
56 58
 
@@ -79,7 +81,9 @@  discard block
 block discarded – undo
79 81
 
80 82
 			         ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
81 83
 
82
-			if (!(DB::send($query) && (DB::getLast()->rows > 0))) return false;
84
+			if (!(DB::send($query) && (DB::getLast()->rows > 0))) {
85
+				return false;
86
+			}
83 87
 
84 88
 			# Set path
85 89
 
@@ -98,27 +102,37 @@  discard block
 block discarded – undo
98 102
 
99 103
 		public function create(array $data) : bool {
100 104
 
101
-			if (0 !== $this->id) return false;
105
+			if (0 !== $this->id) {
106
+				return false;
107
+			}
102 108
 
103 109
 			$data = $this->dataset->cast($data);
104 110
 
105
-			if (static::$auto_increment && isset($data['id'])) $data['id'] = 0;
111
+			if (static::$auto_increment && isset($data['id'])) {
112
+				$data['id'] = 0;
113
+			}
106 114
 
107 115
 			# Insert entity
108 116
 
109 117
 			DB::insert(static::$table, $data);
110 118
 
111
-			if (!(DB::getLast() && DB::getLast()->status)) return false;
119
+			if (!(DB::getLast() && DB::getLast()->status)) {
120
+				return false;
121
+			}
112 122
 
113 123
 			# Update data
114 124
 
115
-			if (static::$auto_increment) $data['id'] = DB::getLast()->id;
125
+			if (static::$auto_increment) {
126
+				$data['id'] = DB::getLast()->id;
127
+			}
116 128
 
117 129
 			$this->dataset->update($data);
118 130
 
119 131
 			# Init subtreee
120 132
 
121
-			if (static::$nesting) $this->initSubtree();
133
+			if (static::$nesting) {
134
+				$this->initSubtree();
135
+			}
122 136
 
123 137
 			# Cache entity
124 138
 
@@ -137,17 +151,23 @@  discard block
 block discarded – undo
137 151
 
138 152
 		public function edit(array $data) : bool {
139 153
 
140
-			if (0 === $this->id) return false;
154
+			if (0 === $this->id) {
155
+				return false;
156
+			}
141 157
 
142 158
 			$data = $this->dataset->cast($data);
143 159
 
144
-			if (isset($data['id'])) unset($data['id']);
160
+			if (isset($data['id'])) {
161
+				unset($data['id']);
162
+			}
145 163
 
146 164
 			# Update entity
147 165
 
148 166
 			DB::update(static::$table, $data, ['id' => $this->id]);
149 167
 
150
-			if (!(DB::getLast() && DB::getLast()->status)) return false;
168
+			if (!(DB::getLast() && DB::getLast()->status)) {
169
+				return false;
170
+			}
151 171
 
152 172
 			# Update data
153 173
 
@@ -155,7 +175,9 @@  discard block
 block discarded – undo
155 175
 
156 176
 			# Init subtreee
157 177
 
158
-			if (static::$nesting) $this->initSubtree();
178
+			if (static::$nesting) {
179
+				$this->initSubtree();
180
+			}
159 181
 
160 182
 			# ------------------------
161 183
 
@@ -170,30 +192,44 @@  discard block
 block discarded – undo
170 192
 
171 193
 		public function move(int $parent_id) : bool {
172 194
 
173
-			if (0 === $this->id) return false;
195
+			if (0 === $this->id) {
196
+				return false;
197
+			}
174 198
 
175 199
 			# Re-connect entity if not in tree
176 200
 
177
-			if (!$this->initSubtree()) return false;
201
+			if (!$this->initSubtree()) {
202
+				return false;
203
+			}
178 204
 
179 205
 			# Get parent entity
180 206
 
181 207
 			if (0 !== ($parent = Entitizer::get(static::$table, $parent_id))->id) {
182 208
 
183
-				if (false === ($path = $parent->getPath())) return false;
209
+				if (false === ($path = $parent->getPath())) {
210
+					return false;
211
+				}
184 212
 
185
-				if (false === ($depth = $this->getSubtreeDepth())) return false;
213
+				if (false === ($depth = $this->getSubtreeDepth())) {
214
+					return false;
215
+				}
186 216
 
187
-				if ((count($path) + $depth + 1) > CONFIG_ENTITIZER_MAX_DEPTH) return false;
217
+				if ((count($path) + $depth + 1) > CONFIG_ENTITIZER_MAX_DEPTH) {
218
+					return false;
219
+				}
188 220
 			}
189 221
 
190 222
 			# Disconnect subtree from current position
191 223
 
192
-			if (!$this->disconnectSubtree()) return false;
224
+			if (!$this->disconnectSubtree()) {
225
+				return false;
226
+			}
193 227
 
194 228
 			# Connect subtree under new position
195 229
 
196
-		 	if (0 !== $parent->id) $this->connectSubtree($parent->id);
230
+		 	if (0 !== $parent->id) {
231
+		 		$this->connectSubtree($parent->id);
232
+		 	}
197 233
 
198 234
 			# ------------------------
199 235
 
@@ -208,19 +244,27 @@  discard block
 block discarded – undo
208 244
 
209 245
 		public function remove() : bool {
210 246
 
211
-			if (0 === $this->id) return false;
247
+			if (0 === $this->id) {
248
+				return false;
249
+			}
212 250
 
213 251
 			# Check if entity is removable
214 252
 
215
-			if (static::$super && ($this->id === 1)) return false;
253
+			if (static::$super && ($this->id === 1)) {
254
+				return false;
255
+			}
216 256
 
217
-			if (static::$nesting && (0 !== $this->getSubtreeCount())) return false;
257
+			if (static::$nesting && (0 !== $this->getSubtreeCount())) {
258
+				return false;
259
+			}
218 260
 
219 261
 			# Remove entity
220 262
 
221 263
 			DB::delete(static::$table, ['id' => $this->id]);
222 264
 
223
-			if (!(DB::getLast() && DB::getLast()->status)) return false;
265
+			if (!(DB::getLast() && DB::getLast()->status)) {
266
+				return false;
267
+			}
224 268
 
225 269
 			# Uncache entity
226 270
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Listview.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 
22 22
 			return ("SELECT SQL_CALC_FOUND_ROWS " . $this->getSelection() . " ") .
23 23
 
24
-			       ("FROM " . static::$table . " ent ") .
24
+				   ("FROM " . static::$table . " ent ") .
25 25
 
26 26
 				   (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") .
27 27
 
28 28
 				   ("ORDER BY " . $this->getOrderBy($order_by) . " ") .
29 29
 
30
-			       (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : "");
30
+				   (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : "");
31 31
 		}
32 32
 
33 33
 		/**
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 
39 39
 			return ("SELECT SQL_CALC_FOUND_ROWS " . $this->getSelection() . ", COUNT(chd.descendant) as children ") .
40 40
 
41
-			       ("FROM " . static::$table . " ent ") .
41
+				   ("FROM " . static::$table . " ent ") .
42 42
 
43
-			       ("LEFT JOIN " . static::$table_relations . " chd ON chd.ancestor = ent.id AND chd.depth = 1 ") .
43
+				   ("LEFT JOIN " . static::$table_relations . " chd ON chd.ancestor = ent.id AND chd.depth = 1 ") .
44 44
 
45 45
 				   ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") .
46 46
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 				   ("GROUP BY ent.id ORDER BY " . $this->getOrderBy($order_by) . " ") .
52 52
 
53
-			       (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : "");
53
+				   (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : "");
54 54
 		}
55 55
 
56 56
 		/**
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 			return ("SELECT COUNT(ent.id) as count FROM " . static::$table . " ent ") .
63 63
 
64
-			       (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition) : "");
64
+				   (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition) : "");
65 65
 		}
66 66
 
67 67
 		/**
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 
73 73
 			return ("SELECT COUNT(ent.id) as count FROM " . static::$table . " ent ") .
74 74
 
75
-			       ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") .
75
+				   ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") .
76 76
 
77
-			       ("WHERE COALESCE(rel.ancestor, 0) = " . $parent_id . " ") .
77
+				   ("WHERE COALESCE(rel.ancestor, 0) = " . $parent_id . " ") .
78 78
 
79
-			       (('' !== ($condition = $this->getCondition($config))) ? ("AND " . $condition) : "");
79
+				   (('' !== ($condition = $this->getCondition($config))) ? ("AND " . $condition) : "");
80 80
 		}
81 81
 
82 82
 		/**
Please login to merge, or discard this patch.
Spacing   +21 added lines, -25 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
 
20 20
 		private function getBasicSelectQuery(array $config, array $order_by, int $index, int $display) : string {
21 21
 
22
-			return ("SELECT SQL_CALC_FOUND_ROWS " . $this->getSelection() . " ") .
22
+			return ("SELECT SQL_CALC_FOUND_ROWS ".$this->getSelection()." ").
23 23
 
24
-			       ("FROM " . static::$table . " ent ") .
24
+			       ("FROM ".static::$table." ent ").
25 25
 
26
-				   (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition . " ") : "") .
26
+				   (('' !== ($condition = $this->getCondition($config))) ? ("WHERE ".$condition." ") : "").
27 27
 
28
-				   ("ORDER BY " . $this->getOrderBy($order_by) . " ") .
28
+				   ("ORDER BY ".$this->getOrderBy($order_by)." ").
29 29
 
30
-			       (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : "");
30
+			       (($index > 0) ? ("LIMIT ".((($index - 1) * $display).", ".$display)) : "");
31 31
 		}
32 32
 
33 33
 		/**
@@ -36,21 +36,21 @@  discard block
 block discarded – undo
36 36
 
37 37
 		private function getNestingSelectQuery(int $parent_id, array $config, array $order_by, int $index, int $display) : string {
38 38
 
39
-			return ("SELECT SQL_CALC_FOUND_ROWS " . $this->getSelection() . ", COUNT(chd.descendant) as children ") .
39
+			return ("SELECT SQL_CALC_FOUND_ROWS ".$this->getSelection().", COUNT(chd.descendant) as children ").
40 40
 
41
-			       ("FROM " . static::$table . " ent ") .
41
+			       ("FROM ".static::$table." ent ").
42 42
 
43
-			       ("LEFT JOIN " . static::$table_relations . " chd ON chd.ancestor = ent.id AND chd.depth = 1 ") .
43
+			       ("LEFT JOIN ".static::$table_relations." chd ON chd.ancestor = ent.id AND chd.depth = 1 ").
44 44
 
45
-				   ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") .
45
+				   ("LEFT JOIN ".static::$table_relations." rel ON rel.descendant = ent.id AND rel.depth = 1 ").
46 46
 
47
-				   ("WHERE COALESCE(rel.ancestor, 0) = " . $parent_id . " ") .
47
+				   ("WHERE COALESCE(rel.ancestor, 0) = ".$parent_id." ").
48 48
 
49
-				   (('' !== ($condition = $this->getCondition($config))) ? ("AND " . $condition . " ") : "") .
49
+				   (('' !== ($condition = $this->getCondition($config))) ? ("AND ".$condition." ") : "").
50 50
 
51
-				   ("GROUP BY ent.id ORDER BY " . $this->getOrderBy($order_by) . " ") .
51
+				   ("GROUP BY ent.id ORDER BY ".$this->getOrderBy($order_by)." ").
52 52
 
53
-			       (($index > 0) ? ("LIMIT " . ((($index - 1) * $display) . ", " . $display)) : "");
53
+			       (($index > 0) ? ("LIMIT ".((($index - 1) * $display).", ".$display)) : "");
54 54
 		}
55 55
 
56 56
 		/**
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 
60 60
 		private function getBasicCountQuery(array $config) : string {
61 61
 
62
-			return ("SELECT COUNT(ent.id) as count FROM " . static::$table . " ent ") .
62
+			return ("SELECT COUNT(ent.id) as count FROM ".static::$table." ent ").
63 63
 
64
-			       (('' !== ($condition = $this->getCondition($config))) ? ("WHERE " . $condition) : "");
64
+			       (('' !== ($condition = $this->getCondition($config))) ? ("WHERE ".$condition) : "");
65 65
 		}
66 66
 
67 67
 		/**
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 
71 71
 		private function getNestingCountQuery(int $parent_id, array $config) : string {
72 72
 
73
-			return ("SELECT COUNT(ent.id) as count FROM " . static::$table . " ent ") .
73
+			return ("SELECT COUNT(ent.id) as count FROM ".static::$table." ent ").
74 74
 
75
-			       ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") .
75
+			       ("LEFT JOIN ".static::$table_relations." rel ON rel.descendant = ent.id AND rel.depth = 1 ").
76 76
 
77
-			       ("WHERE COALESCE(rel.ancestor, 0) = " . $parent_id . " ") .
77
+			       ("WHERE COALESCE(rel.ancestor, 0) = ".$parent_id." ").
78 78
 
79
-			       (('' !== ($condition = $this->getCondition($config))) ? ("AND " . $condition) : "");
79
+			       (('' !== ($condition = $this->getCondition($config))) ? ("AND ".$condition) : "");
80 80
 		}
81 81
 
82 82
 		/**
@@ -93,9 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 			# Select entities
95 95
 
96
-			$query = ((null === $parent_id) ? $this->getBasicSelectQuery($config, $order_by, $index, $display) :
97
-
98
-				$this->getNestingSelectQuery($parent_id, $config, $order_by, $index, $display));
96
+			$query = ((null === $parent_id) ? $this->getBasicSelectQuery($config, $order_by, $index, $display) : $this->getNestingSelectQuery($parent_id, $config, $order_by, $index, $display));
99 97
 
100 98
 			if (!(DB::send($query) && DB::getLast()->status)) return false;
101 99
 
@@ -136,9 +134,7 @@  discard block
 block discarded – undo
136 134
 
137 135
 			# Count entities
138 136
 
139
-			$query = ((null === $parent_id) ? $this->getBasicCountQuery($config) :
140
-
141
-				$this->getNestingCountQuery($parent_id, $config));
137
+			$query = ((null === $parent_id) ? $this->getBasicCountQuery($config) : $this->getNestingCountQuery($parent_id, $config));
142 138
 
143 139
 			if (!(DB::send($query) && DB::getLast()->status)) return false;
144 140
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -87,9 +87,13 @@  discard block
 block discarded – undo
87 87
 
88 88
 		private function select(int $parent_id = null, array $config = [], array $order_by = [], int $index = 0, int $display = 0) {
89 89
 
90
-			if (!((null === $parent_id) || ($parent_id >= 0))) return false;
90
+			if (!((null === $parent_id) || ($parent_id >= 0))) {
91
+				return false;
92
+			}
91 93
 
92
-			if (!(($index >= 0) && ($display >= 0))) return false;
94
+			if (!(($index >= 0) && ($display >= 0))) {
95
+				return false;
96
+			}
93 97
 
94 98
 			# Select entities
95 99
 
@@ -97,7 +101,9 @@  discard block
 block discarded – undo
97 101
 
98 102
 				$this->getNestingSelectQuery($parent_id, $config, $order_by, $index, $display));
99 103
 
100
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
104
+			if (!(DB::send($query) && DB::getLast()->status)) {
105
+				return false;
106
+			}
101 107
 
102 108
 			# Process results
103 109
 
@@ -109,7 +115,9 @@  discard block
 block discarded – undo
109 115
 
110 116
 				$items['list'][$dataset->id]['dataset'] = $dataset;
111 117
 
112
-				if (null !== $parent_id) $items['list'][$dataset->id]['children'] = intval($data['children']);
118
+				if (null !== $parent_id) {
119
+					$items['list'][$dataset->id]['children'] = intval($data['children']);
120
+				}
113 121
 			}
114 122
 
115 123
 			# Count total
@@ -132,7 +140,9 @@  discard block
 block discarded – undo
132 140
 
133 141
 		private function count(int $parent_id = null, array $config = []) {
134 142
 
135
-			if (!((null === $parent_id) || ($parent_id >= 0))) return false;
143
+			if (!((null === $parent_id) || ($parent_id >= 0))) {
144
+				return false;
145
+			}
136 146
 
137 147
 			# Count entities
138 148
 
@@ -140,7 +150,9 @@  discard block
 block discarded – undo
140 150
 
141 151
 				$this->getNestingCountQuery($parent_id, $config));
142 152
 
143
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
153
+			if (!(DB::send($query) && DB::getLast()->status)) {
154
+				return false;
155
+			}
144 156
 
145 157
 			# ------------------------
146 158
 
@@ -190,7 +202,9 @@  discard block
 block discarded – undo
190 202
 
191 203
 		public function getChildren(int $parent_id = 0, array $config = [], array $order_by = [], int $index = 0, int $display = 0) {
192 204
 
193
-			if (!static::$nesting) return false;
205
+			if (!static::$nesting) {
206
+				return false;
207
+			}
194 208
 
195 209
 			return $this->select($parent_id, $config, $order_by, $index, $display);
196 210
 		}
@@ -206,7 +220,9 @@  discard block
 block discarded – undo
206 220
 
207 221
 		public function getChildrenCount(int $parent_id = 0, array $config = []) {
208 222
 
209
-			if (!static::$nesting) return false;
223
+			if (!static::$nesting) {
224
+				return false;
225
+			}
210 226
 
211 227
 			return $this->count($parent_id, $config);
212 228
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Lister/Pages.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@
 block discarded – undo
37 37
 
38 38
 		protected function processEntityParent(Template\Block $parent) {
39 39
 
40
-			if ((0 !== $this->parent->id) && $this->parent->active) $parent->getBlock('browse')->link = $this->parent->link;
41
-
42
-			else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
40
+			if ((0 !== $this->parent->id) && $this->parent->active) {
41
+				$parent->getBlock('browse')->link = $this->parent->link;
42
+			} else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
43 43
 		}
44 44
 
45 45
 		/**
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Lister/Menuitems.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@
 block discarded – undo
37 37
 
38 38
 		protected function processEntityParent(Template\Block $parent) {
39 39
 
40
-			if (0 !== $this->parent->id) $parent->getBlock('browse')->link = $this->parent->link;
41
-
42
-			else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
40
+			if (0 !== $this->parent->id) {
41
+				$parent->getBlock('browse')->link = $this->parent->link;
42
+			} else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
43 43
 		}
44 44
 
45 45
 		/**
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Handler/Edit/Page.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
 		protected function processEntityParent(Template\Block $parent) {
43 43
 
44
-			if ((0 !== $this->parent->id) && $this->parent->active) $parent->getBlock('browse')->link = $this->parent->link;
45
-
46
-			else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
44
+			if ((0 !== $this->parent->id) && $this->parent->active) {
45
+				$parent->getBlock('browse')->link = $this->parent->link;
46
+			} else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
47 47
 		}
48 48
 
49 49
 		/**
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
 
53 53
 		protected function processEntity(Template\Block $contents) {
54 54
 
55
-			if (!$this->create && $this->parent->locked) $contents->getBlock('locked')->enable();
55
+			if (!$this->create && $this->parent->locked) {
56
+				$contents->getBlock('locked')->enable();
57
+			}
56 58
 		}
57 59
 	}
58 60
 }
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Tools/Handler/Sitemap.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 
13 13
 			$selection = 'MAX(time_modified) as last_modified';
14 14
 
15
-			if (!(DB::select(TABLE_PAGES, $selection) && (DB::getLast()->rows === 1))) return 0;
15
+			if (!(DB::select(TABLE_PAGES, $selection) && (DB::getLast()->rows === 1))) {
16
+				return 0;
17
+			}
16 18
 
17 19
 			# ------------------------
18 20
 
@@ -27,11 +29,15 @@  discard block
 block discarded – undo
27 29
 
28 30
 			$condition = ['visibility' => VISIBILITY_PUBLISHED, 'access' => ACCESS_PUBLIC, 'locked' => 0];
29 31
 
30
-			if (!(DB::select(TABLE_PAGES, $selection, $condition, 'slug') && DB::getLast()->status)) return;
32
+			if (!(DB::select(TABLE_PAGES, $selection, $condition, 'slug') && DB::getLast()->status)) {
33
+				return;
34
+			}
31 35
 
32 36
 			# ------------------------
33 37
 
34
-			while (null !== ($data = DB::getLast()->getRow())) yield Entitizer::getDataset(TABLE_PAGES, $data);
38
+			while (null !== ($data = DB::getLast()->getRow())) {
39
+				yield Entitizer::getDataset(TABLE_PAGES, $data);
40
+			}
35 41
 		}
36 42
 
37 43
 		# Handle request
@@ -50,7 +56,9 @@  discard block
 block discarded – undo
50 56
 
51 57
 			if ((false !== $modified) && ($modified > $this->getLastModified())) {
52 58
 
53
-				if (false !== $sitemap->load($file_name)) return $sitemap;
59
+				if (false !== $sitemap->load($file_name)) {
60
+					return $sitemap;
61
+				}
54 62
 			}
55 63
 
56 64
 			# Fill sitemap
Please login to merge, or discard this patch.
www/engine/System/Includes/Constants.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -9,68 +9,68 @@
 block discarded – undo
9 9
 
10 10
 # Cadmium
11 11
 
12
-define('CADMIUM_NAME',                              'Cadmium CMS');
13
-define('CADMIUM_HOME',                              'http://cadmium-cms.com');
12
+define('CADMIUM_NAME', 'Cadmium CMS');
13
+define('CADMIUM_HOME', 'http://cadmium-cms.com');
14 14
 
15
-define('CADMIUM_VERSION',                           '0.4.5');
16
-define('CADMIUM_COPY',                              '2017');
15
+define('CADMIUM_VERSION', '0.4.5');
16
+define('CADMIUM_COPY', '2017');
17 17
 
18 18
 # Third-party
19 19
 
20
-define('JQUERY_VERSION',                            '3.2.0');
21
-define('SEMANTIC_UI_VERSION',                       '2.2.9');
22
-define('CKEDITOR_VERSION',                          '4.6.2');
20
+define('JQUERY_VERSION', '3.2.0');
21
+define('SEMANTIC_UI_VERSION', '2.2.9');
22
+define('CKEDITOR_VERSION', '4.6.2');
23 23
 
24 24
 # Sections
25 25
 
26
-define('SECTION_SITE',                              'site');
27
-define('SECTION_ADMIN',                             'admin');
26
+define('SECTION_SITE', 'site');
27
+define('SECTION_ADMIN', 'admin');
28 28
 
29 29
 # Filemanager types
30 30
 
31
-define('FILEMANAGER_TYPE_DIR',                      'dir');
32
-define('FILEMANAGER_TYPE_FILE',                     'file');
31
+define('FILEMANAGER_TYPE_DIR', 'dir');
32
+define('FILEMANAGER_TYPE_FILE', 'file');
33 33
 
34 34
 # Access
35 35
 
36
-define('ACCESS_PUBLIC',                             0);
37
-define('ACCESS_REGISTERED',                         1);
38
-define('ACCESS_ADMINISTRATOR',                      2);
36
+define('ACCESS_PUBLIC', 0);
37
+define('ACCESS_REGISTERED', 1);
38
+define('ACCESS_ADMINISTRATOR', 2);
39 39
 
40 40
 # Frequency
41 41
 
42
-define('FREQUENCY_ALWAYS',                          'always');
43
-define('FREQUENCY_HOURLY',                          'hourly');
44
-define('FREQUENCY_DAILY',                           'daily');
45
-define('FREQUENCY_WEEKLY',                          'weekly');
46
-define('FREQUENCY_MONTHLY',                         'monthly');
47
-define('FREQUENCY_YEARLY',                          'yearly');
48
-define('FREQUENCY_NEVER',                           'never');
42
+define('FREQUENCY_ALWAYS', 'always');
43
+define('FREQUENCY_HOURLY', 'hourly');
44
+define('FREQUENCY_DAILY', 'daily');
45
+define('FREQUENCY_WEEKLY', 'weekly');
46
+define('FREQUENCY_MONTHLY', 'monthly');
47
+define('FREQUENCY_YEARLY', 'yearly');
48
+define('FREQUENCY_NEVER', 'never');
49 49
 
50 50
 # Rank
51 51
 
52
-define('RANK_GUEST',                                0);
53
-define('RANK_USER',                                 1);
54
-define('RANK_ADMINISTRATOR',                        2);
52
+define('RANK_GUEST', 0);
53
+define('RANK_USER', 1);
54
+define('RANK_ADMINISTRATOR', 2);
55 55
 
56 56
 # Sex
57 57
 
58
-define('SEX_NOT_SELECTED',                          0);
59
-define('SEX_MALE',                                  1);
60
-define('SEX_FEMALE',                                2);
58
+define('SEX_NOT_SELECTED', 0);
59
+define('SEX_MALE', 1);
60
+define('SEX_FEMALE', 2);
61 61
 
62 62
 # Status
63 63
 
64
-define('STATUS_ONLINE',                             0);
65
-define('STATUS_MAINTENANCE',                        1);
66
-define('STATUS_UPDATE',                             2);
64
+define('STATUS_ONLINE', 0);
65
+define('STATUS_MAINTENANCE', 1);
66
+define('STATUS_UPDATE', 2);
67 67
 
68 68
 # Target
69 69
 
70
-define('TARGET_SELF',                               0);
71
-define('TARGET_BLANK',                              1);
70
+define('TARGET_SELF', 0);
71
+define('TARGET_BLANK', 1);
72 72
 
73 73
 # Visibility
74 74
 
75
-define('VISIBILITY_DRAFT',                          0);
76
-define('VISIBILITY_PUBLISHED',                      1);
75
+define('VISIBILITY_DRAFT', 0);
76
+define('VISIBILITY_PUBLISHED', 1);
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Controller/Page.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 		/**
28 28
 		 * Invoker
29 29
 		 *
30
-		 * @return true|string : true on success or an error code on failure
30
+		 * @return string|boolean : true on success or an error code on failure
31 31
 		 */
32 32
 
33 33
 		public function __invoke(array $post) {
Please login to merge, or discard this patch.