| 1 | <?php |
||
| 20 | class UrlEncodedParser implements BodyParserInterface |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @var StreamInterface |
||
| 24 | */ |
||
| 25 | private $stream; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Creates an URL Encoded Body Parser |
||
| 29 | * |
||
| 30 | * @param StreamInterface $stream |
||
| 31 | */ |
||
| 32 | public function __construct(StreamInterface $stream) |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Parses the URL encoded body. |
||
| 39 | * |
||
| 40 | * @return array |
||
| 41 | */ |
||
| 42 | public function parse() |
||
| 48 | } |
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: