]> git.mxchange.org Git - friendica.git/blob - src/DI.php
ef05b5cb07350930990fe68a701f3dd020576b19
[friendica.git] / src / DI.php
1 <?php
2
3 namespace Friendica;
4
5 use Dice\Dice;
6
7 /**
8  * This class is capable of getting all dynamic created classes
9  *
10  * There has to be a "method" phpDoc for each new class, containing result class for a proper matching
11  *
12  * @method static App app()
13  */
14 class DI
15 {
16         /** @var Dice */
17         private static $dice;
18
19         public static function init(Dice $dice)
20         {
21                 self::$dice = $dice;
22         }
23
24         public static function __callStatic($name, $arguments)
25         {
26                 switch ($name) {
27                         case 'app':
28                                 return self::$dice->create(App::class, $arguments);
29                         default:
30                                 return null;
31                 }
32         }
33 }