1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | namespace Aurora\System; |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: | |
17: | class ObjectExtender |
18: | { |
19: | |
20: | |
21: | |
22: | protected $_aObjects = []; |
23: | |
24: | |
25: | |
26: | |
27: | protected static $self = null; |
28: | |
29: | |
30: | |
31: | |
32: | |
33: | public static function createInstance() |
34: | { |
35: | return new self(); |
36: | } |
37: | |
38: | |
39: | |
40: | |
41: | |
42: | public static function getInstance() |
43: | { |
44: | if (is_null(self::$self)) { |
45: | self::$self = new self(); |
46: | } |
47: | |
48: | return self::$self; |
49: | } |
50: | |
51: | |
52: | |
53: | |
54: | |
55: | |
56: | |
57: | public function extend($sModule, $sType, $aMap) |
58: | { |
59: | foreach ($aMap as $sKey => $aValue) { |
60: | $aValue['@Extended'] = true; |
61: | $this->_aObjects[$sType][$sModule . Module\AbstractModule::$Delimiter . $sKey] = $aValue; |
62: | } |
63: | } |
64: | |
65: | |
66: | |
67: | |
68: | |
69: | |
70: | public function getObject($sType) |
71: | { |
72: | return isset($this->_aObjects[$sType]) ? $this->_aObjects[$sType] : []; |
73: | } |
74: | |
75: | |
76: | |
77: | |
78: | |
79: | |
80: | public function issetObject($sType) |
81: | { |
82: | return isset($this->_aObjects[$sType]); |
83: | } |
84: | |
85: | public function getExtendedProps($sType) |
86: | { |
87: | return isset($this->_aObjects[$sType]) ? $this->_aObjects[$sType] : []; |
88: | } |
89: | } |
90: | |