@@ -121,6 +121,10 @@ |
||
| 121 | 121 | return $this; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | + /** |
|
| 125 | + * @param string $key |
|
| 126 | + * @param boolean $value |
|
| 127 | + */ |
|
| 124 | 128 | public function setConfigurationDefault($key, $value) |
| 125 | 129 | { |
| 126 | 130 | if (!array_key_exists($key, $this->configurationData)) { |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | use Symfony\Component\Console\Input\InputInterface; |
| 5 | 5 | use Consolidation\OutputFormatters\Transformations\PropertyParser; |
| 6 | 6 | use Consolidation\OutputFormatters\StructuredData\Xml\XmlSchema; |
| 7 | -use Consolidation\OutputFormatters\StructuredData\Xml\XmlSchemaInterface; |
|
| 8 | 7 | |
| 9 | 8 | /** |
| 10 | 9 | * FormetterOptions holds information that affects the way a formatter |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | * transformation object. |
| 20 | 20 | * |
| 21 | 21 | * @param FormatterOptions $options Options that affect output formatting. |
| 22 | - * @return Consolidation\OutputFormatters\Transformations\TableTransformation |
|
| 22 | + * @return TableTransformation |
|
| 23 | 23 | */ |
| 24 | 24 | public function restructure(FormatterOptions $options) |
| 25 | 25 | { |
@@ -2,9 +2,6 @@ |
||
| 2 | 2 | namespace Consolidation\OutputFormatters\StructuredData; |
| 3 | 3 | |
| 4 | 4 | use Consolidation\OutputFormatters\FormatterOptions; |
| 5 | -use Consolidation\OutputFormatters\StructuredData\ListDataInterface; |
|
| 6 | -use Consolidation\OutputFormatters\Transformations\PropertyParser; |
|
| 7 | -use Consolidation\OutputFormatters\Transformations\ReorderFields; |
|
| 8 | 5 | use Consolidation\OutputFormatters\Transformations\TableTransformation; |
| 9 | 6 | |
| 10 | 7 | /** |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | * transformation object. |
| 18 | 18 | * |
| 19 | 19 | * @param FormatterOptions $options Options that affect output formatting. |
| 20 | - * @return Consolidation\OutputFormatters\Transformations\TableTransformation |
|
| 20 | + * @return \Consolidation\OutputFormatters\Transformations\TableTransformation |
|
| 21 | 21 | */ |
| 22 | 22 | public function restructure(FormatterOptions $options) |
| 23 | 23 | { |
@@ -34,6 +34,9 @@ |
||
| 34 | 34 | $this->addXmlChildren($dom, $element, $elementName, $structuredData); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | + /** |
|
| 38 | + * @param \DOMElement $xmlParent |
|
| 39 | + */ |
|
| 37 | 40 | protected function addXmlChildren(\DOMDocument $dom, $xmlParent, $elementName, $structuredData) |
| 38 | 41 | { |
| 39 | 42 | foreach ($structuredData as $key => $value) { |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | use Consolidation\OutputFormatters\SimplifyToArrayInterface; |
| 5 | 5 | use Consolidation\OutputFormatters\FormatterOptions; |
| 6 | 6 | use Consolidation\OutputFormatters\StructuredData\Xml\DomDataInterface; |
| 7 | -use Consolidation\OutputFormatters\StructuredData\Xml\XmlSchema; |
|
| 8 | 7 | |
| 9 | 8 | /** |
| 10 | 9 | * Simplify a DOMDocument to an array. |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * @param ReflectionClass $dataType |
|
| 19 | + * @param \ReflectionClass $dataType |
|
| 20 | 20 | */ |
| 21 | 21 | public function canSimplify(\ReflectionClass $dataType) |
| 22 | 22 | { |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | protected function tsvEscape($data) |
| 26 | 26 | { |
| 27 | 27 | return implode("\t", array_map( |
| 28 | - function ($item) { |
|
| 28 | + function($item) { |
|
| 29 | 29 | return str_replace(["\t", "\n"], ['\t', '\n'], $item); |
| 30 | 30 | }, |
| 31 | 31 | $data |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use Consolidation\OutputFormatters\OverrideOptionsInterface; |
| 7 | 7 | use Consolidation\OutputFormatters\FormatterOptions; |
| 8 | 8 | use Symfony\Component\Console\Output\OutputInterface; |
| 9 | -use Consolidation\OutputFormatters\StructuredData\RestructureInterface; |
|
| 10 | 9 | |
| 11 | 10 | /** |
| 12 | 11 | * String formatter |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | return |
| 68 | 68 | array_filter( |
| 69 | 69 | array_keys($fieldLabels), |
| 70 | - function ($key) use ($fieldRegex, $fieldLabels) { |
|
| 70 | + function($key) use ($fieldRegex, $fieldLabels) { |
|
| 71 | 71 | $value = $fieldLabels[$key]; |
| 72 | 72 | return preg_match($fieldRegex, $value) || preg_match($fieldRegex, $key); |
| 73 | 73 | } |
@@ -260,6 +260,7 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | /** |
| 262 | 262 | * Test to see if the stipulated format exists |
| 263 | + * @param string $format |
|
| 263 | 264 | */ |
| 264 | 265 | public function hasFormatter($format) |
| 265 | 266 | { |
@@ -335,6 +336,9 @@ discard block |
||
| 335 | 336 | return $structuredOutput; |
| 336 | 337 | } |
| 337 | 338 | |
| 339 | + /** |
|
| 340 | + * @param \ReflectionClass $structuredOutput |
|
| 341 | + */ |
|
| 338 | 342 | protected function canSimplifyToArray($structuredOutput) |
| 339 | 343 | { |
| 340 | 344 | foreach ($this->arraySimplifiers as $simplifier) { |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | if (count($validFormats) > 1) { |
| 92 | 92 | // Make an input option for --format |
| 93 | - $description = 'Format the result data. Available formats: ' . implode(',', $validFormats); |
|
| 93 | + $description = 'Format the result data. Available formats: '.implode(',', $validFormats); |
|
| 94 | 94 | $automaticOptions[FormatterOptions::FORMAT] = new InputOption(FormatterOptions::FORMAT, '', InputOption::VALUE_OPTIONAL, $description, $defaultFormat); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | // We have fields; that implies 'table', unless someone says something different |
| 100 | 100 | $defaultFormat = 'table'; |
| 101 | 101 | |
| 102 | - $description = 'Available fields: ' . implode(', ', $this->availableFieldsList($availableFields)); |
|
| 102 | + $description = 'Available fields: '.implode(', ', $this->availableFieldsList($availableFields)); |
|
| 103 | 103 | $automaticOptions[FormatterOptions::FIELDS] = new InputOption(FormatterOptions::FIELDS, '', InputOption::VALUE_OPTIONAL, $description, $defaultFields); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | protected function availableFieldsList($availableFields) |
| 114 | 114 | { |
| 115 | 115 | return array_map( |
| 116 | - function ($key) use ($availableFields) { |
|
| 117 | - return $availableFields[$key] . " ($key)"; |
|
| 116 | + function($key) use ($availableFields) { |
|
| 117 | + return $availableFields[$key]." ($key)"; |
|
| 118 | 118 | }, |
| 119 | 119 | array_keys($availableFields) |
| 120 | 120 | ); |
@@ -210,10 +210,10 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function write(OutputInterface $output, $format, $structuredOutput, FormatterOptions $options) |
| 212 | 212 | { |
| 213 | - $formatter = $this->getFormatter((string)$format); |
|
| 213 | + $formatter = $this->getFormatter((string) $format); |
|
| 214 | 214 | if (!is_string($structuredOutput) && !$this->isValidFormat($formatter, $structuredOutput)) { |
| 215 | 215 | $validFormats = $this->validFormats($structuredOutput); |
| 216 | - throw new InvalidFormatException((string)$format, $structuredOutput, $validFormats); |
|
| 216 | + throw new InvalidFormatException((string) $format, $structuredOutput, $validFormats); |
|
| 217 | 217 | } |
| 218 | 218 | // Give the formatter a chance to override the options |
| 219 | 219 | $options = $this->overrideOptions($formatter, $structuredOutput, $options); |
@@ -135,8 +135,7 @@ |
||
| 135 | 135 | if (!empty($formatId) && $this->isValidFormatForSpecifiedDataType($formatter, $dataType)) { |
| 136 | 136 | $validFormats[] = $formatId; |
| 137 | 137 | $atLeastOneValidFormat = true; |
| 138 | - } |
|
| 139 | - elseif (!empty($formatId) && ($formatter instanceof ValidationInterface)) { |
|
| 138 | + } elseif (!empty($formatId) && ($formatter instanceof ValidationInterface)) { |
|
| 140 | 139 | // A formatter that supports NO valid data types (e.g. the |
| 141 | 140 | // string formatter) can be used with any data type that |
| 142 | 141 | // is usable with at least one other data formatter. |