Passed
Pull Request — master (#11)
by Anton
03:24
created
www/engine/Framework/Classes/Number/Number.php 1 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) {
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) {
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/Range/Range.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@
 block discarded – undo
19 19
 
20 20
 		protected static function init(string $file_name) {
21 21
 
22
-			if (is_array($range = Explorer::include($file_name))) static::$range = $range;
22
+			if (is_array($range = Explorer::include($file_name))) {
23
+				static::$range = $range;
24
+			}
23 25
 		}
24 26
 
25 27
 		/**
Please login to merge, or discard this patch.
www/engine/Framework/Classes/XML/XML.php 1 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/Framework/Classes/Language/Language.php 1 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
 		private static function addPhrase(string $name, string $value) {
21 21
 
22
-			if (preg_match(REGEX_LANGUAGE_PHRASE_NAME, $name)) self::$phrases[$name] = $value;
22
+			if (preg_match(REGEX_LANGUAGE_PHRASE_NAME, $name)) {
23
+				self::$phrases[$name] = $value;
24
+			}
23 25
 		}
24 26
 
25 27
 		/**
@@ -30,9 +32,13 @@  discard block
 block discarded – undo
30 32
 
31 33
 		public static function load(string $file_name) {
32 34
 
33
-			if (!is_array($phrases = Explorer::include($file_name))) return false;
35
+			if (!is_array($phrases = Explorer::include($file_name))) {
36
+				return false;
37
+			}
34 38
 
35
-			foreach ($phrases as $name => $value) if (is_scalar($value)) self::addPhrase($name, $value);
39
+			foreach ($phrases as $name => $value) {
40
+				if (is_scalar($value)) self::addPhrase($name, $value);
41
+			}
36 42
 
37 43
 			# ------------------------
38 44
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Dataset/Validator.php 1 patch
Braces   +31 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,28 +19,51 @@
 block discarded – undo
19 19
 
20 20
 			# Check basic types
21 21
 
22
-			if (is_string   ($default)) return function(string      $value) { return $value; };
22
+			if (is_string   ($default)) {
23
+				return function(string      $value) { return $value;
24
+			}
25
+			};
23 26
 
24
-			if (is_bool     ($default)) return function(bool        $value) { return $value; };
27
+			if (is_bool     ($default)) {
28
+				return function(bool        $value) { return $value;
29
+			}
30
+			};
25 31
 
26
-			if (is_int      ($default)) return function(int         $value) { return $value; };
32
+			if (is_int      ($default)) {
33
+				return function(int         $value) { return $value;
34
+			}
35
+			};
27 36
 
28
-			if (is_float    ($default)) return function(float       $value) { return $value; };
37
+			if (is_float    ($default)) {
38
+				return function(float       $value) { return $value;
39
+			}
40
+			};
29 41
 
30
-			if (is_array    ($default)) return function(array       $value) { return $value; };
42
+			if (is_array    ($default)) {
43
+				return function(array       $value) { return $value;
44
+			}
45
+			};
31 46
 
32
-			if (is_callable ($default)) return function(callable    $value) { return $value; };
47
+			if (is_callable ($default)) {
48
+				return function(callable    $value) { return $value;
49
+			}
50
+			};
33 51
 
34 52
 			# Check object type
35 53
 
36
-			if (is_object($default)) return function($value) use($default) {
54
+			if (is_object($default)) {
55
+				return function($value) use($default) {
37 56
 
38 57
 				return (is_a($value, get_class($default)) ? $value : null);
58
+			}
39 59
 			};
40 60
 
41 61
 			# Check resource type
42 62
 
43
-			if (is_resource($default)) return function($value) { return (is_resource($value) ? $value : null); };
63
+			if (is_resource($default)) {
64
+				return function($value) { return (is_resource($value) ? $value : null);
65
+			}
66
+			};
44 67
 
45 68
 			# ------------------------
46 69
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/Query/Insert.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,9 +29,11 @@
 block discarded – undo
29 29
 
30 30
 			$names = ''; $values = [];
31 31
 
32
-			foreach ($set as $key => $row) if (is_array($row)) {
32
+			foreach ($set as $key => $row) {
33
+				if (is_array($row)) {
33 34
 
34 35
 				if (0 === $key) $names = $this->getString(array_keys($row), '$name', ', ');
36
+			}
35 37
 
36 38
 				$values[] = ('(' . $this->getString(array_values($row), '$value', ', ') . ')');
37 39
 			}
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/DB.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,19 +21,29 @@  discard block
 block discarded – undo
21 21
 
22 22
 			# Establish connection
23 23
 
24
-			if (false === ($link = mysqli_connect($server, $user, $password))) throw new Exception\DBConnect();
24
+			if (false === ($link = mysqli_connect($server, $user, $password))) {
25
+				throw new Exception\DBConnect();
26
+			}
25 27
 
26 28
 			# Select database
27 29
 
28
-			if (!mysqli_select_db($link, $name)) throw new Exception\DBSelect();
30
+			if (!mysqli_select_db($link, $name)) {
31
+				throw new Exception\DBSelect();
32
+			}
29 33
 
30 34
 			# Set encoding
31 35
 
32
-			if (!mysqli_query($link, "SET character_set_client = 'utf8'")) throw new Exception\DBCharset();
36
+			if (!mysqli_query($link, "SET character_set_client = 'utf8'")) {
37
+				throw new Exception\DBCharset();
38
+			}
33 39
 
34
-			if (!mysqli_query($link, "SET character_set_results = 'utf8'")) throw new Exception\DBCharset();
40
+			if (!mysqli_query($link, "SET character_set_results = 'utf8'")) {
41
+				throw new Exception\DBCharset();
42
+			}
35 43
 
36
-			if (!mysqli_query($link, "SET collation_connection = 'utf8_general_ci'")) throw new Exception\DBCharset();
44
+			if (!mysqli_query($link, "SET collation_connection = 'utf8_general_ci'")) {
45
+				throw new Exception\DBCharset();
46
+			}
37 47
 
38 48
 			# ------------------------
39 49
 
@@ -48,7 +58,9 @@  discard block
 block discarded – undo
48 58
 
49 59
 		public static function send(string $query) {
50 60
 
51
-			if (null === self::$link) return (self::$last = false);
61
+			if (null === self::$link) {
62
+				return (self::$last = false);
63
+			}
52 64
 
53 65
 			$time = microtime(true); $result = mysqli_query(self::$link, $query); $time = (microtime(true) - $time);
54 66
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/Result.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,9 @@  discard block
 block discarded – undo
56 56
 
57 57
 		public function getRow() {
58 58
 
59
-			if (!is_object($this->result)) return null;
59
+			if (!is_object($this->result)) {
60
+				return null;
61
+			}
60 62
 
61 63
 			return mysqli_fetch_assoc($this->result);
62 64
 		}
@@ -67,9 +69,13 @@  discard block
 block discarded – undo
67 69
 
68 70
 		public function getRows() {
69 71
 
70
-			if (!is_object($this->result)) return [];
72
+			if (!is_object($this->result)) {
73
+				return [];
74
+			}
71 75
 
72
-			$rows = []; while (null !== ($row = $this->getRow())) $rows[] = $row;
76
+			$rows = []; while (null !== ($row = $this->getRow())) {
77
+				$rows[] = $row;
78
+			}
73 79
 
74 80
 			# ------------------------
75 81
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Template/Loop.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
36 36
 
37 37
 		public function addItems(array $items) {
38 38
 
39
-			foreach ($items as $item) if (is_array($item)) $this->addItem($item);
39
+			foreach ($items as $item) {
40
+				if (is_array($item)) $this->addItem($item);
41
+			}
40 42
 
41 43
 			return $this;
42 44
 		}
Please login to merge, or discard this patch.