| Total Complexity | 2 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class SafeJson implements Encoder |
||
| 12 | { |
||
| 13 | public const DEFAULT_INDENT = 2; |
||
| 14 | |||
| 15 | private PrinterInterface $printer; |
||
| 16 | |||
| 17 | private string $indent; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param PrinterInterface $printer |
||
| 21 | * @param int $indent |
||
| 22 | */ |
||
| 23 | public function __construct(PrinterInterface $printer, int $indent = self::DEFAULT_INDENT) |
||
| 24 | { |
||
| 25 | $this->printer = $printer; |
||
| 26 | $this->indent = str_repeat(' ', $indent); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @inheritDoc |
||
| 31 | */ |
||
| 32 | public function encode(mixed $data): string |
||
| 37 | ); |
||
| 38 | } |
||
| 40 |