1 | <?php |
||
35 | trait PrefixedContainer |
||
36 | { |
||
37 | /** |
||
38 | * Container. |
||
39 | * |
||
40 | * @var \Pimple\Container |
||
41 | */ |
||
42 | protected $container; |
||
43 | |||
44 | /** |
||
45 | * ContainerAccess constructor. |
||
46 | * |
||
47 | * @param \Pimple\Container $container |
||
48 | */ |
||
49 | public function __construct(Container $container) |
||
53 | |||
54 | /** |
||
55 | * Fetches from pimple container. |
||
56 | * |
||
57 | * @param string $key |
||
58 | * |
||
59 | * @return mixed |
||
60 | */ |
||
61 | public function fetch($key) |
||
65 | |||
66 | /** |
||
67 | * Gets a parameter or an object from pimple container. |
||
68 | * |
||
69 | * Get the `class basename` of the current class. |
||
70 | * Convert `class basename` to snake-case and concatenation with dot notation. |
||
71 | * |
||
72 | * E.g. Class 'EasyWechat', $key foo -> 'easy_wechat.foo' |
||
73 | * |
||
74 | * @param string $key The unique identifier for the parameter or object |
||
75 | * |
||
76 | * @return mixed The value of the parameter or an object |
||
77 | * |
||
78 | * @throws \InvalidArgumentException If the identifier is not defined |
||
79 | */ |
||
80 | public function __get($key) |
||
88 | } |
||
89 |