@@ -80,22 +80,22 @@ discard block |
||
80 | 80 | { |
81 | 81 | return $this->xConfigReader->read($sConfigFile); |
82 | 82 | } |
83 | - catch(YamlExtension $e) |
|
83 | + catch (YamlExtension $e) |
|
84 | 84 | { |
85 | 85 | $sMessage = $this->xTranslator->trans('errors.yaml.install'); |
86 | 86 | throw new SetupException($sMessage); |
87 | 87 | } |
88 | - catch(FileExtension $e) |
|
88 | + catch (FileExtension $e) |
|
89 | 89 | { |
90 | 90 | $sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]); |
91 | 91 | throw new SetupException($sMessage); |
92 | 92 | } |
93 | - catch(FileAccess $e) |
|
93 | + catch (FileAccess $e) |
|
94 | 94 | { |
95 | 95 | $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]); |
96 | 96 | throw new SetupException($sMessage); |
97 | 97 | } |
98 | - catch(FileContent $e) |
|
98 | + catch (FileContent $e) |
|
99 | 99 | { |
100 | 100 | $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]); |
101 | 101 | throw new SetupException($sMessage); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | // Call the config change listeners. |
121 | 121 | $this->xEventManager->onChange($this->xLibConfig, ''); |
122 | 122 | } |
123 | - catch(DataDepth $e) |
|
123 | + catch (DataDepth $e) |
|
124 | 124 | { |
125 | 125 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
126 | 126 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | { |
142 | 142 | try |
143 | 143 | { |
144 | - if(!$this->xLibConfig->setOptions($aOptions, $sKeys)) |
|
144 | + if (!$this->xLibConfig->setOptions($aOptions, $sKeys)) |
|
145 | 145 | { |
146 | 146 | return false; |
147 | 147 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $this->xEventManager->onChange($this->xLibConfig, ''); |
150 | 150 | return true; |
151 | 151 | } |
152 | - catch(DataDepth $e) |
|
152 | + catch (DataDepth $e) |
|
153 | 153 | { |
154 | 154 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
155 | 155 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | { |
262 | 262 | return new Config($aOptions, $sKeys); |
263 | 263 | } |
264 | - catch(DataDepth $e) |
|
264 | + catch (DataDepth $e) |
|
265 | 265 | { |
266 | 266 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
267 | 267 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -79,23 +79,19 @@ discard block |
||
79 | 79 | try |
80 | 80 | { |
81 | 81 | return $this->xConfigReader->read($sConfigFile); |
82 | - } |
|
83 | - catch(YamlExtension $e) |
|
82 | + } catch(YamlExtension $e) |
|
84 | 83 | { |
85 | 84 | $sMessage = $this->xTranslator->trans('errors.yaml.install'); |
86 | 85 | throw new SetupException($sMessage); |
87 | - } |
|
88 | - catch(FileExtension $e) |
|
86 | + } catch(FileExtension $e) |
|
89 | 87 | { |
90 | 88 | $sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]); |
91 | 89 | throw new SetupException($sMessage); |
92 | - } |
|
93 | - catch(FileAccess $e) |
|
90 | + } catch(FileAccess $e) |
|
94 | 91 | { |
95 | 92 | $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]); |
96 | 93 | throw new SetupException($sMessage); |
97 | - } |
|
98 | - catch(FileContent $e) |
|
94 | + } catch(FileContent $e) |
|
99 | 95 | { |
100 | 96 | $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]); |
101 | 97 | throw new SetupException($sMessage); |
@@ -119,8 +115,7 @@ discard block |
||
119 | 115 | $this->xLibConfig->setOptions($this->read($sConfigFile), $sConfigSection); |
120 | 116 | // Call the config change listeners. |
121 | 117 | $this->xEventManager->onChange($this->xLibConfig, ''); |
122 | - } |
|
123 | - catch(DataDepth $e) |
|
118 | + } catch(DataDepth $e) |
|
124 | 119 | { |
125 | 120 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
126 | 121 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -148,8 +143,7 @@ discard block |
||
148 | 143 | // Call the config change listeners. |
149 | 144 | $this->xEventManager->onChange($this->xLibConfig, ''); |
150 | 145 | return true; |
151 | - } |
|
152 | - catch(DataDepth $e) |
|
146 | + } catch(DataDepth $e) |
|
153 | 147 | { |
154 | 148 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
155 | 149 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -260,8 +254,7 @@ discard block |
||
260 | 254 | try |
261 | 255 | { |
262 | 256 | return new Config($aOptions, $sKeys); |
263 | - } |
|
264 | - catch(DataDepth $e) |
|
257 | + } catch(DataDepth $e) |
|
265 | 258 | { |
266 | 259 | $sMessage = $this->xTranslator->trans('errors.data.depth', |
267 | 260 | ['key' => $e->sPrefix, 'depth' => $e->nDepth]); |
@@ -100,29 +100,29 @@ discard block |
||
100 | 100 | public function validateArguments(array $aArguments) |
101 | 101 | { |
102 | 102 | $nArgCount = count($aArguments); |
103 | - if($nArgCount > 2) |
|
103 | + if ($nArgCount > 2) |
|
104 | 104 | { |
105 | 105 | throw new SetupException('The DI attribute requires cannot take more than two arguments.'); |
106 | 106 | } |
107 | - if($this->xTarget === Attribute::TARGET_CLASS) |
|
107 | + if ($this->xTarget === Attribute::TARGET_CLASS) |
|
108 | 108 | { |
109 | - if($nArgCount !== 2) |
|
109 | + if ($nArgCount !== 2) |
|
110 | 110 | { |
111 | 111 | throw new SetupException('When applied to a class, the DI attribute requires two arguments.'); |
112 | 112 | } |
113 | 113 | return; |
114 | 114 | } |
115 | - if($this->xTarget === Attribute::TARGET_METHOD) |
|
115 | + if ($this->xTarget === Attribute::TARGET_METHOD) |
|
116 | 116 | { |
117 | - if($nArgCount !== 1 && $nArgCount !== 2) |
|
117 | + if ($nArgCount !== 1 && $nArgCount !== 2) |
|
118 | 118 | { |
119 | 119 | throw new SetupException('When applied to a method, the DI attribute requires one or two arguments.'); |
120 | 120 | } |
121 | 121 | return; |
122 | 122 | } |
123 | - if($this->xTarget === Attribute::TARGET_PROPERTY) |
|
123 | + if ($this->xTarget === Attribute::TARGET_PROPERTY) |
|
124 | 124 | { |
125 | - if($nArgCount !== 0 && $nArgCount !== 1) |
|
125 | + if ($nArgCount !== 0 && $nArgCount !== 1) |
|
126 | 126 | { |
127 | 127 | throw new SetupException('When applied to a property, the DI attribute requires one or no argument.'); |
128 | 128 | } |
@@ -150,50 +150,50 @@ discard block |
||
150 | 150 | */ |
151 | 151 | protected function validateValues() |
152 | 152 | { |
153 | - if($this->xTarget === Attribute::TARGET_PROPERTY) |
|
153 | + if ($this->xTarget === Attribute::TARGET_PROPERTY) |
|
154 | 154 | { |
155 | 155 | // if($this->sPropertyName !== '') |
156 | 156 | // { |
157 | 157 | // throw new SetupException('The "property" argument must not be set on the DI attribute on a property.'); |
158 | 158 | // } |
159 | 159 | } |
160 | - elseif($this->xTarget === Attribute::TARGET_METHOD) |
|
160 | + elseif ($this->xTarget === Attribute::TARGET_METHOD) |
|
161 | 161 | { |
162 | 162 | // For a method, if only one parameter is provided, then make it the attribute name. |
163 | - if($this->sPropertyName === '' && $this->sPropertyType !== '') |
|
163 | + if ($this->sPropertyName === '' && $this->sPropertyType !== '') |
|
164 | 164 | { |
165 | 165 | $this->sPropertyName = $this->sPropertyType; |
166 | 166 | $this->sPropertyType = ''; |
167 | 167 | } |
168 | - if($this->sPropertyName === '') |
|
168 | + if ($this->sPropertyName === '') |
|
169 | 169 | { |
170 | 170 | throw new SetupException('The "property" argument is mandatory on the DI attribute on a method.'); |
171 | 171 | } |
172 | 172 | } |
173 | 173 | else // if($this->xTarget === Attribute::TARGET_CLASS) |
174 | 174 | { |
175 | - if($this->sPropertyType === '') |
|
175 | + if ($this->sPropertyType === '') |
|
176 | 176 | { |
177 | 177 | throw new SetupException('The "type" argument is mandatory on the DI attribute on a class.'); |
178 | 178 | } |
179 | - if($this->sPropertyName === '') |
|
179 | + if ($this->sPropertyName === '') |
|
180 | 180 | { |
181 | 181 | throw new SetupException('The "property" argument is mandatory on the DI attribute on a class.'); |
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | - if(!$this->validateName()) |
|
185 | + if (!$this->validateName()) |
|
186 | 186 | { |
187 | 187 | throw new SetupException($this->sPropertyName . ' is not a valid "property" value for the DI attribute.'); |
188 | 188 | } |
189 | 189 | // An empty type is allowed on properties and methods... |
190 | - if(($this->sPropertyType !== '' || $this->xTarget === Attribute::TARGET_CLASS) && !$this->validateType()) |
|
190 | + if (($this->sPropertyType !== '' || $this->xTarget === Attribute::TARGET_CLASS) && !$this->validateType()) |
|
191 | 191 | { |
192 | 192 | throw new SetupException($this->sPropertyType . ' is not a valid "type" value for the DI attribute.'); |
193 | 193 | } |
194 | 194 | // But in this case the type must be resolved from the property type. |
195 | 195 | $this->sPropertyType = $this->getFullClassName(); |
196 | - if($this->sPropertyType === '') |
|
196 | + if ($this->sPropertyType === '') |
|
197 | 197 | { |
198 | 198 | throw new SetupException('An empty "type" value is not allowed for the DI attribute.'); |
199 | 199 | } |
@@ -204,29 +204,27 @@ discard block |
||
204 | 204 | */ |
205 | 205 | private function getFullClassName(): string |
206 | 206 | { |
207 | - if($this->sPropertyType === '') |
|
207 | + if ($this->sPropertyType === '') |
|
208 | 208 | { |
209 | 209 | // If no type is provided, take the attribute type. |
210 | 210 | return $this->aPropertyTypes[$this->sPropertyName] ?? ''; |
211 | 211 | } |
212 | - if($this->sPropertyType[0] === '\\') |
|
212 | + if ($this->sPropertyType[0] === '\\') |
|
213 | 213 | { |
214 | 214 | return ltrim($this->sPropertyType, '\\'); |
215 | 215 | } |
216 | 216 | |
217 | 217 | // Try to resolve the full class name |
218 | 218 | $nSeparatorPosition = strpos($this->sPropertyType, '\\'); |
219 | - $sClassprefix = $nSeparatorPosition === false ? $this->sPropertyType : |
|
220 | - substr($this->sPropertyType, 0, $nSeparatorPosition); |
|
221 | - if(isset($this->aImportedTypes[$sClassprefix])) |
|
219 | + $sClassprefix = $nSeparatorPosition === false ? $this->sPropertyType : substr($this->sPropertyType, 0, $nSeparatorPosition); |
|
220 | + if (isset($this->aImportedTypes[$sClassprefix])) |
|
222 | 221 | { |
223 | 222 | // The class namespace is imported. |
224 | - return $nSeparatorPosition === false ? $this->aImportedTypes[$sClassprefix] : |
|
225 | - $this->aImportedTypes[$sClassprefix] . substr($this->sPropertyType, $nSeparatorPosition); |
|
223 | + return $nSeparatorPosition === false ? $this->aImportedTypes[$sClassprefix] : $this->aImportedTypes[$sClassprefix] . substr($this->sPropertyType, $nSeparatorPosition); |
|
226 | 224 | } |
227 | 225 | |
228 | 226 | // The class is in the current namespace. |
229 | - return $this->sNamespace . '\\'. $this->sPropertyType; |
|
227 | + return $this->sNamespace . '\\' . $this->sPropertyType; |
|
230 | 228 | } |
231 | 229 | |
232 | 230 | /** |
@@ -235,7 +233,7 @@ discard block |
||
235 | 233 | */ |
236 | 234 | protected function getValue() |
237 | 235 | { |
238 | - if(is_array($this->xPrevValue)) |
|
236 | + if (is_array($this->xPrevValue)) |
|
239 | 237 | { |
240 | 238 | // Append the current value to the array |
241 | 239 | $this->xPrevValue[$this->sPropertyName] = $this->sPropertyType; |
@@ -156,8 +156,7 @@ discard block |
||
156 | 156 | // { |
157 | 157 | // throw new SetupException('The "property" argument must not be set on the DI attribute on a property.'); |
158 | 158 | // } |
159 | - } |
|
160 | - elseif($this->xTarget === Attribute::TARGET_METHOD) |
|
159 | + } elseif($this->xTarget === Attribute::TARGET_METHOD) |
|
161 | 160 | { |
162 | 161 | // For a method, if only one parameter is provided, then make it the attribute name. |
163 | 162 | if($this->sPropertyName === '' && $this->sPropertyType !== '') |
@@ -169,8 +168,7 @@ discard block |
||
169 | 168 | { |
170 | 169 | throw new SetupException('The "property" argument is mandatory on the DI attribute on a method.'); |
171 | 170 | } |
172 | - } |
|
173 | - else // if($this->xTarget === Attribute::TARGET_CLASS) |
|
171 | + } else // if($this->xTarget === Attribute::TARGET_CLASS) |
|
174 | 172 | { |
175 | 173 | if($this->sPropertyType === '') |
176 | 174 | { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function validateArguments(array $aArguments) |
52 | 52 | { |
53 | - if(count($aArguments) !== 1) |
|
53 | + if (count($aArguments) !== 1) |
|
54 | 54 | { |
55 | 55 | throw new SetupException('The Upload attribute requires only one argument'); |
56 | 56 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function validateValues() |
63 | 63 | { |
64 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $this->sFieldId) > 0) |
|
64 | + if (preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $this->sFieldId) > 0) |
|
65 | 65 | { |
66 | 66 | return; |
67 | 67 | } |
@@ -73,6 +73,6 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected function getValue() |
75 | 75 | { |
76 | - return "'" . $this->sFieldId . "'" ; // The field id is surrounded with simple quotes. |
|
76 | + return "'" . $this->sFieldId . "'"; // The field id is surrounded with simple quotes. |
|
77 | 77 | } |
78 | 78 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function validateArguments(array $aArguments) |
55 | 55 | { |
56 | - if(count($aArguments) !== 1) |
|
56 | + if (count($aArguments) !== 1) |
|
57 | 57 | { |
58 | 58 | throw new SetupException('The DataBag attribute requires only one argument'); |
59 | 59 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | protected function validateValues() |
66 | 66 | { |
67 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $this->sName) > 0) |
|
67 | + if (preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $this->sName) > 0) |
|
68 | 68 | { |
69 | 69 | return; |
70 | 70 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | protected function getValue() |
78 | 78 | { |
79 | - if(is_array($this->xPrevValue)) |
|
79 | + if (is_array($this->xPrevValue)) |
|
80 | 80 | { |
81 | 81 | $this->xPrevValue[] = $this->sName; // Append the current value to the array |
82 | 82 | return $this->xPrevValue; |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function validateArguments(array $aArguments) |
43 | 43 | { |
44 | - if(count($aArguments) !== 0 && count($aArguments) !== 1) |
|
44 | + if (count($aArguments) !== 0 && count($aArguments) !== 1) |
|
45 | 45 | { |
46 | 46 | throw new SetupException('the Exclude attribute requires a single boolean or no argument'); |
47 | 47 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function validateArguments(array $aArguments) |
61 | 61 | { |
62 | - if(count($aArguments) !== 1 && count($aArguments) !== 2) |
|
62 | + if (count($aArguments) !== 1 && count($aArguments) !== 2) |
|
63 | 63 | { |
64 | 64 | throw new SetupException('the Exclude attribute requires a single boolean or no argument'); |
65 | 65 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | protected function validateValues() |
72 | 72 | { |
73 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $this->sMethodName) > 0) |
|
73 | + if (preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $this->sMethodName) > 0) |
|
74 | 74 | { |
75 | 75 | return; |
76 | 76 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | protected function getValue() |
85 | 85 | { |
86 | - if(is_array($this->xPrevValue)) |
|
86 | + if (is_array($this->xPrevValue)) |
|
87 | 87 | { |
88 | 88 | // Add the current value to the array |
89 | 89 | $this->xPrevValue[$this->sMethodName] = $this->aMethodParams; |
@@ -98,24 +98,24 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function addNamespaces(Config $xAppConfig, ?Config $xUserConfig = null) |
100 | 100 | { |
101 | - if(empty($aNamespaces = $xAppConfig->getOptionNames('views'))) |
|
101 | + if (empty($aNamespaces = $xAppConfig->getOptionNames('views'))) |
|
102 | 102 | { |
103 | 103 | return; |
104 | 104 | } |
105 | 105 | $sPackage = $xAppConfig->getOption('package', ''); |
106 | - foreach($aNamespaces as $sNamespace => $sOption) |
|
106 | + foreach ($aNamespaces as $sNamespace => $sOption) |
|
107 | 107 | { |
108 | 108 | // Save the namespace |
109 | 109 | $aNamespace = $xAppConfig->getOption($sOption); |
110 | 110 | $aNamespace['package'] = $sPackage; |
111 | - if(!isset($aNamespace['renderer'])) |
|
111 | + if (!isset($aNamespace['renderer'])) |
|
112 | 112 | { |
113 | 113 | $aNamespace['renderer'] = 'jaxon'; // 'jaxon' is the default renderer. |
114 | 114 | } |
115 | 115 | |
116 | 116 | // If the lib config has defined a template option, then its value must be |
117 | 117 | // read from the app config. |
118 | - if($xUserConfig !== null && isset($aNamespace['template']) && is_array($aNamespace['template'])) |
|
118 | + if ($xUserConfig !== null && isset($aNamespace['template']) && is_array($aNamespace['template'])) |
|
119 | 119 | { |
120 | 120 | $sTemplateOption = $xAppConfig->getOption($sOption . '.template.option'); |
121 | 121 | $sTemplateDefault = $xAppConfig->getOption($sOption . '.template.default'); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $aNamespaces = array_filter($this->aNamespaces, function($aNamespace) use($sId) { |
159 | 159 | return $aNamespace['renderer'] === $sId; |
160 | 160 | }); |
161 | - foreach($aNamespaces as $sNamespace => $aNamespace) |
|
161 | + foreach ($aNamespaces as $sNamespace => $aNamespace) |
|
162 | 162 | { |
163 | 163 | $xRenderer->addNamespace($sNamespace, $aNamespace['directory'], $aNamespace['extension']); |
164 | 164 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function getNamespaceRenderer(string $sNamespace): ?ViewInterface |
193 | 193 | { |
194 | - if(!isset($this->aNamespaces[$sNamespace])) |
|
194 | + if (!isset($this->aNamespaces[$sNamespace])) |
|
195 | 195 | { |
196 | 196 | return null; |
197 | 197 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | protected function store(): Store |
218 | 218 | { |
219 | - if(!$this->xStore) |
|
219 | + if (!$this->xStore) |
|
220 | 220 | { |
221 | 221 | $this->xStore = new Store(); |
222 | 222 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function shareValues(array $aValues): ViewRenderer |
262 | 262 | { |
263 | - foreach($aValues as $sName => $xValue) |
|
263 | + foreach ($aValues as $sName => $xValue) |
|
264 | 264 | { |
265 | 265 | $this->share($sName, $xValue); |
266 | 266 | } |
@@ -284,14 +284,14 @@ discard block |
||
284 | 284 | $sNamespace = $this->sDefaultNamespace; |
285 | 285 | // Get the namespace from the view name |
286 | 286 | $nSeparatorPosition = strrpos($sViewName, '::'); |
287 | - if($nSeparatorPosition !== false) |
|
287 | + if ($nSeparatorPosition !== false) |
|
288 | 288 | { |
289 | 289 | $sNamespace = substr($sViewName, 0, $nSeparatorPosition); |
290 | 290 | $sViewName = substr($sViewName, $nSeparatorPosition + 2); |
291 | 291 | } |
292 | 292 | |
293 | 293 | $xRenderer = $this->getNamespaceRenderer($sNamespace); |
294 | - if(!$xRenderer) |
|
294 | + if (!$xRenderer) |
|
295 | 295 | { |
296 | 296 | // Cannot render a view if there's no renderer corresponding to the namespace. |
297 | 297 | return $this->xEmptyStore; |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | public function html(JxnCall $xJsCall): string |
57 | 57 | { |
58 | 58 | $sClassName = $xJsCall->_class(); |
59 | - if(!$sClassName) |
|
59 | + if (!$sClassName) |
|
60 | 60 | { |
61 | 61 | return ''; |
62 | 62 | } |
63 | 63 | |
64 | 64 | $xCallable = $this->cls->makeRegisteredObject($sClassName); |
65 | - return is_a($xCallable, Component::class) ? (string)$xCallable->html() : ''; |
|
65 | + return is_a($xCallable, Component::class) ? (string) $xCallable->html() : ''; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | { |
114 | 114 | // Only accept arrays of 2 entries. |
115 | 115 | $count = count($on); |
116 | - if($count !== 2) |
|
116 | + if ($count !== 2) |
|
117 | 117 | { |
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | 121 | // Only accept arrays with int index from 0, and string value. |
122 | - for($i = 0; $i < $count; $i++) |
|
122 | + for ($i = 0; $i < $count; $i++) |
|
123 | 123 | { |
124 | - if(!isset($on[$i]) || !is_string($on[$i])) |
|
124 | + if (!isset($on[$i]) || !is_string($on[$i])) |
|
125 | 125 | { |
126 | 126 | return false; |
127 | 127 | } |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @return string |
158 | 158 | */ |
159 | - public function on(string|array $on, JsExpr $xJsExpr): string |
|
159 | + public function on(string | array $on, JsExpr $xJsExpr): string |
|
160 | 160 | { |
161 | 161 | $select = ''; |
162 | 162 | $event = $on; |
163 | - if(is_array($on)) |
|
163 | + if (is_array($on)) |
|
164 | 164 | { |
165 | - if(!$this->checkOn($on)) |
|
165 | + if (!$this->checkOn($on)) |
|
166 | 166 | { |
167 | 167 | return ''; |
168 | 168 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function event(array $on, JsExpr $xJsExpr): string |
198 | 198 | { |
199 | - if(!$this->checkOn($on)) |
|
199 | + if (!$this->checkOn($on)) |
|
200 | 200 | { |
201 | 201 | return ''; |
202 | 202 | } |
@@ -50,8 +50,7 @@ |
||
50 | 50 | */ |
51 | 51 | private function getPageNumber(int $pageNumber): int |
52 | 52 | { |
53 | - return $pageNumber > 0 ? $pageNumber : |
|
54 | - (int)$this->bag($this->bagName())->get($this->bagAttr(), 1); |
|
53 | + return $pageNumber > 0 ? $pageNumber : (int) $this->bag($this->bagName())->get($this->bagAttr(), 1); |
|
55 | 54 | } |
56 | 55 | |
57 | 56 | /** |