Completed
Push — 0.2.1 ( e70612...dab97b )
by Anton
04:42
created
www/engine/Framework/Classes/Url/Url.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,18 +10,24 @@  discard block
 block discarded – undo
10 10
 
11 11
 		public function __construct(string $url = '') {
12 12
 
13
-			if (false === ($url = parse_url($url))) return;
13
+			if (false === ($url = parse_url($url))) {
14
+				return;
15
+			}
14 16
 
15 17
 			# Parse path
16 18
 
17
-			if (isset($url['path'])) foreach (explode('/', $url['path']) as $part) {
19
+			if (isset($url['path'])) {
20
+				foreach (explode('/', $url['path']) as $part) {
18 21
 
19 22
 				if ('' !== $part) $this->path[] = urldecode($part);
20 23
 			}
24
+			}
21 25
 
22 26
 			# Parse query
23 27
 
24
-			if (isset($url['query'])) parse_str($url['query'], $this->query);
28
+			if (isset($url['query'])) {
29
+				parse_str($url['query'], $this->query);
30
+			}
25 31
 		}
26 32
 
27 33
 		# Return path
@@ -53,7 +59,9 @@  discard block
 block discarded – undo
53 59
 
54 60
 			$path = [];
55 61
 
56
-			foreach ($this->path as $value) $path[] = urlencode($value);
62
+			foreach ($this->path as $value) {
63
+				$path[] = urlencode($value);
64
+			}
57 65
 
58 66
 			$path = implode('/', $path); $query = http_build_query($this->query);
59 67
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Explorer/Explorer.php 1 patch
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 php(string $file_name) {
148 156
 
149
-			if ((strtolower(self::extension($file_name)) !== 'php')) return false;
157
+			if ((strtolower(self::extension($file_name)) !== 'php')) {
158
+				return false;
159
+			}
150 160
 
151 161
 			return include $file_name;
152 162
 		}
@@ -155,7 +165,9 @@  discard block
 block discarded – undo
155 165
 
156 166
 		public static function xml(string $file_name) {
157 167
 
158
-			if ((strtolower(self::extension($file_name)) !== 'xml')) return false;
168
+			if ((strtolower(self::extension($file_name)) !== 'xml')) {
169
+				return false;
170
+			}
159 171
 
160 172
 			return @simplexml_load_file($file_name);
161 173
 		}
@@ -164,7 +176,9 @@  discard block
 block discarded – undo
164 176
 
165 177
 		public static function json(string $file_name) {
166 178
 
167
-			if ((strtolower(self::extension($file_name)) !== 'json')) return false;
179
+			if ((strtolower(self::extension($file_name)) !== 'json')) {
180
+				return false;
181
+			}
168 182
 
169 183
 			return json_decode(@file_get_contents($file_name), true);
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.
www/engine/Framework/Classes/DB/DB.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,19 +12,29 @@  discard block
 block discarded – undo
12 12
 
13 13
 			# Establish connection
14 14
 
15
-			if (false === ($link = @mysqli_connect($server, $user, $password))) throw new Exception\DBConnect();
15
+			if (false === ($link = @mysqli_connect($server, $user, $password))) {
16
+				throw new Exception\DBConnect();
17
+			}
16 18
 
17 19
 			# Select database
18 20
 
19
-			if (!@mysqli_select_db($link, $name)) throw new Exception\DBSelect();
21
+			if (!@mysqli_select_db($link, $name)) {
22
+				throw new Exception\DBSelect();
23
+			}
20 24
 
21 25
 			# Set encoding
22 26
 
23
-			if (!@mysqli_query($link, "SET character_set_client = 'utf8'")) throw new Exception\DBCharset();
27
+			if (!@mysqli_query($link, "SET character_set_client = 'utf8'")) {
28
+				throw new Exception\DBCharset();
29
+			}
24 30
 
25
-			if (!@mysqli_query($link, "SET character_set_results = 'utf8'")) throw new Exception\DBCharset();
31
+			if (!@mysqli_query($link, "SET character_set_results = 'utf8'")) {
32
+				throw new Exception\DBCharset();
33
+			}
26 34
 
27
-			if (!@mysqli_query($link, "SET collation_connection = 'utf8_general_ci'")) throw new Exception\DBCharset();
35
+			if (!@mysqli_query($link, "SET collation_connection = 'utf8_general_ci'")) {
36
+				throw new Exception\DBCharset();
37
+			}
28 38
 
29 39
 			# ------------------------
30 40
 
@@ -35,7 +45,9 @@  discard block
 block discarded – undo
35 45
 
36 46
 		public static function send(string $query) {
37 47
 
38
-			if (null === self::$link) return (self::$last = false);
48
+			if (null === self::$link) {
49
+				return (self::$last = false);
50
+			}
39 51
 
40 52
 			$time = microtime(true); $result = mysqli_query(self::$link, $query); $time = (microtime(true) - $time);
41 53
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/Query/Select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 
23 23
 			# Build query
24 24
 
25
-			$this->query = ('SELECT ' . $selection . ' FROM ' . $table . ($condition ? (' WHERE (' .  $condition . ')') : '') .
25
+			$this->query = ('SELECT ' . $selection . ' FROM ' . $table . ($condition ? (' WHERE (' . $condition . ')') : '') .
26 26
 
27
-				($order ? (' ORDER BY ' .  $order) : '') . ($limit ? (' LIMIT ' .  $limit) : ''));
27
+				($order ? (' ORDER BY ' . $order) : '') . ($limit ? (' LIMIT ' . $limit) : ''));
28 28
 		}
29 29
 	}
30 30
 }
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
@@ -20,9 +20,11 @@
 block discarded – undo
20 20
 
21 21
 			$names = ''; $values = [];
22 22
 
23
-			foreach ($dataset as $key => $row) if (is_array($row)) {
23
+			foreach ($dataset as $key => $row) {
24
+				if (is_array($row)) {
24 25
 
25 26
 				if (0 === $key) $names = $this->getString(array_keys($row), '$name', ', ');
27
+			}
26 28
 
27 29
 				$values[] = ('(' . $this->getString(array_values($row), '$value', ', ') . ')');
28 30
 			}
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/Query/Update.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
 			# Build query
22 22
 
23
-			$this->query = ('UPDATE ' . $table . ' SET ' . $dataset . ($condition ? (' WHERE (' .  $condition . ')') : ''));
23
+			$this->query = ('UPDATE ' . $table . ' SET ' . $dataset . ($condition ? (' WHERE (' . $condition . ')') : ''));
24 24
 		}
25 25
 	}
26 26
 }
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.
www/engine/Framework/Classes/DB/Utils/Result.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 
41 41
 		public function row() {
42 42
 
43
-			if (!is_object($this->result)) return null;
43
+			if (!is_object($this->result)) {
44
+				return null;
45
+			}
44 46
 
45 47
 			return mysqli_fetch_assoc($this->result);
46 48
 		}
@@ -49,9 +51,13 @@  discard block
 block discarded – undo
49 51
 
50 52
 		public function rows() {
51 53
 
52
-			if (!is_object($this->result)) return [];
54
+			if (!is_object($this->result)) {
55
+				return [];
56
+			}
53 57
 
54
-			$rows = []; while (null !== ($row = $this->row())) $rows[] = $row;
58
+			$rows = []; while (null !== ($row = $this->row())) {
59
+				$rows[] = $row;
60
+			}
55 61
 
56 62
 			# ------------------------
57 63
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/Utils/Query.php 1 patch
Braces   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
 		protected function getString($source = null, string $pattern = '', string $separator = '') {
33 33
 
34
-			if (!is_array($source)) return (is_scalar($source) ? strval($source) : '');
34
+			if (!is_array($source)) {
35
+				return (is_scalar($source) ? strval($source) : '');
36
+			}
35 37
 
36 38
 			$regexs = ['key' => '/\^([a-z]+)/', 'value' => '/\$([a-z]+)/']; $matches = ['key' => [], 'value' => []];
37 39
 
@@ -39,18 +41,25 @@  discard block
 block discarded – undo
39 41
 
40 42
 			# Parse pattern
41 43
 
42
-			foreach ($regexs as $name => $regex) preg_match($regex, $pattern, $matches[$name]);
44
+			foreach ($regexs as $name => $regex) {
45
+				preg_match($regex, $pattern, $matches[$name]);
46
+			}
43 47
 
44 48
 			# Process replacements
45 49
 
46
-			foreach ($source as $key => $value) if (is_scalar($value)) {
50
+			foreach ($source as $key => $value) {
51
+				if (is_scalar($value)) {
47 52
 
48
-				$output[$count] = $pattern; $item = &$output[$count++];
53
+				$output[$count] = $pattern;
54
+			}
55
+			$item = &$output[$count++];
49 56
 
50
-				foreach ($matches as $name => $match) if (isset($match[1]) && isset($parsers[$match[1]])) {
57
+				foreach ($matches as $name => $match) {
58
+					if (isset($match[1]) && isset($parsers[$match[1]])) {
51 59
 
52 60
 					$item = str_replace($match[0], [$this, $parsers[$match[1]]]($$name), $item);
53 61
 				}
62
+				}
54 63
 			};
55 64
 
56 65
 			# ------------------------
Please login to merge, or discard this patch.