Passed
Branch 0.3.0 (b16461)
by Anton
03:34
created
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/Form/Utils/Field.php 4 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@
 block discarded – undo
45 45
 
46 46
 			if (preg_match(REGEX_FORM_FIELD_KEY, $key)) {
47 47
 
48
-				$prefix = (('' !== $this->form->name()) ? ($this->form->name() . '_') : '');
48
+				$prefix = (('' !== $this->form->name()) ? ($this->form->name().'_') : '');
49 49
 
50
-				$this->key = $key; $this->name = ($prefix . $key);
50
+				$this->key = $key; $this->name = ($prefix.$key);
51 51
 			}
52 52
 
53 53
 			# Set params
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@
 block discarded – undo
14 14
 
15 15
 		# Get tag
16 16
 
17
+		/**
18
+		 * @param string $contents
19
+		 */
17 20
 		protected function getTag(string $name, array $attributes = [], $contents = null) {
18 21
 
19 22
 			$tag = new Tag($name, $attributes, $contents);
Please login to merge, or discard this patch.
Unused Use Statements   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace Form\Utils {
4 4
 
5
-	use Form, Request, Tag;
5
+	use Form;
6
+	use Request;
7
+	use Tag;
6 8
 
7 9
 	abstract class Field {
8 10
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,11 +24,17 @@  discard block
 block discarded – undo
24 24
 
25 25
 			# Set config
26 26
 
27
-			if ($this->disabled) $tag->set('disabled', 'disabled');
27
+			if ($this->disabled) {
28
+				$tag->set('disabled', 'disabled');
29
+			}
28 30
 
29
-			if ($this->required) $tag->set('data-required', 'required');
31
+			if ($this->required) {
32
+				$tag->set('data-required', 'required');
33
+			}
30 34
 
31
-			if ($this->error) $tag->set('data-error', 'error');
35
+			if ($this->error) {
36
+				$tag->set('data-error', 'error');
37
+			}
32 38
 
33 39
 			# ------------------------
34 40
 
@@ -54,9 +60,12 @@  discard block
 block discarded – undo
54 60
 
55 61
 			$params = array_merge(['disabled' => false, 'required' => false], $this->config);
56 62
 
57
-			foreach ($params as $name => $default) if (isset($config[$name])) {
63
+			foreach ($params as $name => $default) {
64
+				if (isset($config[$name])) {
58 65
 
59
-				try { $this->$name($config[$name]); } catch (\TypeError $e) {}
66
+				try { $this->$name($config[$name]);
67
+			}
68
+			} catch (\TypeError $e) {}
60 69
 			}
61 70
 		}
62 71
 
@@ -64,7 +73,9 @@  discard block
 block discarded – undo
64 73
 
65 74
 		public function post() {
66 75
 
67
-			if ($this->posted || $this->disabled || ('' === $this->key)) return false;
76
+			if ($this->posted || $this->disabled || ('' === $this->key)) {
77
+				return false;
78
+			}
68 79
 
69 80
 			$this->error = (!$this->set(Request::post($this->name)) && $this->required);
70 81
 
@@ -98,7 +109,9 @@  discard block
 block discarded – undo
98 109
 
99 110
 		public function disabled(bool $value = null) {
100 111
 
101
-			if (null === $value) return $this->disabled;
112
+			if (null === $value) {
113
+				return $this->disabled;
114
+			}
102 115
 
103 116
 			$this->disabled = $value;
104 117
 		}
@@ -107,7 +120,9 @@  discard block
 block discarded – undo
107 120
 
108 121
 		public function required(bool $value = null) {
109 122
 
110
-			if (null === $value) return $this->required;
123
+			if (null === $value) {
124
+				return $this->required;
125
+			}
111 126
 
112 127
 			$this->required = $value;
113 128
 		}
@@ -116,7 +131,9 @@  discard block
 block discarded – undo
116 131
 
117 132
 		public function error(bool $value = null) {
118 133
 
119
-			if (null === $value) return $this->error;
134
+			if (null === $value) {
135
+				return $this->error;
136
+			}
120 137
 
121 138
 			$this->error = $value;
122 139
 		}
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   +3 added lines patch added patch discarded remove patch
@@ -49,6 +49,9 @@
 block discarded – undo
49 49
 
50 50
 		# Validate file or directory name
51 51
 
52
+		/**
53
+		 * @return string
54
+		 */
52 55
 		public static function fileName(string $value) {
53 56
 
54 57
 			return (preg_match(REGEX_FILE_NAME, $value) ? $name : false);
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.
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.