1 | <?php |
||
10 | trait ContainerAwareTrait |
||
11 | { |
||
12 | /** |
||
13 | * @var ?DefinitionContainerInterface |
||
14 | */ |
||
15 | protected $container; |
||
16 | |||
17 | 114 | public function setContainer(DefinitionContainerInterface $container): ContainerAwareInterface |
|
18 | { |
||
19 | 114 | $this->container = $container; |
|
20 | |||
21 | 114 | if ($this instanceof ContainerAwareInterface) { |
|
22 | 114 | return $this; |
|
23 | } |
||
24 | |||
25 | 3 | throw new BadMethodCallException(sprintf( |
|
26 | 3 | 'Attempt to use (%s) while not implementing (%s)', |
|
27 | 3 | ContainerAwareTrait::class, |
|
28 | 3 | ContainerAwareInterface::class |
|
29 | )); |
||
30 | } |
||
31 | |||
32 | 129 | public function getContainer(): DefinitionContainerInterface |
|
40 | } |
||
41 |