@@ -158,7 +158,7 @@ |
||
158 | 158 | /** |
159 | 159 | * Constructs and returns a <Jaxon\Request\Request> object which is capable of generating the javascript call to invoke this jaxon enabled function |
160 | 160 | * |
161 | - * @return Jaxon\Request\Request |
|
161 | + * @return Request |
|
162 | 162 | */ |
163 | 163 | public function generateRequest() |
164 | 164 | { |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | { |
91 | 91 | $this->aConfiguration = array(); |
92 | 92 | $this->sAlias = ''; |
93 | - if(is_array($sUserFunction)) |
|
93 | + if (is_array($sUserFunction)) |
|
94 | 94 | { |
95 | - if(count($sUserFunction) != 2 && count($sUserFunction) != 3) |
|
95 | + if (count($sUserFunction) != 2 && count($sUserFunction) != 3) |
|
96 | 96 | { |
97 | 97 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration')); |
98 | 98 | } |
99 | - if(count($sUserFunction) == 3) |
|
99 | + if (count($sUserFunction) == 3) |
|
100 | 100 | { |
101 | 101 | $this->sAlias = $sUserFunction[0]; |
102 | 102 | $this->sUserFunction = array_slice($sUserFunction, 1); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $this->sUserFunction = $sUserFunction; |
107 | 107 | } |
108 | 108 | } |
109 | - else if(is_string($sUserFunction)) |
|
109 | + else if (is_string($sUserFunction)) |
|
110 | 110 | { |
111 | 111 | $this->sUserFunction = $sUserFunction; |
112 | 112 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | public function getName() |
125 | 125 | { |
126 | 126 | // Do not use sAlias here! |
127 | - if(is_array($this->sUserFunction)) |
|
127 | + if (is_array($this->sUserFunction)) |
|
128 | 128 | { |
129 | 129 | return $this->sUserFunction[1]; |
130 | 130 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function configure($sName, $sValue) |
143 | 143 | { |
144 | - switch($sName) |
|
144 | + switch ($sName) |
|
145 | 145 | { |
146 | 146 | case 'alias': |
147 | 147 | $this->sAlias = $sValue; |
@@ -195,12 +195,12 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function call($aArgs = array()) |
197 | 197 | { |
198 | - if(($this->sInclude)) |
|
198 | + if (($this->sInclude)) |
|
199 | 199 | { |
200 | 200 | ob_start(); |
201 | 201 | require_once $this->sInclude; |
202 | 202 | $sOutput = ob_get_clean(); |
203 | - if(($sOutput)) |
|
203 | + if (($sOutput)) |
|
204 | 204 | { |
205 | 205 | $sOutput = $this->trans('debug.function.include', array( |
206 | 206 | 'file' => $this->sInclude, |
@@ -100,17 +100,14 @@ |
||
100 | 100 | { |
101 | 101 | $this->sAlias = $sUserFunction[0]; |
102 | 102 | $this->sUserFunction = array_slice($sUserFunction, 1); |
103 | - } |
|
104 | - else |
|
103 | + } else |
|
105 | 104 | { |
106 | 105 | $this->sUserFunction = $sUserFunction; |
107 | 106 | } |
108 | - } |
|
109 | - else if(is_string($sUserFunction)) |
|
107 | + } else if(is_string($sUserFunction)) |
|
110 | 108 | { |
111 | 109 | $this->sUserFunction = $sUserFunction; |
112 | - } |
|
113 | - else |
|
110 | + } else |
|
114 | 111 | { |
115 | 112 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration')); |
116 | 113 | } |
@@ -89,7 +89,6 @@ discard block |
||
89 | 89 | * Return the javascript call to an Jaxon object method |
90 | 90 | * |
91 | 91 | * @param string $sMethod The method (without class) name |
92 | - * @param ... $xParams The parameters of the method |
|
93 | 92 | * |
94 | 93 | * @return object |
95 | 94 | */ |
@@ -110,7 +109,6 @@ discard block |
||
110 | 109 | * @param integer $nItemsPerPage the number of items per page |
111 | 110 | * @param integer $nCurrentPage the current page |
112 | 111 | * @param string $sMethod the name of the method |
113 | - * @param ... $parameters the parameters of the method |
|
114 | 112 | * |
115 | 113 | * @return string the pagination links |
116 | 114 | */ |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getJaxonClassName() |
46 | 46 | { |
47 | - if(!$this->xJaxonCallable) |
|
47 | + if (!$this->xJaxonCallable) |
|
48 | 48 | { |
49 | 49 | // Make the Jaxon class name for a class without an associated callable |
50 | 50 | // !! Warning !! This can happen only if this object is not registered with the Jaxon libary |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function getJaxonNamespace() |
64 | 64 | { |
65 | - if(!$this->xJaxonCallable) |
|
65 | + if (!$this->xJaxonCallable) |
|
66 | 66 | { |
67 | 67 | // Return an empty string. |
68 | 68 | return ''; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getJaxonClassPath() |
79 | 79 | { |
80 | - if(!$this->xJaxonCallable) |
|
80 | + if (!$this->xJaxonCallable) |
|
81 | 81 | { |
82 | 82 | // Return an empty string. |
83 | 83 | return ''; |
@@ -201,7 +201,7 @@ |
||
201 | 201 | /** |
202 | 202 | * Create a new the config manager |
203 | 203 | * |
204 | - * @return Jaxon\Utils\Config\Config The config manager |
|
204 | + * @return Config\Config The config manager |
|
205 | 205 | */ |
206 | 206 | public function newConfig() |
207 | 207 | { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public static function getInstance() |
29 | 29 | { |
30 | - if(!self::$xInstance) |
|
30 | + if (!self::$xInstance) |
|
31 | 31 | { |
32 | 32 | self::$xInstance = new Container(); |
33 | 33 | } |
@@ -65,19 +65,19 @@ discard block |
||
65 | 65 | * Managers |
66 | 66 | */ |
67 | 67 | // Plugin Manager |
68 | - $this->di['plugin_manager'] = function($c){ |
|
68 | + $this->di['plugin_manager'] = function($c) { |
|
69 | 69 | return new \Jaxon\Plugin\Manager(); |
70 | 70 | }; |
71 | 71 | // Request Manager |
72 | - $this->di['request_manager'] = function($c){ |
|
72 | + $this->di['request_manager'] = function($c) { |
|
73 | 73 | return new \Jaxon\Request\Manager(); |
74 | 74 | }; |
75 | 75 | // Request Factory |
76 | - $this->di['request_factory'] = function($c){ |
|
76 | + $this->di['request_factory'] = function($c) { |
|
77 | 77 | return new \Jaxon\Request\Factory(); |
78 | 78 | }; |
79 | 79 | // Response Manager |
80 | - $this->di['response_manager'] = function($c){ |
|
80 | + $this->di['response_manager'] = function($c) { |
|
81 | 81 | return new \Jaxon\Response\Manager(); |
82 | 82 | }; |
83 | 83 | |
@@ -85,35 +85,35 @@ discard block |
||
85 | 85 | * Services |
86 | 86 | */ |
87 | 87 | // Config manager |
88 | - $this->di['config'] = function($c){ |
|
88 | + $this->di['config'] = function($c) { |
|
89 | 89 | return new Config\Config(); |
90 | 90 | }; |
91 | 91 | // Minifier |
92 | - $this->di['minifier'] = function($c){ |
|
92 | + $this->di['minifier'] = function($c) { |
|
93 | 93 | return new Template\Minifier(); |
94 | 94 | }; |
95 | 95 | // Translator |
96 | - $this->di['translator'] = function($c){ |
|
96 | + $this->di['translator'] = function($c) { |
|
97 | 97 | return new Translation\Translator($c['translation_dir'], $c['config']); |
98 | 98 | }; |
99 | 99 | // Template engine |
100 | - $this->di['template'] = function($c){ |
|
100 | + $this->di['template'] = function($c) { |
|
101 | 101 | return new Template\Template($c['template_dir']); |
102 | 102 | }; |
103 | 103 | // Validator |
104 | - $this->di['validator'] = function($c){ |
|
104 | + $this->di['validator'] = function($c) { |
|
105 | 105 | return new Validation\Validator(); |
106 | 106 | }; |
107 | 107 | // Pagination Renderer |
108 | - $this->di['pagination.renderer'] = function($c){ |
|
108 | + $this->di['pagination.renderer'] = function($c) { |
|
109 | 109 | return new Pagination\Renderer(); |
110 | 110 | }; |
111 | 111 | // Pagination Paginator |
112 | - $this->di['pagination.paginator'] = function($c){ |
|
112 | + $this->di['pagination.paginator'] = function($c) { |
|
113 | 113 | return new Pagination\Paginator($c['pagination.renderer']); |
114 | 114 | }; |
115 | 115 | // Event Dispatcher |
116 | - $this->di['events'] = function($c){ |
|
116 | + $this->di['events'] = function($c) { |
|
117 | 117 | return new EventDispatcher(); |
118 | 118 | }; |
119 | 119 | |
@@ -121,27 +121,27 @@ discard block |
||
121 | 121 | * Core library objects |
122 | 122 | */ |
123 | 123 | // Global Response |
124 | - $this->di['response'] = function($c){ |
|
124 | + $this->di['response'] = function($c) { |
|
125 | 125 | return new \Jaxon\Response\Response(); |
126 | 126 | }; |
127 | 127 | // Jaxon Core |
128 | - $this->di['jaxon'] = function($c){ |
|
128 | + $this->di['jaxon'] = function($c) { |
|
129 | 129 | return new \Jaxon\Jaxon(); |
130 | 130 | }; |
131 | 131 | // Jaxon Sentry |
132 | - $this->di['sentry'] = function($c){ |
|
132 | + $this->di['sentry'] = function($c) { |
|
133 | 133 | // This class is not defined in this package |
134 | 134 | $sClass = '\\Jaxon\\Sentry\\Sentry'; |
135 | 135 | return new $sClass; |
136 | 136 | }; |
137 | 137 | // Armada |
138 | - $this->di['armada'] = function($c){ |
|
138 | + $this->di['armada'] = function($c) { |
|
139 | 139 | // This class is not defined in this package |
140 | 140 | $sClass = '\\Jaxon\\Armada\\Armada'; |
141 | 141 | return new $sClass; |
142 | 142 | }; |
143 | 143 | // View Renderer Facade |
144 | - $this->di['sentry.view.renderer'] = function($c){ |
|
144 | + $this->di['sentry.view.renderer'] = function($c) { |
|
145 | 145 | $aRenderers = $c['view.data.renderers']; |
146 | 146 | $sDefaultNamespace = $c['view.data.namespace.default']; |
147 | 147 | return new \Jaxon\Sentry\View\Facade($aRenderers, $sDefaultNamespace); |
@@ -396,9 +396,9 @@ discard block |
||
396 | 396 | $renderer = $c['sentry.view.base.' . $sId]; |
397 | 397 | // Init the renderer with the template namespaces |
398 | 398 | $aNamespaces = $this->di['view.data.namespaces']; |
399 | - if(key_exists($sId, $aNamespaces)) |
|
399 | + if (key_exists($sId, $aNamespaces)) |
|
400 | 400 | { |
401 | - foreach($aNamespaces[$sId] as $ns) |
|
401 | + foreach ($aNamespaces[$sId] as $ns) |
|
402 | 402 | { |
403 | 403 | $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']); |
404 | 404 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function getViewRenderer($sId = '') |
418 | 418 | { |
419 | - if(!$sId) |
|
419 | + if (!$sId) |
|
420 | 420 | { |
421 | 421 | // Return the view renderer facade |
422 | 422 | return $this->di['sentry.view.renderer']; |
@@ -161,7 +161,7 @@ |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
164 | - * @return string |
|
164 | + * @return Request |
|
165 | 165 | */ |
166 | 166 | public function getRequest() |
167 | 167 | { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | protected function updateNumPages() |
67 | 67 | { |
68 | - $this->numPages = ($this->itemsPerPage == 0 ? 0 : (int) ceil($this->totalItems/$this->itemsPerPage)); |
|
68 | + $this->numPages = ($this->itemsPerPage == 0 ? 0 : (int)ceil($this->totalItems / $this->itemsPerPage)); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function setMaxPagesToShow($maxPagesToShow) |
76 | 76 | { |
77 | - if($maxPagesToShow < 3) |
|
77 | + if ($maxPagesToShow < 3) |
|
78 | 78 | { |
79 | 79 | throw new \InvalidArgumentException('maxPagesToShow cannot be less than 3.'); |
80 | 80 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | { |
155 | 155 | $this->request = $request; |
156 | 156 | // Append the page number to the parameter list, if not yet given. |
157 | - if(($this->request) && !$this->request->hasPageNumber()) |
|
157 | + if (($this->request) && !$this->request->hasPageNumber()) |
|
158 | 158 | { |
159 | 159 | $this->request->addParameter(Jaxon::PAGE_NUMBER, 0); |
160 | 160 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | public function getNextPage() |
195 | 195 | { |
196 | - if($this->currentPage < $this->numPages) |
|
196 | + if ($this->currentPage < $this->numPages) |
|
197 | 197 | { |
198 | 198 | return $this->currentPage + 1; |
199 | 199 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | public function getPrevPage() |
205 | 205 | { |
206 | - if($this->currentPage > 1) |
|
206 | + if ($this->currentPage > 1) |
|
207 | 207 | { |
208 | 208 | return $this->currentPage - 1; |
209 | 209 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | public function getNextCall() |
215 | 215 | { |
216 | - if(!$this->getNextPage()) |
|
216 | + if (!$this->getNextPage()) |
|
217 | 217 | { |
218 | 218 | return null; |
219 | 219 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function getPrevCall() |
228 | 228 | { |
229 | - if(!$this->getPrevPage()) |
|
229 | + if (!$this->getPrevPage()) |
|
230 | 230 | { |
231 | 231 | return null; |
232 | 232 | } |
@@ -254,14 +254,14 @@ discard block |
||
254 | 254 | { |
255 | 255 | $pages = array(); |
256 | 256 | |
257 | - if($this->numPages <= 1) |
|
257 | + if ($this->numPages <= 1) |
|
258 | 258 | { |
259 | 259 | return array(); |
260 | 260 | } |
261 | 261 | |
262 | - if($this->numPages <= $this->maxPagesToShow) |
|
262 | + if ($this->numPages <= $this->maxPagesToShow) |
|
263 | 263 | { |
264 | - for($i = 1; $i <= $this->numPages; $i++) |
|
264 | + for ($i = 1; $i <= $this->numPages; $i++) |
|
265 | 265 | { |
266 | 266 | $pages[] = $this->createPage($i, $i == $this->currentPage); |
267 | 267 | } |
@@ -269,9 +269,9 @@ discard block |
||
269 | 269 | else |
270 | 270 | { |
271 | 271 | // Determine the sliding range, centered around the current page. |
272 | - $numAdjacents = (int) floor(($this->maxPagesToShow - 3) / 2); |
|
272 | + $numAdjacents = (int)floor(($this->maxPagesToShow - 3) / 2); |
|
273 | 273 | |
274 | - if($this->currentPage + $numAdjacents > $this->numPages) |
|
274 | + if ($this->currentPage + $numAdjacents > $this->numPages) |
|
275 | 275 | { |
276 | 276 | $slidingStart = $this->numPages - $this->maxPagesToShow + 2; |
277 | 277 | } |
@@ -279,28 +279,28 @@ discard block |
||
279 | 279 | { |
280 | 280 | $slidingStart = $this->currentPage - $numAdjacents; |
281 | 281 | } |
282 | - if($slidingStart < 2) |
|
282 | + if ($slidingStart < 2) |
|
283 | 283 | { |
284 | 284 | $slidingStart = 2; |
285 | 285 | } |
286 | 286 | |
287 | 287 | $slidingEnd = $slidingStart + $this->maxPagesToShow - 3; |
288 | - if($slidingEnd >= $this->numPages) |
|
288 | + if ($slidingEnd >= $this->numPages) |
|
289 | 289 | { |
290 | 290 | $slidingEnd = $this->numPages - 1; |
291 | 291 | } |
292 | 292 | |
293 | 293 | // Build the list of pages. |
294 | 294 | $pages[] = $this->createPage(1, $this->currentPage == 1); |
295 | - if($slidingStart > 2) |
|
295 | + if ($slidingStart > 2) |
|
296 | 296 | { |
297 | 297 | $pages[] = $this->createPageEllipsis(); |
298 | 298 | } |
299 | - for($i = $slidingStart; $i <= $slidingEnd; $i++) |
|
299 | + for ($i = $slidingStart; $i <= $slidingEnd; $i++) |
|
300 | 300 | { |
301 | 301 | $pages[] = $this->createPage($i, $i == $this->currentPage); |
302 | 302 | } |
303 | - if($slidingEnd < $this->numPages - 1) |
|
303 | + if ($slidingEnd < $this->numPages - 1) |
|
304 | 304 | { |
305 | 305 | $pages[] = $this->createPageEllipsis(); |
306 | 306 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public function toHtml() |
348 | 348 | { |
349 | - if($this->getNumPages() <= 1) |
|
349 | + if ($this->getNumPages() <= 1) |
|
350 | 350 | { |
351 | 351 | return ''; |
352 | 352 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | { |
370 | 370 | $first = ($this->currentPage - 1) * $this->itemsPerPage + 1; |
371 | 371 | |
372 | - if($first > $this->totalItems) |
|
372 | + if ($first > $this->totalItems) |
|
373 | 373 | { |
374 | 374 | return null; |
375 | 375 | } |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | public function getCurrentPageLastItem() |
381 | 381 | { |
382 | 382 | $first = $this->getCurrentPageFirstItem(); |
383 | - if($first === null) |
|
383 | + if ($first === null) |
|
384 | 384 | { |
385 | 385 | return null; |
386 | 386 | } |
387 | 387 | |
388 | 388 | $last = $first + $this->itemsPerPage - 1; |
389 | - if($last > $this->totalItems) |
|
389 | + if ($last > $this->totalItems) |
|
390 | 390 | { |
391 | 391 | return $this->totalItems; |
392 | 392 | } |
@@ -265,8 +265,7 @@ discard block |
||
265 | 265 | { |
266 | 266 | $pages[] = $this->createPage($i, $i == $this->currentPage); |
267 | 267 | } |
268 | - } |
|
269 | - else |
|
268 | + } else |
|
270 | 269 | { |
271 | 270 | // Determine the sliding range, centered around the current page. |
272 | 271 | $numAdjacents = (int) floor(($this->maxPagesToShow - 3) / 2); |
@@ -274,8 +273,7 @@ discard block |
||
274 | 273 | if($this->currentPage + $numAdjacents > $this->numPages) |
275 | 274 | { |
276 | 275 | $slidingStart = $this->numPages - $this->maxPagesToShow + 2; |
277 | - } |
|
278 | - else |
|
276 | + } else |
|
279 | 277 | { |
280 | 278 | $slidingStart = $this->currentPage - $numAdjacents; |
281 | 279 | } |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * Get a translated string |
70 | 70 | * |
71 | 71 | * @param string $sText The key of the translated string |
72 | - * @param string $aPlaceHolders The placeholders of the translated string |
|
72 | + * @param string $placeholders The placeholders of the translated string |
|
73 | 73 | * @param string $sLanguage The language of the translated string |
74 | 74 | * |
75 | 75 | * @return string The translated string |
@@ -87,7 +87,7 @@ |
||
87 | 87 | } |
88 | 88 | if(!array_key_exists($sLanguage, $this->aMessages) || !array_key_exists($sText, $this->aMessages[$sLanguage])) |
89 | 89 | { |
90 | - return $sText; |
|
90 | + return $sText; |
|
91 | 91 | } |
92 | 92 | $message = $this->aMessages[$sLanguage][$sText]; |
93 | 93 | foreach($placeholders as $name => $value) |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function loadMessages($sFilePath, $sLanguage) |
47 | 47 | { |
48 | - if(!file_exists($sFilePath)) |
|
48 | + if (!file_exists($sFilePath)) |
|
49 | 49 | { |
50 | 50 | return; |
51 | 51 | } |
52 | 52 | $aMessages = require($sFilePath); |
53 | - if(!is_array($aMessages)) |
|
53 | + if (!is_array($aMessages)) |
|
54 | 54 | { |
55 | 55 | return; |
56 | 56 | } |
57 | 57 | // Load the translations |
58 | - if(!array_key_exists($sLanguage, $this->aMessages)) |
|
58 | + if (!array_key_exists($sLanguage, $this->aMessages)) |
|
59 | 59 | { |
60 | 60 | $this->aMessages[$sLanguage] = $aMessages; |
61 | 61 | } |
@@ -77,20 +77,20 @@ discard block |
||
77 | 77 | public function trans($sText, array $placeholders = array(), $sLanguage = null) |
78 | 78 | { |
79 | 79 | $sText = trim((string)$sText); |
80 | - if(!$sLanguage) |
|
80 | + if (!$sLanguage) |
|
81 | 81 | { |
82 | 82 | $sLanguage = $this->xConfig->getOption('language'); |
83 | 83 | } |
84 | - if(!$sLanguage) |
|
84 | + if (!$sLanguage) |
|
85 | 85 | { |
86 | 86 | $sLanguage = $this->sDefaultLocale; |
87 | 87 | } |
88 | - if(!array_key_exists($sLanguage, $this->aMessages) || !array_key_exists($sText, $this->aMessages[$sLanguage])) |
|
88 | + if (!array_key_exists($sLanguage, $this->aMessages) || !array_key_exists($sText, $this->aMessages[$sLanguage])) |
|
89 | 89 | { |
90 | 90 | return $sText; |
91 | 91 | } |
92 | 92 | $message = $this->aMessages[$sLanguage][$sText]; |
93 | - foreach($placeholders as $name => $value) |
|
93 | + foreach ($placeholders as $name => $value) |
|
94 | 94 | { |
95 | 95 | $message = str_replace(":$name", $value, $message); |
96 | 96 | } |
@@ -58,8 +58,7 @@ |
||
58 | 58 | if(!array_key_exists($sLanguage, $this->aMessages)) |
59 | 59 | { |
60 | 60 | $this->aMessages[$sLanguage] = $aMessages; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | $this->aMessages[$sLanguage] = array_merge($aMessages, $this->aMessages[$sLanguage]); |
65 | 64 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function __construct($xCallable) |
94 | 94 | { |
95 | - if(is_string($xCallable)) // Received a class name |
|
95 | + if (is_string($xCallable)) // Received a class name |
|
96 | 96 | { |
97 | 97 | $this->reflectionClass = new \ReflectionClass($xCallable); |
98 | 98 | $this->callableObject = null; |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | */ |
119 | 119 | private function setCallable($xCallable = null) |
120 | 120 | { |
121 | - if($xCallable == null) |
|
121 | + if ($xCallable == null) |
|
122 | 122 | { |
123 | 123 | $xCallable = $this->reflectionClass->newInstance(); |
124 | 124 | } |
125 | 125 | // Save the Jaxon callable object into the user callable object |
126 | - if($this->reflectionClass->hasMethod('setJaxonCallable')) |
|
126 | + if ($this->reflectionClass->hasMethod('setJaxonCallable')) |
|
127 | 127 | { |
128 | 128 | $xCallable->setJaxonCallable($this); |
129 | 129 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function getRegisteredObject() |
139 | 139 | { |
140 | - if($this->callableObject == null) |
|
140 | + if ($this->callableObject == null) |
|
141 | 141 | { |
142 | 142 | $this->setCallable(); |
143 | 143 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | // The class name without the namespace. |
168 | 168 | $name = $this->reflectionClass->getShortName(); |
169 | 169 | // Append the classpath to the name |
170 | - if(($this->classpath)) |
|
170 | + if (($this->classpath)) |
|
171 | 171 | { |
172 | 172 | $name = $this->classpath . $this->separator . $name; |
173 | 173 | } |
@@ -204,16 +204,16 @@ discard block |
||
204 | 204 | public function getMethods() |
205 | 205 | { |
206 | 206 | $aReturn = array(); |
207 | - foreach($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
207 | + foreach ($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
208 | 208 | { |
209 | 209 | $sMethodName = $xMethod->getShortName(); |
210 | 210 | // Don't take magic __call, __construct, __destruct methods |
211 | - if(strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__') |
|
211 | + if (strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__') |
|
212 | 212 | { |
213 | 213 | continue; |
214 | 214 | } |
215 | 215 | // Don't take excluded methods |
216 | - if(in_array($sMethodName, $this->aProtectedMethods)) |
|
216 | + if (in_array($sMethodName, $this->aProtectedMethods)) |
|
217 | 217 | { |
218 | 218 | continue; |
219 | 219 | } |
@@ -234,37 +234,37 @@ discard block |
||
234 | 234 | public function configure($sMethod, $sName, $sValue) |
235 | 235 | { |
236 | 236 | // Set the namespace |
237 | - if($sName == 'namespace') |
|
237 | + if ($sName == 'namespace') |
|
238 | 238 | { |
239 | - if($sValue != '') |
|
239 | + if ($sValue != '') |
|
240 | 240 | $this->namespace = $sValue; |
241 | 241 | return; |
242 | 242 | } |
243 | 243 | // Set the classpath |
244 | - if($sName == 'classpath') |
|
244 | + if ($sName == 'classpath') |
|
245 | 245 | { |
246 | - if($sValue != '') |
|
246 | + if ($sValue != '') |
|
247 | 247 | $this->classpath = $sValue; |
248 | 248 | return; |
249 | 249 | } |
250 | 250 | // Set the separator |
251 | - if($sName == 'separator') |
|
251 | + if ($sName == 'separator') |
|
252 | 252 | { |
253 | - if($sValue == '_' || $sValue == '.') |
|
253 | + if ($sValue == '_' || $sValue == '.') |
|
254 | 254 | $this->separator = $sValue; |
255 | 255 | return; |
256 | 256 | } |
257 | 257 | // Set the excluded methods |
258 | - if($sName == 'protected') |
|
258 | + if ($sName == 'protected') |
|
259 | 259 | { |
260 | - if(is_array($sValue)) |
|
260 | + if (is_array($sValue)) |
|
261 | 261 | $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
262 | - else if(is_string($sValue)) |
|
262 | + else if (is_string($sValue)) |
|
263 | 263 | $this->aProtectedMethods[] = $sValue; |
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | - if(!isset($this->aConfiguration[$sMethod])) |
|
267 | + if (!isset($this->aConfiguration[$sMethod])) |
|
268 | 268 | { |
269 | 269 | $this->aConfiguration[$sMethod] = array(); |
270 | 270 | } |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | |
285 | 285 | // Common options to be set on all methods |
286 | 286 | $aCommonConfig = array_key_exists('*', $this->aConfiguration) ? $this->aConfiguration['*'] : array(); |
287 | - foreach($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
287 | + foreach ($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
288 | 288 | { |
289 | 289 | $sMethodName = $xMethod->getShortName(); |
290 | 290 | // Don't export magic __call, __construct, __destruct methods |
291 | - if(strlen($sMethodName) > 0 && substr($sMethodName, 0, 2) == '__') |
|
291 | + if (strlen($sMethodName) > 0 && substr($sMethodName, 0, 2) == '__') |
|
292 | 292 | { |
293 | 293 | continue; |
294 | 294 | } |
295 | 295 | // Don't export "protected" methods |
296 | - if(in_array($sMethodName, $this->aProtectedMethods)) |
|
296 | + if (in_array($sMethodName, $this->aProtectedMethods)) |
|
297 | 297 | { |
298 | 298 | continue; |
299 | 299 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | */ |
344 | 344 | public function call($sMethod, $aArgs) |
345 | 345 | { |
346 | - if(!$this->hasMethod($sMethod)) |
|
346 | + if (!$this->hasMethod($sMethod)) |
|
347 | 347 | return; |
348 | 348 | $reflectionMethod = $this->reflectionClass->getMethod($sMethod); |
349 | 349 | $callableObject = $this->getRegisteredObject(); |
@@ -92,12 +92,13 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function __construct($xCallable) |
94 | 94 | { |
95 | - if(is_string($xCallable)) // Received a class name |
|
95 | + if(is_string($xCallable)) { |
|
96 | + // Received a class name |
|
96 | 97 | { |
97 | 98 | $this->reflectionClass = new \ReflectionClass($xCallable); |
98 | - $this->callableObject = null; |
|
99 | 99 | } |
100 | - else // if(is_object($xCallable)) // Received a class instance |
|
100 | + $this->callableObject = null; |
|
101 | + } else // if(is_object($xCallable)) // Received a class instance |
|
101 | 102 | { |
102 | 103 | $this->reflectionClass = new \ReflectionClass(get_class($xCallable)); |
103 | 104 | $this->setCallable($xCallable); |
@@ -236,31 +237,35 @@ discard block |
||
236 | 237 | // Set the namespace |
237 | 238 | if($sName == 'namespace') |
238 | 239 | { |
239 | - if($sValue != '') |
|
240 | - $this->namespace = $sValue; |
|
240 | + if($sValue != '') { |
|
241 | + $this->namespace = $sValue; |
|
242 | + } |
|
241 | 243 | return; |
242 | 244 | } |
243 | 245 | // Set the classpath |
244 | 246 | if($sName == 'classpath') |
245 | 247 | { |
246 | - if($sValue != '') |
|
247 | - $this->classpath = $sValue; |
|
248 | + if($sValue != '') { |
|
249 | + $this->classpath = $sValue; |
|
250 | + } |
|
248 | 251 | return; |
249 | 252 | } |
250 | 253 | // Set the separator |
251 | 254 | if($sName == 'separator') |
252 | 255 | { |
253 | - if($sValue == '_' || $sValue == '.') |
|
254 | - $this->separator = $sValue; |
|
256 | + if($sValue == '_' || $sValue == '.') { |
|
257 | + $this->separator = $sValue; |
|
258 | + } |
|
255 | 259 | return; |
256 | 260 | } |
257 | 261 | // Set the excluded methods |
258 | 262 | if($sName == 'protected') |
259 | 263 | { |
260 | - if(is_array($sValue)) |
|
261 | - $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
|
262 | - else if(is_string($sValue)) |
|
263 | - $this->aProtectedMethods[] = $sValue; |
|
264 | + if(is_array($sValue)) { |
|
265 | + $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
|
266 | + } else if(is_string($sValue)) { |
|
267 | + $this->aProtectedMethods[] = $sValue; |
|
268 | + } |
|
264 | 269 | return; |
265 | 270 | } |
266 | 271 | |
@@ -343,8 +348,9 @@ discard block |
||
343 | 348 | */ |
344 | 349 | public function call($sMethod, $aArgs) |
345 | 350 | { |
346 | - if(!$this->hasMethod($sMethod)) |
|
347 | - return; |
|
351 | + if(!$this->hasMethod($sMethod)) { |
|
352 | + return; |
|
353 | + } |
|
348 | 354 | $reflectionMethod = $this->reflectionClass->getMethod($sMethod); |
349 | 355 | $callableObject = $this->getRegisteredObject(); |
350 | 356 | $this->getResponseManager()->append($reflectionMethod->invokeArgs($callableObject, $aArgs)); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | protected function alert($message, $title) |
28 | 28 | { |
29 | - if($this->getReturn()) |
|
29 | + if ($this->getReturn()) |
|
30 | 30 | { |
31 | 31 | return 'alert(' . $message . ')'; |
32 | 32 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function confirm($question, $yesScript, $noScript) |
24 | 24 | { |
25 | - if(!$noScript) |
|
25 | + if (!$noScript) |
|
26 | 26 | { |
27 | 27 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}'; |
28 | 28 | } |
@@ -25,8 +25,7 @@ |
||
25 | 25 | if(!$noScript) |
26 | 26 | { |
27 | 27 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}'; |
28 | - } |
|
29 | - else |
|
28 | + } else |
|
30 | 29 | { |
31 | 30 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}else{' . $noScript . ';}'; |
32 | 31 | } |
@@ -91,19 +91,19 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function make($xValue) |
93 | 93 | { |
94 | - if($xValue instanceof Interfaces\Parameter) |
|
94 | + if ($xValue instanceof Interfaces\Parameter) |
|
95 | 95 | { |
96 | 96 | return $xValue; |
97 | 97 | } |
98 | - else if(is_numeric($xValue)) |
|
98 | + else if (is_numeric($xValue)) |
|
99 | 99 | { |
100 | 100 | return new Parameter(Jaxon::NUMERIC_VALUE, $xValue); |
101 | 101 | } |
102 | - else if(is_string($xValue)) |
|
102 | + else if (is_string($xValue)) |
|
103 | 103 | { |
104 | 104 | return new Parameter(Jaxon::QUOTED_VALUE, $xValue); |
105 | 105 | } |
106 | - else if(is_bool($xValue)) |
|
106 | + else if (is_bool($xValue)) |
|
107 | 107 | { |
108 | 108 | return new Parameter(Jaxon::BOOL_VALUE, $xValue); |
109 | 109 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $sJsCode = ''; |
124 | 124 | $sQuoteCharacter = "'"; |
125 | - switch($this->sType) |
|
125 | + switch ($this->sType) |
|
126 | 126 | { |
127 | 127 | case Jaxon::FORM_VALUES: |
128 | 128 | $sFormID = (string)$this->xValue; |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | break; |
131 | 131 | case Jaxon::INPUT_VALUE: |
132 | 132 | $sInputID = (string)$this->xValue; |
133 | - $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sInputID . $sQuoteCharacter . ").value"; |
|
133 | + $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sInputID . $sQuoteCharacter . ").value"; |
|
134 | 134 | break; |
135 | 135 | case Jaxon::CHECKED_VALUE: |
136 | 136 | $sCheckedID = (string)$this->xValue; |
137 | - $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sCheckedID . $sQuoteCharacter . ").checked"; |
|
137 | + $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sCheckedID . $sQuoteCharacter . ").checked"; |
|
138 | 138 | break; |
139 | 139 | case Jaxon::ELEMENT_INNERHTML: |
140 | 140 | $sElementID = (string)$this->xValue; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $sJsCode = (string)$this->xValue; |
154 | 154 | break; |
155 | 155 | case Jaxon::JS_VALUE: |
156 | - if(is_array($this->xValue) || is_object($this->xValue)) |
|
156 | + if (is_array($this->xValue) || is_object($this->xValue)) |
|
157 | 157 | { |
158 | 158 | // Unable to use double quotes here because they cannot be handled on client side. |
159 | 159 | // So we are using simple quotes even if the Json standard recommends double quotes. |
@@ -94,20 +94,16 @@ discard block |
||
94 | 94 | if($xValue instanceof Interfaces\Parameter) |
95 | 95 | { |
96 | 96 | return $xValue; |
97 | - } |
|
98 | - else if(is_numeric($xValue)) |
|
97 | + } else if(is_numeric($xValue)) |
|
99 | 98 | { |
100 | 99 | return new Parameter(Jaxon::NUMERIC_VALUE, $xValue); |
101 | - } |
|
102 | - else if(is_string($xValue)) |
|
100 | + } else if(is_string($xValue)) |
|
103 | 101 | { |
104 | 102 | return new Parameter(Jaxon::QUOTED_VALUE, $xValue); |
105 | - } |
|
106 | - else if(is_bool($xValue)) |
|
103 | + } else if(is_bool($xValue)) |
|
107 | 104 | { |
108 | 105 | return new Parameter(Jaxon::BOOL_VALUE, $xValue); |
109 | - } |
|
110 | - else // if(is_array($xValue) || is_object($xValue)) |
|
106 | + } else // if(is_array($xValue) || is_object($xValue)) |
|
111 | 107 | { |
112 | 108 | return new Parameter(Jaxon::JS_VALUE, $xValue); |
113 | 109 | } |
@@ -158,8 +154,7 @@ discard block |
||
158 | 154 | // Unable to use double quotes here because they cannot be handled on client side. |
159 | 155 | // So we are using simple quotes even if the Json standard recommends double quotes. |
160 | 156 | $sJsCode = str_replace(['"'], ["'"], json_encode($this->xValue, JSON_HEX_APOS | JSON_HEX_QUOT)); |
161 | - } |
|
162 | - else |
|
157 | + } else |
|
163 | 158 | { |
164 | 159 | $sJsCode = (string)$this->xValue; |
165 | 160 | } |