| 1 | <?php |
||
| 11 | trait PrefixedContainer |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Container. |
||
| 15 | * |
||
| 16 | * @var \Pimple\Container |
||
| 17 | */ |
||
| 18 | protected $container; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * ContainerAccess constructor. |
||
| 22 | * |
||
| 23 | * @param \Pimple\Container $container |
||
| 24 | */ |
||
| 25 | public function __construct(Container $container) |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Fetches from pimple container. |
||
| 32 | * |
||
| 33 | * @param string $key |
||
| 34 | * |
||
| 35 | * @return mixed |
||
| 36 | */ |
||
| 37 | public function fetch($key) |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Gets a parameter or an object from pimple container. |
||
| 44 | * |
||
| 45 | * Get the `class basename` of the current class. |
||
| 46 | * Convert `class basename` to snake-case and concatenation with dot notation. |
||
| 47 | * |
||
| 48 | * E.g. Class 'EntWechat', $key foo -> 'ent_wechat.foo' |
||
| 49 | * |
||
| 50 | * @param string $key The unique identifier for the parameter or object |
||
| 51 | * |
||
| 52 | * @throws \InvalidArgumentException If the identifier is not defined |
||
| 53 | * |
||
| 54 | * @return mixed The value of the parameter or an object |
||
| 55 | */ |
||
| 56 | public function __get($key) |
||
| 64 | } |
||
| 65 |