@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | trait Traits_Classable |
| 27 | 27 | { |
| 28 | - /** |
|
| 29 | - * @var string[] |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * @var string[] |
|
| 30 | + */ |
|
| 31 | 31 | protected array $classes = array(); |
| 32 | 32 | |
| 33 | 33 | public function hasClasses() : bool |
@@ -82,30 +82,30 @@ discard block |
||
| 82 | 82 | return $this; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Retrieves a list of all classes, if any. |
|
| 87 | - * |
|
| 88 | - * @return string[] |
|
| 89 | - */ |
|
| 85 | + /** |
|
| 86 | + * Retrieves a list of all classes, if any. |
|
| 87 | + * |
|
| 88 | + * @return string[] |
|
| 89 | + */ |
|
| 90 | 90 | public function getClasses() : array |
| 91 | 91 | { |
| 92 | 92 | return $this->classes; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * Renders the class names list as space-separated string for use in an HTML tag. |
|
| 97 | - * |
|
| 98 | - * @return string |
|
| 99 | - */ |
|
| 95 | + /** |
|
| 96 | + * Renders the class names list as space-separated string for use in an HTML tag. |
|
| 97 | + * |
|
| 98 | + * @return string |
|
| 99 | + */ |
|
| 100 | 100 | public function classesToString() : string |
| 101 | 101 | { |
| 102 | 102 | return implode(' ', $this->classes); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Renders the "class" attribute string for inserting into an HTML tag. |
|
| 107 | - * @return string |
|
| 108 | - */ |
|
| 105 | + /** |
|
| 106 | + * Renders the "class" attribute string for inserting into an HTML tag. |
|
| 107 | + * @return string |
|
| 108 | + */ |
|
| 109 | 109 | public function classesToAttribute() : string |
| 110 | 110 | { |
| 111 | 111 | if(!empty($this->classes)) |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function addClass($name) |
| 43 | 43 | { |
| 44 | - if(!in_array($name, $this->classes, true)) { |
|
| 44 | + if (!in_array($name, $this->classes, true)) { |
|
| 45 | 45 | $this->classes[] = $name; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function addClasses(array $names) : self |
| 56 | 56 | { |
| 57 | - foreach($names as $name) { |
|
| 57 | + foreach ($names as $name) { |
|
| 58 | 58 | $this->addClass($name); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $idx = array_search($name, $this->classes, true); |
| 76 | 76 | |
| 77 | - if($idx !== false) { |
|
| 77 | + if ($idx !== false) { |
|
| 78 | 78 | unset($this->classes[$idx]); |
| 79 | 79 | sort($this->classes); |
| 80 | 80 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function classesToAttribute() : string |
| 110 | 110 | { |
| 111 | - if(!empty($this->classes)) |
|
| 111 | + if (!empty($this->classes)) |
|
| 112 | 112 | { |
| 113 | 113 | return sprintf( |
| 114 | 114 | ' class="%s" ', |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | trait Traits_Optionable |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * @var array<string,mixed>|NULL |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * @var array<string,mixed>|NULL |
|
| 31 | + */ |
|
| 32 | 32 | protected ?array $options = null; |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -49,13 +49,13 @@ discard block |
||
| 49 | 49 | return $this; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Sets a collection of options at once, from an |
|
| 54 | - * associative array. |
|
| 55 | - * |
|
| 56 | - * @param array<string,mixed> $options |
|
| 57 | - * @return $this |
|
| 58 | - */ |
|
| 52 | + /** |
|
| 53 | + * Sets a collection of options at once, from an |
|
| 54 | + * associative array. |
|
| 55 | + * |
|
| 56 | + * @param array<string,mixed> $options |
|
| 57 | + * @return $this |
|
| 58 | + */ |
|
| 59 | 59 | public function setOptions(array $options) : self |
| 60 | 60 | { |
| 61 | 61 | foreach($options as $name => $value) { |
@@ -65,16 +65,16 @@ discard block |
||
| 65 | 65 | return $this; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Retrieves an option's value. |
|
| 70 | - * |
|
| 71 | - * NOTE: Use the specialized type getters to ensure an option |
|
| 72 | - * contains the expected type (for ex. getArrayOption()). |
|
| 73 | - * |
|
| 74 | - * @param string $name |
|
| 75 | - * @param mixed $default The default value to return if the option does not exist. |
|
| 76 | - * @return mixed |
|
| 77 | - */ |
|
| 68 | + /** |
|
| 69 | + * Retrieves an option's value. |
|
| 70 | + * |
|
| 71 | + * NOTE: Use the specialized type getters to ensure an option |
|
| 72 | + * contains the expected type (for ex. getArrayOption()). |
|
| 73 | + * |
|
| 74 | + * @param string $name |
|
| 75 | + * @param mixed $default The default value to return if the option does not exist. |
|
| 76 | + * @return mixed |
|
| 77 | + */ |
|
| 78 | 78 | public function getOption(string $name, $default=null) |
| 79 | 79 | { |
| 80 | 80 | if(!isset($this->options)) |
@@ -85,16 +85,16 @@ discard block |
||
| 85 | 85 | return $this->options[$name] ?? $default; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Enforces that the option value is a string. Numbers are converted |
|
| 90 | - * to string, strings are passed through, and all other types will |
|
| 91 | - * return the default value. The default value is also returned if |
|
| 92 | - * the string is empty. |
|
| 93 | - * |
|
| 94 | - * @param string $name |
|
| 95 | - * @param string $default Used if the option does not exist, is invalid, or empty. |
|
| 96 | - * @return string |
|
| 97 | - */ |
|
| 88 | + /** |
|
| 89 | + * Enforces that the option value is a string. Numbers are converted |
|
| 90 | + * to string, strings are passed through, and all other types will |
|
| 91 | + * return the default value. The default value is also returned if |
|
| 92 | + * the string is empty. |
|
| 93 | + * |
|
| 94 | + * @param string $name |
|
| 95 | + * @param string $default Used if the option does not exist, is invalid, or empty. |
|
| 96 | + * @return string |
|
| 97 | + */ |
|
| 98 | 98 | public function getStringOption(string $name, string $default='') : string |
| 99 | 99 | { |
| 100 | 100 | $value = $this->getOption($name, false); |
@@ -126,15 +126,15 @@ discard block |
||
| 126 | 126 | return $default; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * Treats the option value as an integer value: will return |
|
| 131 | - * valid integer values (also from integer strings), or the |
|
| 132 | - * default value otherwise. |
|
| 133 | - * |
|
| 134 | - * @param string $name |
|
| 135 | - * @param int $default |
|
| 136 | - * @return int |
|
| 137 | - */ |
|
| 129 | + /** |
|
| 130 | + * Treats the option value as an integer value: will return |
|
| 131 | + * valid integer values (also from integer strings), or the |
|
| 132 | + * default value otherwise. |
|
| 133 | + * |
|
| 134 | + * @param string $name |
|
| 135 | + * @param int $default |
|
| 136 | + * @return int |
|
| 137 | + */ |
|
| 138 | 138 | public function getIntOption(string $name, int $default=0) : int |
| 139 | 139 | { |
| 140 | 140 | $value = $this->getOption($name); |
@@ -145,14 +145,14 @@ discard block |
||
| 145 | 145 | return $default; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - /** |
|
| 149 | - * Treats an option as an array, and returns its value |
|
| 150 | - * only if it contains an array - otherwise, an empty |
|
| 151 | - * array is returned. |
|
| 152 | - * |
|
| 153 | - * @param string $name |
|
| 154 | - * @return array<int|string,mixed> |
|
| 155 | - */ |
|
| 148 | + /** |
|
| 149 | + * Treats an option as an array, and returns its value |
|
| 150 | + * only if it contains an array - otherwise, an empty |
|
| 151 | + * array is returned. |
|
| 152 | + * |
|
| 153 | + * @param string $name |
|
| 154 | + * @return array<int|string,mixed> |
|
| 155 | + */ |
|
| 156 | 156 | public function getArrayOption(string $name) : array |
| 157 | 157 | { |
| 158 | 158 | $val = $this->getOption($name); |
@@ -163,13 +163,13 @@ discard block |
||
| 163 | 163 | return array(); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - /** |
|
| 167 | - * Checks whether the specified option exists - even |
|
| 168 | - * if it has a NULL value. |
|
| 169 | - * |
|
| 170 | - * @param string $name |
|
| 171 | - * @return bool |
|
| 172 | - */ |
|
| 166 | + /** |
|
| 167 | + * Checks whether the specified option exists - even |
|
| 168 | + * if it has a NULL value. |
|
| 169 | + * |
|
| 170 | + * @param string $name |
|
| 171 | + * @return bool |
|
| 172 | + */ |
|
| 173 | 173 | public function hasOption(string $name) : bool |
| 174 | 174 | { |
| 175 | 175 | if(!isset($this->options)) { |
@@ -179,11 +179,11 @@ discard block |
||
| 179 | 179 | return array_key_exists($name, $this->options); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - /** |
|
| 183 | - * Returns all options in one associative array. |
|
| 184 | - * |
|
| 185 | - * @return array<string,mixed> |
|
| 186 | - */ |
|
| 182 | + /** |
|
| 183 | + * Returns all options in one associative array. |
|
| 184 | + * |
|
| 185 | + * @return array<string,mixed> |
|
| 186 | + */ |
|
| 187 | 187 | public function getOptions() : array |
| 188 | 188 | { |
| 189 | 189 | if(!isset($this->options)) { |
@@ -193,13 +193,13 @@ discard block |
||
| 193 | 193 | return $this->options; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - /** |
|
| 197 | - * Checks whether the option's value is the one specified. |
|
| 198 | - * |
|
| 199 | - * @param string $name |
|
| 200 | - * @param mixed $value |
|
| 201 | - * @return bool |
|
| 202 | - */ |
|
| 196 | + /** |
|
| 197 | + * Checks whether the option's value is the one specified. |
|
| 198 | + * |
|
| 199 | + * @param string $name |
|
| 200 | + * @param mixed $value |
|
| 201 | + * @return bool |
|
| 202 | + */ |
|
| 203 | 203 | public function isOption(string $name, $value) : bool |
| 204 | 204 | { |
| 205 | 205 | return $this->getOption($name) === $value; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function setOption(string $name, $value) : self |
| 43 | 43 | { |
| 44 | - if(!isset($this->options)) { |
|
| 44 | + if (!isset($this->options)) { |
|
| 45 | 45 | $this->options = $this->getDefaultOptions(); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function setOptions(array $options) : self |
| 60 | 60 | { |
| 61 | - foreach($options as $name => $value) { |
|
| 61 | + foreach ($options as $name => $value) { |
|
| 62 | 62 | $this->setOption($name, $value); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | * @param mixed $default The default value to return if the option does not exist. |
| 76 | 76 | * @return mixed |
| 77 | 77 | */ |
| 78 | - public function getOption(string $name, $default=null) |
|
| 78 | + public function getOption(string $name, $default = null) |
|
| 79 | 79 | { |
| 80 | - if(!isset($this->options)) |
|
| 80 | + if (!isset($this->options)) |
|
| 81 | 81 | { |
| 82 | 82 | $this->options = $this->getDefaultOptions(); |
| 83 | 83 | } |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | * @param string $default Used if the option does not exist, is invalid, or empty. |
| 96 | 96 | * @return string |
| 97 | 97 | */ |
| 98 | - public function getStringOption(string $name, string $default='') : string |
|
| 98 | + public function getStringOption(string $name, string $default = '') : string |
|
| 99 | 99 | { |
| 100 | 100 | $value = $this->getOption($name, false); |
| 101 | 101 | |
| 102 | - if((is_string($value) || is_numeric($value)) && !empty($value)) { |
|
| 102 | + if ((is_string($value) || is_numeric($value)) && !empty($value)) { |
|
| 103 | 103 | return (string)$value; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | * @param bool $default |
| 117 | 117 | * @return bool |
| 118 | 118 | */ |
| 119 | - public function getBoolOption(string $name, bool $default=false) : bool |
|
| 119 | + public function getBoolOption(string $name, bool $default = false) : bool |
|
| 120 | 120 | { |
| 121 | - if($this->getOption($name) === true) |
|
| 121 | + if ($this->getOption($name) === true) |
|
| 122 | 122 | { |
| 123 | 123 | return true; |
| 124 | 124 | } |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | * @param int $default |
| 136 | 136 | * @return int |
| 137 | 137 | */ |
| 138 | - public function getIntOption(string $name, int $default=0) : int |
|
| 138 | + public function getIntOption(string $name, int $default = 0) : int |
|
| 139 | 139 | { |
| 140 | 140 | $value = $this->getOption($name); |
| 141 | - if(ConvertHelper::isInteger($value)) { |
|
| 141 | + if (ConvertHelper::isInteger($value)) { |
|
| 142 | 142 | return (int)$value; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function getArrayOption(string $name) : array |
| 157 | 157 | { |
| 158 | 158 | $val = $this->getOption($name); |
| 159 | - if(is_array($val)) { |
|
| 159 | + if (is_array($val)) { |
|
| 160 | 160 | return $val; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function hasOption(string $name) : bool |
| 174 | 174 | { |
| 175 | - if(!isset($this->options)) { |
|
| 175 | + if (!isset($this->options)) { |
|
| 176 | 176 | $this->options = $this->getDefaultOptions(); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function getOptions() : array |
| 188 | 188 | { |
| 189 | - if(!isset($this->options)) { |
|
| 189 | + if (!isset($this->options)) { |
|
| 190 | 190 | $this->options = $this->getDefaultOptions(); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -56,12 +56,12 @@ |
||
| 56 | 56 | */ |
| 57 | 57 | public static function value2string($value) : string |
| 58 | 58 | { |
| 59 | - if($value === true) |
|
| 59 | + if ($value === true) |
|
| 60 | 60 | { |
| 61 | 61 | return 'true'; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if($value === false) |
|
| 64 | + if ($value === false) |
|
| 65 | 65 | { |
| 66 | 66 | return 'false'; |
| 67 | 67 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | * @param bool $enabled |
| 54 | 54 | * @return $this |
| 55 | 55 | */ |
| 56 | - public function prop(string $name, bool $enabled=true) : self; |
|
| 56 | + public function prop(string $name, bool $enabled = true) : self; |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @param string $name |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param mixed $default The default value to return if the option does not exist. |
| 46 | 46 | * @return mixed |
| 47 | 47 | */ |
| 48 | - public function getOption(string $name, $default=null); |
|
| 48 | + public function getOption(string $name, $default = null); |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @param string $name |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function getArrayOption(string $name) : array; |
| 55 | 55 | |
| 56 | - public function getIntOption(string $name, int $default=0) : int; |
|
| 56 | + public function getIntOption(string $name, int $default = 0) : int; |
|
| 57 | 57 | |
| 58 | - public function getBoolOption(string $name, bool $default=false) : bool; |
|
| 58 | + public function getBoolOption(string $name, bool $default = false) : bool; |
|
| 59 | 59 | |
| 60 | - public function getStringOption(string $name, string $default='') : string; |
|
| 60 | + public function getStringOption(string $name, string $default = '') : string; |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Sets a collection of options at once, from an |
@@ -23,44 +23,44 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class Request_URLComparer |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @var Request |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var Request |
|
| 28 | + */ |
|
| 29 | 29 | protected Request $request; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var string |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var string |
|
| 33 | + */ |
|
| 34 | 34 | protected string $sourceURL; |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 36 | + /** |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | 39 | protected string $targetURL; |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @var string[] |
|
| 43 | - */ |
|
| 41 | + /** |
|
| 42 | + * @var string[] |
|
| 43 | + */ |
|
| 44 | 44 | protected array $limitParams = array(); |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @var bool |
|
| 48 | - */ |
|
| 46 | + /** |
|
| 47 | + * @var bool |
|
| 48 | + */ |
|
| 49 | 49 | protected bool $isMatch = false; |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @var bool |
|
| 53 | - */ |
|
| 51 | + /** |
|
| 52 | + * @var bool |
|
| 53 | + */ |
|
| 54 | 54 | protected bool $ignoreFragment = true; |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @var URLInfo |
|
| 58 | - */ |
|
| 56 | + /** |
|
| 57 | + * @var URLInfo |
|
| 58 | + */ |
|
| 59 | 59 | protected URLInfo $sourceInfo; |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @var URLInfo |
|
| 63 | - */ |
|
| 61 | + /** |
|
| 62 | + * @var URLInfo |
|
| 63 | + */ |
|
| 64 | 64 | protected URLInfo $targetInfo; |
| 65 | 65 | |
| 66 | 66 | public function __construct(Request $request, string $sourceURL, string $targetURL) |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | public function addLimitParam(string $name) : Request_URLComparer |
| 83 | 83 | { |
| 84 | - if(!in_array($name, $this->limitParams, true)) |
|
| 84 | + if (!in_array($name, $this->limitParams, true)) |
|
| 85 | 85 | { |
| 86 | 86 | $this->limitParams[] = $name; |
| 87 | 87 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function addLimitParams(array $names) : Request_URLComparer |
| 97 | 97 | { |
| 98 | - foreach($names as $name) |
|
| 98 | + foreach ($names as $name) |
|
| 99 | 99 | { |
| 100 | 100 | $this->addLimitParam($name); |
| 101 | 101 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | return $this; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function setIgnoreFragment(bool $ignore=true) : Request_URLComparer |
|
| 106 | + public function setIgnoreFragment(bool $ignore = true) : Request_URLComparer |
|
| 107 | 107 | { |
| 108 | 108 | $this->ignoreFragment = $ignore; |
| 109 | 109 | return $this; |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | 'query' |
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | - if(!$this->ignoreFragment) { |
|
| 129 | + if (!$this->ignoreFragment) { |
|
| 130 | 130 | $keys[] = 'fragment'; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - foreach($keys as $key) |
|
| 133 | + foreach ($keys as $key) |
|
| 134 | 134 | { |
| 135 | - if(!$this->compareKey($key)) { |
|
| 135 | + if (!$this->compareKey($key)) { |
|
| 136 | 136 | return false; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $filter = 'filter_'.$key; |
| 149 | 149 | |
| 150 | - if(method_exists($this, $filter)) |
|
| 150 | + if (method_exists($this, $filter)) |
|
| 151 | 151 | { |
| 152 | 152 | $sVal = $this->$filter($sVal); |
| 153 | 153 | $tVal = $this->$filter($tVal); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | protected function filter_path(string $path) : string |
| 160 | 160 | { |
| 161 | 161 | // fix double slashes in URLs |
| 162 | - while(strpos($path, '//') !== false) |
|
| 162 | + while (strpos($path, '//') !== false) |
|
| 163 | 163 | { |
| 164 | 164 | $path = str_replace('//', '/', $path); |
| 165 | 165 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | protected function filter_query(string $query) : string |
| 171 | 171 | { |
| 172 | - if(empty($query)) { |
|
| 172 | + if (empty($query)) { |
|
| 173 | 173 | return ''; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -188,15 +188,15 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | protected function limitParams(array $params) : array |
| 190 | 190 | { |
| 191 | - if(empty($this->limitParams)) { |
|
| 191 | + if (empty($this->limitParams)) { |
|
| 192 | 192 | return $params; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | $keep = array(); |
| 196 | 196 | |
| 197 | - foreach($this->limitParams as $name) |
|
| 197 | + foreach ($this->limitParams as $name) |
|
| 198 | 198 | { |
| 199 | - if(isset($params[$name])) { |
|
| 199 | + if (isset($params[$name])) { |
|
| 200 | 200 | $keep[$name] = $params[$name]; |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -35,8 +35,7 @@ |
||
| 35 | 35 | try |
| 36 | 36 | { |
| 37 | 37 | return $this->render(); |
| 38 | - } |
|
| 39 | - catch (Throwable $e) |
|
| 38 | + } catch (Throwable $e) |
|
| 40 | 39 | { |
| 41 | 40 | return sprintf( |
| 42 | 41 | 'Exception while rendering [%s]: %s', |
@@ -35,8 +35,7 @@ |
||
| 35 | 35 | try |
| 36 | 36 | { |
| 37 | 37 | return $this->render(); |
| 38 | - } |
|
| 39 | - catch (Throwable $e) |
|
| 38 | + } catch (Throwable $e) |
|
| 40 | 39 | { |
| 41 | 40 | return sprintf( |
| 42 | 41 | 'Exception while rendering [%s]: %s', |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | * @param bool $forceNew |
| 13 | 13 | * @return NumberInfo |
| 14 | 14 | */ |
| 15 | -function parseNumber($value, bool $forceNew=false) |
|
| 15 | +function parseNumber($value, bool $forceNew = false) |
|
| 16 | 16 | { |
| 17 | - if($value instanceof NumberInfo && $forceNew !== true) { |
|
| 17 | + if ($value instanceof NumberInfo && $forceNew !== true) { |
|
| 18 | 18 | return $value; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $args = func_get_args(); |
| 110 | 110 | |
| 111 | 111 | // is the localization package installed? |
| 112 | - if(function_exists('\AppLocalize\t')) |
|
| 112 | + if (function_exists('\AppLocalize\t')) |
|
| 113 | 113 | { |
| 114 | 114 | return call_user_func_array('\AppLocalize\t', $args); |
| 115 | 115 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param bool $initial The initial boolean value to use. |
| 125 | 125 | * @return Value_Bool |
| 126 | 126 | */ |
| 127 | -function valBool(bool $initial=false) : Value_Bool |
|
| 127 | +function valBool(bool $initial = false) : Value_Bool |
|
| 128 | 128 | { |
| 129 | 129 | return new Value_Bool($initial); |
| 130 | 130 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param bool $initial |
| 138 | 138 | * @return Value_Bool_True |
| 139 | 139 | */ |
| 140 | -function valBoolTrue(bool $initial=false) : Value_Bool_True |
|
| 140 | +function valBoolTrue(bool $initial = false) : Value_Bool_True |
|
| 141 | 141 | { |
| 142 | 142 | return new Value_Bool_True($initial); |
| 143 | 143 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param bool $initial |
| 151 | 151 | * @return Value_Bool_False |
| 152 | 152 | */ |
| 153 | -function valBoolFalse(bool $initial=true) : Value_Bool_False |
|
| 153 | +function valBoolFalse(bool $initial = true) : Value_Bool_False |
|
| 154 | 154 | { |
| 155 | 155 | return new Value_Bool_False($initial); |
| 156 | 156 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | function init() : void |
| 183 | 183 | { |
| 184 | - if(!class_exists('\AppLocalize\Localization')) { |
|
| 184 | + if (!class_exists('\AppLocalize\Localization')) { |
|
| 185 | 185 | return; |
| 186 | 186 | } |
| 187 | 187 | |