| Total Complexity | 4 |
| Total Lines | 61 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | class Json extends AbstractFormatter |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * Default date format |
||
| 29 | * |
||
| 30 | * @var string |
||
| 31 | */ |
||
| 32 | protected $dateFormat; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Json constructor. |
||
| 36 | * |
||
| 37 | * @param string $dateFormat |
||
| 38 | */ |
||
| 39 | 7 | public function __construct(string $dateFormat = "c") |
|
| 40 | { |
||
| 41 | 7 | $this->dateFormat = $dateFormat; |
|
| 42 | 7 | } |
|
| 43 | |||
| 44 | /** |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | 2 | public function getDateFormat(): string |
|
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Applies a format to a message before sent it to the internal log |
||
| 54 | * |
||
| 55 | * @param Item $item |
||
| 56 | * |
||
| 57 | * @return string |
||
| 58 | * @throws Exception |
||
| 59 | */ |
||
| 60 | 4 | public function format(Item $item): string |
|
| 72 | ] |
||
| 73 | ); |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @param string $dateFormat |
||
| 78 | * |
||
| 79 | * @return Json |
||
| 80 | */ |
||
| 81 | 1 | public function setDateFormat(string $dateFormat): Json |
|
| 88 |