Completed
Push — master ( e7c824...3ed60a )
by Anton
10s
created
www/engine/Framework/Classes/Explorer/Explorer.php 2 patches
Braces   +28 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,9 +12,13 @@  discard block
 block discarded – undo
12 12
 
13 13
 				while (false !== ($name = readdir($handler))) {
14 14
 
15
-					if (($name === '.') || ($name === '..')) continue;
15
+					if (($name === '.') || ($name === '..')) {
16
+						continue;
17
+					}
16 18
 
17
-					if ($dirs ? @is_dir($dir_name . $name) : @is_file($dir_name . $name)) yield $name;
19
+					if ($dirs ? @is_dir($dir_name . $name) : @is_file($dir_name . $name)) {
20
+						yield $name;
21
+					}
18 22
 				}
19 23
 
20 24
 				closedir($handler);
@@ -25,7 +29,9 @@  discard block
 block discarded – undo
25 29
 
26 30
 		private static function getInfo(string $file_name, int $param, bool $check_exists = true) {
27 31
 
28
-			if ($check_exists && !self::isFile($file_name)) return false;
32
+			if ($check_exists && !self::isFile($file_name)) {
33
+				return false;
34
+			}
29 35
 
30 36
 			return pathinfo($file_name, $param);
31 37
 		}
@@ -68,9 +74,11 @@  discard block
 block discarded – undo
68 74
 
69 75
 					$name = ($dir_name . '/' . $name);
70 76
 
71
-					if (@is_file($name)) self::removeFile($name);
72
-
73
-					else if (@is_dir($name)) self::removeDir($name, true);
77
+					if (@is_file($name)) {
78
+						self::removeFile($name);
79
+					} else if (@is_dir($name)) {
80
+						self::removeDir($name, true);
81
+					}
74 82
 				}
75 83
 			}
76 84
 
@@ -146,7 +154,9 @@  discard block
 block discarded – undo
146 154
 
147 155
 		public static function json(string $file_name) {
148 156
 
149
-			if ((strtolower(self::extension($file_name)) !== 'json')) return false;
157
+			if ((strtolower(self::extension($file_name)) !== 'json')) {
158
+				return false;
159
+			}
150 160
 
151 161
 			return (json_decode(@file_get_contents($file_name), true) ?? false);
152 162
 		}
@@ -155,7 +165,9 @@  discard block
 block discarded – undo
155 165
 
156 166
 		public static function php(string $file_name) {
157 167
 
158
-			if ((strtolower(self::extension($file_name)) !== 'php')) return false;
168
+			if ((strtolower(self::extension($file_name)) !== 'php')) {
169
+				return false;
170
+			}
159 171
 
160 172
 			return include $file_name;
161 173
 		}
@@ -164,7 +176,9 @@  discard block
 block discarded – undo
164 176
 
165 177
 		public static function xml(string $file_name) {
166 178
 
167
-			if ((strtolower(self::extension($file_name)) !== 'xml')) return false;
179
+			if ((strtolower(self::extension($file_name)) !== 'xml')) {
180
+				return false;
181
+			}
168 182
 
169 183
 			return @simplexml_load_file($file_name);
170 184
 		}
@@ -173,7 +187,11 @@  discard block
 block discarded – undo
173 187
 
174 188
 		public static function save(string $file_name, string $contents, bool $force = false) {
175 189
 
176
-			if (self::isFile($file_name)) if (!$force) return false; else if (!@unlink($file_name)) return false;
190
+			if (self::isFile($file_name)) {
191
+				if (!$force) return false;
192
+			} else if (!@unlink($file_name)) {
193
+				return false;
194
+			}
177 195
 
178 196
 			return @file_put_contents($file_name, $contents);
179 197
 		}
Please login to merge, or discard this patch.
Spacing   +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
 					if (($name === '.') || ($name === '..')) continue;
16 16
 
17
-					if ($dirs ? @is_dir($dir_name . $name) : @is_file($dir_name . $name)) yield $name;
17
+					if ($dirs ? @is_dir($dir_name.$name) : @is_file($dir_name.$name)) yield $name;
18 18
 				}
19 19
 
20 20
 				closedir($handler);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 				foreach (array_diff($list, ['.', '..']) as $name) {
68 68
 
69
-					$name = ($dir_name . '/' . $name);
69
+					$name = ($dir_name.'/'.$name);
70 70
 
71 71
 					if (@is_file($name)) self::removeFile($name);
72 72
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Arr/Arr.php 1 patch
Braces   +20 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,7 +10,12 @@  discard block
 block discarded – undo
10 10
 
11 11
 			$value = false;
12 12
 
13
-			foreach ($path as $item) if (isset($array[$item])) $value = ($array = $array[$item]); else return false;
13
+			foreach ($path as $item) {
14
+				if (isset($array[$item])) $value = ($array = $array[$item]);
15
+			}
16
+			else {
17
+				return false;
18
+			}
14 19
 
15 20
 			# ------------------------
16 21
 
@@ -23,10 +28,12 @@  discard block
 block discarded – undo
23 28
 
24 29
 			$result = [];
25 30
 
26
-			foreach ($keys as $key) if (is_scalar($key)) {
31
+			foreach ($keys as $key) {
32
+				if (is_scalar($key)) {
27 33
 
28 34
 				$result[$key] = ((isset($array[$key]) && is_scalar($array[$key])) ? $array[$key] : false);
29 35
 			}
36
+			}
30 37
 
31 38
 			# ------------------------
32 39
 
@@ -39,7 +46,9 @@  discard block
 block discarded – undo
39 46
 
40 47
 			$result = [];
41 48
 
42
-			foreach ($array as $key => $value) $result[] = [$key_name => $key, $value_name => $value];
49
+			foreach ($array as $key => $value) {
50
+				$result[] = [$key_name => $key, $value_name => $value];
51
+			}
43 52
 
44 53
 			# ------------------------
45 54
 
@@ -57,9 +66,15 @@  discard block
 block discarded – undo
57 66
 
58 67
 			$column = array_map($select_key, $array);
59 68
 
60
-			if (!$descending) asort($column); else arsort($column);
69
+			if (!$descending) {
70
+				asort($column);
71
+			} else {
72
+				arsort($column);
73
+			}
61 74
 
62
-			$result = []; foreach (array_keys($column) as $key) $result[$key] = $array[$key];
75
+			$result = []; foreach (array_keys($column) as $key) {
76
+				$result[$key] = $array[$key];
77
+			}
63 78
 
64 79
 			# ------------------------
65 80
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Tools/Sitemap.php 2 patches
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 
15 15
 			$urlset = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />';
16 16
 
17
-			if (false !== ($xml = XML::create($urlset))) $this->xml = $xml;
17
+			if (false !== ($xml = XML::create($urlset))) {
18
+				$this->xml = $xml;
19
+			}
18 20
 		}
19 21
 
20 22
 		# Load sitemap
@@ -25,9 +27,13 @@  discard block
 block discarded – undo
25 27
 
26 28
 			$modified = Explorer::modified($file_name);
27 29
 
28
-			if ((false === $modified) || ($modified <= $time)) return false;
30
+			if ((false === $modified) || ($modified <= $time)) {
31
+				return false;
32
+			}
29 33
 
30
-			if (false === ($xml = Explorer::xml($file_name))) return false;
34
+			if (false === ($xml = Explorer::xml($file_name))) {
35
+				return false;
36
+			}
31 37
 
32 38
 			$this->xml = $xml; $this->loaded = true;
33 39
 
@@ -40,11 +46,15 @@  discard block
 block discarded – undo
40 46
 
41 47
 		public function save() {
42 48
 
43
-			if ((null === $this->xml) || $this->loaded) return false;
49
+			if ((null === $this->xml) || $this->loaded) {
50
+				return false;
51
+			}
44 52
 
45 53
 			$file_name = (DIR_SYSTEM_DATA . 'Sitemap.xml');
46 54
 
47
-			if (false === Explorer::save($file_name, XML::string($this->xml), true)) return false;
55
+			if (false === Explorer::save($file_name, XML::string($this->xml), true)) {
56
+				return false;
57
+			}
48 58
 
49 59
 			# ------------------------
50 60
 
@@ -55,9 +65,13 @@  discard block
 block discarded – undo
55 65
 
56 66
 		public function add(string $loc, string $lastmod = null, string $changefreq = null, float $priority = null) {
57 67
 
58
-			if ((null === $this->xml) || $this->loaded) return false;
68
+			if ((null === $this->xml) || $this->loaded) {
69
+				return false;
70
+			}
59 71
 
60
-			if (false === ($loc = Validate::url($loc))) return false;
72
+			if (false === ($loc = Validate::url($loc))) {
73
+				return false;
74
+			}
61 75
 
62 76
 			# Create url object
63 77
 
@@ -79,7 +93,9 @@  discard block
 block discarded – undo
79 93
 
80 94
 			# Set priority
81 95
 
82
-			if (null !== $priority) $url->addChild('priority', Number::formatFloat($priority, 0, 1, 1));
96
+			if (null !== $priority) {
97
+				$url->addChild('priority', Number::formatFloat($priority, 0, 1, 1));
98
+			}
83 99
 
84 100
 			# ------------------------
85 101
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 		public function load(int $time) {
23 23
 
24
-			$file_name = (DIR_SYSTEM_DATA . 'Sitemap.xml');
24
+			$file_name = (DIR_SYSTEM_DATA.'Sitemap.xml');
25 25
 
26 26
 			$modified = Explorer::modified($file_name);
27 27
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 			if ((null === $this->xml) || $this->loaded) return false;
44 44
 
45
-			$file_name = (DIR_SYSTEM_DATA . 'Sitemap.xml');
45
+			$file_name = (DIR_SYSTEM_DATA.'Sitemap.xml');
46 46
 
47 47
 			if (false === Explorer::save($file_name, XML::string($this->xml), true)) return false;
48 48
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Tools/Captcha.php 1 patch
Braces   +42 added lines, -13 removed lines patch added patch discarded remove patch
@@ -12,11 +12,19 @@  discard block
 block discarded – undo
12 12
 
13 13
 		private function allocateColor(array $color = null) {
14 14
 
15
-			if (null === $this->image) return false;
15
+			if (null === $this->image) {
16
+				return false;
17
+			}
16 18
 
17
-			if (null === $color) $color = [0, 0, 0]; else if (count($color) !== 3) return false;
19
+			if (null === $color) {
20
+				$color = [0, 0, 0];
21
+			} else if (count($color) !== 3) {
22
+				return false;
23
+			}
18 24
 
19
-			foreach (array_values($color) as $key => $value) $color[$key] = Number::format($value, 0, 255);
25
+			foreach (array_values($color) as $key => $value) {
26
+				$color[$key] = Number::format($value, 0, 255);
27
+			}
20 28
 
21 29
 			# ------------------------
22 30
 
@@ -27,7 +35,9 @@  discard block
 block discarded – undo
27 35
 
28 36
 		public function __construct(int $width, int $height, array $bg_color = null) {
29 37
 
30
-			if (false === ($image = imagecreatetruecolor($width, $height))) return;
38
+			if (false === ($image = imagecreatetruecolor($width, $height))) {
39
+				return;
40
+			}
31 41
 
32 42
 			$this->image = $image; $this->width = $width; $this->height = $height;
33 43
 
@@ -41,11 +51,17 @@  discard block
 block discarded – undo
41 51
 
42 52
 		public function text(string $font, int $size, int $indent, int $step, string $text, array $color = null) {
43 53
 
44
-			if (null === $this->image) return false;
54
+			if (null === $this->image) {
55
+				return false;
56
+			}
45 57
 
46
-			if (!Explorer::isFile($font)) return false;
58
+			if (!Explorer::isFile($font)) {
59
+				return false;
60
+			}
47 61
 
48
-			if (false === ($color = $this->allocateColor($color))) return false;
62
+			if (false === ($color = $this->allocateColor($color))) {
63
+				return false;
64
+			}
49 65
 
50 66
 			$base = (floor(($this->height - $size) / 2) + $size);
51 67
 
@@ -65,13 +81,22 @@  discard block
 block discarded – undo
65 81
 
66 82
 		public function noise(int $rate, array $color = null) {
67 83
 
68
-			if (null === $this->image) return false;
84
+			if (null === $this->image) {
85
+				return false;
86
+			}
69 87
 
70
-			if (false === ($color = $this->allocateColor($color))) return false;
88
+			if (false === ($color = $this->allocateColor($color))) {
89
+				return false;
90
+			}
71 91
 
72
-			for ($x = 0; $x < $this->width; $x++) for ($y = 0; $y < $this->height; $y++) {
92
+			for ($x = 0; $x < $this->width; $x++) {
93
+				for ($y = 0;
94
+			}
95
+			$y < $this->height; $y++) {
73 96
 
74
-				if (random_int(1, $rate) === 1) imagesetpixel($this->image, $x, $y, $color);
97
+				if (random_int(1, $rate) === 1) {
98
+					imagesetpixel($this->image, $x, $y, $color);
99
+				}
75 100
 			}
76 101
 
77 102
 			# ------------------------
@@ -83,9 +108,13 @@  discard block
 block discarded – undo
83 108
 
84 109
 		public function lines(int $count, array $color = null) {
85 110
 
86
-			if (null === $this->image) return false;
111
+			if (null === $this->image) {
112
+				return false;
113
+			}
87 114
 
88
-			if (false === ($color = $this->allocateColor($color))) return false;
115
+			if (false === ($color = $this->allocateColor($color))) {
116
+				return false;
117
+			}
89 118
 
90 119
 			for ($i = 0; $i < $count; $i++) {
91 120
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/XML/XML.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 
18 18
 		public static function string(SimpleXMLElement $xml) {
19 19
 
20
-			if (false === ($xml = dom_import_simplexml($xml))) return '';
20
+			if (false === ($xml = dom_import_simplexml($xml))) {
21
+				return '';
22
+			}
21 23
 
22 24
 			$dom = $xml->ownerDocument; $dom->formatOutput = true;
23 25
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
 		public static function create(string $data) {
10 10
 
11
-			$data = ('<?xml version="1.0" encoding="UTF-8" ?>' . $data);
11
+			$data = ('<?xml version="1.0" encoding="UTF-8" ?>'.$data);
12 12
 
13 13
 			return @simplexml_load_string($data);
14 14
 		}
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 1 patch
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.
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.