Passed
Pull Request — master (#10)
by Anton
04:10
created
www/engine/Framework/Classes/Form/Utils/Field.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@
 block discarded – undo
14 14
 
15 15
 		# Get tag
16 16
 
17
+		/**
18
+		 * @param string $contents
19
+		 */
17 20
 		protected function getTag(string $name, array $attributes = [], $contents = null) {
18 21
 
19 22
 			$tag = new Tag($name, $attributes, $contents);
Please login to merge, or discard this patch.
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 Form\Utils {
4 4
 
5
-	use Form, Request, Tag;
5
+	use Form;
6
+	use Request;
7
+	use Tag;
6 8
 
7 9
 	abstract class Field {
8 10
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,11 +24,17 @@  discard block
 block discarded – undo
24 24
 
25 25
 			# Set config
26 26
 
27
-			if ($this->disabled) $tag->set('disabled', 'disabled');
27
+			if ($this->disabled) {
28
+				$tag->set('disabled', 'disabled');
29
+			}
28 30
 
29
-			if ($this->required) $tag->set('data-required', 'required');
31
+			if ($this->required) {
32
+				$tag->set('data-required', 'required');
33
+			}
30 34
 
31
-			if ($this->error) $tag->set('data-error', 'error');
35
+			if ($this->error) {
36
+				$tag->set('data-error', 'error');
37
+			}
32 38
 
33 39
 			# ------------------------
34 40
 
@@ -54,11 +60,12 @@  discard block
 block discarded – undo
54 60
 
55 61
 			$params = array_merge(['disabled' => false, 'required' => false], $this->config);
56 62
 
57
-			foreach ($params as $name => $default) if (isset($config[$name])) {
63
+			foreach ($params as $name => $default) {
64
+				if (isset($config[$name])) {
58 65
 
59
-				try { $this->$name($config[$name]); }
60
-
61
-				catch (\TypeError $e) { /* Ignore setting value of illegal type */ }
66
+				try { $this->$name($config[$name]);
67
+			}
68
+			} catch (\TypeError $e) { /* Ignore setting value of illegal type */ }
62 69
 			}
63 70
 		}
64 71
 
@@ -66,7 +73,9 @@  discard block
 block discarded – undo
66 73
 
67 74
 		public function post() {
68 75
 
69
-			if ($this->posted || $this->disabled || ('' === $this->key)) return false;
76
+			if ($this->posted || $this->disabled || ('' === $this->key)) {
77
+				return false;
78
+			}
70 79
 
71 80
 			$this->error = (!$this->set(Request::post($this->name)) && $this->required);
72 81
 
@@ -100,7 +109,9 @@  discard block
 block discarded – undo
100 109
 
101 110
 		public function disabled(bool $value = null) {
102 111
 
103
-			if (null === $value) return $this->disabled;
112
+			if (null === $value) {
113
+				return $this->disabled;
114
+			}
104 115
 
105 116
 			$this->disabled = $value;
106 117
 		}
@@ -109,7 +120,9 @@  discard block
 block discarded – undo
109 120
 
110 121
 		public function required(bool $value = null) {
111 122
 
112
-			if (null === $value) return $this->required;
123
+			if (null === $value) {
124
+				return $this->required;
125
+			}
113 126
 
114 127
 			$this->required = $value;
115 128
 		}
@@ -118,7 +131,9 @@  discard block
 block discarded – undo
118 131
 
119 132
 		public function error(bool $value = null) {
120 133
 
121
-			if (null === $value) return $this->error;
134
+			if (null === $value) {
135
+				return $this->error;
136
+			}
122 137
 
123 138
 			$this->error = $value;
124 139
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Site/Section.php 2 patches
Unused Use Statements   +13 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,19 @@
 block discarded – undo
2 2
 
3 3
 namespace Frames\Site {
4 4
 
5
-	use Frames, Frames\Status, Modules\Auth, Modules\Extend, Modules\Settings, Utils\Menu, Utils\Messages;
6
-	use Utils\Template\Variables, Utils\Template\Widgets, Utils\View, Date, Request, Template;
5
+	use Frames;
6
+	use Frames\Status;
7
+	use Modules\Auth;
8
+	use Modules\Extend;
9
+	use Modules\Settings;
10
+	use Utils\Menu;
11
+	use Utils\Messages;
12
+	use Utils\Template\Variables;
13
+	use Utils\Template\Widgets;
14
+	use Utils\View;
15
+	use Date;
16
+	use Request;
17
+	use Template;
7 18
 
8 19
 	abstract class Section extends Frames\Section {
9 20
 
Please login to merge, or discard this patch.
Braces   +29 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@  discard block
 block discarded – undo
39 39
 
40 40
 			if (Settings::get('users_registration')) {
41 41
 
42
-				if (!Auth::check()) $layout->block('auth')->enable(); else {
42
+				if (!Auth::check()) {
43
+					$layout->block('auth')->enable();
44
+				} else {
43 45
 
44 46
 					$layout->block('user')->enable();
45 47
 
@@ -47,7 +49,9 @@  discard block
 block discarded – undo
47 49
 
48 50
 					$layout->block('user')->name = Auth::user()->name;
49 51
 
50
-					if (Auth::user()->rank === RANK_ADMINISTRATOR) $layout->block('user')->block('admin')->enable();
52
+					if (Auth::user()->rank === RANK_ADMINISTRATOR) {
53
+						$layout->block('user')->block('admin')->enable();
54
+					}
51 55
 				}
52 56
 			}
53 57
 
@@ -104,9 +108,11 @@  discard block
 block discarded – undo
104 108
 
105 109
 			# Set canonical
106 110
 
107
-			if ('' === $this->canonical) $page->block('canonical')->disable();
108
-
109
-			else $page->block('canonical')->link = $this->canonical;
111
+			if ('' === $this->canonical) {
112
+				$page->block('canonical')->disable();
113
+			} else {
114
+				$page->block('canonical')->link = $this->canonical;
115
+			}
110 116
 
111 117
 			# Set layout
112 118
 
@@ -127,19 +133,27 @@  discard block
 block discarded – undo
127 133
 
128 134
 			# Check site status
129 135
 
130
-			if (Settings::get('site_status') === STATUS_MAINTENANCE) return Status::maintenance();
136
+			if (Settings::get('site_status') === STATUS_MAINTENANCE) {
137
+				return Status::maintenance();
138
+			}
131 139
 
132
-			if (Settings::get('site_status') === STATUS_UPDATE) return Status::update();
140
+			if (Settings::get('site_status') === STATUS_UPDATE) {
141
+				return Status::update();
142
+			}
133 143
 
134 144
 			# Check access rights
135 145
 
136 146
 			if ($this instanceof Component\Profile) {
137 147
 
138
-				if (!Settings::get('users_registration')) return Status::error404();
148
+				if (!Settings::get('users_registration')) {
149
+					return Status::error404();
150
+				}
139 151
 
140 152
 				if (($this instanceof Component\Profile\Auth)) {
141 153
 
142
-					if (Auth::check()) Request::redirect(INSTALL_PATH . '/profile');
154
+					if (Auth::check()) {
155
+						Request::redirect(INSTALL_PATH . '/profile');
156
+					}
143 157
 
144 158
 				} else if (!Auth::check() || ((false !== Request::get('logout')) && Auth::logout())) {
145 159
 
@@ -153,9 +167,13 @@  discard block
 block discarded – undo
153 167
 
154 168
 				# Set global components
155 169
 
156
-				foreach (Variables::generate() as $name => $value) Template::global($name, $value);
170
+				foreach (Variables::generate() as $name => $value) {
171
+					Template::global($name, $value);
172
+				}
157 173
 
158
-				foreach (Widgets::generate() as $name => $block) Template::widget($name, $block);
174
+				foreach (Widgets::generate() as $name => $block) {
175
+					Template::widget($name, $block);
176
+				}
159 177
 
160 178
 				# Display page
161 179
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Controller/User.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\Controller {
4 4
 
5
-	use Modules\Entitizer, Utils\Validate, Str;
5
+	use Modules\Entitizer;
6
+	use Utils\Validate;
7
+	use Str;
6 8
 
7 9
 	class User {
8 10
 
Please login to merge, or discard this patch.
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,30 +31,46 @@  discard block
 block discarded – undo
31 31
 
32 32
 			# Validate name & email
33 33
 
34
-			if (false === ($name = Validate::userName($name))) return ['name', 'USER_ERROR_NAME_INVALID'];
34
+			if (false === ($name = Validate::userName($name))) {
35
+				return ['name', 'USER_ERROR_NAME_INVALID'];
36
+			}
35 37
 
36
-			if (false === ($email = Validate::userEmail($email))) return ['email', 'USER_ERROR_EMAIL_INVALID'];
38
+			if (false === ($email = Validate::userEmail($email))) {
39
+				return ['email', 'USER_ERROR_EMAIL_INVALID'];
40
+			}
37 41
 
38 42
 			# Validate password
39 43
 
40 44
 			if ((0 === $this->user->id) || ('' !== $password)) {
41 45
 
42
-				if (false === ($password = Validate::userPassword($password))) return ['password', 'USER_ERROR_PASSWORD_INVALID'];
46
+				if (false === ($password = Validate::userPassword($password))) {
47
+					return ['password', 'USER_ERROR_PASSWORD_INVALID'];
48
+				}
43 49
 
44
-				if (0 !== strcmp($password, $password_retype)) return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH'];
50
+				if (0 !== strcmp($password, $password_retype)) {
51
+					return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH'];
52
+				}
45 53
 			}
46 54
 
47 55
 			# Check name exists
48 56
 
49
-			if (false === ($check_name = $this->user->check($name, 'name'))) return 'USER_ERROR_MODIFY';
57
+			if (false === ($check_name = $this->user->check($name, 'name'))) {
58
+				return 'USER_ERROR_MODIFY';
59
+			}
50 60
 
51
-			if ($check_name === 1) return ['name', 'USER_ERROR_NAME_DUPLICATE'];
61
+			if ($check_name === 1) {
62
+				return ['name', 'USER_ERROR_NAME_DUPLICATE'];
63
+			}
52 64
 
53 65
 			# Check email exists
54 66
 
55
-			if (false === ($check_email = $this->user->check($email, 'email'))) return 'USER_ERROR_MODIFY';
67
+			if (false === ($check_email = $this->user->check($email, 'email'))) {
68
+				return 'USER_ERROR_MODIFY';
69
+			}
56 70
 
57
-			if ($check_email === 1) return ['email', 'USER_ERROR_EMAIL_DUPLICATE'];
71
+			if ($check_email === 1) {
72
+				return ['email', 'USER_ERROR_EMAIL_DUPLICATE'];
73
+			}
58 74
 
59 75
 			# Modify user
60 76
 
@@ -84,7 +100,9 @@  discard block
 block discarded – undo
84 100
 
85 101
 			$modifier = ((0 === $this->user->id) ? 'create' : 'edit');
86 102
 
87
-			if (!$this->user->$modifier($data)) return 'USER_ERROR_MODIFY';
103
+			if (!$this->user->$modifier($data)) {
104
+				return 'USER_ERROR_MODIFY';
105
+			}
88 106
 
89 107
 			# ------------------------
90 108
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Form/Page.php 1 patch
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\Form {
4 4
 
5
-	use Modules\Entitizer, Utils\Form, Utils\Range;
5
+	use Modules\Entitizer;
6
+	use Utils\Form;
7
+	use Utils\Range;
6 8
 
7 9
 	class Page extends Form {
8 10
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Form/User.php 1 patch
Unused Use Statements   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,13 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Form {
4 4
 
5
-	use Modules\Auth, Modules\Entitizer, Utils\Form, Utils\Range, Geo\Country, Geo\Timezone, Language;
5
+	use Modules\Auth;
6
+	use Modules\Entitizer;
7
+	use Utils\Form;
8
+	use Utils\Range;
9
+	use Geo\Country;
10
+	use Geo\Timezone;
11
+	use Language;
6 12
 
7 13
 	class User extends Form {
8 14
 
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 1 patch
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.
www/engine/System/Classes/Modules/Entitizer/Utils/Handler.php 2 patches
Unused Use Statements   +8 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,14 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Utils {
4 4
 
5
-	use Modules\Entitizer, Utils\Popup, Utils\View, Ajax, Language, Number, Request, Template;
5
+	use Modules\Entitizer;
6
+	use Utils\Popup;
7
+	use Utils\View;
8
+	use Ajax;
9
+	use Language;
10
+	use Number;
11
+	use Request;
12
+	use Template;
6 13
 
7 14
 	abstract class Handler {
8 15
 
Please login to merge, or discard this 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\Asset\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->block('parent'));
81
+			if (static::$nesting) {
82
+				$this->processParent($contents->block('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->block('selector'));
97
+			if (static::$nesting) {
98
+				$this->processSelector($contents->block('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::format(Request::post('parent_id'));
121 131
 
122
-				if (!$this->entity->move($parent_id)) return $ajax->error(Language::get(static::$message_error_move));
132
+				if (!$this->entity->move($parent_id)) {
133
+					return $ajax->error(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->error(Language::get(static::$message_error_remove));
138
+				if (!$this->entity->remove()) {
139
+					return $ajax->error(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
 		public function handle(bool $create = false) {
137 151
 
138
-			if (!($this->create = $create) && Request::isAjax()) return $this->handleAjax();
152
+			if (!($this->create = $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/Framework/Classes/Range/Range.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
 
11 11
 		protected static function init(string $file_name) {
12 12
 
13
-			if (is_array($range = Explorer::php($file_name))) static::$range = $range;
13
+			if (is_array($range = Explorer::php($file_name))) {
14
+				static::$range = $range;
15
+			}
14 16
 		}
15 17
 
16 18
 		# Check if item exists
Please login to merge, or discard this patch.