1 | <?php |
||
48 | class PimpleContainerMediator extends AbstractContainerMediator |
||
49 | { |
||
50 | /** |
||
51 | * @param Container|null $serviceContainer |
||
52 | * |
||
53 | * @throws \InvalidArgumentException |
||
54 | */ |
||
55 | 26 | public function __construct(Container $serviceContainer = \null) |
|
59 | /** @noinspection GenericObjectTypeUsageInspection */ |
||
60 | /** |
||
61 | * This method is used any time the mediator need to get the actual instance |
||
62 | * of the class for an event. |
||
63 | * |
||
64 | * Normal will only be called during actual trigger of an event since lazy |
||
65 | * loading is used. |
||
66 | * |
||
67 | * @param string $serviceName |
||
68 | * |
||
69 | * @return object |
||
70 | * @throws \LogicException |
||
71 | */ |
||
72 | 3 | public function getServiceByName(string $serviceName) |
|
76 | /** |
||
77 | * This is used to bring in the service container that will be used. |
||
78 | * |
||
79 | * Though not required it would be considered best practice for this method |
||
80 | * to create a new instance of the container when given null. Another good |
||
81 | * practice is to call this method from the class constructor to allow |
||
82 | * easier testing. |
||
83 | * |
||
84 | * @param Container|null $value |
||
85 | * |
||
86 | * @return ContainerMediatorInterface Fluent interface. |
||
87 | * @throws \InvalidArgumentException |
||
88 | * |
||
89 | * @link http://pimple.sensiolabs.org/ Pimple |
||
90 | */ |
||
91 | 26 | public function setServiceContainer($value = \null): ContainerMediatorInterface |
|
106 | /** |
||
107 | * Used to get the service container. |
||
108 | * |
||
109 | * @return mixed |
||
110 | */ |
||
111 | 3 | private function getServiceContainer() |
|
115 | /** |
||
116 | * Holds the container instance to be used. |
||
117 | * |
||
118 | * @var mixed $serviceContainer |
||
119 | */ |
||
120 | private $serviceContainer; |
||
121 | } |
||
122 |