@@ -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 < 4) |
|
77 | + if ($maxPagesToShow < 4) |
|
78 | 78 | { |
79 | 79 | throw new \InvalidArgumentException('maxPagesToShow cannot be less than 4.'); |
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(Parameter::PAGE_NUMBER, 0); |
160 | 160 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | public function getNextPage() |
199 | 199 | { |
200 | - if($this->currentPage < $this->numPages) |
|
200 | + if ($this->currentPage < $this->numPages) |
|
201 | 201 | { |
202 | 202 | return $this->currentPage + 1; |
203 | 203 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | public function getPrevPage() |
209 | 209 | { |
210 | - if($this->currentPage > 1) |
|
210 | + if ($this->currentPage > 1) |
|
211 | 211 | { |
212 | 212 | return $this->currentPage - 1; |
213 | 213 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | public function getNextCall() |
219 | 219 | { |
220 | - if(!$this->getNextPage()) |
|
220 | + if (!$this->getNextPage()) |
|
221 | 221 | { |
222 | 222 | return null; |
223 | 223 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public function getPrevCall() |
232 | 232 | { |
233 | - if(!$this->getPrevPage()) |
|
233 | + if (!$this->getPrevPage()) |
|
234 | 234 | { |
235 | 235 | return null; |
236 | 236 | } |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | { |
259 | 259 | $pages = []; |
260 | 260 | |
261 | - if($this->numPages <= 1) |
|
261 | + if ($this->numPages <= 1) |
|
262 | 262 | { |
263 | 263 | return []; |
264 | 264 | } |
265 | 265 | |
266 | - if($this->numPages <= $this->maxPagesToShow) |
|
266 | + if ($this->numPages <= $this->maxPagesToShow) |
|
267 | 267 | { |
268 | - for($i = 1; $i <= $this->numPages; $i++) |
|
268 | + for ($i = 1; $i <= $this->numPages; $i++) |
|
269 | 269 | { |
270 | 270 | $pages[] = $this->createPage($i); |
271 | 271 | } |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | else |
274 | 274 | { |
275 | 275 | // Determine the sliding range, centered around the current page. |
276 | - $numAdjacents = (int) floor(($this->maxPagesToShow - 4) / 2); |
|
276 | + $numAdjacents = (int)floor(($this->maxPagesToShow - 4) / 2); |
|
277 | 277 | |
278 | 278 | $slidingStart = 1; |
279 | 279 | $slidingEndOffset = $numAdjacents + 3 - $this->currentPage; |
280 | - if($slidingEndOffset < 0) |
|
280 | + if ($slidingEndOffset < 0) |
|
281 | 281 | { |
282 | 282 | $slidingStart = $this->currentPage - $numAdjacents; |
283 | 283 | $slidingEndOffset = 0; |
@@ -285,23 +285,23 @@ discard block |
||
285 | 285 | |
286 | 286 | $slidingEnd = $this->numPages; |
287 | 287 | $slidingStartOffset = $this->currentPage + $numAdjacents + 2 - $this->numPages; |
288 | - if($slidingStartOffset < 0) |
|
288 | + if ($slidingStartOffset < 0) |
|
289 | 289 | { |
290 | 290 | $slidingEnd = $this->currentPage + $numAdjacents; |
291 | 291 | $slidingStartOffset = 0; |
292 | 292 | } |
293 | 293 | |
294 | 294 | // Build the list of pages. |
295 | - if($slidingStart > 1) |
|
295 | + if ($slidingStart > 1) |
|
296 | 296 | { |
297 | 297 | $pages[] = $this->createPage(1); |
298 | 298 | $pages[] = $this->createPageEllipsis(); |
299 | 299 | } |
300 | - for($i = $slidingStart - $slidingStartOffset; $i <= $slidingEnd + $slidingEndOffset; $i++) |
|
300 | + for ($i = $slidingStart - $slidingStartOffset; $i <= $slidingEnd + $slidingEndOffset; $i++) |
|
301 | 301 | { |
302 | 302 | $pages[] = $this->createPage($i); |
303 | 303 | } |
304 | - if($slidingEnd < $this->numPages) |
|
304 | + if ($slidingEnd < $this->numPages) |
|
305 | 305 | { |
306 | 306 | $pages[] = $this->createPageEllipsis(); |
307 | 307 | $pages[] = $this->createPage($this->numPages); |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | { |
345 | 345 | $first = ($this->currentPage - 1) * $this->itemsPerPage + 1; |
346 | 346 | |
347 | - if($first > $this->totalItems) |
|
347 | + if ($first > $this->totalItems) |
|
348 | 348 | { |
349 | 349 | return null; |
350 | 350 | } |
@@ -355,13 +355,13 @@ discard block |
||
355 | 355 | public function getCurrentPageLastItem() |
356 | 356 | { |
357 | 357 | $first = $this->getCurrentPageFirstItem(); |
358 | - if($first === null) |
|
358 | + if ($first === null) |
|
359 | 359 | { |
360 | 360 | return null; |
361 | 361 | } |
362 | 362 | |
363 | 363 | $last = $first + $this->itemsPerPage - 1; |
364 | - if($last > $this->totalItems) |
|
364 | + if ($last > $this->totalItems) |
|
365 | 365 | { |
366 | 366 | return $this->totalItems; |
367 | 367 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | */ |
399 | 399 | public function render() |
400 | 400 | { |
401 | - if($this->getNumPages() <= 1) |
|
401 | + if ($this->getNumPages() <= 1) |
|
402 | 402 | { |
403 | 403 | return ''; |
404 | 404 | } |
@@ -269,8 +269,7 @@ |
||
269 | 269 | { |
270 | 270 | $pages[] = $this->createPage($i); |
271 | 271 | } |
272 | - } |
|
273 | - else |
|
272 | + } else |
|
274 | 273 | { |
275 | 274 | // Determine the sliding range, centered around the current page. |
276 | 275 | $numAdjacents = (int) floor(($this->maxPagesToShow - 4) / 2); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | /** |
60 | 60 | * Process an incoming Jaxon request, and return the response. |
61 | 61 | * |
62 | - * @return void |
|
62 | + * @return boolean|null |
|
63 | 63 | */ |
64 | 64 | public function processRequest() |
65 | 65 | { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function setup($sConfigFile) |
30 | 30 | { |
31 | - if(!file_exists($sConfigFile)) |
|
31 | + if (!file_exists($sConfigFile)) |
|
32 | 32 | { |
33 | 33 | throw new Exception("Unable to find config file at $sConfigFile"); |
34 | 34 | } |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | $aLibOptions = key_exists('lib', $aOptions) ? $aOptions['lib'] : []; |
39 | 39 | $aAppOptions = key_exists('app', $aOptions) ? $aOptions['app'] : []; |
40 | 40 | |
41 | - if(!is_array($aLibOptions) || !is_array($aAppOptions)) |
|
41 | + if (!is_array($aLibOptions) || !is_array($aAppOptions)) |
|
42 | 42 | { |
43 | 43 | throw new Exception("Unexpected content in config file at $sConfigFile"); |
44 | 44 | } |
45 | 45 | |
46 | 46 | // Set the session manager |
47 | - jaxon()->di()->setSessionManager(function () { |
|
47 | + jaxon()->di()->setSessionManager(function() { |
|
48 | 48 | return new SessionManager(); |
49 | 49 | }); |
50 | 50 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @var array $aLibOptions The library options |
74 | 74 | * |
75 | - * @return Boot |
|
75 | + * @return Bootstrap |
|
76 | 76 | */ |
77 | 77 | public function lib(array $aLibOptions) |
78 | 78 | { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @var array $aAppOptions The application options |
87 | 87 | * |
88 | - * @return Boot |
|
88 | + * @return Bootstrap |
|
89 | 89 | */ |
90 | 90 | public function app(array $aAppOptions) |
91 | 91 | { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @var string $sUri The ajax endpoint URI |
100 | 100 | * |
101 | - * @return Boot |
|
101 | + * @return Bootstrap |
|
102 | 102 | */ |
103 | 103 | public function uri($sUri) |
104 | 104 | { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @var |
113 | 113 | * |
114 | - * @return Boot |
|
114 | + * @return Bootstrap |
|
115 | 115 | */ |
116 | 116 | public function js($bExportJs, $sJsUri = '', $sJsDir = '', $bMinifyJs = false) |
117 | 117 | { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $this->triggerEvent('pre.setup'); |
155 | 155 | |
156 | 156 | // Add the view renderer |
157 | - $view->addRenderer('jaxon', function () { |
|
157 | + $view->addRenderer('jaxon', function() { |
|
158 | 158 | return new View\View(); |
159 | 159 | }); |
160 | 160 | |
@@ -181,24 +181,24 @@ discard block |
||
181 | 181 | // Use the Composer autoloader. It's important to call this before triggers and callbacks. |
182 | 182 | // $jaxon->useComposerAutoloader(); |
183 | 183 | // Jaxon library settings |
184 | - if(!$jaxon->hasOption('js.app.export')) |
|
184 | + if (!$jaxon->hasOption('js.app.export')) |
|
185 | 185 | { |
186 | 186 | $jaxon->setOption('js.app.export', $this->bExportJs); |
187 | 187 | } |
188 | - if(!$jaxon->hasOption('js.app.minify')) |
|
188 | + if (!$jaxon->hasOption('js.app.minify')) |
|
189 | 189 | { |
190 | 190 | $jaxon->setOption('js.app.minify', $this->bMinifyJs); |
191 | 191 | } |
192 | - if(!$jaxon->hasOption('js.app.uri') && $this->sJsUri != '') |
|
192 | + if (!$jaxon->hasOption('js.app.uri') && $this->sJsUri != '') |
|
193 | 193 | { |
194 | 194 | $jaxon->setOption('js.app.uri', $this->sJsUri); |
195 | 195 | } |
196 | - if(!$jaxon->hasOption('js.app.dir') && $this->sJsDir != '') |
|
196 | + if (!$jaxon->hasOption('js.app.dir') && $this->sJsDir != '') |
|
197 | 197 | { |
198 | 198 | $jaxon->setOption('js.app.dir', $this->sJsDir); |
199 | 199 | } |
200 | 200 | // Set the request URI |
201 | - if(!$jaxon->hasOption('core.request.uri') && $this->sUri != '') |
|
201 | + if (!$jaxon->hasOption('core.request.uri') && $this->sUri != '') |
|
202 | 202 | { |
203 | 203 | $jaxon->setOption('core.request.uri', $this->sUri); |
204 | 204 | } |
@@ -7,9 +7,8 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * Set the Jaxon application options. |
9 | 9 | * |
10 | - * @param Config $xAppConfig The config options |
|
11 | 10 | * |
12 | - * @return void |
|
11 | + * @return \Jaxon\App\Bootstrap |
|
13 | 12 | */ |
14 | 13 | protected function bootstrap() |
15 | 14 | { |
@@ -19,7 +18,7 @@ discard block |
||
19 | 18 | /** |
20 | 19 | * Get the Jaxon response. |
21 | 20 | * |
22 | - * @return Response |
|
21 | + * @return \Jaxon\Response\Response |
|
23 | 22 | */ |
24 | 23 | public function ajaxResponse() |
25 | 24 | { |
@@ -29,7 +28,7 @@ discard block |
||
29 | 28 | /** |
30 | 29 | * Get an instance of a registered class |
31 | 30 | * |
32 | - * @param string $sClass The class name |
|
31 | + * @param string $sClassName The class name |
|
33 | 32 | * |
34 | 33 | * @return mixed |
35 | 34 | */ |
@@ -41,7 +40,7 @@ discard block |
||
41 | 40 | /** |
42 | 41 | * Get a request to a registered class |
43 | 42 | * |
44 | - * @param string $sClass The class name |
|
43 | + * @param string $sClassName The class name |
|
45 | 44 | * |
46 | 45 | * @return \Jaxon\Request\Factory\CallableClass\Request |
47 | 46 | */ |
@@ -110,7 +109,7 @@ discard block |
||
110 | 109 | /** |
111 | 110 | * Get the view renderer |
112 | 111 | * |
113 | - * @return Jaxon\Utils\View\Renderer |
|
112 | + * @return \Jaxon\Utils\View\Renderer |
|
114 | 113 | */ |
115 | 114 | public function view() |
116 | 115 | { |
@@ -120,7 +119,7 @@ discard block |
||
120 | 119 | /** |
121 | 120 | * Get the session manager |
122 | 121 | * |
123 | - * @return Jaxon\Contracts\Session |
|
122 | + * @return \Jaxon\Contracts\Session |
|
124 | 123 | */ |
125 | 124 | public function session() |
126 | 125 | { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * When registering a callable class, this is the class name |
223 | 223 | * When registering a callable directory, this is the full path to the directory |
224 | 224 | * When registering an event, this is the event name |
225 | - * @param array|string|Closure $aOptions | $sIncludeFile | $sNamespace |
|
225 | + * @param array|string|Closure $xOptions | $sIncludeFile | $sNamespace |
|
226 | 226 | * When registering a function, this is an (optional) array |
227 | 227 | * of call options, or the (optional) include file |
228 | 228 | * When registering a callable class, this is an (optional) array |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | /** |
264 | 264 | * Get an instance of a registered class |
265 | 265 | * |
266 | - * @param string $sClass The class name |
|
266 | + * @param string $sClassName The class name |
|
267 | 267 | * |
268 | 268 | * @return mixed |
269 | 269 | */ |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | /** |
277 | 277 | * Get a request to a registered class |
278 | 278 | * |
279 | - * @param string $sClass The class name |
|
279 | + * @param string $sClassName The class name |
|
280 | 280 | * |
281 | 281 | * @return \Jaxon\Request\Factory\CallableClass\Request |
282 | 282 | */ |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * |
359 | 359 | * This function may exit after the request is processed, if the 'core.process.exit' option is set to true. |
360 | 360 | * |
361 | - * @return void |
|
361 | + * @return boolean|null |
|
362 | 362 | * |
363 | 363 | * @see <Jaxon\Jaxon->canProcessRequest> |
364 | 364 | */ |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | /** |
433 | 433 | * Get the view renderer |
434 | 434 | * |
435 | - * @return Jaxon\Utils\View\Renderer |
|
435 | + * @return Utils\View\Renderer |
|
436 | 436 | */ |
437 | 437 | public function view() |
438 | 438 | { |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | /** |
443 | 443 | * Get the session manager |
444 | 444 | * |
445 | - * @return Jaxon\Contracts\Session |
|
445 | + * @return Contracts\Session |
|
446 | 446 | */ |
447 | 447 | public function session() |
448 | 448 | { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public static function getInstance() |
84 | 84 | { |
85 | - if(self::$xInstance == null) |
|
85 | + if (self::$xInstance == null) |
|
86 | 86 | { |
87 | 87 | self::$xInstance = new Jaxon(); |
88 | 88 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function __construct() |
96 | 96 | { |
97 | - if(self::$xContainer == null) |
|
97 | + if (self::$xContainer == null) |
|
98 | 98 | { |
99 | 99 | self::$xContainer = new Container(); |
100 | 100 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | 'core.prefix.class' => 'Jaxon', |
149 | 149 | // 'core.request.uri' => '', |
150 | 150 | 'core.request.mode' => 'asynchronous', |
151 | - 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
151 | + 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
152 | 152 | 'core.response.send' => true, |
153 | 153 | 'core.response.merge.ap' => true, |
154 | 154 | 'core.response.merge.js' => true, |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function register($sType, $sCallable, $xOptions = []) |
236 | 236 | { |
237 | - if($sType == Jaxon::PROCESSING_EVENT) |
|
237 | + if ($sType == Jaxon::PROCESSING_EVENT) |
|
238 | 238 | { |
239 | 239 | $sEvent = $sCallable; |
240 | 240 | $xCallback = $xOptions; |
241 | - switch($sEvent) |
|
241 | + switch ($sEvent) |
|
242 | 242 | { |
243 | 243 | case Jaxon::PROCESSING_EVENT_BEFORE: |
244 | 244 | $this->callback()->before($xCallback); |
@@ -22,15 +22,12 @@ |
||
22 | 22 | namespace Jaxon\Plugin; |
23 | 23 | |
24 | 24 | use Jaxon\Jaxon; |
25 | -use Jaxon\Plugin\Package; |
|
26 | -use Jaxon\Request\Support\CallableRepository; |
|
27 | 25 | use Jaxon\Request\Plugin\CallableClass; |
28 | 26 | use Jaxon\Request\Plugin\CallableDir; |
29 | 27 | use Jaxon\Request\Plugin\CallableFunction; |
30 | 28 | use Jaxon\Request\Plugin\FileUpload; |
31 | 29 | use Jaxon\Response\Plugin\JQuery as JQueryPlugin; |
32 | 30 | use Jaxon\Utils\Config\Config; |
33 | - |
|
34 | 31 | use Closure; |
35 | 32 | |
36 | 33 | class Manager |
@@ -138,33 +138,33 @@ discard block |
||
138 | 138 | $bIsAlert = ($xPlugin instanceof \Jaxon\Contracts\Dialogs\Alert); |
139 | 139 | $bIsConfirm = ($xPlugin instanceof \Jaxon\Contracts\Dialogs\Confirm); |
140 | 140 | $bIsListener = ($xPlugin instanceof \Jaxon\Contracts\Event\Listener); |
141 | - if($xPlugin instanceof Request) |
|
141 | + if ($xPlugin instanceof Request) |
|
142 | 142 | { |
143 | 143 | // The name of a request plugin is used as key in the plugin table |
144 | 144 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
145 | 145 | } |
146 | - elseif($xPlugin instanceof Response) |
|
146 | + elseif ($xPlugin instanceof Response) |
|
147 | 147 | { |
148 | 148 | // The name of a response plugin is used as key in the plugin table |
149 | 149 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
150 | 150 | } |
151 | - elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
151 | + elseif (!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
152 | 152 | { |
153 | 153 | $sErrorMessage = $this->trans('errors.register.invalid', ['name' => get_class($xPlugin)]); |
154 | 154 | throw new \Jaxon\Exception\Error($sErrorMessage); |
155 | 155 | } |
156 | 156 | // This plugin implements the Alert interface |
157 | - if($bIsAlert) |
|
157 | + if ($bIsAlert) |
|
158 | 158 | { |
159 | 159 | jaxon()->dialog()->setAlert($xPlugin); |
160 | 160 | } |
161 | 161 | // This plugin implements the Confirm interface |
162 | - if($bIsConfirm) |
|
162 | + if ($bIsConfirm) |
|
163 | 163 | { |
164 | 164 | jaxon()->dialog()->setConfirm($xPlugin); |
165 | 165 | } |
166 | 166 | // Register the plugin as an event listener |
167 | - if($bIsListener) |
|
167 | + if ($bIsListener) |
|
168 | 168 | { |
169 | 169 | $this->addEventListener($xPlugin); |
170 | 170 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function registerCallable($sType, $sCallable, $aOptions = []) |
201 | 201 | { |
202 | - if(!key_exists($sType, $this->aRequestPlugins)) |
|
202 | + if (!key_exists($sType, $this->aRequestPlugins)) |
|
203 | 203 | { |
204 | 204 | throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType])); |
205 | 205 | } |
@@ -220,14 +220,14 @@ discard block |
||
220 | 220 | private function registerCallablesFromConfig($xAppConfig, $sSection, $sCallableType) |
221 | 221 | { |
222 | 222 | $aConfig = $xAppConfig->getOption($sSection, []); |
223 | - foreach($aConfig as $xKey => $xValue) |
|
223 | + foreach ($aConfig as $xKey => $xValue) |
|
224 | 224 | { |
225 | - if(is_integer($xKey) && is_string($xValue)) |
|
225 | + if (is_integer($xKey) && is_string($xValue)) |
|
226 | 226 | { |
227 | 227 | // Register a function without options |
228 | 228 | $this->registerCallable($sCallableType, $xValue); |
229 | 229 | } |
230 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
230 | + elseif (is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
231 | 231 | { |
232 | 232 | // Register a function with options |
233 | 233 | $this->registerCallable($sCallableType, $xKey, $xValue); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public function getResponsePlugin($sName) |
271 | 271 | { |
272 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
272 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
273 | 273 | { |
274 | 274 | return $this->aResponsePlugins[$sName]; |
275 | 275 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function getRequestPlugin($sName) |
287 | 287 | { |
288 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
288 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
289 | 289 | { |
290 | 290 | return $this->aRequestPlugins[$sName]; |
291 | 291 | } |
@@ -142,13 +142,11 @@ discard block |
||
142 | 142 | { |
143 | 143 | // The name of a request plugin is used as key in the plugin table |
144 | 144 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
145 | - } |
|
146 | - elseif($xPlugin instanceof Response) |
|
145 | + } elseif($xPlugin instanceof Response) |
|
147 | 146 | { |
148 | 147 | // The name of a response plugin is used as key in the plugin table |
149 | 148 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
150 | - } |
|
151 | - elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
149 | + } elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
152 | 150 | { |
153 | 151 | $sErrorMessage = $this->trans('errors.register.invalid', ['name' => get_class($xPlugin)]); |
154 | 152 | throw new \Jaxon\Exception\Error($sErrorMessage); |
@@ -226,13 +224,11 @@ discard block |
||
226 | 224 | { |
227 | 225 | // Register a function without options |
228 | 226 | $this->registerCallable($sCallableType, $xValue); |
229 | - } |
|
230 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
227 | + } elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
231 | 228 | { |
232 | 229 | // Register a function with options |
233 | 230 | $this->registerCallable($sCallableType, $xKey, $xValue); |
234 | - } |
|
235 | - else |
|
231 | + } else |
|
236 | 232 | { |
237 | 233 | continue; |
238 | 234 | // Todo: throw an exception |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @param integer $nItemsPerPage The number of items per page page |
240 | 240 | * @param integer $nItemsTotal The total number of items |
241 | 241 | * |
242 | - * @return Paginator |
|
242 | + * @return \Jaxon\Utils\Pagination\Paginator |
|
243 | 243 | */ |
244 | 244 | public function pg($nCurrentPage, $nItemsPerPage, $nItemsTotal) |
245 | 245 | { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @param integer $nItemsPerPage The number of items per page page |
255 | 255 | * @param integer $nItemsTotal The total number of items |
256 | 256 | * |
257 | - * @return Paginator |
|
257 | + * @return \Jaxon\Utils\Pagination\Paginator |
|
258 | 258 | */ |
259 | 259 | public function paginate($nCurrentPage, $nItemsPerPage, $nItemsTotal) |
260 | 260 | { |
@@ -20,7 +20,6 @@ |
||
20 | 20 | |
21 | 21 | namespace Jaxon\Request\Factory; |
22 | 22 | |
23 | -use JsonSerializable; |
|
24 | 23 | use Jaxon\Request\Factory\Parameter; |
25 | 24 | use Jaxon\Response\Plugin\JQuery\Dom\Element as DomElement; |
26 | 25 |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function hasPageNumber() |
54 | 54 | { |
55 | - foreach($this->aParameters as $xParameter) |
|
55 | + foreach ($this->aParameters as $xParameter) |
|
56 | 56 | { |
57 | - if($xParameter->getType() == Parameter::PAGE_NUMBER) |
|
57 | + if ($xParameter->getType() == Parameter::PAGE_NUMBER) |
|
58 | 58 | { |
59 | 59 | return true; |
60 | 60 | } |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | public function setPageNumber($nPageNumber) |
73 | 73 | { |
74 | 74 | // Set the value of the Parameter::PAGE_NUMBER parameter |
75 | - foreach($this->aParameters as $xParameter) |
|
75 | + foreach ($this->aParameters as $xParameter) |
|
76 | 76 | { |
77 | - if($xParameter->getType() == Parameter::PAGE_NUMBER) |
|
77 | + if ($xParameter->getType() == Parameter::PAGE_NUMBER) |
|
78 | 78 | { |
79 | 79 | $xParameter->setValue(intval($nPageNumber)); |
80 | 80 | break; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | private function setMessageArgs(array $aArgs) |
94 | 94 | { |
95 | - array_walk($aArgs, function (&$xParameter) { |
|
95 | + array_walk($aArgs, function(&$xParameter) { |
|
96 | 96 | $xParameter = Parameter::make($xParameter); |
97 | 97 | }); |
98 | 98 | $this->aMessageArgs = $aArgs; |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | // This array will avoid declaring multiple variables with the same value. |
148 | 148 | // The array key is the variable value, while the array value is the variable name. |
149 | 149 | $aVariables = []; // Array of local variables. |
150 | - foreach($this->aParameters as &$xParameter) |
|
150 | + foreach ($this->aParameters as &$xParameter) |
|
151 | 151 | { |
152 | 152 | $sParameterStr = $xParameter->getScript(); |
153 | - if($xParameter instanceof DomElement) |
|
153 | + if ($xParameter instanceof DomElement) |
|
154 | 154 | { |
155 | - if(!array_key_exists($sParameterStr, $aVariables)) |
|
155 | + if (!array_key_exists($sParameterStr, $aVariables)) |
|
156 | 156 | { |
157 | 157 | // The value is not yet defined. A new variable is created. |
158 | 158 | $sVarName = "jxnVar$nVarId"; |
@@ -170,19 +170,19 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | $sPhrase = ''; |
173 | - if(count($this->aMessageArgs) > 0) |
|
173 | + if (count($this->aMessageArgs) > 0) |
|
174 | 174 | { |
175 | 175 | $sPhrase = array_shift($this->aMessageArgs); // The first array entry is the question. |
176 | 176 | // $sPhrase = "'" . addslashes($sPhrase) . "'"; // Wrap the phrase with single quotes |
177 | - if(count($this->aMessageArgs) > 0) |
|
177 | + if (count($this->aMessageArgs) > 0) |
|
178 | 178 | { |
179 | 179 | $nParamId = 1; |
180 | - foreach($this->aMessageArgs as &$xParameter) |
|
180 | + foreach ($this->aMessageArgs as &$xParameter) |
|
181 | 181 | { |
182 | 182 | $sParameterStr = $xParameter->getScript(); |
183 | - if($xParameter instanceof DomElement) |
|
183 | + if ($xParameter instanceof DomElement) |
|
184 | 184 | { |
185 | - if(!array_key_exists($sParameterStr, $aVariables)) |
|
185 | + if (!array_key_exists($sParameterStr, $aVariables)) |
|
186 | 186 | { |
187 | 187 | // The value is not yet defined. A new variable is created. |
188 | 188 | $sVarName = "jxnVar$nVarId"; |
@@ -206,14 +206,14 @@ discard block |
||
206 | 206 | |
207 | 207 | $sScript = parent::getScript(); |
208 | 208 | $xDialog = jaxon()->dialog(); |
209 | - if($this->sCondition == '__confirm__') |
|
209 | + if ($this->sCondition == '__confirm__') |
|
210 | 210 | { |
211 | 211 | $sScript = $xDialog->confirm($sPhrase, $sScript, ''); |
212 | 212 | } |
213 | - elseif($this->sCondition !== null) |
|
213 | + elseif ($this->sCondition !== null) |
|
214 | 214 | { |
215 | 215 | $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}'; |
216 | - if(($sPhrase)) |
|
216 | + if (($sPhrase)) |
|
217 | 217 | { |
218 | 218 | $xDialog->getAlert()->setReturn(true); |
219 | 219 | $sScript .= 'else{' . $xDialog->warning($sPhrase) . ';}'; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param string|null $sClass The callable class |
55 | 55 | * |
56 | - * @return Factory |
|
56 | + * @return RequestFactory |
|
57 | 57 | */ |
58 | 58 | public function setClassName($sClass) |
59 | 59 | { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param CallableObject $xCallable The callable object |
82 | 82 | * |
83 | - * @return Factory |
|
83 | + * @return RequestFactory |
|
84 | 84 | */ |
85 | 85 | public function setCallable(CallableObject $xCallable) |
86 | 86 | { |
@@ -93,7 +93,6 @@ discard block |
||
93 | 93 | * Return the javascript call to a Jaxon function or object method |
94 | 94 | * |
95 | 95 | * @param string $sFunction The function or method (without class) name |
96 | - * @param ... $xParams The parameters of the function or method |
|
97 | 96 | * |
98 | 97 | * @return Request |
99 | 98 | */ |
@@ -122,7 +121,6 @@ discard block |
||
122 | 121 | * Return the javascript call to a generic function |
123 | 122 | * |
124 | 123 | * @param string $sFunction The function or method (with class) name |
125 | - * @param ... $xParams The parameters of the function or method |
|
126 | 124 | * |
127 | 125 | * @return Request |
128 | 126 | */ |
@@ -17,7 +17,6 @@ |
||
17 | 17 | |
18 | 18 | use Jaxon\Request\Support\CallableObject; |
19 | 19 | use Jaxon\Request\Support\CallableRepository; |
20 | -use Jaxon\Utils\Pagination\Paginator; |
|
21 | 20 | |
22 | 21 | // Extends Parameter for compatibility with older versions (see function rq()) |
23 | 22 | class RequestFactory |
@@ -140,6 +140,7 @@ discard block |
||
140 | 140 | * This is the pre-request processing callback passed to the Jaxon library. |
141 | 141 | * |
142 | 142 | * @param boolean &$bEndRequest if set to true, the request processing is interrupted. |
143 | + * @param boolean $bEndRequest |
|
143 | 144 | * |
144 | 145 | * @return Jaxon\Response\Response the Jaxon response |
145 | 146 | */ |
@@ -170,6 +171,7 @@ discard block |
||
170 | 171 | /** |
171 | 172 | * This callback is called whenever an invalid request is processed. |
172 | 173 | * |
174 | + * @param string $sMessage |
|
173 | 175 | * @return Jaxon\Response\Response the Jaxon response |
174 | 176 | */ |
175 | 177 | public function onInvalid($sMessage) |
@@ -236,7 +238,7 @@ discard block |
||
236 | 238 | * Calls each of the request plugins to request that they process the current request. |
237 | 239 | * If any plugin processes the request, it will return true. |
238 | 240 | * |
239 | - * @return boolean |
|
241 | + * @return boolean|null |
|
240 | 242 | */ |
241 | 243 | public function processRequest() |
242 | 244 | { |
@@ -24,7 +24,6 @@ |
||
24 | 24 | use Jaxon\Plugin\Manager as PluginManager; |
25 | 25 | use Jaxon\Response\Manager as ResponseManager; |
26 | 26 | use Jaxon\Request\Plugin\FileUpload; |
27 | - |
|
28 | 27 | use Exception; |
29 | 28 | |
30 | 29 | class Handler |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | public function onBefore(&$bEndRequest) |
147 | 147 | { |
148 | 148 | // Call the user defined callback |
149 | - if(($xCallback = $this->xCallbackManager->before())) |
|
149 | + if (($xCallback = $this->xCallbackManager->before())) |
|
150 | 150 | { |
151 | 151 | call_user_func_array($xCallback, [$this->xTargetRequestPlugin->getTarget(), &$bEndRequest]); |
152 | 152 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function onAfter($bEndRequest) |
162 | 162 | { |
163 | - if(($xCallback = $this->xCallbackManager->after())) |
|
163 | + if (($xCallback = $this->xCallbackManager->after())) |
|
164 | 164 | { |
165 | 165 | call_user_func_array($xCallback, [$this->xTargetRequestPlugin->getTarget(), $bEndRequest]); |
166 | 166 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function onInvalid($sMessage) |
176 | 176 | { |
177 | - if(($xCallback = $this->xCallbackManager->invalid())) |
|
177 | + if (($xCallback = $this->xCallbackManager->invalid())) |
|
178 | 178 | { |
179 | 179 | call_user_func_array($xCallback, [$sMessage]); |
180 | 180 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function onError(Exception $xException) |
190 | 190 | { |
191 | - if(($xCallback = $this->xCallbackManager->error())) |
|
191 | + if (($xCallback = $this->xCallbackManager->error())) |
|
192 | 192 | { |
193 | 193 | call_user_func_array($xCallback, [$xException]); |
194 | 194 | } |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | public function canProcessRequest() |
210 | 210 | { |
211 | 211 | // Return true if the request plugin was already found |
212 | - if(($this->xTargetRequestPlugin)) |
|
212 | + if (($this->xTargetRequestPlugin)) |
|
213 | 213 | { |
214 | 214 | return true; |
215 | 215 | } |
216 | 216 | |
217 | 217 | // Find a plugin to process the request |
218 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
218 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
219 | 219 | { |
220 | - if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
220 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
221 | 221 | { |
222 | 222 | $this->xTargetRequestPlugin = $xPlugin; |
223 | 223 | return true; |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | public function processRequest() |
242 | 242 | { |
243 | 243 | // Check to see if headers have already been sent out, in which case we can't do our job |
244 | - if(headers_sent($filename, $linenumber)) |
|
244 | + if (headers_sent($filename, $linenumber)) |
|
245 | 245 | { |
246 | 246 | echo $this->trans('errors.output.already-sent', [ |
247 | 247 | 'location' => $filename . ':' . $linenumber |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | } |
251 | 251 | |
252 | 252 | // Check if there is a plugin to process this request |
253 | - if(!$this->canProcessRequest()) |
|
253 | + if (!$this->canProcessRequest()) |
|
254 | 254 | { |
255 | 255 | return; |
256 | 256 | } |
@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | $bEndRequest = false; |
259 | 259 | |
260 | 260 | // Handle before processing event |
261 | - if(($this->xTargetRequestPlugin)) |
|
261 | + if (($this->xTargetRequestPlugin)) |
|
262 | 262 | { |
263 | 263 | $this->onBefore($bEndRequest); |
264 | 264 | } |
265 | 265 | |
266 | - if(!$bEndRequest) |
|
266 | + if (!$bEndRequest) |
|
267 | 267 | { |
268 | 268 | try |
269 | 269 | { |
@@ -271,12 +271,12 @@ discard block |
||
271 | 271 | $this->xUploadRequestPlugin->processRequest(); |
272 | 272 | |
273 | 273 | // Process the request |
274 | - if(($this->xTargetRequestPlugin)) |
|
274 | + if (($this->xTargetRequestPlugin)) |
|
275 | 275 | { |
276 | 276 | $this->xTargetRequestPlugin->processRequest(); |
277 | 277 | } |
278 | 278 | } |
279 | - catch(Exception $e) |
|
279 | + catch (Exception $e) |
|
280 | 280 | { |
281 | 281 | // An exception was thrown while processing the request. |
282 | 282 | // The request missed the corresponding handler function, |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | $this->xResponseManager->error($e->getMessage()); |
286 | 286 | |
287 | - if($e instanceof \Jaxon\Exception\Error) |
|
287 | + if ($e instanceof \Jaxon\Exception\Error) |
|
288 | 288 | { |
289 | 289 | $this->onInvalid($e->getMessage()); |
290 | 290 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | } |
297 | 297 | |
298 | 298 | // Clean the processing buffer |
299 | - if(($this->getOption('core.process.clean'))) |
|
299 | + if (($this->getOption('core.process.clean'))) |
|
300 | 300 | { |
301 | 301 | $er = error_reporting(0); |
302 | 302 | while (ob_get_level() > 0) |
@@ -306,26 +306,26 @@ discard block |
||
306 | 306 | error_reporting($er); |
307 | 307 | } |
308 | 308 | |
309 | - if(($this->xTargetRequestPlugin)) |
|
309 | + if (($this->xTargetRequestPlugin)) |
|
310 | 310 | { |
311 | 311 | // Handle after processing event |
312 | 312 | $this->onAfter($bEndRequest); |
313 | 313 | } |
314 | 314 | |
315 | 315 | // If the called function returned no response, take the the global response |
316 | - if(!$this->xResponseManager->getResponse()) |
|
316 | + if (!$this->xResponseManager->getResponse()) |
|
317 | 317 | { |
318 | 318 | $this->xResponseManager->append(jaxon()->getResponse()); |
319 | 319 | } |
320 | 320 | |
321 | 321 | $this->xResponseManager->printDebug(); |
322 | 322 | |
323 | - if(($this->getOption('core.response.send'))) |
|
323 | + if (($this->getOption('core.response.send'))) |
|
324 | 324 | { |
325 | 325 | $this->xResponseManager->sendOutput(); |
326 | 326 | } |
327 | 327 | |
328 | - if(($this->getOption('core.process.exit'))) |
|
328 | + if (($this->getOption('core.process.exit'))) |
|
329 | 329 | { |
330 | 330 | exit(); |
331 | 331 | } |
@@ -191,8 +191,7 @@ discard block |
||
191 | 191 | if(($xCallback = $this->xCallbackManager->error())) |
192 | 192 | { |
193 | 193 | call_user_func_array($xCallback, [$xException]); |
194 | - } |
|
195 | - else |
|
194 | + } else |
|
196 | 195 | { |
197 | 196 | throw $xException; |
198 | 197 | } |
@@ -275,8 +274,7 @@ discard block |
||
275 | 274 | { |
276 | 275 | $this->xTargetRequestPlugin->processRequest(); |
277 | 276 | } |
278 | - } |
|
279 | - catch(Exception $e) |
|
277 | + } catch(Exception $e) |
|
280 | 278 | { |
281 | 279 | // An exception was thrown while processing the request. |
282 | 280 | // The request missed the corresponding handler function, |
@@ -287,8 +285,7 @@ discard block |
||
287 | 285 | if($e instanceof \Jaxon\Exception\Error) |
288 | 286 | { |
289 | 287 | $this->onInvalid($e->getMessage()); |
290 | - } |
|
291 | - else |
|
288 | + } else |
|
292 | 289 | { |
293 | 290 | $this->onError($e); |
294 | 291 | } |