@@ -24,11 +24,17 @@ discard block  | 
                                                    ||
| 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,11 +60,12 @@ discard block  | 
                                                    ||
| 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]); } | 
                                                        |
| 60 | -  | 
                                                        |
| 61 | -				catch (\TypeError $e) { /* Ignore setting value of illegal type */ } | 
                                                        |
| 66 | +				try { $this->$name($config[$name]); | 
                                                        |
| 67 | + }  | 
                                                        |
| 68 | +			} catch (\TypeError $e) { /* Ignore setting value of illegal type */ } | 
                                                        |
| 62 | 69 | }  | 
                                                        
| 63 | 70 | }  | 
                                                        
| 64 | 71 | |
@@ -66,7 +73,9 @@ discard block  | 
                                                    ||
| 66 | 73 | |
| 67 | 74 |  		public function post() { | 
                                                        
| 68 | 75 | |
| 69 | -			if ($this->posted || $this->disabled || ('' === $this->key)) return false; | 
                                                        |
| 76 | +			if ($this->posted || $this->disabled || ('' === $this->key)) { | 
                                                        |
| 77 | + return false;  | 
                                                        |
| 78 | + }  | 
                                                        |
| 70 | 79 | |
| 71 | 80 | $this->error = (!$this->set(Request::post($this->name)) && $this->required);  | 
                                                        
| 72 | 81 | |
@@ -100,7 +109,9 @@ discard block  | 
                                                    ||
| 100 | 109 | |
| 101 | 110 |  		public function disabled(bool $value = null) { | 
                                                        
| 102 | 111 | |
| 103 | - if (null === $value) return $this->disabled;  | 
                                                        |
| 112 | +			if (null === $value) { | 
                                                        |
| 113 | + return $this->disabled;  | 
                                                        |
| 114 | + }  | 
                                                        |
| 104 | 115 | |
| 105 | 116 | $this->disabled = $value;  | 
                                                        
| 106 | 117 | }  | 
                                                        
@@ -109,7 +120,9 @@ discard block  | 
                                                    ||
| 109 | 120 | |
| 110 | 121 |  		public function required(bool $value = null) { | 
                                                        
| 111 | 122 | |
| 112 | - if (null === $value) return $this->required;  | 
                                                        |
| 123 | +			if (null === $value) { | 
                                                        |
| 124 | + return $this->required;  | 
                                                        |
| 125 | + }  | 
                                                        |
| 113 | 126 | |
| 114 | 127 | $this->required = $value;  | 
                                                        
| 115 | 128 | }  | 
                                                        
@@ -118,7 +131,9 @@ discard block  | 
                                                    ||
| 118 | 131 | |
| 119 | 132 |  		public function error(bool $value = null) { | 
                                                        
| 120 | 133 | |
| 121 | - if (null === $value) return $this->error;  | 
                                                        |
| 134 | +			if (null === $value) { | 
                                                        |
| 135 | + return $this->error;  | 
                                                        |
| 136 | + }  | 
                                                        |
| 122 | 137 | |
| 123 | 138 | $this->error = $value;  | 
                                                        
| 124 | 139 | }  | 
                                                        
@@ -10,7 +10,9 @@ discard block  | 
                                                    ||
| 10 | 10 | |
| 11 | 11 |  		public function add(string $name, $default, callable $handler) { | 
                                                        
| 12 | 12 | |
| 13 | -			if ('' === $name) return; | 
                                                        |
| 13 | +			if ('' === $name) { | 
                                                        |
| 14 | + return;  | 
                                                        |
| 15 | + }  | 
                                                        |
| 14 | 16 | |
| 15 | 17 | $this->config[$name] = $handler; $this->values[$name] = null;  | 
                                                        
| 16 | 18 | |
@@ -23,11 +25,11 @@ discard block  | 
                                                    ||
| 23 | 25 | |
| 24 | 26 |  			foreach ($data as $name => $value) { | 
                                                        
| 25 | 27 | |
| 26 | - if (!isset($this->config[$name])) continue;  | 
                                                        |
| 27 | -  | 
                                                        |
| 28 | -				try { $this->values[$name] = $this->config[$name]($value); } | 
                                                        |
| 28 | +				if (!isset($this->config[$name])) { | 
                                                        |
| 29 | + continue;  | 
                                                        |
| 30 | + }  | 
                                                        |
| 29 | 31 | |
| 30 | -				catch (\TypeError $e) { /* Ignore setting value of illegal type */ } | 
                                                        |
| 32 | +				try { $this->values[$name] = $this->config[$name]($value); } catch (\TypeError $e) { /* Ignore setting value of illegal type */ } | 
                                                        |
| 31 | 33 | }  | 
                                                        
| 32 | 34 | }  | 
                                                        
| 33 | 35 | |
@@ -39,11 +41,11 @@ discard block  | 
                                                    ||
| 39 | 41 | |
| 40 | 42 |  			foreach ($this->config as $name => $handler) { | 
                                                        
| 41 | 43 | |
| 42 | - if (!($isset = isset($data[$name])) && !$process_all) continue;  | 
                                                        |
| 44 | +				if (!($isset = isset($data[$name])) && !$process_all) { | 
                                                        |
| 45 | + continue;  | 
                                                        |
| 46 | + }  | 
                                                        |
| 43 | 47 | |
| 44 | -				try { $cast[$name] = ($isset ? $handler($data[$name]) : $this->values[$name]); } | 
                                                        |
| 45 | -  | 
                                                        |
| 46 | -				catch (\TypeError $e) { $cast[$name] = $this->values[$name]; } | 
                                                        |
| 48 | +				try { $cast[$name] = ($isset ? $handler($data[$name]) : $this->values[$name]); } catch (\TypeError $e) { $cast[$name] = $this->values[$name]; } | 
                                                        |
| 47 | 49 | }  | 
                                                        
| 48 | 50 | |
| 49 | 51 | # ------------------------  | 
                                                        
@@ -55,7 +57,9 @@ discard block  | 
                                                    ||
| 55 | 57 | |
| 56 | 58 |  		public function get(string $name = null) { | 
                                                        
| 57 | 59 | |
| 58 | - if (null === $name) return $this->values;  | 
                                                        |
| 60 | +			if (null === $name) { | 
                                                        |
| 61 | + return $this->values;  | 
                                                        |
| 62 | + }  | 
                                                        |
| 59 | 63 | |
| 60 | 64 | return ($this->values[$name] ?? null);  | 
                                                        
| 61 | 65 | }  | 
                                                        
@@ -27,13 +27,13 @@ discard block  | 
                                                    ||
| 27 | 27 | |
| 28 | 28 |  			$query = ("DELETE rla FROM " . static::$table_relations . " rla ") . | 
                                                        
| 29 | 29 | |
| 30 | -			         ("JOIN "  . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") . | 
                                                        |
| 30 | +					 ("JOIN "  . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") . | 
                                                        |
| 31 | 31 | |
| 32 | -			         ("LEFT JOIN " . static::$table_relations . " rlx ") . | 
                                                        |
| 32 | +					 ("LEFT JOIN " . static::$table_relations . " rlx ") . | 
                                                        |
| 33 | 33 | |
| 34 | -			         ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") . | 
                                                        |
| 34 | +					 ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") . | 
                                                        |
| 35 | 35 | |
| 36 | -			         ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL"); | 
                                                        |
| 36 | +					 ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL"); | 
                                                        |
| 37 | 37 | |
| 38 | 38 | if (!(DB::send($query) && DB::last()->status)) return false;  | 
                                                        
| 39 | 39 | |
@@ -52,13 +52,13 @@ discard block  | 
                                                    ||
| 52 | 52 | |
| 53 | 53 |  			$query = ("INSERT INTO " . static::$table_relations . " (ancestor, descendant, depth) ") . | 
                                                        
| 54 | 54 | |
| 55 | -			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") . | 
                                                        |
| 55 | +					 ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") . | 
                                                        |
| 56 | 56 | |
| 57 | -			         ("FROM " . static::$table_relations . " sup ") . | 
                                                        |
| 57 | +					 ("FROM " . static::$table_relations . " sup ") . | 
                                                        |
| 58 | 58 | |
| 59 | -			         ("JOIN " . static::$table_relations . " sub ") . | 
                                                        |
| 59 | +					 ("JOIN " . static::$table_relations . " sub ") . | 
                                                        |
| 60 | 60 | |
| 61 | -			         ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id); | 
                                                        |
| 61 | +					 ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id); | 
                                                        |
| 62 | 62 | |
| 63 | 63 | if (!(DB::send($query) && DB::last()->status)) return false;  | 
                                                        
| 64 | 64 | |
@@ -25,15 +25,15 @@ discard block  | 
                                                    ||
| 25 | 25 | |
| 26 | 26 |  		private function disconnectSubtree() { | 
                                                        
| 27 | 27 | |
| 28 | -			$query = ("DELETE rla FROM " . static::$table_relations . " rla ") . | 
                                                        |
| 28 | +			$query = ("DELETE rla FROM ".static::$table_relations." rla "). | 
                                                        |
| 29 | 29 | |
| 30 | -			         ("JOIN "  . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") . | 
                                                        |
| 30 | +			         ("JOIN ".static::$table_relations." rlb ON rlb.descendant = rla.descendant "). | 
                                                        |
| 31 | 31 | |
| 32 | -			         ("LEFT JOIN " . static::$table_relations . " rlx ") . | 
                                                        |
| 32 | +			         ("LEFT JOIN ".static::$table_relations." rlx "). | 
                                                        |
| 33 | 33 | |
| 34 | -			         ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") . | 
                                                        |
| 34 | +			         ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor "). | 
                                                        |
| 35 | 35 | |
| 36 | -			         ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL"); | 
                                                        |
| 36 | +			         ("WHERE rlb.ancestor = ".$this->id." AND rlx.ancestor IS NULL"); | 
                                                        |
| 37 | 37 | |
| 38 | 38 | if (!(DB::send($query) && DB::last()->status)) return false;  | 
                                                        
| 39 | 39 | |
@@ -50,15 +50,15 @@ discard block  | 
                                                    ||
| 50 | 50 | |
| 51 | 51 |  		private function connectSubtree(int $parent_id) { | 
                                                        
| 52 | 52 | |
| 53 | -			$query = ("INSERT INTO " . static::$table_relations . " (ancestor, descendant, depth) ") . | 
                                                        |
| 53 | +			$query = ("INSERT INTO ".static::$table_relations." (ancestor, descendant, depth) "). | 
                                                        |
| 54 | 54 | |
| 55 | -			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") . | 
                                                        |
| 55 | +			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 "). | 
                                                        |
| 56 | 56 | |
| 57 | -			         ("FROM " . static::$table_relations . " sup ") . | 
                                                        |
| 57 | +			         ("FROM ".static::$table_relations." sup "). | 
                                                        |
| 58 | 58 | |
| 59 | -			         ("JOIN " . static::$table_relations . " sub ") . | 
                                                        |
| 59 | +			         ("JOIN ".static::$table_relations." sub "). | 
                                                        |
| 60 | 60 | |
| 61 | -			         ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id); | 
                                                        |
| 61 | +			         ("WHERE sub.ancestor = ".$this->id." AND sup.descendant = ".$parent_id); | 
                                                        |
| 62 | 62 | |
| 63 | 63 | if (!(DB::send($query) && DB::last()->status)) return false;  | 
                                                        
| 64 | 64 | |