ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 
 skills ()
 
 resourceStorage ()
 
 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 18 of file Container.php.

Member Function Documentation

◆ access()

ILIAS\DI\Container::access ( )

Get interface for access checks.

Returns
\ilAccessHandler

Definition at line 65 of file Container.php.

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

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 166 of file Container.php.

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

◆ bookingManager()

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

Definition at line 315 of file Container.php.

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

◆ clientIni()

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

Definition at line 208 of file Container.php.

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

◆ conditions()

ILIAS\DI\Container::conditions ( )

Get conditions service.

Returns
\ilConditionService

Definition at line 242 of file Container.php.

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

◆ ctrl()

ILIAS\DI\Container::ctrl ( )

Get the interface to the control structure.

Returns
\ilCtrl

Definition at line 45 of file Container.php.

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

◆ database()

ILIAS\DI\Container::database ( )

Get interface to the Database.

Returns
\ilDBInterface

Definition at line 25 of file Container.php.

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

◆ event()

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

Definition at line 192 of file Container.php.

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

◆ exercise()

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

Definition at line 280 of file Container.php.

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

◆ filesystem()

ILIAS\DI\Container::filesystem ( )

Get the Filesystem service interface.

Returns
Filesystems

Definition at line 146 of file Container.php.

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

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

+ Here is the caller graph for this function:

◆ globalScreen()

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

Definition at line 175 of file Container.php.

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

◆ help()

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

Definition at line 224 of file Container.php.

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

◆ http()

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

Definition at line 184 of file Container.php.

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

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

+ Here is the caller graph for this function:

◆ iliasIni()

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

Definition at line 200 of file Container.php.

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

◆ 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 355 of file Container.php.

356 {
357 try {
358 $this->$name();
359 } catch (\InvalidArgumentException $e) {
360 return false;
361 }
362 return true;
363 }
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 85 of file Container.php.

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

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 250 of file Container.php.

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

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 95 of file Container.php.

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

◆ news()

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

Definition at line 264 of file Container.php.

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

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 272 of file Container.php.

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

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 232 of file Container.php.

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

◆ rbac()

ILIAS\DI\Container::rbac ( )

Get interface to get interfaces to all things rbac.

Returns
RBACServices

Definition at line 35 of file Container.php.

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

◆ refinery()

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

Definition at line 297 of file Container.php.

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

◆ repositoryTree()

ILIAS\DI\Container::repositoryTree ( )

Get interface to the repository tree.

Returns
\ilTree

Definition at line 75 of file Container.php.

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

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

+ Here is the caller graph for this function:

◆ resourceStorage()

ILIAS\DI\Container::resourceStorage ( )

Definition at line 329 of file Container.php.

330 {
331 return $this['resource_storage'];
332 }

◆ settings()

ILIAS\DI\Container::settings ( )

Get the interface to the settings.

Returns
\ilSetting

Definition at line 135 of file Container.php.

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

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

+ Here is the caller graph for this function:

◆ skills()

ILIAS\DI\Container::skills ( )
Returns
SkillService

Definition at line 324 of file Container.php.

325 {
326 return new SkillService();
327 }

◆ systemStyle()

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

Definition at line 216 of file Container.php.

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

◆ tabs()

ILIAS\DI\Container::tabs ( )

Get interface to the tabs.

Returns
\ilTabsGUI

Definition at line 115 of file Container.php.

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

◆ task()

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

Definition at line 288 of file Container.php.

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

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 105 of file Container.php.

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

◆ ui()

ILIAS\DI\Container::ui ( )

Get the interface to get services from UI framework.

Returns
UIServices

Definition at line 125 of file Container.php.

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

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 306 of file Container.php.

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

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 157 of file Container.php.

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

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 55 of file Container.php.

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

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: