Passed
Push — master ( 68b778...1b1614 )
by Thierry
07:15 queued 04:29
created

Jaxon::dialog()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * Jaxon.php - Jaxon class
5
 *
6
 * The Jaxon class uses a modular plug-in system to facilitate the processing
7
 * of special Ajax requests made by a PHP page.
8
 * It generates Javascript that the page must include in order to make requests.
9
 * It handles the output of response commands (see <Jaxon\Response\Response>).
10
 * Many flags and settings can be adjusted to effect the behavior of the Jaxon class
11
 * as well as the client-side javascript.
12
 *
13
 * @package jaxon-core
0 ignored issues
show
Coding Style introduced by
Package name "jaxon-core" is not valid; consider "Jaxoncore" instead
Loading history...
14
 * @author Jared White
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
15
 * @author J. Max Wilson
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
16
 * @author Joseph Woolley
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
17
 * @author Steffen Konerow
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
18
 * @author Thierry Feuzeu <[email protected]>
19
 * @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
0 ignored issues
show
Coding Style introduced by
@copyright tag must contain a year and the name of the copyright holder
Loading history...
20
 * @copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White  & J. Max Wilson
0 ignored issues
show
Coding Style introduced by
@copyright tag must contain a year and the name of the copyright holder
Loading history...
21
 * @copyright 2016 Thierry Feuzeu <[email protected]>
22
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
23
 * @link https://github.com/jaxon-php/jaxon-core
24
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
25
26
namespace Jaxon;
27
28
use Jaxon\Plugin\Plugin;
29
use Jaxon\Plugin\Package;
30
use Jaxon\Utils\DI\Container;
31
use Jaxon\Utils\Config\Reader as ConfigReader;
32
33
use Psr\Log\LoggerInterface;
34
use Psr\Log\NullLogger;
35
use Psr\Log\LoggerAwareTrait;
36
use Psr\Log\LoggerAwareInterface;
37
38
class Jaxon implements LoggerAwareInterface
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class Jaxon
Loading history...
39
{
40
    use Features\Config;
41
    use Features\Translator;
42
    use LoggerAwareTrait;
43
44
    /**
45
     * Package version number
46
     *
47
     * @var string
48
     */
49
    private $sVersion = 'Jaxon 3.2.0';
50
51
    /*
52
     * Plugin types
53
     */
0 ignored issues
show
Coding Style introduced by
Empty line required after block comment
Loading history...
54
    // Response plugin
55
    const PLUGIN_RESPONSE = 'ResponsePlugin';
56
    // Request plugin
57
    const PLUGIN_REQUEST = 'RequestPlugin';
58
    // Package plugin
59
    const PLUGIN_PACKAGE = 'PackagePlugin';
60
61
    /*
62
     * Request plugins
63
     */
0 ignored issues
show
Coding Style introduced by
Empty line required after block comment
Loading history...
64
    const CALLABLE_CLASS = 'CallableClass';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
65
    const CALLABLE_DIR = 'CallableDir';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
66
    const CALLABLE_FUNCTION = 'CallableFunction';
67
    // For uploaded files.
68
    const FILE_UPLOAD = 'FileUpload';
69
    // For compatibility with previous versions
70
    const CALLABLE_OBJECT = 'CallableClass'; // Same as CALLABLE_CLASS
71
    const USER_FUNCTION = 'CallableFunction'; // Same as CALLABLE_FUNCTION
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
72
73
    /**
74
     * A static instance on this class
75
     *
76
     * @var Jaxon
77
     */
78
    private static $xInstance = null;
79
80
    /**
81
     * The DI container
82
     *
83
     * @var Container
84
     */
85
    private static $xContainer = null;
86
87
    /**
88
     * Get the static instance
89
     *
90
     * @return Jaxon
91
     */
92
    public static function getInstance()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
93
    {
94
        if(self::$xInstance == null)
95
        {
96
            self::$xInstance = new Jaxon();
97
        }
98
        return self::$xInstance;
99
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
100
101
    /**
102
     * The constructor
103
     */
104
    public function __construct()
105
    {
106
        // Set the default logger
107
        $this->setLogger(new NullLogger());
108
109
        if(self::$xContainer == null)
110
        {
111
            self::$xContainer = new Container($this->getDefaultOptions());
112
            /*
0 ignored issues
show
Coding Style introduced by
Empty line required before block comment
Loading history...
113
            * Register the Jaxon request and response plugins
0 ignored issues
show
Coding Style introduced by
First line of comment not aligned correctly; expected 13 spaces but found 12
Loading history...
114
            */
0 ignored issues
show
Coding Style introduced by
Last line of comment aligned incorrectly; expected 13 spaces but found 12
Loading history...
Coding Style introduced by
Empty line required after block comment
Loading history...
115
            $this->di()->getPluginManager()->registerRequestPlugins();
116
            $this->di()->getPluginManager()->registerResponsePlugins();
117
        }
118
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
119
120
    /**
121
     * Get the DI container
122
     *
123
     * @return Container
124
     */
125
    public function di()
126
    {
127
        return self::$xContainer;
128
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
129
130
    /**
131
     * The current Jaxon version
132
     *
133
     * @return string
134
     */
135
    public function getVersion()
136
    {
137
        return $this->sVersion;
138
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
139
140
    /**
141
     * Get the logger
142
     *
143
     * @return LoggerInterface
144
     */
145
    public function logger()
146
    {
147
        return $this->logger;
148
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
149
150
    /**
151
     * Get the config reader
152
     *
153
     * @return ConfigReader
154
     */
155
    public function config()
156
    {
157
        return $this->di()->get(ConfigReader::class);
158
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
159
160
    /**
161
     * Get the default options of all components of the library
162
     *
163
     * @return array<string,string|boolean|integer>
164
     */
165
    private function getDefaultOptions()
166
    {
167
        // The default configuration settings.
168
        return [
169
            'core.version'                      => $this->getVersion(),
170
            'core.language'                     => 'en',
171
            'core.encoding'                     => 'utf-8',
172
            'core.decode_utf8'                  => false,
173
            'core.prefix.function'              => 'jaxon_',
174
            'core.prefix.class'                 => 'Jaxon',
175
            // 'core.request.uri'               => '',
176
            'core.request.mode'                 => 'asynchronous',
177
            'core.request.method'               => 'POST', // W3C: Method is case sensitive
178
            'core.response.send'                => true,
179
            'core.response.merge.ap'            => true,
180
            'core.response.merge.js'            => true,
181
            'core.debug.on'                     => false,
182
            'core.debug.verbose'                => false,
183
            'core.process.exit'                 => true,
184
            'core.process.clean'                => false,
185
            'core.process.timeout'              => 6000,
186
            'core.error.handle'                 => false,
187
            'core.error.log_file'               => '',
188
            'core.jquery.no_conflict'           => false,
189
            'core.upload.enabled'               => true,
190
            'js.lib.output_id'                  => 0,
191
            'js.lib.queue_size'                 => 0,
192
            'js.lib.load_timeout'               => 2000,
193
            'js.lib.show_status'                => false,
194
            'js.lib.show_cursor'                => true,
195
            'js.app.dir'                        => '',
196
            'js.app.minify'                     => true,
197
            'js.app.options'                    => '',
198
        ];
199
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
200
201
    /**
202
     * Get the Global Response object
203
     *
204
     * @return \Jaxon\Response\Response
205
     */
206
    public function getResponse()
207
    {
208
        return $this->di()->getResponse();
209
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
210
211
    /**
212
     * Create a new Jaxon response object
213
     *
214
     * @return \Jaxon\Response\Response
215
     */
216
    public function newResponse()
217
    {
218
        return $this->di()->newResponse();
219
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
220
221
    /**
222
     * Register a plugin
223
     *
224
     * Below is a table for priorities and their description:
225
     * - 0 thru 999: Plugins that are part of or extensions to the jaxon core
226
     * - 1000 thru 8999: User created plugins, typically, these plugins don't care about order
227
     * - 9000 thru 9999: Plugins that generally need to be last or near the end of the plugin list
228
     *
229
     * @param Plugin    $xPlugin        An instance of a plugin
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter type; 4 found
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter name; 8 found
Loading history...
230
     * @param integer   $nPriority      The plugin priority, used to order the plugins
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 6 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 3 found
Loading history...
231
     *
232
     * @return void
233
     */
234
    public function registerPlugin(Plugin $xPlugin, $nPriority = 1000)
235
    {
236
        $this->di()->getPluginManager()->registerPlugin($xPlugin, $nPriority);
237
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
238
239
    /**
240
     * Register request handlers, including functions, callable classes and directories.
241
     *
242
     * @param string        $sType            The type of request handler being registered
0 ignored issues
show
Coding Style introduced by
Expected 7 spaces after parameter type; 8 found
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter name; 12 found
Loading history...
243
     *        Options include:
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 40 spaces but found 8
Loading history...
244
     *        - Jaxon::CALLABLE_FUNCTION: a function declared at global scope
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 40 spaces but found 8
Loading history...
245
     *        - Jaxon::CALLABLE_CLASS: a class who's methods are to be registered
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 40 spaces but found 8
Loading history...
246
     *        - Jaxon::CALLABLE_DIR: a directory containing classes to be registered
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 40 spaces but found 8
Loading history...
247
     *        - Jaxon::PACKAGE: a package
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 40 spaces but found 8
Loading history...
248
     * @param string        $sName
0 ignored issues
show
Coding Style introduced by
Expected 7 spaces after parameter type; 8 found
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
249
     *        When registering a function, this is the name of the function
250
     *        When registering a callable class, this is the class name
251
     *        When registering a callable directory, this is the full path to the directory
252
     *        When registering a package or a plugin, this is the corresponding class name
253
     * @param array|string  $xOptions   The related options
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 3 found
Loading history...
254
     *
255
     * @return void
256
     */
257
    public function register($sType, $sName, $xOptions = [])
258
    {
259
        if($sType == self::CALLABLE_DIR ||
260
            $sType == self::CALLABLE_CLASS ||
261
            $sType == self::CALLABLE_FUNCTION)
262
        {
263
            $this->di()->getPluginManager()->registerCallable($sType, $sName, $xOptions);
264
            return;
265
        }
266
        /*
0 ignored issues
show
Coding Style introduced by
Empty line required before block comment
Loading history...
267
        if($sType == self::PLUGIN_RESPONSE)
0 ignored issues
show
Coding Style introduced by
First line of comment not aligned correctly; expected 12 spaces but found 8
Loading history...
Coding Style introduced by
Block comments must start with a capital letter
Loading history...
268
        {
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 12 spaces but found 8
Loading history...
269
            $this->di()->getPluginManager()->registerRequestPlugin($sName, $xOptions);
270
            return;
271
        }
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 12 spaces but found 8
Loading history...
272
        if($sType == self::PLUGIN_REQUEST)
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 12 spaces but found 8
Loading history...
273
        {
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 12 spaces but found 8
Loading history...
274
            $this->di()->getPluginManager()->registerResponsePlugin($sName, $xOptions);
275
            return;
276
        }
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 12 spaces but found 8
Loading history...
277
        */
0 ignored issues
show
Coding Style introduced by
Empty line required after block comment
Loading history...
278
        if($sType == self::PLUGIN_PACKAGE && is_array($xOptions))
279
        {
280
            $this->di()->getPluginManager()->registerPackage($sName, $xOptions);
281
            return;
282
        }
283
        // Todo: throw an error
284
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
285
286
    /**
287
     * Get an instance of a registered class
288
     *
289
     * @param string        $sClassName         The class name
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 9 found
Loading history...
290
     *
291
     * @return mixed
292
     */
293
    public function instance($sClassName)
294
    {
295
        $xCallable = $this->di()->getCallableRegistry()->getCallableObject($sClassName);
296
        return ($xCallable) ? $xCallable->getRegisteredObject() : null;
0 ignored issues
show
introduced by
$xCallable is of type Jaxon\Request\Support\CallableObject, thus it always evaluated to true.
Loading history...
297
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
298
299
    /**
300
     * Get a request to a registered class
301
     *
302
     * @param string        $sClassName         The class name
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 9 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
303
     *
304
     * @return \Jaxon\Request\Factory\CallableClass\Request
305
     */
306
    public function request($sClassName)
307
    {
308
        $xInstance = $this->instance($sClassName);
309
        return ($xInstance) ? $xInstance->rq() : null;
0 ignored issues
show
introduced by
$xInstance is of type object, thus it always evaluated to true.
Loading history...
310
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
311
312
    /**
313
     * Returns the Jaxon Javascript header and wrapper code to be printed into the page
314
     *
315
     * The javascript code returned by this function is dependent on the plugins
316
     * that are included and the functions and classes that are registered.
317
     *
318
     * @param boolean        $bIncludeJs            Also get the JS files
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter name; 12 found
Loading history...
319
     * @param boolean        $bIncludeCss        Also get the CSS files
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 8 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
320
     *
321
     * @return string
322
     */
323
    public function getScript($bIncludeJs = false, $bIncludeCss = false)
324
    {
325
        return $this->di()->getCodeGenerator()->getScript($bIncludeJs, $bIncludeCss);
326
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
327
328
    /**
329
     * Print the jaxon Javascript header and wrapper code into your page
330
     *
331
     * The javascript code returned by this function is dependent on the plugins
332
     * that are included and the functions and classes that are registered.
333
     *
334
     * @param boolean        $bIncludeJs            Also print the JS files
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter name; 12 found
Loading history...
335
     * @param boolean        $bIncludeCss        Also print the CSS files
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 8 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
336
     *
337
     * @return void
338
     */
339
    public function printScript($bIncludeJs = false, $bIncludeCss = false)
340
    {
341
        print $this->getScript($bIncludeJs, $bIncludeCss);
342
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
343
344
    /**
345
     * Return the javascript header code and file includes
346
     *
347
     * @return string
348
     */
349
    public function getJs()
350
    {
351
        return $this->di()->getCodeGenerator()->getJs();
352
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
353
354
    /**
355
     * Return the CSS header code and file includes
356
     *
357
     * @return string
358
     */
359
    public function getCss()
360
    {
361
        return $this->di()->getCodeGenerator()->getCss();
362
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
363
364
    /**
365
     * Determine if a call is a jaxon request or a page load request
366
     *
367
     * @return boolean
368
     */
369
    public function canProcessRequest()
370
    {
371
        return $this->di()->getRequestHandler()->canProcessRequest();
372
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
373
374
    /**
375
     * If this is a jaxon request, call the requested PHP function, build the response and send it back to the browser
376
     *
377
     * This is the main server side engine for Jaxon.
378
     * It handles all the incoming requests, including the firing of events and handling of the response.
379
     * If your RequestURI is the same as your web page, then this function should be called before ANY
380
     * headers or HTML is output from your script.
381
     *
382
     * This function may exit after the request is processed, if the 'core.process.exit' option is set to true.
383
     *
384
     * @return void
385
     *
386
     * @see <Jaxon\Jaxon->canProcessRequest>
387
     */
388
    public function processRequest()
389
    {
390
        // Check to see if headers have already been sent out, in which case we can't do our job
391
        if(headers_sent($filename, $linenumber))
392
        {
393
            echo $this->trans('errors.output.already-sent', [
394
                'location' => $filename . ':' . $linenumber
395
            ]), "\n", $this->trans('errors.output.advice');
396
            exit();
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
397
        }
398
399
        $this->di()->getRequestHandler()->processRequest();
400
401
        if(($this->getOption('core.response.send')))
402
        {
403
            $this->di()->getResponseManager()->sendOutput();
404
405
            if(($this->getOption('core.process.exit')))
406
            {
407
                exit();
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
408
            }
409
        }
410
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
411
412
    /**
413
     * Get a registered response plugin
414
     *
415
     * @param string        $sName                The name of the plugin
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 16 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
416
     *
417
     * @return \Jaxon\Plugin\Response
418
     */
419
    public function plugin($sName)
420
    {
421
        return $this->di()->getPluginManager()->getResponsePlugin($sName);
422
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
423
424
    /**
425
     * Get a package instance
426
     *
427
     * @param string        $sClassName           The package class name
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 11 found
Loading history...
428
     *
429
     * @return \Jaxon\Plugin\Package
430
     */
431
    public function package($sClassName)
432
    {
433
        return $this->di()->getPluginManager()->getPackage($sClassName);
434
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
435
436
    /**
437
     * Get the upload plugin
438
     *
439
     * @return \Jaxon\Request\Plugin\FileUpload
440
     */
441
    public function upload()
442
    {
443
        return $this->di()->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD);
444
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
445
446
    /**
447
     * Get the request callback manager
448
     *
449
     * @return \Jaxon\Request\Handler\Callback
450
     */
451
    public function callback()
452
    {
453
        return $this->di()->getRequestHandler()->getCallbackManager();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->di()->getR...)->getCallbackManager() returns the type callable which is incompatible with the documented return type Jaxon\Request\Handler\Callback.
Loading history...
454
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
455
456
    /**
457
     * Get the dialog wrapper
458
     *
459
     * @return \Jaxon\Utils\Dialogs\Dialog
460
     */
461
    public function dialog()
462
    {
463
        return $this->di()->getDialog();
464
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
465
466
    /**
467
     * Get the template engine
468
     *
469
     * @return \Jaxon\Utils\Template\Engine
470
     */
471
    public function template()
472
    {
473
        return $this->di()->getTemplateEngine();
474
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
475
476
    /**
477
     * Get the App instance
478
     *
479
     * @return \Jaxon\App\App
480
     */
481
    public function app()
482
    {
483
        return $this->di()->getApp();
484
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
485
486
    /**
487
     * Get the view renderer
488
     *
489
     * @return \Jaxon\Utils\View\Renderer
490
     */
491
    public function view()
492
    {
493
        return $this->di()->getViewRenderer();
494
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
495
496
    /**
497
     * Get the session manager
498
     *
499
     * @return \Jaxon\Contracts\Session
500
     */
501
    public function session()
502
    {
503
        return $this->di()->getSessionManager();
504
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
505
}
506