| Total Complexity | 7 |
| Total Lines | 75 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | final class ImplodeErrorPrinter implements FormErrorPrinterInterface |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * The errors separator |
||
| 15 | * |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | private $separator; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Lines of errors |
||
| 22 | * |
||
| 23 | * @var string[] |
||
| 24 | */ |
||
| 25 | private $lines = []; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Does the printer is visiting a child ? |
||
| 29 | * If true, call to print will do nothing |
||
| 30 | * |
||
| 31 | * @var bool |
||
| 32 | */ |
||
| 33 | private $inChild = false; |
||
| 34 | |||
| 35 | |||
| 36 | /** |
||
| 37 | * ImplodeErrorsPrinter constructor. |
||
| 38 | * |
||
| 39 | 3 | * @param string $separator |
|
| 40 | */ |
||
| 41 | 3 | public function __construct(string $separator = PHP_EOL) |
|
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | 3 | * {@inheritdoc} |
|
| 48 | */ |
||
| 49 | 3 | public function field(HttpFieldPath $field): void |
|
| 50 | 3 | { |
|
| 51 | // Ignore field name |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | 3 | * {@inheritdoc} |
|
| 56 | */ |
||
| 57 | public function global(string $error): void |
||
| 58 | 3 | { |
|
| 59 | $this->lines[] = $error; |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | 2 | * {@inheritdoc} |
|
| 64 | */ |
||
| 65 | 2 | public function code(string $code): void |
|
| 66 | 2 | { |
|
| 67 | 2 | // Ignore code |
|
| 68 | 2 | } |
|
| 69 | |||
| 70 | /** |
||
| 71 | * {@inheritdoc} |
||
| 72 | */ |
||
| 73 | 3 | public function child(string $name, FormError $error): void |
|
| 78 | } |
||
| 79 | |||
| 80 | /** |
||
| 81 | * {@inheritdoc} |
||
| 82 | */ |
||
| 83 | public function print() |
||
| 86 | } |
||
| 87 | } |
||
| 88 |