@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Entity { |
4 | 4 | |
5 | - use Modules\Auth, Modules\Entitizer, DB; |
|
5 | + use Modules\Auth; |
|
6 | + use Modules\Entitizer; |
|
7 | + use DB; |
|
6 | 8 | |
7 | 9 | class Page extends Entitizer\Utils\Entity { |
8 | 10 |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | |
23 | 23 | $selection = array_keys($this->definition->params()); |
24 | 24 | |
25 | - foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field); |
|
25 | + foreach ($selection as $key => $field) $selection[$key] = ('ent.'.$field); |
|
26 | 26 | |
27 | 27 | # Process query |
28 | 28 | |
29 | - $query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") . |
|
29 | + $query = ("SELECT ".implode(', ', $selection).", rel.ancestor as parent_id "). |
|
30 | 30 | |
31 | - ("FROM " . static::$table . " ent ") . |
|
31 | + ("FROM ".static::$table." ent "). |
|
32 | 32 | |
33 | - ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") . |
|
33 | + ("LEFT JOIN ".static::$table_relations." rel ON rel.descendant = ent.id AND rel.depth = 1 "). |
|
34 | 34 | |
35 | - ("WHERE ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.access <= " . Auth::user()->rank . " AND ") . |
|
35 | + ("WHERE ent.visibility = ".VISIBILITY_PUBLISHED." AND ent.access <= ".Auth::user()->rank." AND "). |
|
36 | 36 | |
37 | - ("ent.locked = 0 AND ent.slug = '" . addslashes($slug) . "' LIMIT 1"); |
|
37 | + ("ent.locked = 0 AND ent.slug = '".addslashes($slug)."' LIMIT 1"); |
|
38 | 38 | |
39 | 39 | # Select entity from DB |
40 | 40 | |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | |
54 | 54 | # Send lock/update request |
55 | 55 | |
56 | - $query = ("UPDATE " . static::$table . " ent JOIN (") . |
|
56 | + $query = ("UPDATE ".static::$table." ent JOIN ("). |
|
57 | 57 | |
58 | - ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug ") . |
|
58 | + ("SELECT rel.descendant as id, GROUP_CONCAT(ens.name ORDER BY rls.depth DESC SEPARATOR '/') slug "). |
|
59 | 59 | |
60 | - ("FROM " . static::$table_relations . " rel ") . |
|
60 | + ("FROM ".static::$table_relations." rel "). |
|
61 | 61 | |
62 | - ("JOIN " . static::$table_relations . " rls ON rls.descendant = rel.descendant ") . |
|
62 | + ("JOIN ".static::$table_relations." rls ON rls.descendant = rel.descendant "). |
|
63 | 63 | |
64 | - ("JOIN " . static::$table . " ens ON ens.id = rls.ancestor ") . |
|
64 | + ("JOIN ".static::$table." ens ON ens.id = rls.ancestor "). |
|
65 | 65 | |
66 | - ("WHERE rel.ancestor = " . $this->id . " GROUP BY rel.descendant") . |
|
66 | + ("WHERE rel.ancestor = ".$this->id." GROUP BY rel.descendant"). |
|
67 | 67 | |
68 | 68 | (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
69 | 69 | |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | |
72 | 72 | # Send unlock request |
73 | 73 | |
74 | - $query = ("UPDATE " . static::$table . " ent JOIN (") . |
|
74 | + $query = ("UPDATE ".static::$table." ent JOIN ("). |
|
75 | 75 | |
76 | - ("SELECT rel.descendant as id FROM " . static::$table_relations . " rel ") . |
|
76 | + ("SELECT rel.descendant as id FROM ".static::$table_relations." rel "). |
|
77 | 77 | |
78 | - ("JOIN " . static::$table . " enc ON enc.id = rel.descendant AND enc.locked = 1 ") . |
|
78 | + ("JOIN ".static::$table." enc ON enc.id = rel.descendant AND enc.locked = 1 "). |
|
79 | 79 | |
80 | - ("LEFT JOIN " . static::$table . " end ON end.id != enc.id AND end.slug = enc.slug ") . |
|
80 | + ("LEFT JOIN ".static::$table." end ON end.id != enc.id AND end.slug = enc.slug "). |
|
81 | 81 | |
82 | - ("WHERE end.id IS NULL GROUP BY rel.descendant") . |
|
82 | + ("WHERE end.id IS NULL GROUP BY rel.descendant"). |
|
83 | 83 | |
84 | 84 | (") chk ON chk.id = ent.id SET ent.locked = 0"); |
85 | 85 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | public function initBySlug(string $slug) { |
14 | 14 | |
15 | - if (0 !== $this->id) return false; |
|
15 | + if (0 !== $this->id) { |
|
16 | + return false; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # Process value |
18 | 20 | |
@@ -22,7 +24,9 @@ discard block |
||
22 | 24 | |
23 | 25 | $selection = array_keys($this->definition->params()); |
24 | 26 | |
25 | - foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field); |
|
27 | + foreach ($selection as $key => $field) { |
|
28 | + $selection[$key] = ('ent.' . $field); |
|
29 | + } |
|
26 | 30 | |
27 | 31 | # Process query |
28 | 32 | |
@@ -38,7 +42,9 @@ discard block |
||
38 | 42 | |
39 | 43 | # Select entity from DB |
40 | 44 | |
41 | - if (!(DB::send($query) && (DB::last()->rows === 1))) return false; |
|
45 | + if (!(DB::send($query) && (DB::last()->rows === 1))) { |
|
46 | + return false; |
|
47 | + } |
|
42 | 48 | |
43 | 49 | # ------------------------ |
44 | 50 | |
@@ -49,7 +55,9 @@ discard block |
||
49 | 55 | |
50 | 56 | public function updateSlugs() { |
51 | 57 | |
52 | - if (0 === $this->id) return false; |
|
58 | + if (0 === $this->id) { |
|
59 | + return false; |
|
60 | + } |
|
53 | 61 | |
54 | 62 | # Send lock/update request |
55 | 63 | |
@@ -67,7 +75,9 @@ discard block |
||
67 | 75 | |
68 | 76 | (") slg ON slg.id = ent.id SET ent.locked = 1, ent.slug = slg.slug"); |
69 | 77 | |
70 | - if (!(DB::send($query) && DB::last()->status)) return false; |
|
78 | + if (!(DB::send($query) && DB::last()->status)) { |
|
79 | + return false; |
|
80 | + } |
|
71 | 81 | |
72 | 82 | # Send unlock request |
73 | 83 | |
@@ -83,7 +93,9 @@ discard block |
||
83 | 93 | |
84 | 94 | (") chk ON chk.id = ent.id SET ent.locked = 0"); |
85 | 95 | |
86 | - if (!(DB::send($query) && DB::last()->status)) return false; |
|
96 | + if (!(DB::send($query) && DB::last()->status)) { |
|
97 | + return false; |
|
98 | + } |
|
87 | 99 | |
88 | 100 | # ------------------------ |
89 | 101 | |
@@ -94,7 +106,9 @@ discard block |
||
94 | 106 | |
95 | 107 | public function create(array $data) { |
96 | 108 | |
97 | - if (!parent::create($data)) return false; |
|
109 | + if (!parent::create($data)) { |
|
110 | + return false; |
|
111 | + } |
|
98 | 112 | |
99 | 113 | $this->updateSlugs(); |
100 | 114 | |
@@ -107,7 +121,9 @@ discard block |
||
107 | 121 | |
108 | 122 | public function edit(array $data) { |
109 | 123 | |
110 | - if (!parent::edit($data)) return false; |
|
124 | + if (!parent::edit($data)) { |
|
125 | + return false; |
|
126 | + } |
|
111 | 127 | |
112 | 128 | $this->updateSlugs(); |
113 | 129 | |
@@ -120,7 +136,9 @@ discard block |
||
120 | 136 | |
121 | 137 | public function move(int $parent_id) { |
122 | 138 | |
123 | - if (!parent::move($parent_id)) return false; |
|
139 | + if (!parent::move($parent_id)) { |
|
140 | + return false; |
|
141 | + } |
|
124 | 142 | |
125 | 143 | $this->updateSlugs(); |
126 | 144 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | $selection = 'MAX(time_modified) as last_modified'; |
14 | 14 | |
15 | - if (!(DB::select(TABLE_PAGES, $selection) && (DB::last()->rows === 1))) return 0; |
|
15 | + if (!(DB::select(TABLE_PAGES, $selection) && (DB::last()->rows === 1))) { |
|
16 | + return 0; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # ------------------------ |
18 | 20 | |
@@ -27,11 +29,15 @@ discard block |
||
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::last()->status)) return; |
|
32 | + if (!(DB::select(TABLE_PAGES, $selection, $condition, 'slug') && DB::last()->status)) { |
|
33 | + return; |
|
34 | + } |
|
31 | 35 | |
32 | 36 | # ------------------------ |
33 | 37 | |
34 | - while (null !== ($page = DB::last()->row())) yield Entitizer::dataset(TABLE_PAGES, $page); |
|
38 | + while (null !== ($page = DB::last()->row())) { |
|
39 | + yield Entitizer::dataset(TABLE_PAGES, $page); |
|
40 | + } |
|
35 | 41 | } |
36 | 42 | |
37 | 43 | # Handle request |
@@ -44,7 +50,9 @@ discard block |
||
44 | 50 | |
45 | 51 | # Get last modification time |
46 | 52 | |
47 | - if ($sitemap->load($this->getLastModified())) return $sitemap; |
|
53 | + if ($sitemap->load($this->getLastModified())) { |
|
54 | + return $sitemap; |
|
55 | + } |
|
48 | 56 | |
49 | 57 | # Fill sitemap |
50 | 58 |
@@ -12,23 +12,23 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->addHandler('active', function (array $data) { |
|
15 | + $this->addHandler('active', function(array $data) { |
|
16 | 16 | |
17 | 17 | return (($data['visibility'] === VISIBILITY_PUBLISHED) && !$data['locked']); |
18 | 18 | }); |
19 | 19 | |
20 | - $this->addHandler('link', function (array $data) { |
|
20 | + $this->addHandler('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->addHandler('canonical', function (array $data) { |
|
27 | + $this->addHandler('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 | } |
@@ -19,14 +19,18 @@ |
||
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 | }); |
@@ -12,9 +12,9 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->addHandler('full_name', function (array $data) { |
|
15 | + $this->addHandler('full_name', function(array $data) { |
|
16 | 16 | |
17 | - return trim($data['first_name'] . ' ' . $data['last_name']); |
|
17 | + return trim($data['first_name'].' '.$data['last_name']); |
|
18 | 18 | }); |
19 | 19 | } |
20 | 20 | } |
@@ -12,13 +12,13 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->addHandler('link', function (array $data) { |
|
15 | + $this->addHandler('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 | } |
@@ -14,9 +14,13 @@ |
||
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 | }); |
@@ -16,7 +16,9 @@ |
||
16 | 16 | |
17 | 17 | foreach ([$this->params, $this->indexes, $this->foreigns] as $group) { |
18 | 18 | |
19 | - foreach ($group->list() as $item) $statements[] = $item->statement(); |
|
19 | + foreach ($group->list() as $item) { |
|
20 | + $statements[] = $item->statement(); |
|
21 | + } |
|
20 | 22 | } |
21 | 23 | |
22 | 24 | # ------------------------ |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | |
21 | 21 | # Set create button |
22 | 22 | |
23 | - if (count($this->path) < CONFIG_ENTITIZER_MAX_DEPTH) $parent->block('create')->id = $this->parent->id; |
|
24 | - |
|
25 | - else { $parent->block('create')->disable(); $parent->block('create_disabled')->enable(); } |
|
23 | + if (count($this->path) < CONFIG_ENTITIZER_MAX_DEPTH) { |
|
24 | + $parent->block('create')->id = $this->parent->id; |
|
25 | + } else { $parent->block('create')->disable(); $parent->block('create_disabled')->enable(); } |
|
26 | 26 | |
27 | 27 | # Set edit button |
28 | 28 | |
29 | - if (0 !== $this->parent->id) $parent->block('edit')->id = $this->parent->id; |
|
30 | - |
|
31 | - else { $parent->block('edit')->disable(); $parent->block('edit_disabled')->enable(); } |
|
29 | + if (0 !== $this->parent->id) { |
|
30 | + $parent->block('edit')->id = $this->parent->id; |
|
31 | + } else { $parent->block('edit')->disable(); $parent->block('edit_disabled')->enable(); } |
|
32 | 32 | |
33 | 33 | # Add parent additional data |
34 | 34 | |
@@ -43,7 +43,9 @@ discard block |
||
43 | 43 | |
44 | 44 | foreach ($this->items['list'] as $item) { |
45 | 45 | |
46 | - if ((null !== $this->entity) && ($item['dataset']->id === $this->entity->id)) continue; |
|
46 | + if ((null !== $this->entity) && ($item['dataset']->id === $this->entity->id)) { |
|
47 | + continue; |
|
48 | + } |
|
47 | 49 | |
48 | 50 | $items->add($view = View::get(!$ajax ? static::$view_item : static::$view_ajax_item)); |
49 | 51 | |
@@ -101,21 +103,29 @@ discard block |
||
101 | 103 | |
102 | 104 | # Set path |
103 | 105 | |
104 | - if (static::$nesting) $contents->path = $this->path; |
|
106 | + if (static::$nesting) { |
|
107 | + $contents->path = $this->path; |
|
108 | + } |
|
105 | 109 | |
106 | 110 | # Process parent block |
107 | 111 | |
108 | - if (static::$nesting && !$ajax) $this->processParent($contents->block('parent')); |
|
112 | + if (static::$nesting && !$ajax) { |
|
113 | + $this->processParent($contents->block('parent')); |
|
114 | + } |
|
109 | 115 | |
110 | 116 | # Set items |
111 | 117 | |
112 | 118 | $items = $this->getItemsBlock($ajax); |
113 | 119 | |
114 | - if ($items->count() > 0) $contents->items = $items; |
|
120 | + if ($items->count() > 0) { |
|
121 | + $contents->items = $items; |
|
122 | + } |
|
115 | 123 | |
116 | 124 | # Set pagination |
117 | 125 | |
118 | - if (!$ajax) $contents->pagination = $this->getPaginationBlock(); |
|
126 | + if (!$ajax) { |
|
127 | + $contents->pagination = $this->getPaginationBlock(); |
|
128 | + } |
|
119 | 129 | |
120 | 130 | # ------------------------ |
121 | 131 | |
@@ -140,15 +150,21 @@ discard block |
||
140 | 150 | |
141 | 151 | # Get path and depth |
142 | 152 | |
143 | - if (false !== ($path = $this->parent->path())) $this->path = $path; |
|
153 | + if (false !== ($path = $this->parent->path())) { |
|
154 | + $this->path = $path; |
|
155 | + } |
|
144 | 156 | |
145 | - if ((0 !== $this->entity->id) && (false !== ($depth = $this->entity->subtreeDepth()))) $this->depth = $depth; |
|
157 | + if ((0 !== $this->entity->id) && (false !== ($depth = $this->entity->subtreeDepth()))) { |
|
158 | + $this->depth = $depth; |
|
159 | + } |
|
146 | 160 | |
147 | 161 | # Get items list |
148 | 162 | |
149 | 163 | $lister = (static::$nesting ? 'children' : 'items'); |
150 | 164 | |
151 | - if (false !== ($items = $this->parent->$lister())) $this->items = $items; |
|
165 | + if (false !== ($items = $this->parent->$lister())) { |
|
166 | + $this->items = $items; |
|
167 | + } |
|
152 | 168 | |
153 | 169 | # ------------------------ |
154 | 170 | |
@@ -159,7 +175,9 @@ discard block |
||
159 | 175 | |
160 | 176 | public function handle() { |
161 | 177 | |
162 | - if (Request::isAjax()) return $this->handleAjax(); |
|
178 | + if (Request::isAjax()) { |
|
179 | + return $this->handleAjax(); |
|
180 | + } |
|
163 | 181 | |
164 | 182 | $this->index = Number::format(Request::get('index'), 1, 999999); |
165 | 183 | |
@@ -171,13 +189,17 @@ discard block |
||
171 | 189 | |
172 | 190 | # Get path |
173 | 191 | |
174 | - if (false !== ($path = $this->parent->path())) $this->path = $path; |
|
192 | + if (false !== ($path = $this->parent->path())) { |
|
193 | + $this->path = $path; |
|
194 | + } |
|
175 | 195 | |
176 | 196 | # Get items list |
177 | 197 | |
178 | 198 | $lister = (static::$nesting ? 'children' : 'items'); $index = $this->index; $display = static::$display; |
179 | 199 | |
180 | - if (false !== ($items = $this->parent->$lister([], [], $index, $display))) $this->items = $items; |
|
200 | + if (false !== ($items = $this->parent->$lister([], [], $index, $display))) { |
|
201 | + $this->items = $items; |
|
202 | + } |
|
181 | 203 | |
182 | 204 | # ------------------------ |
183 | 205 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | protected function addHandler(string $name, callable $handler) { |
14 | 14 | |
15 | - if ((false !== $this->definition->param($name)) || isset($this->handlers[$name])) return; |
|
15 | + if ((false !== $this->definition->param($name)) || isset($this->handlers[$name])) { |
|
16 | + return; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | $this->handlers[$name] = $handler; |
18 | 20 | } |
@@ -32,15 +34,21 @@ discard block |
||
32 | 34 | |
33 | 35 | # Reset params |
34 | 36 | |
35 | - foreach ($this->definition->params() as $name => $param) $this->data[$name] = $param->cast(null); |
|
37 | + foreach ($this->definition->params() as $name => $param) { |
|
38 | + $this->data[$name] = $param->cast(null); |
|
39 | + } |
|
36 | 40 | |
37 | 41 | # Reset extras |
38 | 42 | |
39 | - foreach ($this->handlers as $name => $handler) $this->data[$name] = $handler($this->data); |
|
43 | + foreach ($this->handlers as $name => $handler) { |
|
44 | + $this->data[$name] = $handler($this->data); |
|
45 | + } |
|
40 | 46 | |
41 | 47 | # Reset parent id |
42 | 48 | |
43 | - if (static::$nesting) $this->data['parent_id'] = 0; |
|
49 | + if (static::$nesting) { |
|
50 | + $this->data['parent_id'] = 0; |
|
51 | + } |
|
44 | 52 | |
45 | 53 | # ------------------------ |
46 | 54 | |
@@ -55,14 +63,18 @@ discard block |
||
55 | 63 | |
56 | 64 | foreach ($data as $name => $value) { |
57 | 65 | |
58 | - if (false === ($param = $this->definition->param($name))) continue; |
|
66 | + if (false === ($param = $this->definition->param($name))) { |
|
67 | + continue; |
|
68 | + } |
|
59 | 69 | |
60 | 70 | $this->data[$name] = $param->cast($value); |
61 | 71 | } |
62 | 72 | |
63 | 73 | # Update extras |
64 | 74 | |
65 | - foreach ($this->handlers as $name => $handler) $this->data[$name] = $handler($this->data); |
|
75 | + foreach ($this->handlers as $name => $handler) { |
|
76 | + $this->data[$name] = $handler($this->data); |
|
77 | + } |
|
66 | 78 | |
67 | 79 | # Update parent id |
68 | 80 | |
@@ -84,7 +96,9 @@ discard block |
||
84 | 96 | |
85 | 97 | foreach ($data as $name => $value) { |
86 | 98 | |
87 | - if (false === ($param = $this->definition->param($name))) continue; |
|
99 | + if (false === ($param = $this->definition->param($name))) { |
|
100 | + continue; |
|
101 | + } |
|
88 | 102 | |
89 | 103 | $cast[$name] = $param->cast($value); |
90 | 104 | } |
@@ -68,9 +68,13 @@ discard block |
||
68 | 68 | |
69 | 69 | private function select(int $parent_id = null, array $config = [], array $order_by = [], int $index = 0, int $display = 0) { |
70 | 70 | |
71 | - if (!((null === $parent_id) || ($parent_id >= 0))) return false; |
|
71 | + if (!((null === $parent_id) || ($parent_id >= 0))) { |
|
72 | + return false; |
|
73 | + } |
|
72 | 74 | |
73 | - if (!(($index >= 0) && ($display >= 0))) return false; |
|
75 | + if (!(($index >= 0) && ($display >= 0))) { |
|
76 | + return false; |
|
77 | + } |
|
74 | 78 | |
75 | 79 | # Select entities |
76 | 80 | |
@@ -78,7 +82,9 @@ discard block |
||
78 | 82 | |
79 | 83 | $this->getNestingSelectQuery($parent_id, $config, $order_by, $index, $display)); |
80 | 84 | |
81 | - if (!(DB::send($query) && DB::last()->status)) return false; |
|
85 | + if (!(DB::send($query) && DB::last()->status)) { |
|
86 | + return false; |
|
87 | + } |
|
82 | 88 | |
83 | 89 | # Process results |
84 | 90 | |
@@ -90,7 +96,9 @@ discard block |
||
90 | 96 | |
91 | 97 | $items['list'][$dataset->id]['dataset'] = $dataset; |
92 | 98 | |
93 | - if (null !== $parent_id) $items['list'][$dataset->id]['children'] = intval($data['children']); |
|
99 | + if (null !== $parent_id) { |
|
100 | + $items['list'][$dataset->id]['children'] = intval($data['children']); |
|
101 | + } |
|
94 | 102 | } |
95 | 103 | |
96 | 104 | # Count total |
@@ -109,7 +117,9 @@ discard block |
||
109 | 117 | |
110 | 118 | private function count(int $parent_id = null, array $config = []) { |
111 | 119 | |
112 | - if (!((null === $parent_id) || ($parent_id >= 0))) return false; |
|
120 | + if (!((null === $parent_id) || ($parent_id >= 0))) { |
|
121 | + return false; |
|
122 | + } |
|
113 | 123 | |
114 | 124 | # Count entities |
115 | 125 | |
@@ -117,7 +127,9 @@ discard block |
||
117 | 127 | |
118 | 128 | $this->getNestingCountQuery($parent_id, $config)); |
119 | 129 | |
120 | - if (!(DB::send($query) && DB::last()->status)) return false; |
|
130 | + if (!(DB::send($query) && DB::last()->status)) { |
|
131 | + return false; |
|
132 | + } |
|
121 | 133 | |
122 | 134 | # ------------------------ |
123 | 135 | |
@@ -142,7 +154,9 @@ discard block |
||
142 | 154 | |
143 | 155 | public function children(int $parent_id = 0, array $config = [], array $order_by = [], int $index = 0, int $display = 0) { |
144 | 156 | |
145 | - if (!static::$nesting) return false; |
|
157 | + if (!static::$nesting) { |
|
158 | + return false; |
|
159 | + } |
|
146 | 160 | |
147 | 161 | return $this->select($parent_id, $config, $order_by, $index, $display); |
148 | 162 | } |
@@ -151,7 +165,9 @@ discard block |
||
151 | 165 | |
152 | 166 | public function childrenCount(int $parent_id = 0, array $config = []) { |
153 | 167 | |
154 | - if (!static::$nesting) return false; |
|
168 | + if (!static::$nesting) { |
|
169 | + return false; |
|
170 | + } |
|
155 | 171 | |
156 | 172 | return $this->count($parent_id, $config); |
157 | 173 | } |