| Total Complexity | 8 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | final class Logger |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var LoggerInterface |
||
| 23 | */ |
||
| 24 | private $origin; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var LogStrategy |
||
| 28 | */ |
||
| 29 | private $strategy; |
||
| 30 | |||
| 31 | public function __construct(LoggerInterface $origin, LogStrategy $strategy = null) |
||
| 32 | { |
||
| 33 | if ($strategy === null) { |
||
| 34 | $strategy = LogStrategy::errorsOnly(); |
||
| 35 | } |
||
| 36 | |||
| 37 | $this->origin = $origin; |
||
| 38 | $this->strategy = $strategy; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function log(string $level, string $message, array $context): void |
||
| 42 | { |
||
| 43 | $this->origin->log($level, $message, $context); |
||
| 44 | } |
||
| 45 | |||
| 46 | public function logRequestsOnly(): bool |
||
| 49 | } |
||
| 50 | |||
| 51 | public function logErrorsOnly(): bool |
||
| 54 | } |
||
| 55 | |||
| 56 | public function debugMode(): bool |
||
| 59 | } |
||
| 60 | |||
| 61 | public function getLogLevel(ResponseInterface $response): string |
||
| 66 |