Passed
Push — 0.3.0 ( 7b15ee...0d73f1 )
by Anton
03:54
created
www/engine/System/Classes/Modules/Entitizer/Handler/Menuitem.php 2 patches
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Listview {
4 4
 
5
-	use Modules\Entitizer, Template;
5
+	use Modules\Entitizer;
6
+	use Template;
6 7
 
7 8
 	class Variables extends Entitizer\Utils\Listview {
8 9
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@
 block discarded – undo
32 32
 
33 33
 				$parent->block('browse')->disable(); $parent->block('browse_disabled')->enable();
34 34
 
35
-			} else $parent->block('browse')->link = $this->parent->link;
35
+			} else {
36
+				$parent->block('browse')->link = $this->parent->link;
37
+			}
36 38
 		}
37 39
 
38 40
 		# Add item additional data
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Lister/Menuitems.php 2 patches
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Listview {
4 4
 
5
-	use Modules\Entitizer, Template;
5
+	use Modules\Entitizer;
6
+	use Template;
6 7
 
7 8
 	class Variables extends Entitizer\Utils\Listview {
8 9
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@
 block discarded – undo
32 32
 
33 33
 				$parent->block('browse')->disable(); $parent->block('browse_disabled')->enable();
34 34
 
35
-			} else $parent->block('browse')->link = $this->parent->link;
35
+			} else {
36
+				$parent->block('browse')->link = $this->parent->link;
37
+			}
36 38
 		}
37 39
 
38 40
 		# Add item additional data
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Lister/Pages.php 2 patches
Unused Use Statements   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Lister {
4 4
 
5
-	use Modules\Entitizer, Utils\Range, Template;
5
+	use Modules\Entitizer;
6
+	use Utils\Range;
7
+	use Template;
6 8
 
7 9
 	class Pages extends Entitizer\Utils\Lister {
8 10
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@
 block discarded – undo
32 32
 
33 33
 				$parent->block('browse')->disable(); $parent->block('browse_disabled')->enable();
34 34
 
35
-			} else $parent->block('browse')->link = $this->parent->link;
35
+			} else {
36
+				$parent->block('browse')->link = $this->parent->link;
37
+			}
36 38
 		}
37 39
 
38 40
 		# Add item additional data
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Lister/Users.php 2 patches
Unused Use Statements   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Lister {
4 4
 
5
-	use Modules\Auth, Modules\Entitizer, Utils\Range, Template;
5
+	use Modules\Auth;
6
+	use Modules\Entitizer;
7
+	use Utils\Range;
8
+	use Template;
6 9
 
7 10
 	class Users extends Entitizer\Utils\Lister {
8 11
 
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
 			$view->rank = Lister\Rank::get($user->rank);
38 38
 
39
-			if ($user->id === Auth::user()->id) $view->block('remove')->class = 'disabled';
39
+			if ($user->id === Auth::user()->id) {
40
+				$view->block('remove')->class = 'disabled';
41
+			}
40 42
 		}
41 43
 	}
42 44
 }
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Lister/Variables.php 1 patch
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Listview {
4 4
 
5
-	use Modules\Entitizer, Template;
5
+	use Modules\Entitizer;
6
+	use Template;
6 7
 
7 8
 	class Variables extends Entitizer\Utils\Listview {
8 9
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Lister/Widgets.php 1 patch
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Listview {
4 4
 
5
-	use Modules\Entitizer, Template;
5
+	use Modules\Entitizer;
6
+	use Template;
6 7
 
7 8
 	class Variables extends Entitizer\Utils\Listview {
8 9
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Entity.php 4 patches
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Utils {
4 4
 
5
-	use Modules\Entitizer, DB;
5
+	use Modules\Entitizer;
6
+	use DB;
6 7
 
7 8
 	abstract class Entity extends Entitizer {
8 9
 
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@
 block discarded – undo
24 24
 
25 25
 			$query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") .
26 26
 
27
-			         ("FROM " . static::$table . " ent ") .
27
+					 ("FROM " . static::$table . " ent ") .
28 28
 
29
-			         ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") .
29
+					 ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") .
30 30
 
31
-			         ("WHERE ent." . $name . " = '" . addslashes($value) . "' LIMIT 1");
31
+					 ("WHERE ent." . $name . " = '" . addslashes($value) . "' LIMIT 1");
32 32
 
33 33
 			# ------------------------
34 34
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
 
19 19
 			$selection = array_keys($this->definition->params());
20 20
 
21
-			foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field);
21
+			foreach ($selection as $key => $field) $selection[$key] = ('ent.'.$field);
22 22
 
23 23
 			# Process query
24 24
 
25
-			$query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") .
25
+			$query = ("SELECT ".implode(', ', $selection).", rel.ancestor as parent_id ").
26 26
 
27
-			         ("FROM " . static::$table . " ent ") .
27
+			         ("FROM ".static::$table." ent ").
28 28
 
29
-			         ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") .
29
+			         ("LEFT JOIN ".static::$table_relations." rel ON rel.descendant = ent.id AND rel.depth = 1 ").
30 30
 
31
-			         ("WHERE ent." . $name . " = '" . addslashes($value) . "' LIMIT 1");
31
+			         ("WHERE ent.".$name." = '".addslashes($value)."' LIMIT 1");
32 32
 
33 33
 			# ------------------------
34 34
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 			# Select entity from DB
135 135
 
136
-			$condition = ($name . " = '" . addslashes($value) . "' AND id != " . $this->id);
136
+			$condition = ($name." = '".addslashes($value)."' AND id != ".$this->id);
137 137
 
138 138
 			DB::select(static::$table, 'id', $condition, null, 1);
139 139
 
Please login to merge, or discard this patch.
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@  discard block
 block discarded – undo
18 18
 
19 19
 			$selection = array_keys($this->definition->params());
20 20
 
21
-			foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field);
21
+			foreach ($selection as $key => $field) {
22
+				$selection[$key] = ('ent.' . $field);
23
+			}
22 24
 
23 25
 			# Process query
24 26
 
@@ -43,7 +45,9 @@  discard block
 block discarded – undo
43 45
 
44 46
 			$this->data = $this->definition->cast($data, true);
45 47
 
46
-			if (static::$nesting) $this->data['parent_id'] = intval($data['parent_id'] ?? 0);
48
+			if (static::$nesting) {
49
+				$this->data['parent_id'] = intval($data['parent_id'] ?? 0);
50
+			}
47 51
 
48 52
 			# Implement entity
49 53
 
@@ -68,7 +72,9 @@  discard block
 block discarded – undo
68 72
 
69 73
 			# Check data
70 74
 
71
-			if ([] === $data) $this->modifiable = true;
75
+			if ([] === $data) {
76
+				$this->modifiable = true;
77
+			}
72 78
 
73 79
 			# Preset data
74 80
 
@@ -76,7 +82,9 @@  discard block
 block discarded – undo
76 82
 
77 83
 			# Preset parent id
78 84
 
79
-			if (static::$nesting) $this->data['parent_id'] = 0;
85
+			if (static::$nesting) {
86
+				$this->data['parent_id'] = 0;
87
+			}
80 88
 
81 89
 			# Implement entity
82 90
 
@@ -87,13 +95,19 @@  discard block
 block discarded – undo
87 95
 
88 96
 		public function init($value, string $name = 'id') {
89 97
 
90
-			if (!$this->modifiable || (0 !== $this->id)) return false;
98
+			if (!$this->modifiable || (0 !== $this->id)) {
99
+				return false;
100
+			}
91 101
 
92 102
 			# Get initiation index
93 103
 
94
-			if (false === ($index = $this->definition->index($name))) return false;
104
+			if (false === ($index = $this->definition->index($name))) {
105
+				return false;
106
+			}
95 107
 
96
-			if (($index->type !== 'PRIMARY') && ($index->type !== 'UNIQUE')) return false;
108
+			if (($index->type !== 'PRIMARY') && ($index->type !== 'UNIQUE')) {
109
+				return false;
110
+			}
97 111
 
98 112
 			# Process name & value
99 113
 
@@ -101,14 +115,18 @@  discard block
 block discarded – undo
101 115
 
102 116
 			# Select entity from DB
103 117
 
104
-			if (static::$nesting) $this->selectNesting($name, $value); else {
118
+			if (static::$nesting) {
119
+				$this->selectNesting($name, $value);
120
+			} else {
105 121
 
106 122
 				$selection = array_keys($this->definition->params());
107 123
 
108 124
 				DB::select(static::$table, $selection, [$name => $value], null, 1);
109 125
 			}
110 126
 
111
-			if (($this->error = !(DB::last() && DB::last()->status)) || (DB::last()->rows !== 1)) return false;
127
+			if (($this->error = !(DB::last() && DB::last()->status)) || (DB::last()->rows !== 1)) {
128
+				return false;
129
+			}
112 130
 
113 131
 			# ------------------------
114 132
 
@@ -119,13 +137,19 @@  discard block
 block discarded – undo
119 137
 
120 138
 		public function check($value, string $name) {
121 139
 
122
-			if (!$this->modifiable) return false;
140
+			if (!$this->modifiable) {
141
+				return false;
142
+			}
123 143
 
124 144
 			# Get initiation index
125 145
 
126
-			if (false === ($index = $this->definition->index($name))) return false;
146
+			if (false === ($index = $this->definition->index($name))) {
147
+				return false;
148
+			}
127 149
 
128
-			if ($index->type !== 'UNIQUE') return false;
150
+			if ($index->type !== 'UNIQUE') {
151
+				return false;
152
+			}
129 153
 
130 154
 			# Process name & value
131 155
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Entity/Modify.php 4 patches
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Utils {
4 4
 
5
-	use Modules\Entitizer, DB;
5
+	use Modules\Entitizer;
6
+	use DB;
6 7
 
7 8
 	abstract class Entity extends Entitizer {
8 9
 
Please login to merge, or discard this patch.
Braces   +60 added lines, -20 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::last()->status)) return false;
38
+			if (!(DB::send($query) && DB::last()->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::last()->status)) return false;
65
+			if (!(DB::send($query) && DB::last()->status)) {
66
+				return false;
67
+			}
64 68
 
65 69
 			# Set path
66 70
 
@@ -75,25 +79,35 @@  discard block
 block discarded – undo
75 79
 
76 80
 		public function create(array $data) {
77 81
 
78
-			if (!$this->modifiable || (0 !== $this->id)) return false;
82
+			if (!$this->modifiable || (0 !== $this->id)) {
83
+				return false;
84
+			}
79 85
 
80 86
 			$data = $this->definition->cast($data);
81 87
 
82
-			if (static::$auto_increment && isset($data['id'])) unset($data['id']);
88
+			if (static::$auto_increment && isset($data['id'])) {
89
+				unset($data['id']);
90
+			}
83 91
 
84 92
 			# Insert entity
85 93
 
86 94
 			DB::insert(static::$table, $data);
87 95
 
88
-			if (!(DB::last() && DB::last()->status)) return false;
96
+			if (!(DB::last() && DB::last()->status)) {
97
+				return false;
98
+			}
89 99
 
90 100
 			# Set data
91 101
 
92 102
 			$this->error = false;
93 103
 
94
-			if (static::$auto_increment) $this->data['id'] = DB::last()->id;
104
+			if (static::$auto_increment) {
105
+				$this->data['id'] = DB::last()->id;
106
+			}
95 107
 
96
-			foreach ($data as $name => $value) $this->data[$name] = $value;
108
+			foreach ($data as $name => $value) {
109
+				$this->data[$name] = $value;
110
+			}
97 111
 
98 112
 			# Implement entity
99 113
 
@@ -101,7 +115,9 @@  discard block
 block discarded – undo
101 115
 
102 116
 			# Init subtreee
103 117
 
104
-			if (static::$nesting) $this->initSubtree();
118
+			if (static::$nesting) {
119
+				$this->initSubtree();
120
+			}
105 121
 
106 122
 			# Cache entity
107 123
 
@@ -116,21 +132,29 @@  discard block
 block discarded – undo
116 132
 
117 133
 		public function edit(array $data) {
118 134
 
119
-			if (!$this->modifiable || (0 === $this->id)) return false;
135
+			if (!$this->modifiable || (0 === $this->id)) {
136
+				return false;
137
+			}
120 138
 
121 139
 			$data = $this->definition->cast($data);
122 140
 
123
-			if (isset($data['id'])) unset($data['id']);
141
+			if (isset($data['id'])) {
142
+				unset($data['id']);
143
+			}
124 144
 
125 145
 			# Update entity
126 146
 
127 147
 			DB::update(static::$table, $data, ['id' => $this->id]);
128 148
 
129
-			if (!(DB::last() && DB::last()->status)) return false;
149
+			if (!(DB::last() && DB::last()->status)) {
150
+				return false;
151
+			}
130 152
 
131 153
 			# Set data
132 154
 
133
-			foreach ($data as $name => $value) $this->data[$name] = $value;
155
+			foreach ($data as $name => $value) {
156
+				$this->data[$name] = $value;
157
+			}
134 158
 
135 159
 			# Implement entity
136 160
 
@@ -138,7 +162,9 @@  discard block
 block discarded – undo
138 162
 
139 163
 			# Init subtreee
140 164
 
141
-			if (static::$nesting) $this->initSubtree();
165
+			if (static::$nesting) {
166
+				$this->initSubtree();
167
+			}
142 168
 
143 169
 			# ------------------------
144 170
 
@@ -149,30 +175,44 @@  discard block
 block discarded – undo
149 175
 
150 176
 		public function move(int $parent_id) {
151 177
 
152
-			if (!$this->modifiable || (0 === $this->id)) return false;
178
+			if (!$this->modifiable || (0 === $this->id)) {
179
+				return false;
180
+			}
153 181
 
154 182
 			# Re-connect entity if not in tree
155 183
 
156
-			if (!$this->initSubtree()) return false;
184
+			if (!$this->initSubtree()) {
185
+				return false;
186
+			}
157 187
 
158 188
 			# Create parent entity
159 189
 
160 190
 			if (0 !== ($parent = Entitizer::get(static::$table, $parent_id))->id) {
161 191
 
162
-				if (false === ($path = $parent->path())) return false;
192
+				if (false === ($path = $parent->path())) {
193
+					return false;
194
+				}
163 195
 
164
-				if (false === ($depth = $this->subtreeDepth())) return false;
196
+				if (false === ($depth = $this->subtreeDepth())) {
197
+					return false;
198
+				}
165 199
 
166
-				if ((count($path) + $depth + 1) > CONFIG_ENTITIZER_MAX_DEPTH) return false;
200
+				if ((count($path) + $depth + 1) > CONFIG_ENTITIZER_MAX_DEPTH) {
201
+					return false;
202
+				}
167 203
 			}
168 204
 
169 205
 			# Disconnect subtree from current position
170 206
 
171
-			if (!$this->disconnectSubtree()) return false;
207
+			if (!$this->disconnectSubtree()) {
208
+				return false;
209
+			}
172 210
 
173 211
 			# Connect subtree under new position
174 212
 
175
-		 	if (0 !== $parent->id) $this->connectSubtree($parent->id);
213
+		 	if (0 !== $parent->id) {
214
+		 		$this->connectSubtree($parent->id);
215
+		 	}
176 216
 
177 217
 			# ------------------------
178 218
 
Please login to merge, or discard this patch.
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.
www/engine/System/Classes/Modules/Entitizer/Utils/Entity/Remove.php 2 patches
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Utils {
4 4
 
5
-	use Modules\Entitizer, DB;
5
+	use Modules\Entitizer;
6
+	use DB;
6 7
 
7 8
 	abstract class Entity extends Entitizer {
8 9
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,19 +12,27 @@  discard block
 block discarded – undo
12 12
 
13 13
 		public function remove() {
14 14
 
15
-			if (!$this->modifiable || (0 === $this->id)) return false;
15
+			if (!$this->modifiable || (0 === $this->id)) {
16
+				return false;
17
+			}
16 18
 
17 19
 			# Check if entity is removable
18 20
 
19
-			if (static::$super && ($this->id === 1)) return false;
21
+			if (static::$super && ($this->id === 1)) {
22
+				return false;
23
+			}
20 24
 
21
-			if (static::$nesting && (0 !== $this->subtreeCount())) return false;
25
+			if (static::$nesting && (0 !== $this->subtreeCount())) {
26
+				return false;
27
+			}
22 28
 
23 29
 			# Remove entity
24 30
 
25 31
 			DB::delete(static::$table, ['id' => $this->id]);
26 32
 
27
-			if (!(DB::last() && DB::last()->status)) return false;
33
+			if (!(DB::last() && DB::last()->status)) {
34
+				return false;
35
+			}
28 36
 
29 37
 			# Uncache entity
30 38
 
@@ -37,7 +45,9 @@  discard block
 block discarded – undo
37 45
 
38 46
 			$this->data = $this->definition->cast([], true);
39 47
 
40
-			if (static::$nesting) $this->data['parent_id'] = 0;
48
+			if (static::$nesting) {
49
+				$this->data['parent_id'] = 0;
50
+			}
41 51
 
42 52
 			# Implement entity
43 53
 
Please login to merge, or discard this patch.