ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
InitCtrlService.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use ILIAS\components\Help\ScreenId\HelpScreenIdObserver;
23
31final class InitCtrlService
32{
40 public function init(Container $dic): void
41 {
42 $this->abortIfMissingDependencies($dic);
43
44 try {
45 $ctrl_structure = new ilCtrlStructure(
49 );
50 } catch (Throwable $t) {
51 throw new ilCtrlException(self::class . " could not require artifacts, try `composer du` first.");
52 }
53
54 $token_repository = new ilCtrlTokenRepository();
55 $path_factory = new ilCtrlPathFactory($ctrl_structure);
57 $path_factory,
58 $dic->http()->wrapper()->query(),
59 $dic->refinery()
60 );
61
62 // create global instance of ilCtrl
63 $GLOBALS['ilCtrl'] = new ilCtrl(
64 $ctrl_structure,
65 $token_repository,
66 $path_factory,
68 $dic["http.response_sender_strategy"],
69 $dic->http()->request(),
70 $dic->http()->wrapper()->post(),
71 $dic->http()->wrapper()->query(),
72 $dic->refinery(),
73 $dic["component.factory"],
74 new ilCtrlSubject(),
76 );
77
78 // add helper function to DI container that
79 // returns the global instance.
80 $dic['ilCtrl'] = static function () {
81 return $GLOBALS['ilCtrl'];
82 };
83 }
84
93 {
94 if (!$dic->offsetExists('http')) {
95 throw new ilCtrlException("Cannot initialize ilCtrl if HTTP Services are not yet available.");
96 }
97
98 if (!$dic->offsetExists('refinery')) {
99 throw new ilCtrlException("Cannot initialize ilCtrl if Refinery Factory is not yet available.");
100 }
101
102 // if (!$dic->offsetExists('ilDB')) {
103 // throw new ilCtrlException("Cannot initialize ilCtrl if Database is not yet available.");
104 // }
105 }
106}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Class InitCtrlService wraps the initialization of ilCtrl.
init(Container $dic)
Initializes the ilCtrl service.
abortIfMissingDependencies(Container $dic)
Aborts if another dependency required by the ctrl service is not yet available.
Class ilCtrlContext is responsible for holding the current context information.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrlPathFactory.
Class ilCtrlStructure holds the currently read control structure.
Class ilCtrlTokenRepository.
Class ilCtrl provides processing control methods.
$dic
Definition: ltiresult.php:33
$GLOBALS["DIC"]
Definition: wac.php:54
$context
Definition: webdav.php:31