Passed
Branch 0.4.0 (311924)
by Anton
03:06
created
www/engine/Framework/Classes/Form/Field/Checkbox.php 2 patches
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,8 @@
 block discarded – undo
9 9
 
10 10
 namespace Form\Field {
11 11
 
12
-	use Form, Validate;
12
+	use Form;
13
+	use Validate;
13 14
 
14 15
 	class Checkbox extends Form\Field {
15 16
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@
 block discarded – undo
53 53
 
54 54
 			$tag->setAttribute('type', 'checkbox');
55 55
 
56
-			if ($this->value) $tag->setAttribute('checked', 'checked');
56
+			if ($this->value) {
57
+				$tag->setAttribute('checked', 'checked');
58
+			}
57 59
 
58 60
 			# ------------------------
59 61
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Form/Form.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 		/**
19 19
 		 * Add a field to the form
20 20
 		 *
21
-		 * @return true if the field was successfully added, otherwise false
21
+		 * @return boolean if the field was successfully added, otherwise false
22 22
 		 */
23 23
 
24 24
 		private function addField(Form\Field $field) {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		/**
45 45
 		 * Add a text field
46 46
 		 *
47
-		 * @return true if the field was successfully added, otherwise false
47
+		 * @return boolean if the field was successfully added, otherwise false
48 48
 		 */
49 49
 
50 50
 		public function addText(string $key, string $value = '',
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		/**
58 58
 		 * Add a select field
59 59
 		 *
60
-		 * @return true if the field was successfully added, otherwise false
60
+		 * @return boolean if the field was successfully added, otherwise false
61 61
 		 */
62 62
 
63 63
 		public function addSelect(string $key, string $value = '',
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		/**
71 71
 		 * Add a checkbox field
72 72
 		 *
73
-		 * @return true if the field was successfully added, otherwise false
73
+		 * @return boolean if the field was successfully added, otherwise false
74 74
 		 */
75 75
 
76 76
 		public function addCheckbox(string $key, string $value = '') {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		/**
82 82
 		 * Check if valid POST data has been recieved
83 83
 		 *
84
-		 * @return the check status
84
+		 * @return boolean check status
85 85
 		 */
86 86
 
87 87
 		public function check() {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@
 block discarded – undo
181 181
 
182 182
 			foreach ($this->fields as $field) {
183 183
 
184
-				$block->setBlock(('field_' . $field->getName()), $field->getBlock());
184
+				$block->setBlock(('field_'.$field->getName()), $field->getBlock());
185 185
 			}
186 186
 		}
187 187
 	}
Please login to merge, or discard this patch.
Braces   +20 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 		private function addField(Form\Field $field) {
25 25
 
26
-			if ($this->posted || ('' === ($key = $field->getKey()))) return false;
26
+			if ($this->posted || ('' === ($key = $field->getKey()))) {
27
+				return false;
28
+			}
27 29
 
28 30
 			$this->fields[$key] = $field;
29 31
 
@@ -38,7 +40,9 @@  discard block
 block discarded – undo
38 40
 
39 41
 		public function __construct(string $name = '') {
40 42
 
41
-			if (preg_match(REGEX_FORM_NAME, $name)) $this->name = $name;
43
+			if (preg_match(REGEX_FORM_NAME, $name)) {
44
+				$this->name = $name;
45
+			}
42 46
 		}
43 47
 
44 48
 		/**
@@ -90,9 +94,15 @@  discard block
 block discarded – undo
90 94
 
91 95
 			foreach ($this->fields as $field) {
92 96
 
93
-				if (($field instanceof Form\Field\Checkbox) || $field->disabled) continue;
97
+				if (($field instanceof Form\Field\Checkbox) || $field->disabled) {
98
+					continue;
99
+				}
94 100
 
95
-				if (false !== Request::post($field->getName())) $check = true; else return false;
101
+				if (false !== Request::post($field->getName())) {
102
+					$check = true;
103
+				} else {
104
+					return false;
105
+				}
96 106
 			}
97 107
 
98 108
 			# ------------------------
@@ -108,7 +118,9 @@  discard block
 block discarded – undo
108 118
 
109 119
 		public function post() {
110 120
 
111
-			if ($this->posted || !$this->check()) return false;
121
+			if ($this->posted || !$this->check()) {
122
+				return false;
123
+			}
112 124
 
113 125
 			$post = []; $errors = false;
114 126
 
@@ -116,7 +128,9 @@  discard block
 block discarded – undo
116 128
 
117 129
 				$field->post(); $post[$field->getKey()] = $field->getValue();
118 130
 
119
-				if ($field->error) $errors = true;
131
+				if ($field->error) {
132
+					$errors = true;
133
+				}
120 134
 			}
121 135
 
122 136
 			$this->posted = true; $this->errors = $errors;
Please login to merge, or discard this patch.
www/engine/Framework/Classes/JSON/JSON.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 		/**
26 26
 		 * Convert a JSON value to a string
27 27
 		 *
28
-		 * @return the string or false on failure
28
+		 * @return string string or false on failure
29 29
 		 */
30 30
 
31 31
 		public static function stringify($value) {
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
 		public static function load(string $file_name) {
43 43
 
44
-			if (false === ($contents = Explorer::getContents($file_name))) return null;
44
+			if (false === ($contents = Explorer::getContents($file_name))) {
45
+				return null;
46
+			}
45 47
 
46 48
 			return self::parse($contents);
47 49
 		}
@@ -54,7 +56,9 @@  discard block
 block discarded – undo
54 56
 
55 57
 		public static function save(string $file_name, $value) {
56 58
 
57
-			if (false === ($value = self::stringify($value))) return false;
59
+			if (false === ($value = self::stringify($value))) {
60
+				return false;
61
+			}
58 62
 
59 63
 			return Explorer::putContents($file_name, $value);
60 64
 		}
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Session/Session.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -43,6 +43,7 @@
 block discarded – undo
43 43
 
44 44
 		/**
45 45
 		 * Set a variable
46
+		 * @param string $value
46 47
 		 */
47 48
 
48 49
 		public static function set(string $name, $value) {
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 		public static function start(string $name, int $lifetime) {
21 21
 
22
-			if (session_id()) return true;
22
+			if (session_id()) {
23
+				return true;
24
+			}
23 25
 
24 26
 			ini_set('session.gc_maxlifetime', $lifetime);
25 27
 
@@ -47,7 +49,9 @@  discard block
 block discarded – undo
47 49
 
48 50
 		public static function set(string $name, $value) {
49 51
 
50
-			if (session_id()) $_SESSION[$name] = $value;
52
+			if (session_id()) {
53
+				$_SESSION[$name] = $value;
54
+			}
51 55
 		}
52 56
 
53 57
 		/**
@@ -76,7 +80,9 @@  discard block
 block discarded – undo
76 80
 
77 81
 		public static function delete(string $name) {
78 82
 
79
-			if (isset($_SESSION[$name])) unset($_SESSION[$name]);
83
+			if (isset($_SESSION[$name])) {
84
+				unset($_SESSION[$name]);
85
+			}
80 86
 		}
81 87
 	}
82 88
 }
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Url/Url.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 		/**
37 37
 		 * Set a query attribute. If the value is null, an attribute will be removed
38 38
 		 *
39
-		 * @return the current url object
39
+		 * @return Url current url object
40 40
 		 */
41 41
 
42 42
 		public function setAttribute(string $name, string $value = null) {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@
 block discarded – undo
47 47
 		}
48 48
 
49 49
 		/**
50
-		* Get a query attribute
51
-		*
52
-		* @return the value, otherwise false
53
-		*/
50
+		 * Get a query attribute
51
+		 *
52
+		 * @return the value, otherwise false
53
+		 */
54 54
 
55 55
 		public function getAttribute(string $name) {
56 56
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 		public function getPath() {
74 74
 
75
-			return ('/' . implode('/', array_map('urlencode', $this->path)));
75
+			return ('/'.implode('/', array_map('urlencode', $this->path)));
76 76
 		}
77 77
 
78 78
 		/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 		public function getQuery() {
83 83
 
84
-			return (($query = http_build_query($this->query)) ? ('?' . $query) : '');
84
+			return (($query = http_build_query($this->query)) ? ('?'.$query) : '');
85 85
 		}
86 86
 
87 87
 		/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
 		public function getString(bool $include_query = true) {
110 110
 
111
-			return ($this->getPath() . $this->getQuery());
111
+			return ($this->getPath().$this->getQuery());
112 112
 		}
113 113
 	}
114 114
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,18 +19,24 @@
 block discarded – undo
19 19
 
20 20
 		public function __construct(string $url = '') {
21 21
 
22
-			if (false === ($url = parse_url($url))) return;
22
+			if (false === ($url = parse_url($url))) {
23
+				return;
24
+			}
23 25
 
24 26
 			# Parse path
25 27
 
26
-			if (isset($url['path'])) foreach (explode('/', $url['path']) as $part) {
28
+			if (isset($url['path'])) {
29
+				foreach (explode('/', $url['path']) as $part) {
27 30
 
28 31
 				if ('' !== $part) $this->path[] = urldecode($part);
29 32
 			}
33
+			}
30 34
 
31 35
 			# Parse query
32 36
 
33
-			if (isset($url['query'])) parse_str($url['query'], $this->query);
37
+			if (isset($url['query'])) {
38
+				parse_str($url['query'], $this->query);
39
+			}
34 40
 		}
35 41
 
36 42
 		/**
Please login to merge, or discard this patch.
www/engine/Framework/Classes/XML/XML.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		/**
15 15
 		 * Parse a string as XML
16 16
 		 *
17
-		 * @return the XML object or false on failure
17
+		 * @return SimpleXMLElement XML object or false on failure
18 18
 		 */
19 19
 
20 20
 		public static function parse(string $string) {
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		/**
26 26
 		 * Convert an XML object to a string
27 27
 		 *
28
-		 * @return the string or false on failure
28
+		 * @return false|string string or false on failure
29 29
 		 */
30 30
 
31 31
 		public static function stringify(SimpleXMLElement $xml) {
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@  discard block
 block discarded – undo
30 30
 
31 31
 		public static function stringify(SimpleXMLElement $xml) {
32 32
 
33
-			if (false === ($xml = dom_import_simplexml($xml))) return false;
33
+			if (false === ($xml = dom_import_simplexml($xml))) {
34
+				return false;
35
+			}
34 36
 
35 37
 			$dom = $xml->ownerDocument; $dom->formatOutput = true;
36 38
 
@@ -47,7 +49,9 @@  discard block
 block discarded – undo
47 49
 
48 50
 		public static function load(string $file_name) {
49 51
 
50
-			if (false === ($contents = Explorer::getContents($file_name))) return false;
52
+			if (false === ($contents = Explorer::getContents($file_name))) {
53
+				return false;
54
+			}
51 55
 
52 56
 			return self::parse($contents);
53 57
 		}
@@ -60,7 +64,9 @@  discard block
 block discarded – undo
60 64
 
61 65
 		public static function save(string $file_name, SimpleXMLElement $xml) {
62 66
 
63
-			if (false === ($xml = self::stringify($xml))) return false;
67
+			if (false === ($xml = self::stringify($xml))) {
68
+				return false;
69
+			}
64 70
 
65 71
 			return Explorer::putContents($file_name, $xml);
66 72
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Dispatcher.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 {
4 4
 
5
-	use Modules\Extend, Utils\Map, Utils\Schema;
5
+	use Modules\Extend;
6
+	use Utils\Map;
7
+	use Utils\Schema;
6 8
 
7 9
 	class Dispatcher {
8 10
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 			if (null === ($data = Schema::get('System')->load())) {
16 16
 
17
-				Request::redirect(INSTALL_PATH . '/install.php');
17
+				Request::redirect(INSTALL_PATH.'/install.php');
18 18
 			}
19 19
 
20 20
 			# Connect to database
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Admin/Area/Authorized.php 3 patches
Unused Use Statements   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,12 @@
 block discarded – undo
2 2
 
3 3
 namespace Frames\Admin\Area {
4 4
 
5
-	use Frames, Frames\Status, Modules, Ajax, Request, Template;
5
+	use Frames;
6
+	use Frames\Status;
7
+	use Modules;
8
+	use Ajax;
9
+	use Request;
10
+	use Template;
6 11
 
7 12
 	abstract class Authorized extends Frames\Admin\Section {
8 13
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 
17 17
 			if (!Modules\Auth::check() || ((false !== Request::get('logout')) && Modules\Auth::logout())) {
18 18
 
19
-				Request::redirect(INSTALL_PATH . '/admin/login');
19
+				Request::redirect(INSTALL_PATH.'/admin/login');
20 20
 			}
21 21
 
22 22
 			# Handle request
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,9 +21,13 @@
 block discarded – undo
21 21
 
22 22
 			# Handle request
23 23
 
24
-			if (Template::isBlock($result = $this->handle())) return $this->displayPage($result, STATUS_CODE_200);
24
+			if (Template::isBlock($result = $this->handle())) {
25
+				return $this->displayPage($result, STATUS_CODE_200);
26
+			}
25 27
 
26
-			if (Ajax::isResponse($result)) return Ajax::output($result);
28
+			if (Ajax::isResponse($result)) {
29
+				return Ajax::output($result);
30
+			}
27 31
 
28 32
 			# ------------------------
29 33
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Admin/Section.php 3 patches
Unused Use Statements   +11 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,17 @@
 block discarded – undo
2 2
 
3 3
 namespace Frames\Admin {
4 4
 
5
-	use Frames, Frames\Status, Modules\Auth, Modules\Extend, Utils\Messages, Utils\Popup, Utils\View;
6
-	use DB, Debug, Language, Template;
5
+	use Frames;
6
+	use Frames\Status;
7
+	use Modules\Auth;
8
+	use Modules\Extend;
9
+	use Utils\Messages;
10
+	use Utils\Popup;
11
+	use Utils\View;
12
+	use DB;
13
+	use Debug;
14
+	use Language;
15
+	use Template;
7 16
 
8 17
 	abstract class Section extends Frames\Section {
9 18
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
 		private function getLayout(Template\Block $contents) {
25 25
 
26
-			$layout = View::get('Layouts/' . $this->layout);
26
+			$layout = View::get('Layouts/'.$this->layout);
27 27
 
28 28
 			# Set menu and user
29 29
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
 		protected function displayPage(Template\Block $contents, int $status = STATUS_CODE_200) {
84 84
 
85
-			$page = View::get('Main/' . $this->layout);
85
+			$page = View::get('Main/'.$this->layout);
86 86
 
87 87
 			# Set language
88 88
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 			# Set title
92 92
 
93
-			$page->title = ((('' !== $this->title) ? (Language::get($this->title) . ' | ') : '') . CADMIUM_NAME);
93
+			$page->title = ((('' !== $this->title) ? (Language::get($this->title).' | ') : '').CADMIUM_NAME);
94 94
 
95 95
 			# Set layout
96 96
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -111,7 +111,9 @@
 block discarded – undo
111 111
 
112 112
 				$ips = preg_split('/ +/', CONFIG_ADMIN_IP, -1, PREG_SPLIT_NO_EMPTY);
113 113
 
114
-				if (!in_array(REQUEST_CLIENT_IP, $ips, true)) return Status::error404();
114
+				if (!in_array(REQUEST_CLIENT_IP, $ips, true)) {
115
+					return Status::error404();
116
+				}
115 117
 			}
116 118
 
117 119
 			# ------------------------
Please login to merge, or discard this patch.