ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\DI\Container Class Reference

Customizing of pimple-DIC for ILIAS. More...

+ Inheritance diagram for ILIAS\DI\Container:
+ Collaboration diagram for ILIAS\DI\Container:

Public Member Functions

 database ()
 Get interface to the Database. More...
 
 rbac ()
 Get interface to get interfaces to all things rbac. More...
 
 ctrl ()
 Get the interface to the control structure. More...
 
 user ()
 Get the current user. More...
 
 access ()
 Get interface for access checks. More...
 
 repositoryTree ()
 Get interface to the repository tree. More...
 
 language ()
 Get interface to the i18n service. More...
 
 logger ()
 Get interface to get interfaces to different loggers. More...
 
 toolbar ()
 Get interface to the toolbar. More...
 
 tabs ()
 Get interface to the tabs. More...
 
 ui ()
 Get the interface to get services from UI framework. More...
 
 settings ()
 Get the interface to the settings. More...
 
 filesystem ()
 Get the Filesystem service interface. More...
 
 upload ()
 Gets the file upload interface. More...
 
 backgroundTasks ()
 
 globalScreen ()
 
 http ()
 
 event ()
 
 iliasIni ()
 
 clientIni ()
 
 systemStyle ()
 
 help ()
 
 question ()
 
 conditions ()
 Get conditions service. More...
 
 learningHistory ()
 
 news ()
 
 object ()
 
 exercise ()
 
 task ()
 
 refinery ()
 
 uiService ()
 
 bookingManager ()
 
 isDependencyAvailable ($name)
 Note: Only use isDependencyAvailable if strictly required. More...
 

Detailed Description

Customizing of pimple-DIC for ILIAS.

This just exposes some of the services in the container as plain methods to help IDEs when using ILIAS.

Definition at line 17 of file Container.php.

Member Function Documentation

◆ access()

ILIAS\DI\Container::access ( )

Get interface for access checks.

Returns
\ilAccessHandler

Definition at line 64 of file Container.php.

65 {
66 return $this["ilAccess"];
67 }

Referenced by ILIAS\DI\Container\learningHistory(), and ILIAS\DI\Container\task().

+ Here is the caller graph for this function:

◆ backgroundTasks()

ILIAS\DI\Container::backgroundTasks ( )
Returns
BackgroundTaskServices

Definition at line 165 of file Container.php.

166 {
167 return new BackgroundTaskServices($this);
168 }

◆ bookingManager()

ILIAS\DI\Container::bookingManager ( )
Returns
\ilBookingManagerService

Definition at line 314 of file Container.php.

315 {
316 return new \ilBookingManagerService();
317 }

◆ clientIni()

ILIAS\DI\Container::clientIni ( )
Returns
\ilIniFile

Definition at line 207 of file Container.php.

208 {
209 return $this['ilClientIniFile'];
210 }

◆ conditions()

ILIAS\DI\Container::conditions ( )

Get conditions service.

Returns
\ilConditionService

Definition at line 241 of file Container.php.

242 {
243 return \ilConditionService::getInstance(new \ilConditionObjectAdapter());
244 }

◆ ctrl()

ILIAS\DI\Container::ctrl ( )

Get the interface to the control structure.

Returns
\ilCtrl

Definition at line 44 of file Container.php.

45 {
46 return $this["ilCtrl"];
47 }

◆ database()

ILIAS\DI\Container::database ( )

Get interface to the Database.

Returns
\ilDBInterface

Definition at line 24 of file Container.php.

25 {
26 return $this["ilDB"];
27 }

◆ event()

ILIAS\DI\Container::event ( )
Returns
\ilAppEventHandler

Definition at line 191 of file Container.php.

192 {
193 return $this['ilAppEventHandler'];
194 }

◆ exercise()

ILIAS\DI\Container::exercise ( )
Returns
\ilExerciseFactory

Definition at line 279 of file Container.php.

280 {
281 return new \ilExerciseFactory();
282 }

◆ filesystem()

ILIAS\DI\Container::filesystem ( )

Get the Filesystem service interface.

Returns
Filesystems

Definition at line 145 of file Container.php.

146 {
147 return $this['filesystem'];
148 }

Referenced by ILIAS\DI\Container\object().

+ Here is the caller graph for this function:

◆ globalScreen()

ILIAS\DI\Container::globalScreen ( )
Returns
Services

Definition at line 174 of file Container.php.

175 {
176 return $this['global_screen'];
177 }

◆ help()

ILIAS\DI\Container::help ( )
Returns
\ilHelpGUI

Definition at line 223 of file Container.php.

224 {
225 return $this['ilHelp'];
226 }

◆ http()

ILIAS\DI\Container::http ( )
Returns
HTTPServices

Definition at line 183 of file Container.php.

184 {
185 return $this['http'];
186 }

Referenced by ILIAS\DI\Container\uiService().

+ Here is the caller graph for this function:

◆ iliasIni()

ILIAS\DI\Container::iliasIni ( )
Returns
\ilIniFile

Definition at line 199 of file Container.php.

200 {
201 return $this['ilIliasIniFile'];
202 }

◆ isDependencyAvailable()

ILIAS\DI\Container::isDependencyAvailable (   $name)

Note: Only use isDependencyAvailable if strictly required.

The need for this, mostly points to some underlying problem needing to be solved instead of using this. This was introduced as temporary workaround. See: https://github.com/ILIAS-eLearning/ILIAS/pull/1064

This is syntactic sugar for executing the try catch statement in the clients code. Note that the use of the offsetSet code of the default container should be avoided, since knowledge about the containers internal mechanism is injected.

Example: //This is bad since the client should not need to know about the id's name $DIC->offsetSet("styleDefinition")

//This is better, since the client just needs to know the name defined in the //interface of the component $DIC->isDependencyAvailable("systemStyle")

Parameters
$name
Returns
bool

Definition at line 340 of file Container.php.

341 {
342 try {
343 $this->$name();
344 } catch (\InvalidArgumentException $e) {
345 return false;
346 }
347 return true;
348 }
if($format !==null) $name
Definition: metadata.php:230

References Vendor\Package\$e, and $name.

◆ language()

ILIAS\DI\Container::language ( )

Get interface to the i18n service.

Returns
\ilLanguage

Reimplemented in ilSystemStyleDICMock.

Definition at line 84 of file Container.php.

85 {
86 return $this["lng"];
87 }

Referenced by ILIAS\DI\Container\learningHistory(), ILIAS\DI\Container\news(), ILIAS\DI\Container\object(), and ILIAS\DI\Container\task().

+ Here is the caller graph for this function:

◆ learningHistory()

ILIAS\DI\Container::learningHistory ( )
Returns
\ilLearningHistoryService

Definition at line 249 of file Container.php.

250 {
251 return new \ilLearningHistoryService(
252 $this->user(),
253 $this->language(),
254 $this->ui(),
255 $this->access(),
256 $this->repositoryTree()
257 );
258 }
access()
Get interface for access checks.
Definition: Container.php:64
user()
Get the current user.
Definition: Container.php:54
language()
Get interface to the i18n service.
Definition: Container.php:84
ui()
Get the interface to get services from UI framework.
Definition: Container.php:124
repositoryTree()
Get interface to the repository tree.
Definition: Container.php:74

References ILIAS\DI\Container\access(), ILIAS\DI\Container\language(), ILIAS\DI\Container\repositoryTree(), ILIAS\DI\Container\ui(), and ILIAS\DI\Container\user().

+ Here is the call graph for this function:

◆ logger()

ILIAS\DI\Container::logger ( )

Get interface to get interfaces to different loggers.

Returns
LoggingServices

Reimplemented in ilSystemStyleDICMock.

Definition at line 94 of file Container.php.

95 {
96 return new LoggingServices($this);
97 }

◆ news()

ILIAS\DI\Container::news ( )
Returns
\ilNewsService

Definition at line 263 of file Container.php.

264 {
265 return new \ilNewsService($this->language(), $this->settings(), $this->user());
266 }
settings()
Get the interface to the settings.
Definition: Container.php:134

References ILIAS\DI\Container\language(), ILIAS\DI\Container\settings(), and ILIAS\DI\Container\user().

+ Here is the call graph for this function:

◆ object()

ILIAS\DI\Container::object ( )
Returns
\ilObjectService

Definition at line 271 of file Container.php.

272 {
273 return new \ilObjectService($this->language(), $this->settings(), $this->filesystem(), $this->upload());
274 }
filesystem()
Get the Filesystem service interface.
Definition: Container.php:145
upload()
Gets the file upload interface.
Definition: Container.php:156

References ILIAS\DI\Container\filesystem(), ILIAS\DI\Container\language(), ILIAS\DI\Container\settings(), and ILIAS\DI\Container\upload().

+ Here is the call graph for this function:

◆ question()

ILIAS\DI\Container::question ( )
Returns
\ilAsqFactory

Definition at line 231 of file Container.php.

232 {
233 return new \ilAsqFactory();
234 }

◆ rbac()

ILIAS\DI\Container::rbac ( )

Get interface to get interfaces to all things rbac.

Returns
RBACServices

Definition at line 34 of file Container.php.

35 {
36 return new RBACServices($this);
37 }

◆ refinery()

ILIAS\DI\Container::refinery ( )
Returns
Factory

Definition at line 296 of file Container.php.

297 {
298 return $this['refinery'];
299 }

◆ repositoryTree()

ILIAS\DI\Container::repositoryTree ( )

Get interface to the repository tree.

Returns
\ilTree

Definition at line 74 of file Container.php.

75 {
76 return $this["tree"];
77 }

Referenced by ILIAS\DI\Container\learningHistory().

+ Here is the caller graph for this function:

◆ settings()

ILIAS\DI\Container::settings ( )

Get the interface to the settings.

Returns
\ilSetting

Definition at line 134 of file Container.php.

135 {
136 return $this["ilSetting"];
137 }

Referenced by ILIAS\DI\Container\news(), and ILIAS\DI\Container\object().

+ Here is the caller graph for this function:

◆ systemStyle()

ILIAS\DI\Container::systemStyle ( )
Returns
\ilStyleDefinition

Definition at line 215 of file Container.php.

216 {
217 return $this['styleDefinition'];
218 }

◆ tabs()

ILIAS\DI\Container::tabs ( )

Get interface to the tabs.

Returns
\ilTabsGUI

Definition at line 114 of file Container.php.

115 {
116 return $this["ilTabs"];
117 }

◆ task()

ILIAS\DI\Container::task ( )
Returns
\ilTaskService

Definition at line 287 of file Container.php.

288 {
289 return new \ilTaskService($this->user(), $this->language(), $this->ui(), $this->access());
290 }

References ILIAS\DI\Container\access(), ILIAS\DI\Container\language(), ILIAS\DI\Container\ui(), and ILIAS\DI\Container\user().

+ Here is the call graph for this function:

◆ toolbar()

ILIAS\DI\Container::toolbar ( )

Get interface to the toolbar.

Returns
\ilToolbarGUI

Definition at line 104 of file Container.php.

105 {
106 return $this["ilToolbar"];
107 }

◆ ui()

ILIAS\DI\Container::ui ( )

Get the interface to get services from UI framework.

Returns
UIServices

Definition at line 124 of file Container.php.

125 {
126 return new UIServices($this);
127 }

Referenced by ILIAS\DI\Container\learningHistory(), ILIAS\DI\Container\task(), and ILIAS\DI\Container\uiService().

+ Here is the caller graph for this function:

◆ uiService()

ILIAS\DI\Container::uiService ( )
Returns
\ilUIService

Definition at line 305 of file Container.php.

306 {
307 return new \ilUIService($this->http()->request(), $this->ui());
308 }

References ILIAS\DI\Container\http(), and ILIAS\DI\Container\ui().

+ Here is the call graph for this function:

◆ upload()

ILIAS\DI\Container::upload ( )

Gets the file upload interface.

Returns
FileUpload

Definition at line 156 of file Container.php.

157 {
158 return $this['upload'];
159 }

Referenced by ILIAS\DI\Container\object().

+ Here is the caller graph for this function:

◆ user()

ILIAS\DI\Container::user ( )

Get the current user.

Returns
\ilObjUser

Definition at line 54 of file Container.php.

55 {
56 return $this["ilUser"];
57 }

Referenced by ILIAS\DI\Container\learningHistory(), ILIAS\DI\Container\news(), and ILIAS\DI\Container\task().

+ Here is the caller graph for this function:

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