|
@@ -119,7 +119,7 @@ discard block |
|
|
block discarded – undo |
|
119
|
119
|
|
|
120
|
120
|
if (count($validFormats) > 1) { |
|
121
|
121
|
// Make an input option for --format |
|
122
|
|
- $description = 'Format the result data. Available formats: ' . implode(',', $validFormats); |
|
|
122
|
+ $description = 'Format the result data. Available formats: '.implode(',', $validFormats); |
|
123
|
123
|
$automaticOptions[FormatterOptions::FORMAT] = new InputOption(FormatterOptions::FORMAT, '', InputOption::VALUE_REQUIRED, $description, $defaultFormat); |
|
124
|
124
|
} |
|
125
|
125
|
|
|
@@ -127,7 +127,7 @@ discard block |
|
|
block discarded – undo |
|
127
|
127
|
|
|
128
|
128
|
if ($availableFields) { |
|
129
|
129
|
$defaultFields = $options->get(FormatterOptions::DEFAULT_FIELDS, [], ''); |
|
130
|
|
- $description = 'Available fields: ' . implode(', ', $this->availableFieldsList($availableFields)); |
|
|
130
|
+ $description = 'Available fields: '.implode(', ', $this->availableFieldsList($availableFields)); |
|
131
|
131
|
$automaticOptions[FormatterOptions::FIELDS] = new InputOption(FormatterOptions::FIELDS, '', InputOption::VALUE_REQUIRED, $description, $defaultFields); |
|
132
|
132
|
} elseif ($dataTypeClass->implementsInterface('Consolidation\OutputFormatters\StructuredData\RestructureInterface')) { |
|
133
|
133
|
$automaticOptions[FormatterOptions::FIELDS] = new InputOption(FormatterOptions::FIELDS, '', InputOption::VALUE_REQUIRED, 'Limit output to only the listed elements. Name top-level elements by key, e.g. "--fields=name,date", or use dot notation to select a nested element, e.g. "--fields=a.b.c as example".', []); |
|
@@ -147,8 +147,8 @@ discard block |
|
|
block discarded – undo |
|
147
|
147
|
protected function availableFieldsList($availableFields) |
|
148
|
148
|
{ |
|
149
|
149
|
return array_map( |
|
150
|
|
- function ($key) use ($availableFields) { |
|
151
|
|
- return $availableFields[$key] . " ($key)"; |
|
|
150
|
+ function($key) use ($availableFields) { |
|
|
151
|
+ return $availableFields[$key]." ($key)"; |
|
152
|
152
|
}, |
|
153
|
153
|
array_keys($availableFields) |
|
154
|
154
|
); |
|
@@ -220,12 +220,12 @@ discard block |
|
|
block discarded – undo |
|
220
|
220
|
// TODO: If the $format is the default format (not selected by the user), and |
|
221
|
221
|
// if `convertData` switched us to unstructured data, then select a new default |
|
222
|
222
|
// format (e.g. yaml) if the selected format cannot render the converted data. |
|
223
|
|
- $formatter = $this->getFormatter((string)$format); |
|
|
223
|
+ $formatter = $this->getFormatter((string) $format); |
|
224
|
224
|
|
|
225
|
225
|
// If the data format is not applicable for the selected formatter, throw an error. |
|
226
|
226
|
if (!is_string($structuredOutput) && !$this->isValidFormat($formatter, $structuredOutput)) { |
|
227
|
227
|
$validFormats = $this->validFormats($structuredOutput); |
|
228
|
|
- throw new InvalidFormatException((string)$format, $structuredOutput, $validFormats); |
|
|
228
|
+ throw new InvalidFormatException((string) $format, $structuredOutput, $validFormats); |
|
229
|
229
|
} |
|
230
|
230
|
if ($structuredOutput instanceof FormatterAwareInterface) { |
|
231
|
231
|
$structuredOutput->setFormatter($formatter); |