|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* Copyright (C) 2018 |
|
5
|
|
|
* Nathan Boiron <[email protected]> |
|
6
|
|
|
* Romain Canon <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* This file is part of the TYPO3 NotiZ project. |
|
9
|
|
|
* It is free software; you can redistribute it and/or modify it |
|
10
|
|
|
* under the terms of the GNU General Public License, either |
|
11
|
|
|
* version 3 of the License, or any later version. |
|
12
|
|
|
* |
|
13
|
|
|
* For the full copyright and license information, see: |
|
14
|
|
|
* http://www.gnu.org/licenses/gpl-3.0.html |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
namespace CuyZ\Notiz\Service; |
|
18
|
|
|
|
|
19
|
|
|
use CuyZ\Notiz\Service\Traits\ExtendedSelfInstantiateTrait; |
|
20
|
|
|
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; |
|
21
|
|
|
use TYPO3\CMS\Core\SingletonInterface; |
|
22
|
|
|
use TYPO3\CMS\Extbase\Object\ObjectManager; |
|
23
|
|
|
|
|
24
|
|
|
class Container implements SingletonInterface |
|
25
|
|
|
{ |
|
26
|
|
|
use ExtendedSelfInstantiateTrait { |
|
27
|
|
|
get as getInstance; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var ObjectManager |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $objectManager; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @param ObjectManager $objectManager |
|
37
|
|
|
*/ |
|
38
|
|
|
public function __construct(ObjectManager $objectManager) |
|
39
|
|
|
{ |
|
40
|
|
|
$this->objectManager = $objectManager; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @param string $className |
|
45
|
|
|
* @param mixed ...$arguments |
|
46
|
|
|
* @return object |
|
47
|
|
|
*/ |
|
48
|
|
|
public static function get($className, ...$arguments) |
|
49
|
|
|
{ |
|
50
|
|
|
return static::getInstance()->objectManager->get($className, ...$arguments); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @return BackendUserAuthentication |
|
55
|
|
|
*/ |
|
56
|
|
|
public static function getBackendUser() |
|
57
|
|
|
{ |
|
58
|
|
|
return $GLOBALS['BE_USER']; |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|