1 | <?php |
||
22 | 1 | class StringFormatter implements FormatterInterface, ValidationInterface, OverrideOptionsInterface |
|
23 | 1 | { |
|
24 | 1 | /** |
|
25 | 1 | * By default, we assume that we can convert any data type to `string`, |
|
26 | * unless it implements UnstructuredInterface, in which case we won't |
||
27 | * allow the `string` format unless the data type also implements |
||
28 | * StringTransformationInterface. |
||
29 | */ |
||
30 | public function isValidDataType(\ReflectionClass $dataType) |
||
37 | |||
38 | /** |
||
39 | * @inheritdoc |
||
40 | */ |
||
41 | public function write(OutputInterface $output, $data, FormatterOptions $options) |
||
48 | |||
49 | /** |
||
50 | * @inheritdoc |
||
51 | */ |
||
52 | public function overrideOptions($structuredOutput, FormatterOptions $options) |
||
62 | |||
63 | /** |
||
64 | * If the data provided to a 'string' formatter is a table, then try |
||
65 | * to emit it in a simplified form (by default, TSV). |
||
66 | * |
||
67 | * @param OutputInterface $output |
||
68 | * @param mixed $data |
||
69 | * @param FormatterOptions $options |
||
70 | */ |
||
71 | protected function reduceToSigleFieldAndWrite(OutputInterface $output, $data, FormatterOptions $options) |
||
85 | |||
86 | /** |
||
87 | * Always validate any data, though. This format will never |
||
88 | * cause an error if it is selected for an incompatible data type; at |
||
89 | * worse, it simply does not print any data. |
||
90 | */ |
||
91 | public function validate($structuredData) |
||
95 | } |
||
96 |