| 1 | <?php |
||
| 10 | class Standard extends Channel |
||
| 11 | { |
||
| 12 | const NAME = 'Standard'; |
||
| 13 | |||
| 14 | 1 | public function configure() |
|
|
|
|||
| 15 | { |
||
| 16 | 1 | $canSendHeaders = !$this->headerSent() && $this->getSapi()->get() != Sapi::CLI; |
|
| 17 | 1 | $isDev = $this->getEnvironment()->get() == Environment::DEV; |
|
| 18 | 1 | $allowBrowser = isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Castelis') !== false; |
|
| 19 | 1 | if ($canSendHeaders && ($allowBrowser || $isDev)) { |
|
| 20 | 1 | $this->getLogger() |
|
| 21 | 1 | ->pushHandler(new FirePHPHandler()) |
|
| 22 | 1 | ->pushHandler(new ChromePHPHandler()); |
|
| 23 | } |
||
| 24 | 1 | return $this; |
|
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @codeCoverageIgnore |
||
| 29 | * @return bool |
||
| 30 | */ |
||
| 31 | protected function headerSent() |
||
| 35 | } |
||
| 36 |
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: