Passed
Pull Request — master (#11)
by Anton
03:24
created
www/engine/System/Classes/Modules/Entitizer/Utils/Handler.php 1 patch
Braces   +37 added lines, -15 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@  discard block
 block discarded – undo
45 45
 
46 46
 		private function processSelector(Template\Block $selector) {
47 47
 
48
-			if ($this->create) return $selector->disable();
48
+			if ($this->create) {
49
+				return $selector->disable();
50
+			}
49 51
 
50 52
 			$selector->parent_id = $this->entity->parent_id;
51 53
 
@@ -68,25 +70,33 @@  discard block
 block discarded – undo
68 70
 
69 71
 			# Set path / title
70 72
 
71
-			if (static::$nesting) $contents->path = $this->path;
72
-
73
-			else $contents->title = ($this->create ? Language::get(static::$naming_new) : $this->entity->get(static::$naming));
73
+			if (static::$nesting) {
74
+				$contents->path = $this->path;
75
+			} else {
76
+				$contents->title = ($this->create ? Language::get(static::$naming_new) : $this->entity->get(static::$naming));
77
+			}
74 78
 
75 79
 			# Process parent block
76 80
 
77
-			if (static::$nesting) $this->processParent($contents->getBlock('parent'));
81
+			if (static::$nesting) {
82
+				$this->processParent($contents->getBlock('parent'));
83
+			}
78 84
 
79 85
 			# Set link
80 86
 
81 87
 			$link = (INSTALL_PATH . static::$link . '/');
82 88
 
83
-			if (static::$nesting) $contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id);
84
-
85
-			else $contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id)));
89
+			if (static::$nesting) {
90
+				$contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id);
91
+			} else {
92
+				$contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id)));
93
+			}
86 94
 
87 95
 			# Process selector block
88 96
 
89
-			if (static::$nesting) $this->processSelector($contents->getBlock('selector'));
97
+			if (static::$nesting) {
98
+				$this->processSelector($contents->getBlock('selector'));
99
+			}
90 100
 
91 101
 			# Implement form
92 102
 
@@ -119,11 +129,15 @@  discard block
 block discarded – undo
119 129
 
120 130
 				$parent_id = Number::forceInt(Request::post('parent_id'));
121 131
 
122
-				if (!$this->entity->move($parent_id)) return $ajax->setError(Language::get(static::$message_error_move));
132
+				if (!$this->entity->move($parent_id)) {
133
+					return $ajax->setError(Language::get(static::$message_error_move));
134
+				}
123 135
 
124 136
 			} else if (Request::post('action') === 'remove') {
125 137
 
126
-				if (!$this->entity->remove()) return $ajax->setError(Language::get(static::$message_error_remove));
138
+				if (!$this->entity->remove()) {
139
+					return $ajax->setError(Language::get(static::$message_error_remove));
140
+				}
127 141
 			}
128 142
 
129 143
 			# ------------------------
@@ -135,7 +149,9 @@  discard block
 block discarded – undo
135 149
 
136 150
 		protected function handle() {
137 151
 
138
-			if (!$this->create && Request::isAjax()) return $this->handleAjax();
152
+			if (!$this->create && Request::isAjax()) {
153
+				return $this->handleAjax();
154
+			}
139 155
 
140 156
 			# Create entity
141 157
 
@@ -143,7 +159,9 @@  discard block
 block discarded – undo
143 159
 
144 160
 			$this->entity = Entitizer::get(static::$table, (!$this->create ? $id : 0));
145 161
 
146
-			if (!$this->create && (0 === $this->entity->id)) return Request::redirect(INSTALL_PATH . static::$link);
162
+			if (!$this->create && (0 === $this->entity->id)) {
163
+				return Request::redirect(INSTALL_PATH . static::$link);
164
+			}
147 165
 
148 166
 			# Create parent entity
149 167
 
@@ -151,7 +169,9 @@  discard block
 block discarded – undo
151 169
 
152 170
 			# Get path
153 171
 
154
-			if (false !== ($path = $this->parent->path())) $this->path = $path;
172
+			if (false !== ($path = $this->parent->path())) {
173
+				$this->path = $path;
174
+			}
155 175
 
156 176
 			# Create form
157 177
 
@@ -161,7 +181,9 @@  discard block
 block discarded – undo
161 181
 
162 182
 			if ($this->form->handle(new static::$controller($this->entity), true)) {
163 183
 
164
-				if ($this->create && (0 !== $this->parent->id)) $this->entity->move($this->parent->id);
184
+				if ($this->create && (0 !== $this->parent->id)) {
185
+					$this->entity->move($this->parent->id);
186
+				}
165 187
 
166 188
 				Request::redirect(INSTALL_PATH . static::$link . '/edit?id=' . $this->entity->id . '&submitted');
167 189
 			}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Dataset.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 
13 13
 		protected function addWorker(string $name, callable $worker) {
14 14
 
15
-			if (isset($this->params[$name]) || isset($this->workers[$name])) return;
15
+			if (isset($this->params[$name]) || isset($this->workers[$name])) {
16
+				return;
17
+			}
16 18
 
17 19
 			$this->workers[$name] = $worker;
18 20
 		}
@@ -23,7 +25,9 @@  discard block
 block discarded – undo
23 25
 
24 26
 			$this->params = Entitizer::definition(static::$table)->params();
25 27
 
26
-			if (static::$nesting) $this->params['parent_id'] = $this->params['id'];
28
+			if (static::$nesting) {
29
+				$this->params['parent_id'] = $this->params['id'];
30
+			}
27 31
 
28 32
 			$this->init(); $this->reset();
29 33
 		}
@@ -34,11 +38,15 @@  discard block
 block discarded – undo
34 38
 
35 39
 			# Reset params
36 40
 
37
-			foreach ($this->params as $name => $param) $this->data[$name] = $param->cast(null);
41
+			foreach ($this->params as $name => $param) {
42
+				$this->data[$name] = $param->cast(null);
43
+			}
38 44
 
39 45
 			# Reset extras
40 46
 
41
-			foreach ($this->workers as $name => $worker) $this->data[$name] = $worker($this->data);
47
+			foreach ($this->workers as $name => $worker) {
48
+				$this->data[$name] = $worker($this->data);
49
+			}
42 50
 
43 51
 			# ------------------------
44 52
 
@@ -53,12 +61,16 @@  discard block
 block discarded – undo
53 61
 
54 62
 			foreach ($data as $name => $value) {
55 63
 
56
-				if (isset($this->params[$name])) $this->data[$name] = $this->params[$name]->cast($value);
64
+				if (isset($this->params[$name])) {
65
+					$this->data[$name] = $this->params[$name]->cast($value);
66
+				}
57 67
 			}
58 68
 
59 69
 			# Update extras
60 70
 
61
-			foreach ($this->workers as $name => $worker) $this->data[$name] = $worker($this->data);
71
+			foreach ($this->workers as $name => $worker) {
72
+				$this->data[$name] = $worker($this->data);
73
+			}
62 74
 
63 75
 			# ------------------------
64 76
 
@@ -73,7 +85,9 @@  discard block
 block discarded – undo
73 85
 
74 86
 			foreach ($data as $name => $value) {
75 87
 
76
-				if (isset($this->params[$name])) $cast[$name] = $this->params[$name]->cast($value);
88
+				if (isset($this->params[$name])) {
89
+					$cast[$name] = $this->params[$name]->cast($value);
90
+				}
77 91
 			}
78 92
 
79 93
 			# ------------------------
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Listview.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -68,9 +68,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
78 82
 
79 83
 				$this->getNestingSelectQuery($parent_id, $config, $order_by, $index, $display));
80 84
 
81
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
85
+			if (!(DB::send($query) && DB::getLast()->status)) {
86
+				return false;
87
+			}
82 88
 
83 89
 			# Process results
84 90
 
@@ -90,7 +96,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
117 127
 
118 128
 				$this->getNestingCountQuery($parent_id, $config));
119 129
 
120
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
130
+			if (!(DB::send($query) && DB::getLast()->status)) {
131
+				return false;
132
+			}
121 133
 
122 134
 			# ------------------------
123 135
 
@@ -142,7 +154,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 		}
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
@@ -30,9 +30,9 @@
 block discarded – undo
30 30
 
31 31
 		protected function processEntityParent(Template\Block $parent) {
32 32
 
33
-			if (0 !== $this->parent->id) $parent->getBlock('browse')->link = $this->parent->link;
34
-
35
-			else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
33
+			if (0 !== $this->parent->id) {
34
+				$parent->getBlock('browse')->link = $this->parent->link;
35
+			} else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
36 36
 		}
37 37
 
38 38
 		# Add item additional data
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
@@ -30,9 +30,9 @@
 block discarded – undo
30 30
 
31 31
 		protected function processEntityParent(Template\Block $parent) {
32 32
 
33
-			if ((0 !== $this->parent->id) && $this->parent->active) $parent->getBlock('browse')->link = $this->parent->link;
34
-
35
-			else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
33
+			if ((0 !== $this->parent->id) && $this->parent->active) {
34
+				$parent->getBlock('browse')->link = $this->parent->link;
35
+			} else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); }
36 36
 		}
37 37
 
38 38
 		# Add item additional data
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Lister/Users.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@
 block discarded – undo
40 40
 
41 41
 			# Set remove button
42 42
 
43
-			if ($user->id === Auth::user()->id) $view->getBlock('remove')->class = 'disabled';
43
+			if ($user->id === Auth::user()->id) {
44
+				$view->getBlock('remove')->class = 'disabled';
45
+			}
44 46
 		}
45 47
 	}
46 48
 }
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Install/Controller/Database.php 1 patch
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -20,21 +20,19 @@  discard block
 block discarded – undo
20 20
 
21 21
 			# Connect to DB
22 22
 
23
-			try { DB::connect($server, $user, $password, $name); }
24
-
25
-			catch (Exception\DBConnect $error) { return 'INSTALL_ERROR_DATABASE_CONNECT'; }
26
-
27
-			catch (Exception\DBSelect $error) { return 'INSTALL_ERROR_DATABASE_SELECT'; }
28
-
29
-			catch (Exception\DBCharset $error) { return 'INSTALL_ERROR_DATABASE_CHARSET'; }
23
+			try { DB::connect($server, $user, $password, $name); } catch (Exception\DBConnect $error) { return 'INSTALL_ERROR_DATABASE_CONNECT'; } catch (Exception\DBSelect $error) { return 'INSTALL_ERROR_DATABASE_SELECT'; } catch (Exception\DBCharset $error) { return 'INSTALL_ERROR_DATABASE_CHARSET'; }
30 24
 
31 25
 			# Create tables
32 26
 
33
-			if (!Install\Utils\Tables::create()) return 'INSTALL_ERROR_DATABASE_TABLES_CREATE';
27
+			if (!Install\Utils\Tables::create()) {
28
+				return 'INSTALL_ERROR_DATABASE_TABLES_CREATE';
29
+			}
34 30
 
35 31
 			# Fill tables
36 32
 
37
-			if (!Install\Utils\Tables::fill()) return 'INSTALL_ERROR_DATABASE_TABLES_FILL';
33
+			if (!Install\Utils\Tables::fill()) {
34
+				return 'INSTALL_ERROR_DATABASE_TABLES_FILL';
35
+			}
38 36
 
39 37
 			# Save system file
40 38
 
@@ -49,7 +47,9 @@  discard block
 block discarded – undo
49 47
 
50 48
 			$system_file = (DIR_SYSTEM_DATA . 'System.json');
51 49
 
52
-			if (false === JSON::save($system_file, $system)) return 'INSTALL_ERROR_SYSTEM';
50
+			if (false === JSON::save($system_file, $system)) {
51
+				return 'INSTALL_ERROR_SYSTEM';
52
+			}
53 53
 
54 54
 			# ------------------------
55 55
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Install/Utils/Tables.php 1 patch
Braces   +25 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,7 +30,11 @@  discard block
 block discarded – undo
30 30
 
31 31
 			$count = Informer::countEntries(TABLE_PAGES, true);
32 32
 
33
-			if (false === $count) return false; else if ($count > 0) return true;
33
+			if (false === $count) {
34
+				return false;
35
+			} else if ($count > 0) {
36
+				return true;
37
+			}
34 38
 
35 39
 			# Process dataset
36 40
 
@@ -44,7 +48,8 @@  discard block
 block discarded – undo
44 48
 
45 49
 				'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]];
46 50
 
47
-			for ($id = 2; $id <= 4; $id++) $pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED,
51
+			for ($id = 2; $id <= 4; $id++) {
52
+				$pages[] = ['id' => $id, 'visibility' => VISIBILITY_PUBLISHED,
48 53
 
49 54
 				'locked' => false, 'slug' => ('page-' . ($id - 1)), 'name' => ('page-' . ($id - 1)),
50 55
 
@@ -53,10 +58,13 @@  discard block
 block discarded – undo
53 58
 				'contents' => Template::createBlock(Language::get('INSTALL_PAGE_DEMO_CONTENTS'))->getContents(),
54 59
 
55 60
 				'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME];
61
+			}
56 62
 
57 63
 			# Process insertion
58 64
 
59
-			if (!(DB::insert(TABLE_PAGES, $pages, true) && DB::getLast()->status)) return false;
65
+			if (!(DB::insert(TABLE_PAGES, $pages, true) && DB::getLast()->status)) {
66
+				return false;
67
+			}
60 68
 
61 69
 			self::fillRelationsTable(TABLE_PAGES_RELATIONS, 4);
62 70
 
@@ -73,21 +81,29 @@  discard block
 block discarded – undo
73 81
 
74 82
 			$count = Informer::countEntries(TABLE_MENU, true);
75 83
 
76
-			if (false === $count) return false; else if ($count > 0) return true;
84
+			if (false === $count) {
85
+				return false;
86
+			} else if ($count > 0) {
87
+				return true;
88
+			}
77 89
 
78 90
 			# Process dataset
79 91
 
80 92
 			$menu = [];
81 93
 
82
-			for ($id = 1; $id <= 3; $id++) $menu[] = [
94
+			for ($id = 1; $id <= 3; $id++) {
95
+				$menu[] = [
83 96
 
84 97
 				'id' => $id, 'active' => true, 'position' => ($id - 1), 'slug' => ('page-' . $id),
85 98
 
86 99
 				'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $id)];
100
+			}
87 101
 
88 102
 			# Process insertion
89 103
 
90
-			if (!(DB::insert(TABLE_MENU, $menu, true) && DB::getLast()->status)) return false;
104
+			if (!(DB::insert(TABLE_MENU, $menu, true) && DB::getLast()->status)) {
105
+				return false;
106
+			}
91 107
 
92 108
 			self::fillRelationsTable(TABLE_MENU_RELATIONS, 3);
93 109
 
@@ -116,7 +132,9 @@  discard block
 block discarded – undo
116 132
 
117 133
 			$definitions[] = Entitizer::definition(TABLE_USERS_SESSIONS);
118 134
 
119
-			foreach ($definitions as $definition) if (!$definition->createTable()) return false;
135
+			foreach ($definitions as $definition) {
136
+				if (!$definition->createTable()) return false;
137
+			}
120 138
 
121 139
 			# ------------------------
122 140
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Tools/Handler/Sitemap.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 
45 45
 			# Load sitemap
46 46
 
47
-			$file_name = (DIR_SYSTEM_DATA . 'Sitemap.xml');
47
+			$file_name = (DIR_SYSTEM_DATA.'Sitemap.xml');
48 48
 
49 49
 			$modified = Explorer::getModified($file_name);
50 50
 
Please login to merge, or discard this 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::dataset(TABLE_PAGES, $data);
38
+			while (null !== ($data = DB::getLast()->getRow())) {
39
+				yield Entitizer::dataset(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.