| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function register() |
||
| 21 | { |
||
| 22 | $this->container->share(ResponseInterface::class, function () { |
||
| 23 | return new \Zend\Diactoros\Response; |
||
| 24 | }); |
||
| 25 | |||
| 26 | $this->container->share(ServerRequestInterface::class, function () { |
||
| 27 | return ServerRequestFactory::fromGlobals( |
||
| 28 | $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES |
||
| 29 | ); |
||
| 30 | }); |
||
| 31 | |||
| 32 | $this->container->share(EmitterInterface::class, function () { |
||
| 33 | return new SapiEmitter; |
||
| 34 | }); |
||
| 35 | } |
||
| 36 | } |
||
| 37 |
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: