Passed
Pull Request — master (#19)
by Anton
03:32
created
www/engine/Framework/Classes/Explorer/Explorer.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
 					if (($name === '.') || ($name === '..')) continue;
25 25
 
26
-					if ((null === $type) || (@filetype($dir_name . $name) === $type)) yield $name;
26
+					if ((null === $type) || (@filetype($dir_name.$name) === $type)) yield $name;
27 27
 				}
28 28
 
29 29
 				closedir($handler);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
 				foreach (array_diff($list, ['.', '..']) as $name) {
117 117
 
118
-					$name = ($dir_name . '/' . $name);
118
+					$name = ($dir_name.'/'.$name);
119 119
 
120 120
 					if (@is_dir($name)) self::removeDir($name, true);
121 121
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,9 +21,13 @@  discard block
 block discarded – undo
21 21
 
22 22
 				while (false !== ($name = readdir($handler))) {
23 23
 
24
-					if (($name === '.') || ($name === '..')) continue;
24
+					if (($name === '.') || ($name === '..')) {
25
+						continue;
26
+					}
25 27
 
26
-					if ((null === $type) || (@filetype($dir_name . $name) === $type)) yield $name;
28
+					if ((null === $type) || (@filetype($dir_name . $name) === $type)) {
29
+						yield $name;
30
+					}
27 31
 				}
28 32
 
29 33
 				closedir($handler);
@@ -38,7 +42,9 @@  discard block
 block discarded – undo
38 42
 
39 43
 		private static function getInfo(string $file_name, int $param, bool $check_exists = true) {
40 44
 
41
-			if ($check_exists && !self::isFile($file_name)) return false;
45
+			if ($check_exists && !self::isFile($file_name)) {
46
+				return false;
47
+			}
42 48
 
43 49
 			return pathinfo($file_name, $param);
44 50
 		}
@@ -117,9 +123,11 @@  discard block
 block discarded – undo
117 123
 
118 124
 					$name = ($dir_name . '/' . $name);
119 125
 
120
-					if (@is_dir($name)) self::removeDir($name, true);
121
-
122
-					else if (@is_file($name)) self::removeFile($name);
126
+					if (@is_dir($name)) {
127
+						self::removeDir($name, true);
128
+					} else if (@is_file($name)) {
129
+						self::removeFile($name);
130
+					}
123 131
 				}
124 132
 			}
125 133
 
@@ -145,7 +153,9 @@  discard block
 block discarded – undo
145 153
 
146 154
 		public static function iterate(string $dir_name) : Generator {
147 155
 
148
- 			foreach (self::getList($dir_name) as $name) yield $name;
156
+ 			foreach (self::getList($dir_name) as $name) {
157
+ 				yield $name;
158
+ 			}
149 159
  		}
150 160
 
151 161
 		/**
@@ -154,7 +164,9 @@  discard block
 block discarded – undo
154 164
 
155 165
 		public static function iterateDirs(string $dir_name) : Generator {
156 166
 
157
-			foreach (self::getList($dir_name, 'dir') as $name) yield $name;
167
+			foreach (self::getList($dir_name, 'dir') as $name) {
168
+				yield $name;
169
+			}
158 170
 		}
159 171
 
160 172
 		/**
@@ -163,7 +175,9 @@  discard block
 block discarded – undo
163 175
 
164 176
 		public static function iterateFiles(string $dir_name) : Generator {
165 177
 
166
-			foreach (self::getList($dir_name, 'file') as $name) yield $name;
178
+			foreach (self::getList($dir_name, 'file') as $name) {
179
+				yield $name;
180
+			}
167 181
 		}
168 182
 
169 183
 		/**
@@ -334,7 +348,9 @@  discard block
 block discarded – undo
334 348
 
335 349
 		public static function include(string $file_name) {
336 350
 
337
-			if ((strtolower(self::getExtension($file_name)) !== 'php')) return false;
351
+			if ((strtolower(self::getExtension($file_name)) !== 'php')) {
352
+				return false;
353
+			}
338 354
 
339 355
 			return @include $file_name;
340 356
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Extend/Utils/Loader/Basic.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
 		/**
134 134
 		 * Get the active item data or a specific param value
135 135
 		 *
136
-		 * @return array|mixed|false : the data array, the param value, or false if the active item was not loaded
136
+		 * @return string : the data array, the param value, or false if the active item was not loaded
137 137
 		 */
138 138
 
139 139
 		public function get(string $param = null) {
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,11 +34,15 @@  discard block
 block discarded – undo
34 34
 
35 35
 		protected function loadFirst() {
36 36
 
37
-			if ($this->loaded) return ($this->items[key($this->items)] ?? null);
37
+			if ($this->loaded) {
38
+				return ($this->items[key($this->items)] ?? null);
39
+			}
38 40
 
39 41
 			foreach (Explorer::iterateDirs($this->dir_name) as $name) {
40 42
 
41
-				if (null !== ($data = $this->loadItem($name))) return $data;
43
+				if (null !== ($data = $this->loadItem($name))) {
44
+					return $data;
45
+				}
42 46
 			}
43 47
 
44 48
 			# ------------------------
@@ -97,9 +101,13 @@  discard block
 block discarded – undo
97 101
 
98 102
 		public function activate(string $name, bool $save = false) : bool {
99 103
 
100
-			if (null === ($data = $this->loadItem($name))) return false;
104
+			if (null === ($data = $this->loadItem($name))) {
105
+				return false;
106
+			}
101 107
 
102
-			if ($save && ((!Settings::set(static::$param[$this->section], $name)) || !Settings::save())) return false;
108
+			if ($save && ((!Settings::set(static::$param[$this->section], $name)) || !Settings::save())) {
109
+				return false;
110
+			}
103 111
 
104 112
 			$this->active = $data;
105 113
 
@@ -125,7 +133,9 @@  discard block
 block discarded – undo
125 133
 
126 134
 		public function getPrimary(string $param = null) {
127 135
 
128
-			if (null !== $param) return ($this->primary[$param] ?? false);
136
+			if (null !== $param) {
137
+				return ($this->primary[$param] ?? false);
138
+			}
129 139
 
130 140
 			return ($this->primary ?? false);
131 141
 		}
@@ -138,7 +148,9 @@  discard block
 block discarded – undo
138 148
 
139 149
 		public function get(string $param = null) {
140 150
 
141
-			if (null !== $param) return ($this->active[$param] ?? false);
151
+			if (null !== $param) {
152
+				return ($this->active[$param] ?? false);
153
+			}
142 154
 
143 155
 			return ($this->active ?? false);
144 156
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Router.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
 
93 93
 			if (false === ($handler = self::parseString($route['handler'], REGEX_MAP_ITEM_HANDLER))) return;
94 94
 
95
-			self::$routes['/' . implode('/', $path)] = ('Addons\\' . $name . '\\' . implode('\\', $handler));
95
+			self::$routes['/'.implode('/', $path)] = ('Addons\\'.$name.'\\'.implode('\\', $handler));
96 96
 		}
97 97
 
98 98
 		/**
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,7 +75,9 @@  discard block
 block discarded – undo
75 75
 
76 76
 			$parts = preg_split('/\//', $string, 0, PREG_SPLIT_NO_EMPTY);
77 77
 
78
-			foreach ($parts as $name) if (!preg_match($regex, $name)) return false;
78
+			foreach ($parts as $name) {
79
+				if (!preg_match($regex, $name)) return false;
80
+			}
79 81
 
80 82
 			# ------------------------
81 83
 
@@ -88,9 +90,13 @@  discard block
 block discarded – undo
88 90
 
89 91
 		private static function parseRoute(string $name, array $route) {
90 92
 
91
-			if (false === ($path = self::parseString($route['path'], REGEX_MAP_ITEM_PATH))) return;
93
+			if (false === ($path = self::parseString($route['path'], REGEX_MAP_ITEM_PATH))) {
94
+				return;
95
+			}
92 96
 
93
-			if (false === ($handler = self::parseString($route['handler'], REGEX_MAP_ITEM_HANDLER))) return;
97
+			if (false === ($handler = self::parseString($route['handler'], REGEX_MAP_ITEM_HANDLER))) {
98
+				return;
99
+			}
94 100
 
95 101
 			self::$routes['/' . implode('/', $path)] = ('Addons\\' . $name . '\\' . implode('\\', $handler));
96 102
 		}
@@ -103,7 +109,9 @@  discard block
 block discarded – undo
103 109
 
104 110
 			foreach (Extend\Addons::getItems() as $item) {
105 111
 
106
-				foreach ($item['routes'] as $route) self::parseRoute($item['name'], $route);
112
+				foreach ($item['routes'] as $route) {
113
+					self::parseRoute($item['name'], $route);
114
+				}
107 115
 			}
108 116
 		}
109 117
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Menu.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
 				$item->children = ($children = Template::createBlock());
31 31
 
32
-				foreach ($this->menu[$id]['children'] as $child) $children->addItem($this->parseItem($child));
32
+				foreach ($this->menu[$id]['children'] as $child) {
33
+					$children->addItem($this->parseItem($child));
34
+				}
33 35
 
34 36
 			} else {
35 37
 
@@ -55,7 +57,9 @@  discard block
 block discarded – undo
55 57
 
56 58
 			$menu = Entitizer::getTreeview(TABLE_MENU)->getSubtree(0, ['active' => true]);
57 59
 
58
-			if (false !== $menu) $this->menu = $menu;
60
+			if (false !== $menu) {
61
+				$this->menu = $menu;
62
+			}
59 63
 		}
60 64
 
61 65
 		/**
@@ -66,7 +70,9 @@  discard block
 block discarded – undo
66 70
 
67 71
 			$menu = Template::createBlock();
68 72
 
69
-			foreach ($this->menu[0]['children'] as $id) $menu->addItem($this->parseItem($id));
73
+			foreach ($this->menu[0]['children'] as $id) {
74
+				$menu->addItem($this->parseItem($id));
75
+			}
70 76
 
71 77
 			# ------------------------
72 78
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Form.php 1 patch
Braces   +17 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,7 +23,11 @@  discard block
 block discarded – undo
23 23
 
24 24
 			$text = Language::get($phrase);
25 25
 
26
-			if (!$popup) Messages::set('error', $text); else Popup::set('negative', $text);
26
+			if (!$popup) {
27
+				Messages::set('error', $text);
28
+			} else {
29
+				Popup::set('negative', $text);
30
+			}
27 31
 
28 32
 			# ------------------------
29 33
 
@@ -41,17 +45,25 @@  discard block
 block discarded – undo
41 45
 
42 46
 		public function handle(callable $callback, bool $popup = false) : bool {
43 47
 
44
-			if (false === ($post = $this->post())) return false;
48
+			if (false === ($post = $this->post())) {
49
+				return false;
50
+			}
45 51
 
46 52
 			# Check form for errors
47 53
 
48
-			if ($this->hasErrors()) return $this->displayError('FORM_ERROR_REQUIRED', $popup);
54
+			if ($this->hasErrors()) {
55
+				return $this->displayError('FORM_ERROR_REQUIRED', $popup);
56
+			}
49 57
 
50 58
 			# Call controller method and display error
51 59
 
52
-			if (is_string($result = $callback($post))) return $this->displayError($result, $popup);
60
+			if (is_string($result = $callback($post))) {
61
+				return $this->displayError($result, $popup);
62
+			}
53 63
 
54
-			if (is_array($result)) return (($this->getField($result[0])->error = true) && $this->displayError($result[1], $popup));
64
+			if (is_array($result)) {
65
+				return (($this->getField($result[0])->error = true) && $this->displayError($result[1], $popup));
66
+			}
55 67
 
56 68
 			# ------------------------
57 69
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/View.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
 			if (false === ($path = Extend\Templates::get('path'))) throw new Exception\View;
34 34
 
35
-			if (!isset(self::$cache[$file_name = ($path . $name . '.ctp')])) {
35
+			if (!isset(self::$cache[$file_name = ($path.$name.'.ctp')])) {
36 36
 
37 37
 				if (false === ($contents = Explorer::getContents($file_name))) throw new Exception\ViewFile($file_name);
38 38
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,11 +30,15 @@
 block discarded – undo
30 30
 
31 31
 		public static function get(string $name) : Template\Block {
32 32
 
33
-			if (false === ($path = Extend\Templates::get('path'))) throw new Exception\View;
33
+			if (false === ($path = Extend\Templates::get('path'))) {
34
+				throw new Exception\View;
35
+			}
34 36
 
35 37
 			if (!isset(self::$cache[$file_name = ($path . $name . '.ctp')])) {
36 38
 
37
-				if (false === ($contents = Explorer::getContents($file_name))) throw new Exception\ViewFile($file_name);
39
+				if (false === ($contents = Explorer::getContents($file_name))) {
40
+					throw new Exception\ViewFile($file_name);
41
+				}
38 42
 
39 43
 				self::$cache[$file_name] = Template::createBlock($contents);
40 44
 			}
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/SEO.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 
61 61
 			if (null === self::$dataset) self::init();
62 62
 
63
-			return ((self::get('robots_index') ? 'INDEX' : 'NOINDEX') . ',' . (self::get('robots_follow') ? 'FOLLOW' : 'NOFOLLOW'));
63
+			return ((self::get('robots_index') ? 'INDEX' : 'NOINDEX').','.(self::get('robots_follow') ? 'FOLLOW' : 'NOFOLLOW'));
64 64
 		}
65 65
 	}
66 66
 }
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 
35 35
 		public static function set(string $name, $value) : bool {
36 36
 
37
-			if (null === self::$dataset) self::init();
37
+			if (null === self::$dataset) {
38
+				self::init();
39
+			}
38 40
 
39 41
 			return (self::$dataset->set($name, $value) ?? false);
40 42
 		}
@@ -47,7 +49,9 @@  discard block
 block discarded – undo
47 49
 
48 50
 		public static function get(string $name) {
49 51
 
50
-			if (null === self::$dataset) self::init();
52
+			if (null === self::$dataset) {
53
+				self::init();
54
+			}
51 55
 
52 56
 			return (self::$dataset->get($name) ?? false);
53 57
 		}
@@ -58,7 +62,9 @@  discard block
 block discarded – undo
58 62
 
59 63
 		public static function getRobots() {
60 64
 
61
-			if (null === self::$dataset) self::init();
65
+			if (null === self::$dataset) {
66
+				self::init();
67
+			}
62 68
 
63 69
 			return ((self::get('robots_index') ? 'INDEX' : 'NOINDEX') . ',' . (self::get('robots_follow') ? 'FOLLOW' : 'NOFOLLOW'));
64 70
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Messages.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 
35 35
 		public static function set(string $type, string $text, string $title = null) {
36 36
 
37
-			if (!in_array($type, static::$types, true) || isset(static::$items[$type]) || ('' === $text)) return;
37
+			if (!in_array($type, static::$types, true) || isset(static::$items[$type]) || ('' === $text)) {
38
+				return;
39
+			}
38 40
 
39 41
 			static::$items[$type] = ['text' => $text, 'title' => (('' !== $title) ? $title : null)];
40 42
 		}
@@ -64,7 +66,9 @@  discard block
 block discarded – undo
64 66
 
65 67
 				$message->type = $type; $message->text = Template::createBlock($item['text']);
66 68
 
67
-				if (isset($item['title'])) $message->getBlock('title')->set('text', $item['title'])->enable();
69
+				if (isset($item['title'])) {
70
+					$message->getBlock('title')->set('text', $item['title'])->enable();
71
+				}
68 72
 			}
69 73
 
70 74
 			# ------------------------
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Page.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -68,11 +68,11 @@
 block discarded – undo
68 68
 
69 69
 			if ($this->page->id !== 1) SEO::set('title', $this->page->title); else $this->_layout = 'Index';
70 70
 
71
-			SEO::set('description',         $this->page->description);
72
-			SEO::set('keywords',            $this->page->keywords);
73
-			SEO::set('robots_index',        $this->page->robots_index);
74
-			SEO::set('robots_follow',       $this->page->robots_follow);
75
-			SEO::set('canonical',           $this->page->canonical);
71
+			SEO::set('description', $this->page->description);
72
+			SEO::set('keywords', $this->page->keywords);
73
+			SEO::set('robots_index', $this->page->robots_index);
74
+			SEO::set('robots_follow', $this->page->robots_follow);
75
+			SEO::set('canonical', $this->page->canonical);
76 76
 
77 77
 			# ------------------------
78 78
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,9 +25,11 @@  discard block
 block discarded – undo
25 25
 
26 26
 			# Set breadcrumbs
27 27
 
28
-			if (count($this->path) <= 1) $contents->getBlock('breadcrumbs')->disable();
29
-
30
-			else $contents->getBlock('breadcrumbs')->path = $this->path;
28
+			if (count($this->path) <= 1) {
29
+				$contents->getBlock('breadcrumbs')->disable();
30
+			} else {
31
+				$contents->getBlock('breadcrumbs')->path = $this->path;
32
+			}
31 33
 
32 34
 			# Set contents
33 35
 
@@ -54,19 +56,31 @@  discard block
 block discarded – undo
54 56
 
55 57
 			$slug = $this->_url->getSlug();
56 58
 
57
-			if ('' !== $slug) $this->page->initBySlug($slug); else $this->page->init(1);
59
+			if ('' !== $slug) {
60
+				$this->page->initBySlug($slug);
61
+			} else {
62
+				$this->page->init(1);
63
+			}
58 64
 
59 65
 			# Display error if not found
60 66
 
61
-			if (0 === $this->page->id) return false;
67
+			if (0 === $this->page->id) {
68
+				return false;
69
+			}
62 70
 
63 71
 			# Get path
64 72
 
65
-			if (false !== ($path = $this->page->getPath())) $this->path = $path;
73
+			if (false !== ($path = $this->page->getPath())) {
74
+				$this->path = $path;
75
+			}
66 76
 
67 77
 			# Set data
68 78
 
69
-			if ($this->page->id !== 1) SEO::set('title', $this->page->title); else $this->_layout = 'Index';
79
+			if ($this->page->id !== 1) {
80
+				SEO::set('title', $this->page->title);
81
+			} else {
82
+				$this->_layout = 'Index';
83
+			}
70 84
 
71 85
 			SEO::set('description',         $this->page->description);
72 86
 			SEO::set('keywords',            $this->page->keywords);
Please login to merge, or discard this patch.