|
@@ -111,13 +111,13 @@ discard block |
|
|
block discarded – undo |
|
111
|
111
|
|
|
112
|
112
|
if (count($validFormats) > 1) { |
|
113
|
113
|
// Make an input option for --format |
|
114
|
|
- $description = 'Format the result data. Available formats: ' . implode(',', $validFormats); |
|
|
114
|
+ $description = 'Format the result data. Available formats: '.implode(',', $validFormats); |
|
115
|
115
|
$automaticOptions[FormatterOptions::FORMAT] = new InputOption(FormatterOptions::FORMAT, '', InputOption::VALUE_REQUIRED, $description, $defaultFormat); |
|
116
|
116
|
} |
|
117
|
117
|
|
|
118
|
118
|
if ($availableFields) { |
|
119
|
119
|
$defaultFields = $options->get(FormatterOptions::DEFAULT_FIELDS, [], ''); |
|
120
|
|
- $description = 'Available fields: ' . implode(', ', $this->availableFieldsList($availableFields)); |
|
|
120
|
+ $description = 'Available fields: '.implode(', ', $this->availableFieldsList($availableFields)); |
|
121
|
121
|
$automaticOptions[FormatterOptions::FIELDS] = new InputOption(FormatterOptions::FIELDS, '', InputOption::VALUE_REQUIRED, $description, $defaultFields); |
|
122
|
122
|
$automaticOptions[FormatterOptions::FIELD] = new InputOption(FormatterOptions::FIELD, '', InputOption::VALUE_REQUIRED, "Select just one field, and force format to 'string'.", ''); |
|
123
|
123
|
} |
|
@@ -132,8 +132,8 @@ discard block |
|
|
block discarded – undo |
|
132
|
132
|
protected function availableFieldsList($availableFields) |
|
133
|
133
|
{ |
|
134
|
134
|
return array_map( |
|
135
|
|
- function ($key) use ($availableFields) { |
|
136
|
|
- return $availableFields[$key] . " ($key)"; |
|
|
135
|
+ function($key) use ($availableFields) { |
|
|
136
|
+ return $availableFields[$key]." ($key)"; |
|
137
|
137
|
}, |
|
138
|
138
|
array_keys($availableFields) |
|
139
|
139
|
); |
|
@@ -197,10 +197,10 @@ discard block |
|
|
block discarded – undo |
|
197
|
197
|
*/ |
|
198
|
198
|
public function write(OutputInterface $output, $format, $structuredOutput, FormatterOptions $options) |
|
199
|
199
|
{ |
|
200
|
|
- $formatter = $this->getFormatter((string)$format); |
|
|
200
|
+ $formatter = $this->getFormatter((string) $format); |
|
201
|
201
|
if (!is_string($structuredOutput) && !$this->isValidFormat($formatter, $structuredOutput)) { |
|
202
|
202
|
$validFormats = $this->validFormats($structuredOutput); |
|
203
|
|
- throw new InvalidFormatException((string)$format, $structuredOutput, $validFormats); |
|
|
203
|
+ throw new InvalidFormatException((string) $format, $structuredOutput, $validFormats); |
|
204
|
204
|
} |
|
205
|
205
|
// Give the formatter a chance to override the options |
|
206
|
206
|
$options = $this->overrideOptions($formatter, $structuredOutput, $options); |