ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
InitCtrlService Class Reference

Class InitCtrlService wraps the initialization of ilCtrl. More...

+ Collaboration diagram for InitCtrlService:

Public Member Functions

 init (Container $dic)
 Initializes the ilCtrl service. More...
 

Private Member Functions

 abortIfMissingDependencies (Container $dic)
 Aborts if another dependency required by the ctrl service is not yet available. More...
 

Detailed Description

Class InitCtrlService wraps the initialization of ilCtrl.

Author
Thibeau Fuhrer thf@s.nosp@m.tude.nosp@m.r-rai.nosp@m.mann.nosp@m..ch This class exists because due to dependency-injection the initialization of ilCtrl got a little more complicated - and is used on several occasions.

Definition at line 31 of file InitCtrlService.php.

Member Function Documentation

◆ abortIfMissingDependencies()

InitCtrlService::abortIfMissingDependencies ( Container  $dic)
private

Aborts if another dependency required by the ctrl service is not yet available.

Parameters
Container$dic
Exceptions
ilCtrlExceptionif a necessary dependency is not yet initialized.

Definition at line 92 of file InitCtrlService.php.

92 : void
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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$dic
Definition: ltiresult.php:33

References $dic.

Referenced by init().

+ Here is the caller graph for this function:

◆ init()

InitCtrlService::init ( Container  $dic)

Initializes the ilCtrl service.

This method EXPECTS that $GLOBALS['DIC'] is already initialized with the http services and the refinery factory.

Parameters
Container$dic
Exceptions
ilCtrlExceptionif the initialization fails.

Definition at line 40 of file InitCtrlService.php.

40 : 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 }
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.
Class ilCtrlPathFactory.
Class ilCtrlStructure holds the currently read control structure.
Class ilCtrlTokenRepository.
Class ilCtrl provides processing control methods.
$GLOBALS["DIC"]
Definition: wac.php:54
$context
Definition: webdav.php:31

References $context, $dic, $GLOBALS, abortIfMissingDependencies(), and ILIAS\Setup\Artifact\BuildArtifactObjective\PATH().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: