Passed
Push — feature/packages ( 3445e7...793294 )
by Thierry
03:04
created

Container::getTemplateRenderer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Container.php - Jaxon data container
5
 *
6
 * Provide container service for Jaxon utils class instances.
7
 *
8
 * @package jaxon-core
0 ignored issues
show
Coding Style introduced by
Package name "jaxon-core" is not valid; consider "Jaxoncore" instead
Loading history...
9
 * @author Thierry Feuzeu <[email protected]>
10
 * @copyright 2016 Thierry Feuzeu <[email protected]>
11
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
12
 * @link https://github.com/jaxon-php/jaxon-core
13
 */
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...
14
15
namespace Jaxon\Utils\DI;
16
17
use Jaxon\Response\Response;
18
use Jaxon\Request\Support\CallableRegistry;
19
use Jaxon\Request\Support\CallableRepository;
20
use Jaxon\Request\Plugin\CallableClass;
21
use Jaxon\Request\Plugin\CallableDir;
22
use Jaxon\Request\Plugin\CallableFunction;
23
use Jaxon\Request\Plugin\FileUpload;
24
use Jaxon\Request\Support\FileUpload as FileUploadSupport;
25
use Jaxon\Request\Handler\Handler as RequestHandler;
26
use Jaxon\Request\Factory\RequestFactory;
27
use Jaxon\Request\Factory\ParameterFactory;
28
use Jaxon\Request\Factory\CallableClass\Request as CallableClassRequestFactory;
29
use Jaxon\Request\Factory\CallableClass\Paginator as CallableClassPaginatorFactory;
30
use Jaxon\Request\Support\CallableObject;
31
use Jaxon\Response\Manager as ResponseManager;
32
use Jaxon\Response\Plugin\JQuery as JQueryPlugin;
33
use Jaxon\Plugin\Manager as PluginManager;
34
use Jaxon\Plugin\Code\Generator as CodeGenerator;
35
use Jaxon\Contracts\Session as SessionContract;
36
use Jaxon\Contracts\Container as ContainerContract;
37
38
use Jaxon\App\App;
39
use Jaxon\App\Bootstrap;
40
41
use Jaxon\Utils\Config\Config;
42
use Jaxon\Utils\Config\Reader as ConfigReader;
43
use Jaxon\Utils\View\Manager as ViewManager;
44
use Jaxon\Utils\View\Renderer as ViewRenderer;
45
use Jaxon\Utils\Dialogs\Dialog;
46
use Jaxon\Utils\Template\Minifier;
47
use Jaxon\Utils\Template\Engine as TemplateEngine;
48
use Jaxon\Utils\Pagination\Paginator;
49
use Jaxon\Utils\Pagination\Renderer as PaginationRenderer;
50
use Jaxon\Utils\Validation\Validator;
51
use Jaxon\Utils\Translation\Translator;
52
use Jaxon\Utils\Http\URI;
53
54
use Lemon\Event\EventDispatcher;
55
use Closure;
56
use ReflectionClass;
57
58
class Container
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class Container
Loading history...
59
{
60
    /**
61
     * The Dependency Injection Container
62
     *
63
     * @var \Pimple\Container
64
     */
65
    private $libContainer = null;
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
66
67
    /**
68
     * The Dependency Injection Container
69
     *
70
     * @var \Jaxon\Contracts\Container
71
     */
72
    private $appContainer = null;
73
74
    /**
75
     * The class constructor
76
     */
77
    public function __construct()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
78
    {
79
        $this->libContainer = new \Pimple\Container();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 19 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...
80
        $this->libContainer[Container::class] = $this;
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
81
82
        $sTranslationDir = realpath(__DIR__ . '/../../../translations');
83
        $sTemplateDir = realpath(__DIR__ . '/../../../templates');
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...
84
        $this->init($sTranslationDir, $sTemplateDir);
85
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
86
87
    /**
88
     * Get the container provided by the integrated framework
89
     *
90
     * @return ContainerContract
91
     */
92
    public function getAppContainer()
93
    {
94
        return $this->appContainer;
95
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
96
97
    /**
98
     * Set the container provided by the integrated framework
99
     *
100
     * @param ContainerContract  $container     The container implementation
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; 5 found
Loading history...
101
     *
102
     * @return void
103
     */
104
    public function setAppContainer(ContainerContract $container)
105
    {
106
        $this->appContainer = $container;
107
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
108
109
    /**
110
     * Set the parameters and create the objects in the dependency injection container
111
     *
112
     * @param string        $sTranslationDir     The translation directory
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; 5 found
Loading history...
113
     * @param string        $sTemplateDir        The template directory
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter name; 8 found
Loading history...
114
     *
115
     * @return void
116
     */
117
    private function init($sTranslationDir, $sTemplateDir)
118
    {
119
        /*
120
         * Parameters
121
         */
0 ignored issues
show
Coding Style introduced by
Empty line required after block comment
Loading history...
122
        // Translation directory
123
        $this->libContainer['jaxon.core.translation_dir'] = $sTranslationDir;
124
        // Template directory
125
        $this->libContainer['jaxon.core.template_dir'] = $sTemplateDir;
126
127
        /*
128
         * Core library objects
129
         */
0 ignored issues
show
Coding Style introduced by
Empty line required after block comment
Loading history...
130
        // Global Response
131
        $this->libContainer[Response::class] = function() {
132
            return new Response();
133
        };
134
        // Dialog
135
        $this->libContainer[Dialog::class] = function() {
136
            return new Dialog();
137
        };
138
        // Jaxon App
139
        $this->libContainer[App::class] = function() {
140
            return new App();
141
        };
142
        // Jaxon App bootstrap
143
        $this->libContainer[Bootstrap::class] = function() {
144
            return new Bootstrap();
145
        };
146
147
        /*
148
         * Plugins
149
         */
0 ignored issues
show
Coding Style introduced by
Empty line required after block comment
Loading history...
150
        // Callable objects repository
151
        $this->libContainer[CallableRepository::class] = function() {
152
            return new CallableRepository();
153
        };
154
        // Callable objects registry
155
        $this->libContainer[CallableRegistry::class] = function($c) {
156
            return new CallableRegistry($c[CallableRepository::class]);
157
        };
158
        // Callable class plugin
159
        $this->libContainer[CallableClass::class] = function($c) {
160
            return new CallableClass($c[CallableRegistry::class], $c[CallableRepository::class]);
161
        };
162
        // Callable dir plugin
163
        $this->libContainer[CallableDir::class] = function($c) {
164
            return new CallableDir($c[CallableRegistry::class]);
165
        };
166
        // Callable function plugin
167
        $this->libContainer[CallableFunction::class] = function() {
168
            return new CallableFunction();
169
        };
170
        // File upload support
171
        $this->libContainer[FileUploadSupport::class] = function() {
172
            return new FileUploadSupport();
173
        };
174
        // File upload plugin
175
        $this->libContainer[FileUpload::class] = function($c) {
176
            return new FileUpload($c[FileUploadSupport::class]);
177
        };
178
        // JQuery response plugin
179
        $this->libContainer[JQueryPlugin::class] = function() {
180
            return new JQueryPlugin();
181
        };
182
183
        /*
184
         * Managers
185
         */
0 ignored issues
show
Coding Style introduced by
Empty line required after block comment
Loading history...
186
        // Plugin Manager
187
        $this->libContainer[PluginManager::class] = function($c) {
188
            return new PluginManager($c[CodeGenerator::class]);
189
        };
190
        // Request Handler
191
        $this->libContainer[RequestHandler::class] = function($c) {
192
            return new RequestHandler($c[PluginManager::class], $c[ResponseManager::class], $c[FileUpload::class]);
193
        };
194
        // Request Factory
195
        $this->libContainer[RequestFactory::class] = function($c) {
196
            return new RequestFactory($c[CallableRegistry::class]);
197
        };
198
        // Parameter Factory
199
        $this->libContainer[ParameterFactory::class] = function() {
200
            return new ParameterFactory();
201
        };
202
        // Response Manager
203
        $this->libContainer[ResponseManager::class] = function() {
204
            return new ResponseManager();
205
        };
206
        // Code Generator
207
        $this->libContainer[CodeGenerator::class] = function($c) {
208
            return new CodeGenerator($c[TemplateEngine::class]);
209
        };
210
        // View Manager
211
        $this->libContainer[ViewManager::class] = function() {
212
            return new ViewManager();
213
        };
214
        // View Renderer
215
        $this->libContainer[ViewRenderer::class] = function($c) {
216
            return new ViewRenderer($c[ViewManager::class]);
217
        };
218
219
        /*
220
         * Config
221
         */
0 ignored issues
show
Coding Style introduced by
Empty line required after block comment
Loading history...
222
        $this->libContainer[Config::class] = function() {
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 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...
223
            return new Config();
224
        };
225
        $this->libContainer[ConfigReader::class] = function() {
226
            return new ConfigReader();
227
        };
228
229
        /*
230
         * Services
231
         */
0 ignored issues
show
Coding Style introduced by
Empty line required after block comment
Loading history...
232
        // Minifier
233
        $this->libContainer[Minifier::class] = function() {
234
            return new Minifier();
235
        };
236
        // Translator
237
        $this->libContainer[Translator::class] = function($c) {
238
            return new Translator($c['jaxon.core.translation_dir'], $c[Config::class]);
239
        };
240
        // Template engine
241
        $this->libContainer[TemplateEngine::class] = function($c) {
242
            return new TemplateEngine($c['jaxon.core.template_dir']);
243
        };
244
        // Validator
245
        $this->libContainer[Validator::class] = function($c) {
246
            return new Validator($c[Translator::class], $c[Config::class]);
247
        };
248
        // Pagination Paginator
249
        $this->libContainer[Paginator::class] = function($c) {
250
            return new Paginator($c[PaginationRenderer::class]);
251
        };
252
        // Pagination Renderer
253
        $this->libContainer[PaginationRenderer::class] = function($c) {
254
            return new PaginationRenderer($c[ViewRenderer::class]);
255
        };
256
        // Event Dispatcher
257
        $this->libContainer[EventDispatcher::class] = function() {
258
            return new EventDispatcher();
259
        };
260
        // URI decoder
261
        $this->libContainer[URI::class] = function() {
262
            return new URI();
263
        };
264
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
265
266
    /**
0 ignored issues
show
Coding Style introduced by
Parameter $sClass should have a doc-comment as per coding-style.
Loading history...
267
     * Get a class instance
268
     *
269
     * @return object        The class instance
270
     */
271
    public function get($sClass)
272
    {
273
        if($this->appContainer != null && $this->appContainer->has($sClass))
274
        {
275
            return $this->appContainer->get($sClass);
276
        }
277
        return $this->libContainer[$sClass];
278
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
279
280
    /**
281
     * Set a DI closure
282
     *
283
     * @param string                $sClass             The full class name
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter type; 16 found
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter name; 13 found
Loading history...
284
     * @param Closure               $xClosure           The closure
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 15 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 11 found
Loading history...
285
     *
286
     * @return void
287
     */
288
    public function set($sClass, Closure $xClosure)
289
    {
290
        $this->libContainer[$sClass] = function() use($xClosure) {
291
            return call_user_func($xClosure, $this);
292
        };
293
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
294
295
    /**
296
     * Set an alias
297
     *
298
     * @param string                $sClass             The class name
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 16 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 13 found
Loading history...
299
     * @param string                $sAlias             The alias name
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 16 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 13 found
Loading history...
300
     *
301
     * @return void
302
     */
303
    public function alias($sClass, $sAlias)
304
    {
305
        $this->libContainer[$sClass] = function($c) use ($sAlias) {
306
            return $c[$sAlias];
307
        };
308
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
309
310
    /**
311
     * Set an alias
312
     *
313
     * @param string|ReflectionClass    $xClass         The class name or the reflection class
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 4 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 9 found
Loading history...
314
     *
315
     * @return null|object
316
     */
317
    public function make($xClass)
318
    {
319
        if(is_string($xClass))
320
        {
321
            // Create tye reflection class instance
322
            $xClass = new ReflectionClass($xClass);
0 ignored issues
show
Coding Style introduced by
Consider using a different name than the parameter $xClass. This often makes code more readable.
Loading history...
323
        }
324
        if(!($xClass instanceof ReflectionClass))
325
        {
326
            return null;
327
        }
328
        // Use the Reflection class to get the parameters of the constructor
329
        if(($constructor = $xClass->getConstructor()) == null)
0 ignored issues
show
Coding Style introduced by
Variable assignment found within a condition. Did you mean to do a comparison ?
Loading history...
330
        {
331
            return $xClass->newInstance();
332
        }
333
        $parameters = $constructor->getParameters();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 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...
334
        $parameterInstances = [];
335
        foreach($parameters as $parameter)
336
        {
337
            // Get the parameter instance from the DI
338
            $parameterInstances[] = $this->get($parameter->getClass()->getName());
339
        }
340
        return $xClass->newInstanceArgs($parameterInstances);
341
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
342
343
    /**
344
     * Get the plugin manager
345
     *
346
     * @return PluginManager
347
     */
348
    public function getPluginManager()
349
    {
350
        return $this->libContainer[PluginManager::class];
351
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
352
353
    /**
354
     * Get the request handler
355
     *
356
     * @return RequestHandler
357
     */
358
    public function getRequestHandler()
359
    {
360
        return $this->libContainer[RequestHandler::class];
361
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
362
363
    /**
364
     * Get the request factory
365
     *
366
     * @return RequestFactory
367
     */
368
    public function getRequestFactory()
369
    {
370
        return $this->libContainer[RequestFactory::class];
371
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
372
373
    /**
374
     * Get the parameter factory
375
     *
376
     * @return ParameterFactory
377
     */
378
    public function getParameterFactory()
379
    {
380
        return $this->libContainer[ParameterFactory::class];
381
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
382
383
    /**
384
     * Get the response manager
385
     *
386
     * @return ResponseManager
387
     */
388
    public function getResponseManager()
389
    {
390
        return $this->libContainer[ResponseManager::class];
391
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
392
393
    /**
394
     * Get the code generator
395
     *
396
     * @return CodeGenerator
397
     */
398
    public function getCodeGenerator()
399
    {
400
        return $this->libContainer[CodeGenerator::class];
401
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
402
403
    /**
404
     * Get the callable registry
405
     *
406
     * @return CallableRegistry
407
     */
408
    public function getCallableRegistry()
409
    {
410
        return $this->libContainer[CallableRegistry::class];
411
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
412
413
    /**
414
     * Get the config manager
415
     *
416
     * @return Config
417
     */
418
    public function getConfig()
419
    {
420
        return $this->libContainer[Config::class];
421
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
422
423
    /**
424
     * Create a new the config manager
425
     *
426
     * @param array             $aOptions           The options array
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter type; 13 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 11 found
Loading history...
427
     * @param string            $sKeys              The keys of the options in the array
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 12 found
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter name; 14 found
Loading history...
428
     *
429
     * @return Config            The config manager
430
     */
431
    public function newConfig(array $aOptions = [], $sKeys = '')
432
    {
433
        return new Config($aOptions, $sKeys);
434
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
435
436
    /**
437
     * Get the dialog wrapper
438
     *
439
     * @return Dialog
440
     */
441
    public function getDialog()
442
    {
443
        return $this->libContainer[Dialog::class];
444
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
445
446
    /**
447
     * Get the minifier
448
     *
449
     * @return Minifier
450
     */
451
    public function getMinifier()
452
    {
453
        return $this->libContainer[Minifier::class];
454
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
455
456
    /**
457
     * Get the translator
458
     *
459
     * @return Translator
460
     */
461
    public function getTranslator()
462
    {
463
        return $this->libContainer[Translator::class];
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 TemplateEngine
470
     */
471
    public function getTemplateEngine()
472
    {
473
        return $this->libContainer[TemplateEngine::class];
474
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
475
476
    /**
477
     * Get the validator
478
     *
479
     * @return Validator
480
     */
481
    public function getValidator()
482
    {
483
        return $this->libContainer[Validator::class];
484
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
485
486
    /**
487
     * Get the paginator
488
     *
489
     * @return Paginator
490
     */
491
    public function getPaginator()
492
    {
493
        return $this->libContainer[Paginator::class];
494
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
495
496
    /**
497
     * Get the event dispatcher
498
     *
499
     * @return EventDispatcher
500
     */
501
    public function getEventDispatcher()
502
    {
503
        return $this->libContainer[EventDispatcher::class];
504
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
505
506
    /**
507
     * Get the global Response object
508
     *
509
     * @return Response
510
     */
511
    public function getResponse()
512
    {
513
        return $this->libContainer[Response::class];
514
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
515
516
    /**
517
     * Create a new Jaxon response object
518
     *
519
     * @return Response
520
     */
521
    public function newResponse()
522
    {
523
        return new Response();
524
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
525
526
    /**
527
     * Get the App instance
528
     *
529
     * @return App
530
     */
531
    public function getApp()
532
    {
533
        return $this->libContainer[App::class];
534
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
535
536
    /**
537
     * Get the App bootstrap
538
     *
539
     * @return Bootstrap
540
     */
541
    public function getBootstrap()
542
    {
543
        return $this->libContainer[Bootstrap::class];
544
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
545
546
    /**
547
     * Get the view manager
548
     *
549
     * @return ViewManager
550
     */
551
    public function getViewManager()
552
    {
553
        return $this->libContainer[ViewManager::class];
554
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
555
556
    /**
557
     * Get the view facade
558
     *
559
     * @return ViewRenderer
560
     */
561
    public function getViewRenderer()
562
    {
563
        return $this->libContainer[ViewRenderer::class];
564
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
565
566
    /**
567
     * Get the session manager
568
     *
569
     * @return SessionContract
570
     */
571
    public function getSessionManager()
572
    {
573
        return $this->libContainer[SessionContract::class];
574
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
575
576
    /**
577
     * Set the session manager
578
     *
579
     * @param Closure      $xClosure      A closure to create the session manager instance
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 6 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 6 found
Loading history...
580
     *
581
     * @return void
582
     */
583
    public function setSessionManager(Closure $xClosure)
584
    {
585
        $this->libContainer[SessionContract::class] = $xClosure;
586
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
587
588
    /**
589
     * Set the callable class request factory
590
     *
591
     * @param string            $sClassName         The callable class name
0 ignored issues
show
Coding Style introduced by
Expected 9 spaces after parameter type; 12 found
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter name; 9 found
Loading history...
592
     * @param CallableObject    $xCallableObject    The corresponding callable object
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 4 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
593
     *
594
     * @return void
595
     */
596
    public function setCallableClassRequestFactory($sClassName, CallableObject $xCallableObject)
597
    {
598
        $this->libContainer[$sClassName . '_RequestFactory'] = function() use ($xCallableObject) {
599
            return new CallableClassRequestFactory($xCallableObject);
600
        };
601
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
602
603
    /**
604
     * Get the callable class request factory
605
     *
606
     * @param string        $sClassName             The callable 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; 13 found
Loading history...
607
     *
608
     * @return CallableClassRequestFactory
609
     */
610
    public function getCallableClassRequestFactory($sClassName)
611
    {
612
        return $this->libContainer[$sClassName . '_RequestFactory'];
613
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
614
}
615