| @@ -29,7 +29,7 @@ discard block | ||
| 29 | 29 | * If a validator was not given, a default validator will be used to convert a given variable type to a default's type. | 
| 30 | 30 | * In a case the conversion fails an existing value will not be changed | 
| 31 | 31 | * | 
| 32 | - * @return the current dataset object | |
| 32 | + * @return Dataset current dataset object | |
| 33 | 33 | */ | 
| 34 | 34 | |
| 35 | 35 |  		public function addParam(string $name, $default, callable $validator = null) : Dataset { | 
| @@ -48,7 +48,7 @@ discard block | ||
| 48 | 48 | /** | 
| 49 | 49 | * Add multiple params | 
| 50 | 50 | * | 
| 51 | - * @return the current dataset object | |
| 51 | + * @return Dataset current dataset object | |
| 52 | 52 | */ | 
| 53 | 53 | |
| 54 | 54 |  		public function addParams(array $data) : Dataset { | 
| @@ -61,7 +61,7 @@ discard block | ||
| 61 | 61 | /** | 
| 62 | 62 | * Update a value | 
| 63 | 63 | * | 
| 64 | - * @return true on success, false on error, or null if the param does not exist | |
| 64 | + * @return null|boolean on success, false on error, or null if the param does not exist | |
| 65 | 65 | */ | 
| 66 | 66 | |
| 67 | 67 |  		public function set(string $name, $value) { | 
| @@ -34,7 +34,9 @@ discard block | ||
| 34 | 34 | |
| 35 | 35 |  		public function addParam(string $name, $default, callable $validator = null) : Dataset { | 
| 36 | 36 | |
| 37 | -			if ('' === $name) return $this; | |
| 37 | +			if ('' === $name) { | |
| 38 | + return $this; | |
| 39 | + } | |
| 38 | 40 | |
| 39 | 41 | $this->data[$name] = $default; $this->defaults[$name] = $default; | 
| 40 | 42 | |
| @@ -53,7 +55,9 @@ discard block | ||
| 53 | 55 | |
| 54 | 56 |  		public function addParams(array $data) : Dataset { | 
| 55 | 57 | |
| 56 | - foreach ($data as $name => $value) if (is_scalar($name)) $this->addParam($name, $value); | |
| 58 | +			foreach ($data as $name => $value) { | |
| 59 | + if (is_scalar($name)) $this->addParam($name, $value); | |
| 60 | + } | |
| 57 | 61 | |
| 58 | 62 | return $this; | 
| 59 | 63 | } | 
| @@ -66,16 +70,16 @@ discard block | ||
| 66 | 70 | |
| 67 | 71 |  		public function set(string $name, $value) { | 
| 68 | 72 | |
| 69 | - if (!isset($this->validators[$name])) return null; | |
| 73 | +			if (!isset($this->validators[$name])) { | |
| 74 | + return null; | |
| 75 | + } | |
| 70 | 76 | |
| 71 | 77 |  			try { | 
| 72 | 78 | |
| 73 | - if (null === ($value = $this->validators[$name]($value))) return false; | |
| 74 | - | |
| 75 | -				else { $this->data[$name] = $value; return true; } | |
| 76 | - } | |
| 77 | - | |
| 78 | -			catch (TypeError $e) { return false; } | |
| 79 | +				if (null === ($value = $this->validators[$name]($value))) { | |
| 80 | + return false; | |
| 81 | +				} else { $this->data[$name] = $value; return true; } | |
| 82 | +			} catch (TypeError $e) { return false; } | |
| 79 | 83 | } | 
| 80 | 84 | |
| 81 | 85 | /** | 
| @@ -90,7 +94,9 @@ discard block | ||
| 90 | 94 | |
| 91 | 95 |  			foreach ($data as $name => $value) { | 
| 92 | 96 | |
| 93 | - if (null !== ($value = $this->set($name, $value))) $setted[$name] = $value; | |
| 97 | +				if (null !== ($value = $this->set($name, $value))) { | |
| 98 | + $setted[$name] = $value; | |
| 99 | + } | |
| 94 | 100 | } | 
| 95 | 101 | |
| 96 | 102 | # ------------------------ | 
| @@ -106,16 +112,18 @@ discard block | ||
| 106 | 112 | |
| 107 | 113 |  		public function cast(string $name, $value) { | 
| 108 | 114 | |
| 109 | - if (!isset($this->validators[$name])) return null; | |
| 115 | +			if (!isset($this->validators[$name])) { | |
| 116 | + return null; | |
| 117 | + } | |
| 110 | 118 | |
| 111 | 119 |  			try { | 
| 112 | 120 | |
| 113 | - if (null !== ($value = $this->validators[$name]($value))) return $value; | |
| 114 | - | |
| 115 | - else return $this->data[$name]; | |
| 116 | - } | |
| 117 | - | |
| 118 | -			catch (TypeError $e) { return $this->data[$name]; } | |
| 121 | +				if (null !== ($value = $this->validators[$name]($value))) { | |
| 122 | + return $value; | |
| 123 | +				} else { | |
| 124 | + return $this->data[$name]; | |
| 125 | + } | |
| 126 | +			} catch (TypeError $e) { return $this->data[$name]; } | |
| 119 | 127 | } | 
| 120 | 128 | |
| 121 | 129 | /** | 
| @@ -130,7 +138,9 @@ discard block | ||
| 130 | 138 | |
| 131 | 139 |  			foreach ($data as $name => $value) { | 
| 132 | 140 | |
| 133 | - if (null !== ($value = $this->cast($name, $value))) $casted[$name] = $value; | |
| 141 | +				if (null !== ($value = $this->cast($name, $value))) { | |
| 142 | + $casted[$name] = $value; | |
| 143 | + } | |
| 134 | 144 | } | 
| 135 | 145 | |
| 136 | 146 | # ------------------------ | 
| @@ -64,7 +64,7 @@ discard block | ||
| 64 | 64 | /** | 
| 65 | 65 | * Create a directory | 
| 66 | 66 | * | 
| 67 | - * @return true on success or false on failure | |
| 67 | + * @return boolean on success or false on failure | |
| 68 | 68 | */ | 
| 69 | 69 | |
| 70 | 70 |  		public static function createDir(string $dir_name, int $mode = 0755) : bool { | 
| @@ -75,7 +75,7 @@ discard block | ||
| 75 | 75 | /** | 
| 76 | 76 | * Create a file | 
| 77 | 77 | * | 
| 78 | - * @return true on success or false on failure | |
| 78 | + * @return boolean on success or false on failure | |
| 79 | 79 | */ | 
| 80 | 80 | |
| 81 | 81 |  		public static function createFile(string $file_name) : bool { | 
| @@ -86,7 +86,7 @@ discard block | ||
| 86 | 86 | /** | 
| 87 | 87 | * Remove a directory | 
| 88 | 88 | * | 
| 89 | - * @return true on success or false on failure | |
| 89 | + * @return boolean on success or false on failure | |
| 90 | 90 | */ | 
| 91 | 91 | |
| 92 | 92 |  		public static function removeDir(string $dir_name, bool $recursive = false) : bool { | 
| @@ -111,7 +111,7 @@ discard block | ||
| 111 | 111 | /** | 
| 112 | 112 | * Remove a file | 
| 113 | 113 | * | 
| 114 | - * @return true on success or false on failure | |
| 114 | + * @return boolean on success or false on failure | |
| 115 | 115 | */ | 
| 116 | 116 | |
| 117 | 117 |  		public static function removeFile(string $file_name) : bool { | 
| @@ -191,7 +191,7 @@ discard block | ||
| 191 | 191 | /** | 
| 192 | 192 | * Get an extnesion of a file | 
| 193 | 193 | * | 
| 194 | - * @return the string or false if check_exists is true and the file does not actually exists | |
| 194 | + * @return string string or false if check_exists is true and the file does not actually exists | |
| 195 | 195 | */ | 
| 196 | 196 | |
| 197 | 197 |  		public static function getExtension(string $file_name, bool $check_exists = true) { | 
| @@ -213,7 +213,7 @@ discard block | ||
| 213 | 213 | /** | 
| 214 | 214 | * Get file contents | 
| 215 | 215 | * | 
| 216 | - * @return the read data or false on failure | |
| 216 | + * @return string read data or false on failure | |
| 217 | 217 | */ | 
| 218 | 218 | |
| 219 | 219 |  		public static function getContents(string $file_name) { | 
| @@ -9,7 +9,9 @@ | ||
| 9 | 9 | |
| 10 | 10 |  namespace Form\Field { | 
| 11 | 11 | |
| 12 | - use Form, Tag, Template; | |
| 12 | + use Form; | |
| 13 | + use Tag; | |
| 14 | + use Template; | |
| 13 | 15 | |
| 14 | 16 |  	class Select extends Form\Field { | 
| 15 | 17 | |
| @@ -9,7 +9,9 @@ | ||
| 9 | 9 | |
| 10 | 10 |  namespace Form\Field { | 
| 11 | 11 | |
| 12 | - use Form, Str, Template; | |
| 12 | + use Form; | |
| 13 | + use Str; | |
| 14 | + use Template; | |
| 13 | 15 | |
| 14 | 16 |  	class Text extends Form\Field { | 
| 15 | 17 | |
| @@ -18,7 +18,7 @@ discard block | ||
| 18 | 18 | /** | 
| 19 | 19 | * Add a field to the form | 
| 20 | 20 | * | 
| 21 | - * @return true if the field was successfully added, otherwise false | |
| 21 | + * @return boolean if the field was successfully added, otherwise false | |
| 22 | 22 | */ | 
| 23 | 23 | |
| 24 | 24 |  		private function addField(Form\Field $field) : bool { | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | /** | 
| 45 | 45 | * Add a text field | 
| 46 | 46 | * | 
| 47 | - * @return true if the field was successfully added, otherwise false | |
| 47 | + * @return boolean if the field was successfully added, otherwise false | |
| 48 | 48 | */ | 
| 49 | 49 | |
| 50 | 50 | public function addText(string $key, string $value = '', | 
| @@ -57,7 +57,7 @@ discard block | ||
| 57 | 57 | /** | 
| 58 | 58 | * Add a select field | 
| 59 | 59 | * | 
| 60 | - * @return true if the field was successfully added, otherwise false | |
| 60 | + * @return boolean if the field was successfully added, otherwise false | |
| 61 | 61 | */ | 
| 62 | 62 | |
| 63 | 63 | public function addSelect(string $key, string $value = '', | 
| @@ -70,7 +70,7 @@ discard block | ||
| 70 | 70 | /** | 
| 71 | 71 | * Add a checkbox field | 
| 72 | 72 | * | 
| 73 | - * @return true if the field was successfully added, otherwise false | |
| 73 | + * @return boolean if the field was successfully added, otherwise false | |
| 74 | 74 | */ | 
| 75 | 75 | |
| 76 | 76 |  		public function addCheckbox(string $key, string $value = '') : bool { | 
| @@ -81,7 +81,7 @@ discard block | ||
| 81 | 81 | /** | 
| 82 | 82 | * Check if valid POST data has been recieved | 
| 83 | 83 | * | 
| 84 | - * @return true if the data has been recieved, otherwise false | |
| 84 | + * @return boolean if the data has been recieved, otherwise false | |
| 85 | 85 | */ | 
| 86 | 86 | |
| 87 | 87 |  		public function check() : bool { | 
| @@ -33,15 +33,19 @@ discard block | ||
| 33 | 33 | |
| 34 | 34 | $type = $matches[2][$key]; $name = $matches[3][$key]; $contents = ($matches[4][$key] ?? ''); | 
| 35 | 35 | |
| 36 | - if (!preg_match(REGEX_TEMPLATE_COMPONENT_NAME, $name)) continue; | |
| 36 | +				if (!preg_match(REGEX_TEMPLATE_COMPONENT_NAME, $name)) { | |
| 37 | + continue; | |
| 38 | + } | |
| 37 | 39 | |
| 38 | 40 |  				$this->contents = str_replace($match, ('{ ' . $type . ':' . $name . ' / }'), $this->contents); | 
| 39 | 41 | |
| 40 | - if ($type === 'block') $this->blocks[$name] = (new Block($contents))->$toggle(); | |
| 41 | - | |
| 42 | - else if ($type === 'for') $this->loops[$name] = new Loop($contents); | |
| 43 | - | |
| 44 | - else if ($type === 'widget') $this->widgets[] = $name; | |
| 42 | +				if ($type === 'block') { | |
| 43 | + $this->blocks[$name] = (new Block($contents))->$toggle(); | |
| 44 | +				} else if ($type === 'for') { | |
| 45 | + $this->loops[$name] = new Loop($contents); | |
| 46 | +				} else if ($type === 'widget') { | |
| 47 | + $this->widgets[] = $name; | |
| 48 | + } | |
| 45 | 49 | } | 
| 46 | 50 | } | 
| 47 | 51 | |
| @@ -61,7 +65,9 @@ discard block | ||
| 61 | 65 | |
| 62 | 66 |  				foreach ($matches[1] as $index => $name) { | 
| 63 | 67 | |
| 64 | - if (!preg_match(REGEX_TEMPLATE_COMPONENT_NAME, $name)) continue; | |
| 68 | +					if (!preg_match(REGEX_TEMPLATE_COMPONENT_NAME, $name)) { | |
| 69 | + continue; | |
| 70 | + } | |
| 65 | 71 | |
| 66 | 72 | $elementaries['stack'][$name] = false; | 
| 67 | 73 | } | 
| @@ -138,7 +144,9 @@ discard block | ||
| 138 | 144 | |
| 139 | 145 | # Process items | 
| 140 | 146 | |
| 141 | - foreach ($this->items as $block) $contents .= $block->getContents(); | |
| 147 | +			foreach ($this->items as $block) { | |
| 148 | + $contents .= $block->getContents(); | |
| 149 | + } | |
| 142 | 150 | |
| 143 | 151 | # ------------------------ | 
| 144 | 152 | |
| @@ -177,7 +185,9 @@ discard block | ||
| 177 | 185 | |
| 178 | 186 |  		public function addItems(array $items) : Block { | 
| 179 | 187 | |
| 180 | - foreach ($items as $item) if ($item instanceof Block) $this->addItem($item); | |
| 188 | +			foreach ($items as $item) { | |
| 189 | + if ($item instanceof Block) $this->addItem($item); | |
| 190 | + } | |
| 181 | 191 | |
| 182 | 192 | return $this; | 
| 183 | 193 | } | 
| @@ -203,11 +213,13 @@ discard block | ||
| 203 | 213 | |
| 204 | 214 |  		public function set(string $name, $value) : Block { | 
| 205 | 215 | |
| 206 | - if ($value instanceof Block) $this->setBlock($name, $value); | |
| 207 | - | |
| 208 | - else if (is_array($value)) $this->setLoop($name, $value); | |
| 209 | - | |
| 210 | - else if (is_scalar($value)) $this->setVar($name, $value); | |
| 216 | +			if ($value instanceof Block) { | |
| 217 | + $this->setBlock($name, $value); | |
| 218 | +			} else if (is_array($value)) { | |
| 219 | + $this->setLoop($name, $value); | |
| 220 | +			} else if (is_scalar($value)) { | |
| 221 | + $this->setVar($name, $value); | |
| 222 | + } | |
| 211 | 223 | |
| 212 | 224 | # ------------------------ | 
| 213 | 225 | |
| @@ -222,7 +234,9 @@ discard block | ||
| 222 | 234 | |
| 223 | 235 |  		public function setArray(array $components) : Block { | 
| 224 | 236 | |
| 225 | - foreach ($components as $name => $component) $this->set($name, $component); | |
| 237 | +			foreach ($components as $name => $component) { | |
| 238 | + $this->set($name, $component); | |
| 239 | + } | |
| 226 | 240 | |
| 227 | 241 | return $this; | 
| 228 | 242 | } | 
| @@ -235,7 +249,9 @@ discard block | ||
| 235 | 249 | |
| 236 | 250 |  		public function setBlock(string $name, Block $block) : Block { | 
| 237 | 251 | |
| 238 | - if (isset($this->blocks[$name])) $this->blocks[$name] = $block; | |
| 252 | +			if (isset($this->blocks[$name])) { | |
| 253 | + $this->blocks[$name] = $block; | |
| 254 | + } | |
| 239 | 255 | |
| 240 | 256 | return $this; | 
| 241 | 257 | } | 
| @@ -248,7 +264,9 @@ discard block | ||
| 248 | 264 | |
| 249 | 265 |  		public function setLoop(string $name, array $items) : Block { | 
| 250 | 266 | |
| 251 | - if (isset($this->loops[$name])) $this->loops[$name]->setItems($items); | |
| 267 | +			if (isset($this->loops[$name])) { | |
| 268 | + $this->loops[$name]->setItems($items); | |
| 269 | + } | |
| 252 | 270 | |
| 253 | 271 | return $this; | 
| 254 | 272 | } | 
| @@ -261,7 +279,9 @@ discard block | ||
| 261 | 279 | |
| 262 | 280 |  		public function setVar(string $name, string $value) : Block { | 
| 263 | 281 | |
| 264 | - if (isset($this->variables[$name])) $this->variables[$name] = $value; | |
| 282 | +			if (isset($this->variables[$name])) { | |
| 283 | + $this->variables[$name] = $value; | |
| 284 | + } | |
| 265 | 285 | |
| 266 | 286 | return $this; | 
| 267 | 287 | } | 
| @@ -374,7 +394,9 @@ discard block | ||
| 374 | 394 | |
| 375 | 395 |  		public function getContents() : string { | 
| 376 | 396 | |
| 377 | - if (!$this->enabled) return ''; | |
| 397 | +			if (!$this->enabled) { | |
| 398 | + return ''; | |
| 399 | + } | |
| 378 | 400 | |
| 379 | 401 | # Lock the block | 
| 380 | 402 | |
| @@ -434,11 +456,17 @@ discard block | ||
| 434 | 456 | |
| 435 | 457 |  		public function __clone() { | 
| 436 | 458 | |
| 437 | - foreach ($this->blocks as $name => $block) $this->blocks[$name] = clone $block; | |
| 459 | +			foreach ($this->blocks as $name => $block) { | |
| 460 | + $this->blocks[$name] = clone $block; | |
| 461 | + } | |
| 438 | 462 | |
| 439 | - foreach ($this->loops as $name => $loop) $this->loops[$name] = clone $loop; | |
| 463 | +			foreach ($this->loops as $name => $loop) { | |
| 464 | + $this->loops[$name] = clone $loop; | |
| 465 | + } | |
| 440 | 466 | |
| 441 | - foreach ($this->items as $name => $item) $this->items[$name] = clone $item; | |
| 467 | +			foreach ($this->items as $name => $item) { | |
| 468 | + $this->items[$name] = clone $item; | |
| 469 | + } | |
| 442 | 470 | } | 
| 443 | 471 | |
| 444 | 472 | /** | 
| @@ -47,10 +47,10 @@ | ||
| 47 | 47 | } | 
| 48 | 48 | |
| 49 | 49 | /** | 
| 50 | - * Get a query attribute | |
| 51 | - * | |
| 52 | - * @return the value or false if the attribute does not exist | |
| 53 | - */ | |
| 50 | + * Get a query attribute | |
| 51 | + * | |
| 52 | + * @return the value or false if the attribute does not exist | |
| 53 | + */ | |
| 54 | 54 | |
| 55 | 55 |  		public function getAttribute(string $name) { | 
| 56 | 56 | |