1 | <?php |
||
14 | class AuraSqlReplicationDbProvider implements ProviderInterface, SetContextInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var InjectorInterface |
||
18 | */ |
||
19 | private $injector; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | private $context = ''; |
||
25 | |||
26 | 7 | public function __construct(InjectorInterface $injector) |
|
30 | |||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | 7 | public function setContext($context) |
|
38 | |||
39 | /** |
||
40 | * {@inheritdoc} |
||
41 | */ |
||
42 | 7 | public function get() |
|
50 | } |
||
51 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: