| 1 | <?php |
||
| 15 | class ContentType extends AbstractCallbackMediator implements ProxyableBy, Unique |
||
| 16 | { |
||
| 17 | protected $contentMap = array(); |
||
| 18 | protected $negotiated = null; |
||
| 19 | |||
| 20 | 2 | protected function identifyRequested(Request $request, $params) |
|
| 28 | 2 | protected function notifyApproved($requested, $provided, Request $request, $params) |
|
| 29 | { |
||
| 30 | 2 | $this->negotiated = new SplObjectStorage(); |
|
| 31 | 2 | $this->negotiated[$request] = $this->getCallback($provided); |
|
| 32 | 2 | } |
|
| 33 | 1 | protected function notifyDeclined($requested, $provided, Request $request, $params) |
|
| 37 | |||
| 38 | 2 | public function by(Request $request, $params) |
|
| 44 | } |
||
| 45 |
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: