Passed
Pull Request — master (#16)
by Anton
03:08
created
www/engine/Framework/Exception.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@
 block discarded – undo
26 26
 
27 27
 		public function __construct(string $message = '') {
28 28
 
29
-			if ('' !== $message) $this->message = $message;
29
+			if ('' !== $message) {
30
+				$this->message = $message;
31
+			}
30 32
 		}
31 33
 	}
32 34
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,22 +37,22 @@
 block discarded – undo
37 37
 		}
38 38
 	}
39 39
 
40
-	class ClassLoad extends Exception  {
40
+	class ClassLoad extends Exception {
41 41
 
42 42
 		protected $message = 'Class \'$value$\' not found';
43 43
 	}
44 44
 
45
-	class DBConnect extends Exception  {
45
+	class DBConnect extends Exception {
46 46
 
47 47
 		protected $message = 'Unable to connect to database';
48 48
 	}
49 49
 
50
-	class DBCharset extends Exception  {
50
+	class DBCharset extends Exception {
51 51
 
52 52
 		protected $message = 'Unable to set database charset';
53 53
 	}
54 54
 
55
-	class DBSelect extends Exception  {
55
+	class DBSelect extends Exception {
56 56
 
57 57
 		protected $message = 'Unable to select database';
58 58
 	}
Please login to merge, or discard this patch.
www/engine/Main.php 2 patches
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,7 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 # Check PHP version
4 4
 
5
-if (version_compare(PHP_VERSION, '7.0.0') < 0) exit('PHP version 7 or higher is required.');
5
+if (version_compare(PHP_VERSION, '7.0.0') < 0) {
6
+	exit('PHP version 7 or higher is required.');
7
+}
6 8
 
7 9
 # Set error reporting
8 10
 
@@ -37,9 +39,11 @@  discard block
 block discarded – undo
37 39
 
38 40
 	# Require class file
39 41
 
40
-	if (@file_exists($file_name = ($path . '.php')) && @is_file($file_name)) require_once $file_name;
41
-
42
-	else if (@file_exists($file_name = ($path . '/' . $last . '.php')) && @is_file($file_name)) require_once $file_name;
42
+	if (@file_exists($file_name = ($path . '.php')) && @is_file($file_name)) {
43
+		require_once $file_name;
44
+	} else if (@file_exists($file_name = ($path . '/' . $last . '.php')) && @is_file($file_name)) {
45
+		require_once $file_name;
46
+	}
43 47
 
44 48
 	# Check if class exists
45 49
 
@@ -50,5 +54,7 @@  discard block
 block discarded – undo
50 54
 
51 55
 	# Call autoload method
52 56
 
53
-	if (method_exists($class_name, '__autoload')) $class_name::__autoload();
54
-});
57
+	if (method_exists($class_name, '__autoload')) {
58
+		$class_name::__autoload();
59
+	}
60
+	});
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,22 +17,22 @@  discard block
 block discarded – undo
17 17
 
18 18
 # Define constants
19 19
 
20
-define('DIR_ENGINE',        (dirname(__FILE__) . '/'));
20
+define('DIR_ENGINE', (dirname(__FILE__).'/'));
21 21
 
22
-define('DIR_WWW',           (DIR_ENGINE . '../'));
23
-define('DIR_UPLOADS',       (DIR_ENGINE . '../uploads/'));
22
+define('DIR_WWW', (DIR_ENGINE.'../'));
23
+define('DIR_UPLOADS', (DIR_ENGINE.'../uploads/'));
24 24
 
25 25
 # Require framework main file
26 26
 
27
-require_once(DIR_ENGINE . 'Framework/Main.php');
27
+require_once(DIR_ENGINE.'Framework/Main.php');
28 28
 
29 29
 # Require system main file
30 30
 
31
-require_once(DIR_ENGINE . 'System/Main.php');
31
+require_once(DIR_ENGINE.'System/Main.php');
32 32
 
33 33
 # Register classes autoloader
34 34
 
35
-spl_autoload_register(function ($class_name) {
35
+spl_autoload_register(function($class_name) {
36 36
 
37 37
 	$path = explode('\\', $class_name); $last = $path[count($path) - 1];
38 38
 
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
 
41 41
 	$system_classes = ['Addons', 'Frames', 'Modules', 'Schemas', 'Utils', 'Dispatcher', 'Installer'];
42 42
 
43
-	$path = ((in_array($path[0], $system_classes, true) ? DIR_SYSTEM_CLASSES : DIR_CLASSES) . implode('/', $path));
43
+	$path = ((in_array($path[0], $system_classes, true) ? DIR_SYSTEM_CLASSES : DIR_CLASSES).implode('/', $path));
44 44
 
45 45
 	# Require class file
46 46
 
47
-	if (@file_exists($file_name = ($path . '.php')) && @is_file($file_name)) require_once $file_name;
47
+	if (@file_exists($file_name = ($path.'.php')) && @is_file($file_name)) require_once $file_name;
48 48
 
49
-	else if (@file_exists($file_name = ($path . '/' . $last . '.php')) && @is_file($file_name)) require_once $file_name;
49
+	else if (@file_exists($file_name = ($path.'/'.$last.'.php')) && @is_file($file_name)) require_once $file_name;
50 50
 
51 51
 	# Check if class exists
52 52
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Validate.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,9 +49,13 @@
 block discarded – undo
49 49
 
50 50
 		public static function url(string $value) {
51 51
 
52
-			if (false === ($value = parent::url($value))) return false;
52
+			if (false === ($value = parent::url($value))) {
53
+				return false;
54
+			}
53 55
 
54
-			if (!preg_match('/^https?:\/\//', $value)) return false;
56
+			if (!preg_match('/^https?:\/\//', $value)) {
57
+				return false;
58
+			}
55 59
 
56 60
 			# ------------------------
57 61
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Number/Number.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 
47 47
 				$number = number_format(($number / pow(1024, $exponent)), (($exponent < 2) ? $exponent : 2));
48 48
 
49
-				return (floatval($number) . ' ' . $text);
49
+				return (floatval($number).' '.$text);
50 50
 			}
51 51
 
52 52
 			# ------------------------
Please login to merge, or discard this patch.
Braces   +33 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,11 +17,17 @@  discard block
 block discarded – undo
17 17
 
18 18
 		public static function forceInt($number, int $min = 0, int $max = 0) : int {
19 19
 
20
-			if (!is_numeric($number) || (($number = intval($number)) < 0)) $number = 0;
20
+			if (!is_numeric($number) || (($number = intval($number)) < 0)) {
21
+				$number = 0;
22
+			}
21 23
 
22
-			if (($min > 0) && ($number < $min)) return $min;
24
+			if (($min > 0) && ($number < $min)) {
25
+				return $min;
26
+			}
23 27
 
24
-			if (($max > 0) && ($number > $max)) return $max;
28
+			if (($max > 0) && ($number > $max)) {
29
+				return $max;
30
+			}
25 31
 
26 32
 			# ------------------------
27 33
 
@@ -34,11 +40,17 @@  discard block
 block discarded – undo
34 40
 
35 41
 		public static function forceFloat($number, float $min = 0, float $max = 0, int $decimals = 0) : float {
36 42
 
37
-			if (!is_numeric($number) || (($number = floatval($number)) < 0)) $number = 0;
43
+			if (!is_numeric($number) || (($number = floatval($number)) < 0)) {
44
+				$number = 0;
45
+			}
38 46
 
39
-			if (($min > 0) && ($number < $min)) $number = $min;
47
+			if (($min > 0) && ($number < $min)) {
48
+				$number = $min;
49
+			}
40 50
 
41
-			if (($max > 0) && ($number > $max)) $number = $max;
51
+			if (($max > 0) && ($number > $max)) {
52
+				$number = $max;
53
+			}
42 54
 
43 55
 			$number = floatval(number_format($number, $decimals, '.', ''));
44 56
 
@@ -55,9 +67,11 @@  discard block
 block discarded – undo
55 67
 
56 68
 			$number = (($number >= 0) ? $number : 0); $exponents = [0 => 'Bytes', 'KB', 'MB', 'GB', 'TB'];
57 69
 
58
-			foreach ($exponents as $exponent => $text) if ($number < pow(1024, ($exponent + 1))) {
70
+			foreach ($exponents as $exponent => $text) {
71
+				if ($number < pow(1024, ($exponent + 1))) {
59 72
 
60 73
 				$number = number_format(($number / pow(1024, $exponent)), (($exponent < 2) ? $exponent : 2));
74
+			}
61 75
 
62 76
 				return (floatval($number) . ' ' . $text);
63 77
 			}
@@ -79,13 +93,21 @@  discard block
 block discarded – undo
79 93
 
80 94
 			$last_1 = substr($number, ($length - 1), 1); $last_2 = substr($number, ($length - 2), 2);
81 95
 
82
-			if (($last_2 >= 11) && ($last_2 <= 20)) return $form_5;
96
+			if (($last_2 >= 11) && ($last_2 <= 20)) {
97
+				return $form_5;
98
+			}
83 99
 
84
-			if ($last_1 == 1) return $form_1;
100
+			if ($last_1 == 1) {
101
+				return $form_1;
102
+			}
85 103
 
86
-			if (($last_1 >= 2) && ($last_1 <= 4)) return $form_3;
104
+			if (($last_1 >= 2) && ($last_1 <= 4)) {
105
+				return $form_3;
106
+			}
87 107
 
88
-			if (($last_1 >= 5) || ($last_1 == 0)) return $form_5;
108
+			if (($last_1 >= 5) || ($last_1 == 0)) {
109
+				return $form_5;
110
+			}
89 111
 		}
90 112
 	}
91 113
 }
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Geo/Country.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
 		public static function __autoload() {
14 14
 
15
-			self::init(DIR_DATA . 'Geo/Countries.php');
15
+			self::init(DIR_DATA.'Geo/Countries.php');
16 16
 		}
17 17
 	}
18 18
 }
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Geo/Timezone.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
 		public static function __autoload() {
14 14
 
15
-			self::init(DIR_DATA . 'Geo/Timezones.php');
15
+			self::init(DIR_DATA.'Geo/Timezones.php');
16 16
 		}
17 17
 	}
18 18
 }
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Request/Request.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 
46 46
 		public static function redirect(string $url) {
47 47
 
48
-			header("Location: " . $url); exit();
48
+			header("Location: ".$url); exit();
49 49
 		}
50 50
 	}
51 51
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 		/**
57 57
 		 * Get a FILE-param value
58 58
 		 *
59
-		 * @return array|false : the array with file info or false if the param does not exist
59
+		 * @return string : the array with file info or false if the param does not exist
60 60
 		 */
61 61
 
62 62
 		public static function file(string $name) {
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Mailer/Mailer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
 
13 13
 			# Set headers
14 14
 
15
-			$headers  = ('MIME-Version: 1.0' . "\r\n");
15
+			$headers  = ('MIME-Version: 1.0'."\r\n");
16 16
 
17
-			$headers .= ('Content-Type: ' . ($is_html ? 'text/html' : 'text/plain') . '; charset=UTF-8' . "\r\n");
17
+			$headers .= ('Content-Type: '.($is_html ? 'text/html' : 'text/plain').'; charset=UTF-8'."\r\n");
18 18
 
19
-			$headers .= ('From: ' . $sender . ' <' . $from . '>' . "\r\n" . 'Reply-To: ' . $reply_to . "\r\n");
19
+			$headers .= ('From: '.$sender.' <'.$from.'>'."\r\n".'Reply-To: '.$reply_to."\r\n");
20 20
 
21
-			$headers .= ('X-Mailer: PHP/' . phpversion() . "\r\n");
21
+			$headers .= ('X-Mailer: PHP/'.phpversion()."\r\n");
22 22
 
23 23
 			# Send message
24 24
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/Query/Delete.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
 			# Build query
20 20
 
21
-			$this->query = ('DELETE FROM ' . $table . ($condition ? (' WHERE (' .  $condition . ')') : ''));
21
+			$this->query = ('DELETE FROM '.$table.($condition ? (' WHERE ('.$condition.')') : ''));
22 22
 		}
23 23
 	}
24 24
 }
Please login to merge, or discard this patch.