Passed
Branch 0.4.0 (434eea)
by Anton
04:47
created
www/engine/System/Classes/Modules/Settings/Controller/General.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 
13 13
 			# Check for demo mode
14 14
 
15
-			if (Informer::isDemoMode()) return 'DEMO_MODE_RESTRICTION';
15
+			if (Informer::isDemoMode()) {
16
+				return 'DEMO_MODE_RESTRICTION';
17
+			}
16 18
 
17 19
 			# Define errors list
18 20
 
@@ -25,12 +27,16 @@  discard block
 block discarded – undo
25 27
 
26 28
 			foreach (Settings::setArray($post) as $name => $result) {
27 29
 
28
-				if (!$result) return (isset($errors[$name]) ? [$name, $errors[$name]] : false);
30
+				if (!$result) {
31
+					return (isset($errors[$name]) ? [$name, $errors[$name]] : false);
32
+				}
29 33
 			}
30 34
 
31 35
 			# Save settings
32 36
 
33
-			if (!Settings::save()) return 'SETTINGS_ERROR_SAVE';
37
+			if (!Settings::save()) {
38
+				return 'SETTINGS_ERROR_SAVE';
39
+			}
34 40
 
35 41
 			# ------------------------
36 42
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Settings/Settings.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,14 +12,18 @@
 block discarded – undo
12 12
 
13 13
 		public static function __autoload() {
14 14
 
15
-			if (null === self::$settings) self::$settings = new Settings\Utils\Dataset;
15
+			if (null === self::$settings) {
16
+				self::$settings = new Settings\Utils\Dataset;
17
+			}
16 18
 		}
17 19
 
18 20
 		# Load settings
19 21
 
20 22
 		public static function load() {
21 23
 
22
-			if (null === ($data = Schema::get('Settings')->load())) return false;
24
+			if (null === ($data = Schema::get('Settings')->load())) {
25
+				return false;
26
+			}
23 27
 
24 28
 			self::$settings->setArray($data); self::$loaded = true;
25 29
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Settings/Utils/Dataset.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 			if (empty($host = getenv('HTTP_HOST'))) return;
14 14
 
15
-			return ((Request::isSecure() ? 'https://' : 'http://') . $host);
15
+			return ((Request::isSecure() ? 'https://' : 'http://').$host);
16 16
 		}
17 17
 
18 18
 		# Get system email
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 			if (empty($host = getenv('HTTP_HOST'))) return;
23 23
 
24
-			return ('admin@' . $host);
24
+			return ('admin@'.$host);
25 25
 		}
26 26
 
27 27
 		# Constructor
@@ -30,84 +30,84 @@  discard block
 block discarded – undo
30 30
 
31 31
 			# Admin language
32 32
 
33
-			$this->addParam('admin_language', CONFIG_ADMIN_LANGUAGE_DEFAULT, function (string $name) {
33
+			$this->addParam('admin_language', CONFIG_ADMIN_LANGUAGE_DEFAULT, function(string $name) {
34 34
 
35 35
 				return ((false !== ($name = Extend\Languages::validate($name))) ? $name : null);
36 36
 			});
37 37
 
38 38
 			# Admin template
39 39
 
40
-			$this->addParam('admin_template', CONFIG_ADMIN_TEMPLATE_DEFAULT, function (string $name) {
40
+			$this->addParam('admin_template', CONFIG_ADMIN_TEMPLATE_DEFAULT, function(string $name) {
41 41
 
42 42
 				return ((false !== ($name = Extend\Templates::validate($name))) ? $name : null);
43 43
 			});
44 44
 
45 45
 			# Site language
46 46
 
47
-			$this->addParam('site_language', CONFIG_SITE_LANGUAGE_DEFAULT, function (string $name) {
47
+			$this->addParam('site_language', CONFIG_SITE_LANGUAGE_DEFAULT, function(string $name) {
48 48
 
49 49
 				return ((false !== ($name = Extend\Languages::validate($name))) ? $name : null);
50 50
 			});
51 51
 
52 52
 			# Site template
53 53
 
54
-			$this->addParam('site_template', CONFIG_SITE_TEMPLATE_DEFAULT, function (string $name) {
54
+			$this->addParam('site_template', CONFIG_SITE_TEMPLATE_DEFAULT, function(string $name) {
55 55
 
56 56
 				return ((false !== ($name = Extend\Templates::validate($name))) ? $name : null);
57 57
 			});
58 58
 
59 59
 			# Site title
60 60
 
61
-			$this->addParam('site_title', CONFIG_SITE_TITLE_DEFAULT, function (string $title) {
61
+			$this->addParam('site_title', CONFIG_SITE_TITLE_DEFAULT, function(string $title) {
62 62
 
63 63
 				return (('' !== $title) ? $title : null);
64 64
 			});
65 65
 
66 66
 			# Site slogan
67 67
 
68
-			$this->addParam('site_slogan', CONFIG_SITE_SLOGAN_DEFAULT, function (string $slogan) {
68
+			$this->addParam('site_slogan', CONFIG_SITE_SLOGAN_DEFAULT, function(string $slogan) {
69 69
 
70 70
 				return $slogan;
71 71
 			});
72 72
 
73 73
 			# Site status
74 74
 
75
-			$this->addParam('site_status', STATUS_ONLINE, function (string $status) {
75
+			$this->addParam('site_status', STATUS_ONLINE, function(string $status) {
76 76
 
77 77
 				return ((false !== ($status = Range\Status::validate($status))) ? $status : null);
78 78
 			});
79 79
 
80 80
 			# Site description
81 81
 
82
-			$this->addParam('site_description', '', function (string $description) {
82
+			$this->addParam('site_description', '', function(string $description) {
83 83
 
84 84
 				return $description;
85 85
 			});
86 86
 
87 87
 			# Site keywords
88 88
 
89
-			$this->addParam('site_keywords', '', function (string $keywords) {
89
+			$this->addParam('site_keywords', '', function(string $keywords) {
90 90
 
91 91
 				return $keywords;
92 92
 			});
93 93
 
94 94
 			# System url
95 95
 
96
-			$this->addParam('system_url', $this->getSystemUrl(), function (string $url) {
96
+			$this->addParam('system_url', $this->getSystemUrl(), function(string $url) {
97 97
 
98 98
 				return ((false !== ($url = Validate::url($url))) ? $url : null);
99 99
 			});
100 100
 
101 101
 			# System email
102 102
 
103
-			$this->addParam('system_email', $this->getSystemEmail(), function (string $email) {
103
+			$this->addParam('system_email', $this->getSystemEmail(), function(string $email) {
104 104
 
105 105
 				return ((false !== ($email = Validate::email($email))) ? $email : null);
106 106
 			});
107 107
 
108 108
 			# System timezone
109 109
 
110
-			$this->addParam('system_timezone', CONFIG_SYSTEM_TIMEZONE_DEFAULT, function (string $timezone) {
110
+			$this->addParam('system_timezone', CONFIG_SYSTEM_TIMEZONE_DEFAULT, function(string $timezone) {
111 111
 
112 112
 				return ((false !== ($timezone = Timezone::validate($timezone))) ? $timezone : null);
113 113
 			});
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
 
11 11
 		private function getSystemUrl() {
12 12
 
13
-			if (empty($host = getenv('HTTP_HOST'))) return;
13
+			if (empty($host = getenv('HTTP_HOST'))) {
14
+				return;
15
+			}
14 16
 
15 17
 			return ((Request::isSecure() ? 'https://' : 'http://') . $host);
16 18
 		}
@@ -19,7 +21,9 @@  discard block
 block discarded – undo
19 21
 
20 22
 		private function getSystemEmail() {
21 23
 
22
-			if (empty($host = getenv('HTTP_HOST'))) return;
24
+			if (empty($host = getenv('HTTP_HOST'))) {
25
+				return;
26
+			}
23 27
 
24 28
 			return ('admin@' . $host);
25 29
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Informer/Handler/Dashboard.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,11 +37,15 @@
 block discarded – undo
37 37
 
38 38
 			# Check if install file exists
39 39
 
40
-			if (Informer::checkInstallFile()) Messages::set('error', Language::get('DASHBOARD_MESSAGE_INSTALL_FILE'));
40
+			if (Informer::checkInstallFile()) {
41
+				Messages::set('error', Language::get('DASHBOARD_MESSAGE_INSTALL_FILE'));
42
+			}
41 43
 
42 44
 			# Check if configuration file is loaded
43 45
 
44
-			if (!Settings::loaded()) Messages::set('warning', Language::get('DASHBOARD_MESSAGE_SETTINGS_FILE'));
46
+			if (!Settings::loaded()) {
47
+				Messages::set('warning', Language::get('DASHBOARD_MESSAGE_SETTINGS_FILE'));
48
+			}
45 49
 
46 50
 			# ------------------------
47 51
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Installer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
14 14
 
15 15
 			if (null !== ($data = Schema::get('System')->load())) {
16 16
 
17
-				Request::redirect(INSTALL_PATH . '/index.php');
17
+				Request::redirect(INSTALL_PATH.'/index.php');
18 18
 			}
19 19
 
20 20
 			# Determine handler class
21 21
 
22 22
 			$checked = (Install::status() && Validate::boolean(Request::get('checked')));
23 23
 
24
-			$class = ('Modules\Install\Handler\\' . (!$checked ? 'Check' : 'Database'));
24
+			$class = ('Modules\Install\Handler\\'.(!$checked ? 'Check' : 'Database'));
25 25
 
26 26
 			# ------------------------
27 27
 
Please login to merge, or discard this patch.
www/engine/System/Exception.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,42 +4,42 @@
 block discarded – undo
4 4
 
5 5
 	# Captcha generate exception
6 6
 
7
-	class Captcha extends Exception  {
7
+	class Captcha extends Exception {
8 8
 
9 9
 		protected $message = 'Error generating captcha';
10 10
 	}
11 11
 
12 12
 	# Sitemap generate exception
13 13
 
14
-	class Sitemap extends Exception  {
14
+	class Sitemap extends Exception {
15 15
 
16 16
 		protected $message = 'Error generating sitemap';
17 17
 	}
18 18
 
19 19
 	# Language not found exception
20 20
 
21
-	class Language extends Exception  {
21
+	class Language extends Exception {
22 22
 
23 23
 		protected $message = 'Languages not found';
24 24
 	}
25 25
 
26 26
 	# Template not found exception
27 27
 
28
-	class Template extends Exception  {
28
+	class Template extends Exception {
29 29
 
30 30
 		protected $message = 'Templates not found';
31 31
 	}
32 32
 
33 33
 	# View not initialized exception
34 34
 
35
-	class View extends Exception  {
35
+	class View extends Exception {
36 36
 
37 37
 		protected $message = 'View is not initialized';
38 38
 	}
39 39
 
40 40
 	# View file not found exception
41 41
 
42
-	class ViewFile extends Exception  {
42
+	class ViewFile extends Exception {
43 43
 
44 44
 		protected $message = 'View file \'$value$\' not found';
45 45
 	}
Please login to merge, or discard this patch.
www/engine/System/Languages/en-US/Phrases/Admin.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,9 +65,9 @@
 block discarded – undo
65 65
 	'DASHBOARD_GROUP_DATABASE'                  => 'Database',
66 66
 
67 67
 	'DASHBOARD_MESSAGE_INSTALL_FILE'            => 'Installation file <a href="$install_path$/install.php" target="_blank">install.php</a> ' .
68
-	                                               'still exists in the root of your site. It\'s necessary to remove it.',
68
+												   'still exists in the root of your site. It\'s necessary to remove it.',
69 69
 	'DASHBOARD_MESSAGE_SETTINGS_FILE'           => 'It seems you have not yet edited site settings. ' .
70
-	                                               'Go to <a href="$install_path$/admin/system/settings">settings page</a> to provide actual data.',
70
+												   'Go to <a href="$install_path$/admin/system/settings">settings page</a> to provide actual data.',
71 71
 
72 72
 	# Pages
73 73
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,9 +64,9 @@
 block discarded – undo
64 64
 	'DASHBOARD_GROUP_GENERAL'                   => 'General',
65 65
 	'DASHBOARD_GROUP_DATABASE'                  => 'Database',
66 66
 
67
-	'DASHBOARD_MESSAGE_INSTALL_FILE'            => 'Installation file <a href="$install_path$/install.php" target="_blank">install.php</a> ' .
67
+	'DASHBOARD_MESSAGE_INSTALL_FILE'            => 'Installation file <a href="$install_path$/install.php" target="_blank">install.php</a> '.
68 68
 	                                               'still exists in the root of your site. It\'s necessary to remove it.',
69
-	'DASHBOARD_MESSAGE_SETTINGS_FILE'           => 'It seems you have not yet edited site settings. ' .
69
+	'DASHBOARD_MESSAGE_SETTINGS_FILE'           => 'It seems you have not yet edited site settings. '.
70 70
 	                                               'Go to <a href="$install_path$/admin/system/settings">settings page</a> to provide actual data.',
71 71
 
72 72
 	# Pages
Please login to merge, or discard this patch.
www/engine/System/Main.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,24 +2,24 @@
 block discarded – undo
2 2
 
3 3
 # Define constants
4 4
 
5
-define('DIR_SYSTEM',                (dirname(__FILE__) . '/'));
5
+define('DIR_SYSTEM', (dirname(__FILE__).'/'));
6 6
 
7
-define('DIR_SYSTEM_CLASSES',        (DIR_SYSTEM . 'Classes/'));
8
-define('DIR_SYSTEM_DATA',           (DIR_SYSTEM . 'Data/'));
9
-define('DIR_SYSTEM_INCLUDES',       (DIR_SYSTEM . 'Includes/'));
10
-define('DIR_SYSTEM_LANGUAGES',      (DIR_SYSTEM . 'Languages/'));
11
-define('DIR_SYSTEM_TEMPLATES',      (DIR_SYSTEM . 'Templates/'));
7
+define('DIR_SYSTEM_CLASSES', (DIR_SYSTEM.'Classes/'));
8
+define('DIR_SYSTEM_DATA', (DIR_SYSTEM.'Data/'));
9
+define('DIR_SYSTEM_INCLUDES', (DIR_SYSTEM.'Includes/'));
10
+define('DIR_SYSTEM_LANGUAGES', (DIR_SYSTEM.'Languages/'));
11
+define('DIR_SYSTEM_TEMPLATES', (DIR_SYSTEM.'Templates/'));
12 12
 
13 13
 # Require classes
14 14
 
15
-require_once (DIR_SYSTEM . 'Exception.php');
15
+require_once (DIR_SYSTEM.'Exception.php');
16 16
 
17 17
 # Require configuration
18 18
 
19
-require_once (DIR_SYSTEM_INCLUDES . 'Config.php');
20
-require_once (DIR_SYSTEM_INCLUDES . 'Constants.php');
21
-require_once (DIR_SYSTEM_INCLUDES . 'Regex.php');
22
-require_once (DIR_SYSTEM_INCLUDES . 'Tables.php');
19
+require_once (DIR_SYSTEM_INCLUDES.'Config.php');
20
+require_once (DIR_SYSTEM_INCLUDES.'Constants.php');
21
+require_once (DIR_SYSTEM_INCLUDES.'Regex.php');
22
+require_once (DIR_SYSTEM_INCLUDES.'Tables.php');
23 23
 
24 24
 # Process environment variables
25 25
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Dataset/Dataset.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		 * If a validator was not given, a default validator will be used to convert a given variable type to a default's type.
30 30
 		 * In a case the conversion fails an existing value will not be changed
31 31
 		 *
32
-		 * @return the current dataset object
32
+		 * @return Dataset current dataset object
33 33
 		 */
34 34
 
35 35
 		public function addParam(string $name, $default, callable $validator = null) : Dataset {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		/**
49 49
 		 * Add multiple params
50 50
 		 *
51
-		 * @return the current dataset object
51
+		 * @return Dataset current dataset object
52 52
 		 */
53 53
 
54 54
 		public function addParams(array $data) : Dataset {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		/**
62 62
 		 * Update a value
63 63
 		 *
64
-		 * @return true on success, false on error, or null if the param does not exist
64
+		 * @return null|boolean on success, false on error, or null if the param does not exist
65 65
 		 */
66 66
 
67 67
 		public function set(string $name, $value) {
Please login to merge, or discard this patch.
Braces   +28 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 
35 35
 		public function addParam(string $name, $default, callable $validator = null) : Dataset {
36 36
 
37
-			if ('' === $name) return $this;
37
+			if ('' === $name) {
38
+				return $this;
39
+			}
38 40
 
39 41
 			$this->data[$name] = $default; $this->defaults[$name] = $default;
40 42
 
@@ -53,7 +55,9 @@  discard block
 block discarded – undo
53 55
 
54 56
 		public function addParams(array $data) : Dataset {
55 57
 
56
-			foreach ($data as $name => $value) if (is_scalar($name)) $this->addParam($name, $value);
58
+			foreach ($data as $name => $value) {
59
+				if (is_scalar($name)) $this->addParam($name, $value);
60
+			}
57 61
 
58 62
 			return $this;
59 63
 		}
@@ -66,16 +70,16 @@  discard block
 block discarded – undo
66 70
 
67 71
 		public function set(string $name, $value) {
68 72
 
69
-			if (!isset($this->validators[$name])) return null;
73
+			if (!isset($this->validators[$name])) {
74
+				return null;
75
+			}
70 76
 
71 77
 			try {
72 78
 
73
-				if (null === ($value = $this->validators[$name]($value))) return false;
74
-
75
-				else { $this->data[$name] = $value; return true; }
76
-			}
77
-
78
-			catch (TypeError $e) { return false; }
79
+				if (null === ($value = $this->validators[$name]($value))) {
80
+					return false;
81
+				} else { $this->data[$name] = $value; return true; }
82
+			} catch (TypeError $e) { return false; }
79 83
 		}
80 84
 
81 85
 		/**
@@ -90,7 +94,9 @@  discard block
 block discarded – undo
90 94
 
91 95
 			foreach ($data as $name => $value) {
92 96
 
93
-				if (null !== ($value = $this->set($name, $value))) $setted[$name] = $value;
97
+				if (null !== ($value = $this->set($name, $value))) {
98
+					$setted[$name] = $value;
99
+				}
94 100
 			}
95 101
 
96 102
 			# ------------------------
@@ -106,16 +112,18 @@  discard block
 block discarded – undo
106 112
 
107 113
 		public function cast(string $name, $value) {
108 114
 
109
-			if (!isset($this->validators[$name])) return null;
115
+			if (!isset($this->validators[$name])) {
116
+				return null;
117
+			}
110 118
 
111 119
 			try {
112 120
 
113
-				if (null !== ($value = $this->validators[$name]($value))) return $value;
114
-
115
-				else return $this->data[$name];
116
-			}
117
-
118
-			catch (TypeError $e) { return $this->data[$name]; }
121
+				if (null !== ($value = $this->validators[$name]($value))) {
122
+					return $value;
123
+				} else {
124
+					return $this->data[$name];
125
+				}
126
+			} catch (TypeError $e) { return $this->data[$name]; }
119 127
 		}
120 128
 
121 129
 		/**
@@ -130,7 +138,9 @@  discard block
 block discarded – undo
130 138
 
131 139
 			foreach ($data as $name => $value) {
132 140
 
133
-				if (null !== ($value = $this->cast($name, $value))) $casted[$name] = $value;
141
+				if (null !== ($value = $this->cast($name, $value))) {
142
+					$casted[$name] = $value;
143
+				}
134 144
 			}
135 145
 
136 146
 			# ------------------------
Please login to merge, or discard this patch.