1 | <?php |
||
32 | trait DelegatorTrait |
||
33 | { |
||
34 | /** |
||
35 | * lookup pool of containers |
||
36 | * |
||
37 | * @var array |
||
38 | * @access private |
||
39 | */ |
||
40 | private $lookup_pool = []; |
||
41 | |||
42 | /** |
||
43 | * cached lookup key |
||
44 | * |
||
45 | * @var string |
||
46 | * @access private |
||
47 | */ |
||
48 | private $cache_key; |
||
49 | |||
50 | /** |
||
51 | * cached lookup container |
||
52 | * |
||
53 | * @var object |
||
54 | * @access private |
||
55 | */ |
||
56 | private $cache_obj; |
||
57 | |||
58 | /** |
||
59 | * {@inheritDoc} |
||
60 | */ |
||
61 | public function addContainer($container) |
||
78 | |||
79 | /** |
||
80 | * {@inheritDoc} |
||
81 | */ |
||
82 | public function hasInLookup(/*# string */ $key)/*# : bool */ |
||
93 | |||
94 | /** |
||
95 | * {@inheritDoc} |
||
96 | */ |
||
97 | public function getFromLookup(/*# string */ $key) |
||
115 | |||
116 | /** |
||
117 | * Remove one object from the pool |
||
118 | * |
||
119 | * @param object $container |
||
120 | * @return $this |
||
121 | * @access protected |
||
122 | */ |
||
123 | protected function removeFromLookup($container) |
||
132 | |||
133 | /** |
||
134 | * Is container type allowed in lookup pool ? |
||
135 | * |
||
136 | * @param object $container |
||
137 | * @return bool |
||
138 | * @access protected |
||
139 | */ |
||
140 | abstract protected function isValidContainer($container)/*# : bool */; |
||
141 | |||
142 | /** |
||
143 | * Try has in container |
||
144 | * |
||
145 | * @param object $container |
||
146 | * @param name $key |
||
147 | * @return bool |
||
148 | * @access protected |
||
149 | */ |
||
150 | abstract protected function hasInContainer( |
||
154 | |||
155 | /** |
||
156 | * Try get from container |
||
157 | * |
||
158 | * @param object $container |
||
159 | * @param name $key |
||
160 | * @return mixed |
||
161 | * @access protected |
||
162 | */ |
||
163 | abstract protected function getFromContainer( |
||
167 | } |
||
168 |