@@ -4,10 +4,7 @@ |
||
| 4 | 4 | use Consolidation\OutputFormatters\Validate\ValidationInterface; |
| 5 | 5 | use Consolidation\OutputFormatters\Options\OverrideOptionsInterface; |
| 6 | 6 | use Consolidation\OutputFormatters\Options\FormatterOptions; |
| 7 | -use Consolidation\OutputFormatters\Validate\ValidDataTypesTrait; |
|
| 8 | 7 | use Symfony\Component\Console\Output\OutputInterface; |
| 9 | -use Consolidation\OutputFormatters\StructuredData\RestructureInterface; |
|
| 10 | -use Consolidation\OutputFormatters\Transformations\SimplifiedFormatterInterface; |
|
| 11 | 8 | use Consolidation\OutputFormatters\Transformations\StringTransformationInterface; |
| 12 | 9 | |
| 13 | 10 | /** |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | } |
| 37 | 37 | $transformed_fields = []; |
| 38 | 38 | foreach ($fields as $field) { |
| 39 | - list($machine_name,$label) = explode(' as ', $field) + [$field, preg_replace('#.*\.#', '', $field)]; |
|
| 39 | + list($machine_name, $label) = explode(' as ', $field) + [$field, preg_replace('#.*\.#', '', $field)]; |
|
| 40 | 40 | $transformed_fields[$machine_name] = $label; |
| 41 | 41 | } |
| 42 | 42 | return $transformed_fields; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | if (count($validFormats) > 1) { |
| 120 | 120 | // Make an input option for --format |
| 121 | - $description = 'Format the result data. Available formats: ' . implode(',', $validFormats); |
|
| 121 | + $description = 'Format the result data. Available formats: '.implode(',', $validFormats); |
|
| 122 | 122 | $automaticOptions[FormatterOptions::FORMAT] = new InputOption(FormatterOptions::FORMAT, '', InputOption::VALUE_REQUIRED, $description, $defaultFormat); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | if ($availableFields) { |
| 128 | 128 | $defaultFields = $options->get(FormatterOptions::DEFAULT_FIELDS, [], ''); |
| 129 | - $description = 'Available fields: ' . implode(', ', $this->availableFieldsList($availableFields)); |
|
| 129 | + $description = 'Available fields: '.implode(', ', $this->availableFieldsList($availableFields)); |
|
| 130 | 130 | $automaticOptions[FormatterOptions::FIELDS] = new InputOption(FormatterOptions::FIELDS, '', InputOption::VALUE_REQUIRED, $description, $defaultFields); |
| 131 | 131 | } elseif ($dataTypeClass->implementsInterface('Consolidation\OutputFormatters\StructuredData\RestructureInterface')) { |
| 132 | 132 | $automaticOptions[FormatterOptions::FIELDS] = new InputOption(FormatterOptions::FIELDS, '', InputOption::VALUE_REQUIRED, 'Dot notation of fields to include in output.', []); |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | protected function availableFieldsList($availableFields) |
| 147 | 147 | { |
| 148 | 148 | return array_map( |
| 149 | - function ($key) use ($availableFields) { |
|
| 150 | - return $availableFields[$key] . " ($key)"; |
|
| 149 | + function($key) use ($availableFields) { |
|
| 150 | + return $availableFields[$key]." ($key)"; |
|
| 151 | 151 | }, |
| 152 | 152 | array_keys($availableFields) |
| 153 | 153 | ); |
@@ -219,12 +219,12 @@ discard block |
||
| 219 | 219 | // TODO: If the $format is the default format (not selected by the user), and |
| 220 | 220 | // if `convertData` switched us to unstructured data, then select a new default |
| 221 | 221 | // format (e.g. yaml) if the selected format cannot render the converted data. |
| 222 | - $formatter = $this->getFormatter((string)$format); |
|
| 222 | + $formatter = $this->getFormatter((string) $format); |
|
| 223 | 223 | |
| 224 | 224 | // If the data format is not applicable for the selected formatter, throw an error. |
| 225 | 225 | if (!is_string($structuredOutput) && !$this->isValidFormat($formatter, $structuredOutput)) { |
| 226 | 226 | $validFormats = $this->validFormats($structuredOutput); |
| 227 | - throw new InvalidFormatException((string)$format, $structuredOutput, $validFormats); |
|
| 227 | + throw new InvalidFormatException((string) $format, $structuredOutput, $validFormats); |
|
| 228 | 228 | } |
| 229 | 229 | if ($structuredOutput instanceof FormatterAwareInterface) { |
| 230 | 230 | $structuredOutput->setFormatter($formatter); |