@@ -134,8 +134,7 @@ discard block |
||
134 | 134 | if(is_array($sValue)) |
135 | 135 | { |
136 | 136 | $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
137 | - } |
|
138 | - elseif(is_string($sValue)) |
|
137 | + } elseif(is_string($sValue)) |
|
139 | 138 | { |
140 | 139 | $this->aProtectedMethods[] = $sValue; |
141 | 140 | } |
@@ -192,8 +191,7 @@ discard block |
||
192 | 191 | $parameterInstances[] = $di->get($parameter->getClass()->getName()); |
193 | 192 | } |
194 | 193 | $this->registeredObject = $this->reflectionClass->newInstanceArgs($parameterInstances); |
195 | - } |
|
196 | - else |
|
194 | + } else |
|
197 | 195 | { |
198 | 196 | $this->registeredObject = $this->reflectionClass->newInstance(); |
199 | 197 | } |
@@ -120,22 +120,22 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function configure($sName, $sValue) |
122 | 122 | { |
123 | - switch($sName) |
|
123 | + switch ($sName) |
|
124 | 124 | { |
125 | 125 | // Set the separator |
126 | 126 | case 'separator': |
127 | - if($sValue == '_' || $sValue == '.') |
|
127 | + if ($sValue == '_' || $sValue == '.') |
|
128 | 128 | { |
129 | 129 | $this->separator = $sValue; |
130 | 130 | } |
131 | 131 | break; |
132 | 132 | // Set the protected methods |
133 | 133 | case 'protected': |
134 | - if(is_array($sValue)) |
|
134 | + if (is_array($sValue)) |
|
135 | 135 | { |
136 | 136 | $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
137 | 137 | } |
138 | - elseif(is_string($sValue)) |
|
138 | + elseif (is_string($sValue)) |
|
139 | 139 | { |
140 | 140 | $this->aProtectedMethods[] = $sValue; |
141 | 141 | } |
@@ -153,16 +153,16 @@ discard block |
||
153 | 153 | public function getMethods() |
154 | 154 | { |
155 | 155 | $aMethods = []; |
156 | - foreach($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
156 | + foreach ($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
157 | 157 | { |
158 | 158 | $sMethodName = $xMethod->getShortName(); |
159 | 159 | // Don't take magic __call, __construct, __destruct methods |
160 | - if(strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__') |
|
160 | + if (strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__') |
|
161 | 161 | { |
162 | 162 | continue; |
163 | 163 | } |
164 | 164 | // Don't take excluded methods |
165 | - if(in_array($sMethodName, $this->aProtectedMethods)) |
|
165 | + if (in_array($sMethodName, $this->aProtectedMethods)) |
|
166 | 166 | { |
167 | 167 | continue; |
168 | 168 | } |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function getRegisteredObject() |
180 | 180 | { |
181 | - if($this->registeredObject == null) |
|
181 | + if ($this->registeredObject == null) |
|
182 | 182 | { |
183 | 183 | $di = jaxon()->di(); |
184 | 184 | // Use the Reflection class to get the parameters of the constructor |
185 | - if(($constructor = $this->reflectionClass->getConstructor()) != null) |
|
185 | + if (($constructor = $this->reflectionClass->getConstructor()) != null) |
|
186 | 186 | { |
187 | 187 | $parameters = $constructor->getParameters(); |
188 | 188 | $parameterInstances = []; |
189 | - foreach($parameters as $parameter) |
|
189 | + foreach ($parameters as $parameter) |
|
190 | 190 | { |
191 | 191 | // Get the parameter instance from the DI |
192 | 192 | $parameterInstances[] = $di->get($parameter->getClass()->getName()); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function call($sMethod, $aArgs) |
225 | 225 | { |
226 | - if(!$this->hasMethod($sMethod)) |
|
226 | + if (!$this->hasMethod($sMethod)) |
|
227 | 227 | { |
228 | 228 | return; |
229 | 229 | } |
@@ -243,8 +243,7 @@ |
||
243 | 243 | if($sName == 'separator' || $sName == 'protected') |
244 | 244 | { |
245 | 245 | $xCallableObject->configure($sName, $xValue); |
246 | - } |
|
247 | - elseif(is_array($xValue) && $sName != 'include') |
|
246 | + } elseif(is_array($xValue) && $sName != 'include') |
|
248 | 247 | { |
249 | 248 | // These options are to be included in javascript code. |
250 | 249 | $this->aCallableOptions[$sClassName][$sName] = $xValue; |
@@ -91,19 +91,19 @@ discard block |
||
91 | 91 | private function getClassOptions($sClassName, array $aDirectoryOptions, array $aDefaultOptions = []) |
92 | 92 | { |
93 | 93 | $aOptions = $aDefaultOptions; |
94 | - if(key_exists('separator', $aDirectoryOptions)) |
|
94 | + if (key_exists('separator', $aDirectoryOptions)) |
|
95 | 95 | { |
96 | 96 | $aOptions['separator'] = $aDirectoryOptions['separator']; |
97 | 97 | } |
98 | - if(key_exists('protected', $aDirectoryOptions)) |
|
98 | + if (key_exists('protected', $aDirectoryOptions)) |
|
99 | 99 | { |
100 | 100 | $aOptions['protected'] = $aDirectoryOptions['protected']; |
101 | 101 | } |
102 | - if(key_exists('*', $aDirectoryOptions)) |
|
102 | + if (key_exists('*', $aDirectoryOptions)) |
|
103 | 103 | { |
104 | 104 | $aOptions = array_merge($aOptions, $aDirectoryOptions['*']); |
105 | 105 | } |
106 | - if(key_exists($sClassName, $aDirectoryOptions)) |
|
106 | + if (key_exists($sClassName, $aDirectoryOptions)) |
|
107 | 107 | { |
108 | 108 | $aOptions = array_merge($aOptions, $aDirectoryOptions[$sClassName]); |
109 | 109 | } |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
124 | 124 | $itFile = new RecursiveIteratorIterator($itDir); |
125 | 125 | // Iterate on dir content |
126 | - foreach($itFile as $xFile) |
|
126 | + foreach ($itFile as $xFile) |
|
127 | 127 | { |
128 | 128 | // skip everything except PHP files |
129 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
129 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
130 | 130 | { |
131 | 131 | continue; |
132 | 132 | } |
133 | 133 | |
134 | 134 | $aClassOptions = []; |
135 | 135 | // No more classmap autoloading. The file will be included when needed. |
136 | - if(($aOptions['autoload'])) |
|
136 | + if (($aOptions['autoload'])) |
|
137 | 137 | { |
138 | 138 | $aClassOptions['include'] = $xFile->getPathname(); |
139 | 139 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | public function addNamespace($sNamespace, array $aOptions) |
155 | 155 | { |
156 | 156 | // Separator default value |
157 | - if(!key_exists('separator', $aOptions)) |
|
157 | + if (!key_exists('separator', $aOptions)) |
|
158 | 158 | { |
159 | 159 | $aOptions['separator'] = '.'; |
160 | 160 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | private function getOptionsFromClass($sClassName) |
172 | 172 | { |
173 | - if(!key_exists($sClassName, $this->aClassOptions)) |
|
173 | + if (!key_exists($sClassName, $this->aClassOptions)) |
|
174 | 174 | { |
175 | 175 | return null; // Class not registered |
176 | 176 | } |
@@ -188,18 +188,18 @@ discard block |
||
188 | 188 | private function getOptionsFromNamespace($sClassName, $sNamespace = null) |
189 | 189 | { |
190 | 190 | // Find the corresponding namespace |
191 | - if($sNamespace === null) |
|
191 | + if ($sNamespace === null) |
|
192 | 192 | { |
193 | - foreach(array_keys($this->aNamespaceOptions) as $_sNamespace) |
|
193 | + foreach (array_keys($this->aNamespaceOptions) as $_sNamespace) |
|
194 | 194 | { |
195 | - if(substr($sClassName, 0, strlen($_sNamespace) + 1) == $_sNamespace . '\\') |
|
195 | + if (substr($sClassName, 0, strlen($_sNamespace) + 1) == $_sNamespace . '\\') |
|
196 | 196 | { |
197 | 197 | $sNamespace = $_sNamespace; |
198 | 198 | break; |
199 | 199 | } |
200 | 200 | } |
201 | 201 | } |
202 | - if($sNamespace === null) |
|
202 | + if ($sNamespace === null) |
|
203 | 203 | { |
204 | 204 | return null; // Class not registered |
205 | 205 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | // Get the class options |
208 | 208 | $aOptions = $this->aNamespaceOptions[$sNamespace]; |
209 | 209 | $aDefaultOptions = []; // ['namespace' => $aOptions['namespace']]; |
210 | - if(key_exists('separator', $aOptions)) |
|
210 | + if (key_exists('separator', $aOptions)) |
|
211 | 211 | { |
212 | 212 | $aDefaultOptions['separator'] = $aOptions['separator']; |
213 | 213 | } |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | protected function _getCallableObject($sClassName, array $aOptions) |
226 | 226 | { |
227 | 227 | // Make sure the registered class exists |
228 | - if(key_exists('include', $aOptions)) |
|
228 | + if (key_exists('include', $aOptions)) |
|
229 | 229 | { |
230 | 230 | require_once($aOptions['include']); |
231 | 231 | } |
232 | - if(!class_exists($sClassName)) |
|
232 | + if (!class_exists($sClassName)) |
|
233 | 233 | { |
234 | 234 | return null; |
235 | 235 | } |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | // Create the callable object |
238 | 238 | $xCallableObject = new \Jaxon\Request\Support\CallableObject($sClassName); |
239 | 239 | $this->aCallableOptions[$sClassName] = []; |
240 | - foreach($aOptions as $sName => $xValue) |
|
240 | + foreach ($aOptions as $sName => $xValue) |
|
241 | 241 | { |
242 | - if($sName == 'separator' || $sName == 'protected') |
|
242 | + if ($sName == 'separator' || $sName == 'protected') |
|
243 | 243 | { |
244 | 244 | $xCallableObject->configure($sName, $xValue); |
245 | 245 | } |
246 | - elseif(is_array($xValue) && $sName != 'include') |
|
246 | + elseif (is_array($xValue) && $sName != 'include') |
|
247 | 247 | { |
248 | 248 | // These options are to be included in javascript code. |
249 | 249 | $this->aCallableOptions[$sClassName][$sName] = $xValue; |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | $this->aCallableObjects[$sClassName] = $xCallableObject; |
253 | 253 | |
254 | 254 | // Register the request factory for this callable object |
255 | - jaxon()->di()->set($sClassName . '_Factory_Rq', function () use ($sClassName) { |
|
255 | + jaxon()->di()->set($sClassName . '_Factory_Rq', function() use ($sClassName) { |
|
256 | 256 | $xCallableObject = $this->aCallableObjects[$sClassName]; |
257 | 257 | return new \Jaxon\Factory\Request\Portable($xCallableObject); |
258 | 258 | }); |
259 | 259 | // Register the paginator factory for this callable object |
260 | - jaxon()->di()->set($sClassName . '_Factory_Pg', function () use ($sClassName) { |
|
260 | + jaxon()->di()->set($sClassName . '_Factory_Pg', function() use ($sClassName) { |
|
261 | 261 | $xCallableObject = $this->aCallableObjects[$sClassName]; |
262 | 262 | return new \Jaxon\Factory\Request\Paginator($xCallableObject); |
263 | 263 | }); |
@@ -278,17 +278,17 @@ discard block |
||
278 | 278 | // at the beginning and the end of the class name. |
279 | 279 | $sClassName = trim(str_replace(['.', '_'], ['\\', '\\'], (string)$sClassName), '\\'); |
280 | 280 | |
281 | - if(key_exists($sClassName, $this->aCallableObjects)) |
|
281 | + if (key_exists($sClassName, $this->aCallableObjects)) |
|
282 | 282 | { |
283 | 283 | return $this->aCallableObjects[$sClassName]; |
284 | 284 | } |
285 | 285 | |
286 | 286 | $aOptions = $this->getOptionsFromClass($sClassName); |
287 | - if($aOptions === null) |
|
287 | + if ($aOptions === null) |
|
288 | 288 | { |
289 | 289 | $aOptions = $this->getOptionsFromNamespace($sClassName); |
290 | 290 | } |
291 | - if($aOptions === null) |
|
291 | + if ($aOptions === null) |
|
292 | 292 | { |
293 | 293 | return null; |
294 | 294 | } |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | private function createCallableObjects() |
305 | 305 | { |
306 | 306 | // Create callable objects for registered classes |
307 | - foreach($this->aClassOptions as $sClassName => $aClassOptions) |
|
307 | + foreach ($this->aClassOptions as $sClassName => $aClassOptions) |
|
308 | 308 | { |
309 | - if(!key_exists($sClassName, $this->aCallableObjects)) |
|
309 | + if (!key_exists($sClassName, $this->aCallableObjects)) |
|
310 | 310 | { |
311 | 311 | $this->_getCallableObject($sClassName, $aClassOptions); |
312 | 312 | } |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | |
315 | 315 | // Create callable objects for registered namespaces |
316 | 316 | $sDS = DIRECTORY_SEPARATOR; |
317 | - foreach($this->aNamespaceOptions as $sNamespace => $aOptions) |
|
317 | + foreach ($this->aNamespaceOptions as $sNamespace => $aOptions) |
|
318 | 318 | { |
319 | - if(key_exists($sNamespace, $this->aNamespaces)) |
|
319 | + if (key_exists($sNamespace, $this->aNamespaces)) |
|
320 | 320 | { |
321 | 321 | continue; |
322 | 322 | } |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | $sDirectory = $aOptions['directory']; |
328 | 328 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
329 | 329 | $itFile = new RecursiveIteratorIterator($itDir); |
330 | - foreach($itFile as $xFile) |
|
330 | + foreach ($itFile as $xFile) |
|
331 | 331 | { |
332 | 332 | // skip everything except PHP files |
333 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
333 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
334 | 334 | { |
335 | 335 | continue; |
336 | 336 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $sClassPath = $sNamespace; |
340 | 340 | $sRelativePath = substr($xFile->getPath(), strlen($sDirectory)); |
341 | 341 | $sRelativePath = trim(str_replace($sDS, '\\', $sRelativePath), '\\'); |
342 | - if($sRelativePath != '') |
|
342 | + if ($sRelativePath != '') |
|
343 | 343 | { |
344 | 344 | $sClassPath .= '\\' . $sRelativePath; |
345 | 345 | } |
@@ -347,10 +347,10 @@ discard block |
||
347 | 347 | $this->aNamespaces[$sClassPath] = ['separator' => $aOptions['separator']]; |
348 | 348 | $sClassName = $sClassPath . '\\' . $xFile->getBasename('.php'); |
349 | 349 | |
350 | - if(!key_exists($sClassName, $this->aCallableObjects)) |
|
350 | + if (!key_exists($sClassName, $this->aCallableObjects)) |
|
351 | 351 | { |
352 | 352 | $aClassOptions = $this->getOptionsFromNamespace($sClassName, $sNamespace); |
353 | - if($aClassOptions !== null) |
|
353 | + if ($aClassOptions !== null) |
|
354 | 354 | { |
355 | 355 | $this->_getCallableObject($sClassName, $aClassOptions); |
356 | 356 | } |
@@ -383,11 +383,11 @@ discard block |
||
383 | 383 | $this->createCallableObjects(); |
384 | 384 | |
385 | 385 | $sHash = ''; |
386 | - foreach($this->aNamespaces as $sNamespace => $aOptions) |
|
386 | + foreach ($this->aNamespaces as $sNamespace => $aOptions) |
|
387 | 387 | { |
388 | 388 | $sHash .= $sNamespace . $aOptions['separator']; |
389 | 389 | } |
390 | - foreach($this->aCallableObjects as $sClassName => $xCallableObject) |
|
390 | + foreach ($this->aCallableObjects as $sClassName => $xCallableObject) |
|
391 | 391 | { |
392 | 392 | $sHash .= $sClassName . implode('|', $xCallableObject->getMethods()); |
393 | 393 | } |
@@ -408,16 +408,16 @@ discard block |
||
408 | 408 | |
409 | 409 | $aJsClasses = []; |
410 | 410 | $sCode = ''; |
411 | - foreach(array_keys($this->aNamespaces) as $sNamespace) |
|
411 | + foreach (array_keys($this->aNamespaces) as $sNamespace) |
|
412 | 412 | { |
413 | 413 | $offset = 0; |
414 | 414 | $sJsNamespace = str_replace('\\', '.', $sNamespace); |
415 | 415 | $sJsNamespace .= '.Null'; // This is a sentinel. The last token is not processed in the while loop. |
416 | - while(($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false) |
|
416 | + while (($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false) |
|
417 | 417 | { |
418 | 418 | $sJsClass = substr($sJsNamespace, 0, $dotPosition); |
419 | 419 | // Generate code for this object |
420 | - if(!key_exists($sJsClass, $aJsClasses)) |
|
420 | + if (!key_exists($sJsClass, $aJsClasses)) |
|
421 | 421 | { |
422 | 422 | $sCode .= "$sPrefix$sJsClass = {};\n"; |
423 | 423 | $aJsClasses[$sJsClass] = $sJsClass; |
@@ -426,13 +426,13 @@ discard block |
||
426 | 426 | } |
427 | 427 | } |
428 | 428 | |
429 | - foreach($this->aCallableObjects as $sClassName => $xCallableObject) |
|
429 | + foreach ($this->aCallableObjects as $sClassName => $xCallableObject) |
|
430 | 430 | { |
431 | 431 | $aConfig = $this->aCallableOptions[$sClassName]; |
432 | 432 | $aCommonConfig = key_exists('*', $aConfig) ? $aConfig['*'] : []; |
433 | 433 | |
434 | 434 | $aMethods = []; |
435 | - foreach($xCallableObject->getMethods() as $sMethodName) |
|
435 | + foreach ($xCallableObject->getMethods() as $sMethodName) |
|
436 | 436 | { |
437 | 437 | // Specific options for this method |
438 | 438 | $aMethodConfig = key_exists($sMethodName, $aConfig) ? |
@@ -164,7 +164,7 @@ |
||
164 | 164 | } |
165 | 165 | else |
166 | 166 | { |
167 | - // Use underscore as separator, so there's no need to deal with namespace |
|
167 | + // Use underscore as separator, so there's no need to deal with namespace |
|
168 | 168 | // when generating javascript code. |
169 | 169 | $aOptions['separator'] = '_'; |
170 | 170 | $aOptions['autoload'] = $this->bAutoloadEnabled; |
@@ -161,8 +161,7 @@ |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | $this->xRepository->addNamespace($sNamespace, $aOptions); |
164 | - } |
|
165 | - else |
|
164 | + } else |
|
166 | 165 | { |
167 | 166 | // Use underscore as separator, so there's no need to deal with namespace |
168 | 167 | // when generating javascript code. |
@@ -105,33 +105,33 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function register($sType, $sDirectory, $aOptions) |
107 | 107 | { |
108 | - if($sType != $this->getName()) |
|
108 | + if ($sType != $this->getName()) |
|
109 | 109 | { |
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | - if(!is_string($sDirectory) || !is_dir($sDirectory)) |
|
113 | + if (!is_string($sDirectory) || !is_dir($sDirectory)) |
|
114 | 114 | { |
115 | 115 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
116 | 116 | } |
117 | - if(is_string($aOptions)) |
|
117 | + if (is_string($aOptions)) |
|
118 | 118 | { |
119 | 119 | $aOptions = ['namespace' => $aOptions]; |
120 | 120 | } |
121 | - if(!is_array($aOptions)) |
|
121 | + if (!is_array($aOptions)) |
|
122 | 122 | { |
123 | 123 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
124 | 124 | } |
125 | 125 | |
126 | 126 | $sDirectory = rtrim(trim($sDirectory), DIRECTORY_SEPARATOR); |
127 | - if(!is_dir($sDirectory)) |
|
127 | + if (!is_dir($sDirectory)) |
|
128 | 128 | { |
129 | 129 | return false; |
130 | 130 | } |
131 | 131 | $aOptions['directory'] = realpath($sDirectory); |
132 | 132 | |
133 | 133 | $sNamespace = key_exists('namespace', $aOptions) ? $aOptions['namespace'] : ''; |
134 | - if(!($sNamespace = trim($sNamespace, ' \\'))) |
|
134 | + if (!($sNamespace = trim($sNamespace, ' \\'))) |
|
135 | 135 | { |
136 | 136 | $sNamespace = ''; |
137 | 137 | } |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | |
146 | 146 | // Change the keys in $aOptions to have "\" as separator |
147 | 147 | $_aOptions = []; |
148 | - foreach($aOptions as $sName => $aOption) |
|
148 | + foreach ($aOptions as $sName => $aOption) |
|
149 | 149 | { |
150 | 150 | $sName = trim(str_replace('.', '\\', $sName), ' \\'); |
151 | 151 | $_aOptions[$sName] = $aOption; |
152 | 152 | } |
153 | 153 | $aOptions = $_aOptions; |
154 | 154 | |
155 | - if(($sNamespace)) |
|
155 | + if (($sNamespace)) |
|
156 | 156 | { |
157 | 157 | // Register the dir with PSR4 autoloading |
158 | - if(($this->xAutoloader)) |
|
158 | + if (($this->xAutoloader)) |
|
159 | 159 | { |
160 | 160 | $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory); |
161 | 161 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected function getPrevLink() |
65 | 65 | { |
66 | - if(!($sCall = $this->xPaginator->getPrevCall())) |
|
66 | + if (!($sCall = $this->xPaginator->getPrevCall())) |
|
67 | 67 | { |
68 | 68 | return ''; |
69 | 69 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function getNextLink() |
80 | 80 | { |
81 | - if(!($sCall = $this->xPaginator->getNextCall())) |
|
81 | + if (!($sCall = $this->xPaginator->getNextCall())) |
|
82 | 82 | { |
83 | 83 | return ''; |
84 | 84 | } |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | protected function getLinks() |
95 | 95 | { |
96 | 96 | $sLinks = ''; |
97 | - foreach($this->xPaginator->getPages() as $page) |
|
97 | + foreach ($this->xPaginator->getPages() as $page) |
|
98 | 98 | { |
99 | - if($page['call']) |
|
99 | + if ($page['call']) |
|
100 | 100 | { |
101 | 101 | $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled'); |
102 | 102 | $sLinks .= $this->xTemplate->render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]); |
@@ -100,8 +100,7 @@ |
||
100 | 100 | { |
101 | 101 | $sTemplate = ($page['isCurrent'] ? 'pagination::links/current' : 'pagination::links/enabled'); |
102 | 102 | $sLinks .= $this->xTemplate->render($sTemplate, ['call' => $page['call'], 'text' => $page['num']]); |
103 | - } |
|
104 | - else |
|
103 | + } else |
|
105 | 104 | { |
106 | 105 | $sLinks .= $this->xTemplate->render('pagination::links/disabled', ['text' => $page['num']]); |
107 | 106 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function configure($sName, $sValue) |
86 | 86 | { |
87 | - switch($sName) |
|
87 | + switch ($sName) |
|
88 | 88 | { |
89 | 89 | case 'class': // The user function is a method in the given class |
90 | 90 | $this->xUserFunction = [$sValue, $this->xUserFunction]; |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function call($aArgs = []) |
141 | 141 | { |
142 | - if(($this->sInclude)) |
|
142 | + if (($this->sInclude)) |
|
143 | 143 | { |
144 | 144 | require_once $this->sInclude; |
145 | 145 | } |
146 | 146 | |
147 | 147 | // If the function is an alias for a class method, then instanciate the class |
148 | - if(is_array($this->xUserFunction) && is_string($this->xUserFunction[0])) |
|
148 | + if (is_array($this->xUserFunction) && is_string($this->xUserFunction[0])) |
|
149 | 149 | { |
150 | 150 | $sClassName = $this->xUserFunction[0]; |
151 | 151 | $this->xUserFunction[0] = new $sClassName; |
@@ -26,12 +26,12 @@ |
||
26 | 26 | public static function read($sConfigFile) |
27 | 27 | { |
28 | 28 | $sConfigFile = realpath($sConfigFile); |
29 | - if(!is_readable($sConfigFile)) |
|
29 | + if (!is_readable($sConfigFile)) |
|
30 | 30 | { |
31 | 31 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
32 | 32 | } |
33 | 33 | $aConfigOptions = include($sConfigFile); |
34 | - if(!is_array($aConfigOptions)) |
|
34 | + if (!is_array($aConfigOptions)) |
|
35 | 35 | { |
36 | 36 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
37 | 37 | } |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | $sPrefix = trim((string)$sPrefix); |
46 | 46 | $nDepth = intval($nDepth); |
47 | 47 | // Check the max depth |
48 | - if($nDepth < 0 || $nDepth > 9) |
|
48 | + if ($nDepth < 0 || $nDepth > 9) |
|
49 | 49 | { |
50 | 50 | throw new \Jaxon\Config\Exception\Data(jaxon_trans('config.errors.data.depth', |
51 | 51 | array('key' => $sPrefix, 'depth' => $nDepth))); |
52 | 52 | } |
53 | - foreach($aOptions as $sName => $xOption) |
|
53 | + foreach ($aOptions as $sName => $xOption) |
|
54 | 54 | { |
55 | - if(is_int($sName)) |
|
55 | + if (is_int($sName)) |
|
56 | 56 | { |
57 | 57 | continue; |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // Save the value of this option |
63 | 63 | $this->aOptions[$sFullName] = $xOption; |
64 | 64 | // Save the values of its sub-options |
65 | - if(is_array($xOption)) |
|
65 | + if (is_array($xOption)) |
|
66 | 66 | { |
67 | 67 | // Recursively read the options in the array |
68 | 68 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | $aKeys = explode('.', (string)$sKeys); |
85 | 85 | foreach ($aKeys as $sKey) |
86 | 86 | { |
87 | - if(($sKey)) |
|
87 | + if (($sKey)) |
|
88 | 88 | { |
89 | - if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
89 | + if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
90 | 90 | { |
91 | 91 | return; |
92 | 92 | } |
@@ -134,13 +134,12 @@ discard block |
||
134 | 134 | $sPrefix = rtrim($sPrefix, '.') . '.'; |
135 | 135 | $sPrefixLen = strlen($sPrefix); |
136 | 136 | $aOptions = []; |
137 | - foreach($this->aOptions as $sName => $xValue) |
|
137 | + foreach ($this->aOptions as $sName => $xValue) |
|
138 | 138 | { |
139 | - if(substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
139 | + if (substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
140 | 140 | { |
141 | 141 | $iNextDotPos = strpos($sName, '.', $sPrefixLen); |
142 | - $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : |
|
143 | - substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
142 | + $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
144 | 143 | $aOptions[$sOptionName] = $sPrefix . $sOptionName; |
145 | 144 | } |
146 | 145 | } |
@@ -26,16 +26,16 @@ |
||
26 | 26 | public static function read($sConfigFile) |
27 | 27 | { |
28 | 28 | $sConfigFile = realpath($sConfigFile); |
29 | - if(!extension_loaded('yaml')) |
|
29 | + if (!extension_loaded('yaml')) |
|
30 | 30 | { |
31 | 31 | throw new \Jaxon\Config\Exception\Yaml(jaxon_trans('config.errors.yaml.install')); |
32 | 32 | } |
33 | - if(!is_readable($sConfigFile)) |
|
33 | + if (!is_readable($sConfigFile)) |
|
34 | 34 | { |
35 | 35 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
36 | 36 | } |
37 | 37 | $aConfigOptions = yaml_parse_file($sConfigFile); |
38 | - if(!is_array($aConfigOptions)) |
|
38 | + if (!is_array($aConfigOptions)) |
|
39 | 39 | { |
40 | 40 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
41 | 41 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | public function read($sConfigFile) |
25 | 25 | { |
26 | 26 | $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
27 | - switch($sExt) |
|
27 | + switch ($sExt) |
|
28 | 28 | { |
29 | 29 | case 'php': |
30 | 30 | $aConfigOptions = Php::read($sConfigFile); |