Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Logger | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| log | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | #declare(strict_types=1); |
| 4 | |
| 5 | /** |
| 6 | * CNIC\HEXONET |
| 7 | * Copyright © CentralNic Group PLC |
| 8 | */ |
| 9 | |
| 10 | namespace CNIC\HEXONET; |
| 11 | |
| 12 | /** |
| 13 | * HEXONET Logger |
| 14 | * |
| 15 | * @package CNIC\HEXONET |
| 16 | */ |
| 17 | |
| 18 | class Logger implements \CNIC\LoggerInterface |
| 19 | { |
| 20 | /** |
| 21 | * output/log given data |
| 22 | * @param string $post post request data in string format |
| 23 | * @param Response $r Response to log |
| 24 | * @param string|null $error error message |
| 25 | */ |
| 26 | public function log($post, $r, $error = null): void |
| 27 | { |
| 28 | echo implode("\n", [ |
| 29 | print_r($r->getCommand(), true), |
| 30 | $post, |
| 31 | $error ? "HTTP communication failed: " . $error : "", |
| 32 | $r->getPlain() |
| 33 | ]); |
| 34 | } |
| 35 | } |