Completed
Pull Request — master (#25)
by Greg
02:27
created
src/FormatterManager.php 2 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -182,6 +182,9 @@  discard block
 block discarded – undo
182 182
         return $this->isValidFormatForReflectionClass($formatter, $dataType);
183 183
     }
184 184
 
185
+    /**
186
+     * @param \ReflectionClass $dataType
187
+     */
185 188
     public function isValidFormatForReflectionClass(FormatterInterface $formatter, $dataType)
186 189
     {
187 190
         if ($this->canSimplifyToArray($dataType)) {
@@ -196,6 +199,10 @@  discard block
 block discarded – undo
196 199
         }
197 200
         return array_reduce(
198 201
             $formatter->validDataTypes(),
202
+
203
+            /**
204
+             * @param \ReflectionClass $supportedType
205
+             */
199 206
             function ($carry, $supportedType) use ($dataType) {
200 207
                 return
201 208
                     $carry ||
@@ -266,6 +273,7 @@  discard block
 block discarded – undo
266 273
 
267 274
     /**
268 275
      * Test to see if the stipulated format exists
276
+     * @param string $format
269 277
      */
270 278
     public function hasFormatter($format)
271 279
     {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 
93 93
         if (count($validFormats) > 1) {
94 94
             // Make an input option for --format
95
-            $description = 'Format the result data. Available formats: ' . implode(',', $validFormats);
95
+            $description = 'Format the result data. Available formats: '.implode(',', $validFormats);
96 96
             $automaticOptions[FormatterOptions::FORMAT] = new InputOption(FormatterOptions::FORMAT, '', InputOption::VALUE_OPTIONAL, $description, $defaultFormat);
97 97
         }
98 98
 
99 99
         if ($availableFields) {
100 100
             $defaultFields = $options->get(FormatterOptions::DEFAULT_FIELDS, [], implode(',', $availableFields));
101
-            $description = 'Available fields: ' . implode(', ', $this->availableFieldsList($availableFields));
101
+            $description = 'Available fields: '.implode(', ', $this->availableFieldsList($availableFields));
102 102
             $automaticOptions[FormatterOptions::FIELDS] = new InputOption(FormatterOptions::FIELDS, '', InputOption::VALUE_OPTIONAL, $description, $defaultFields);
103 103
         }
104 104
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
     protected function availableFieldsList($availableFields)
113 113
     {
114 114
         return array_map(
115
-            function ($key) use ($availableFields) {
116
-                return $availableFields[$key] . " ($key)";
115
+            function($key) use ($availableFields) {
116
+                return $availableFields[$key]." ($key)";
117 117
             },
118 118
             array_keys($availableFields)
119 119
         );
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         }
197 197
         return array_reduce(
198 198
             $formatter->validDataTypes(),
199
-            function ($carry, $supportedType) use ($dataType) {
199
+            function($carry, $supportedType) use ($dataType) {
200 200
                 return
201 201
                     $carry ||
202 202
                     ($dataType->getName() == $supportedType->getName()) ||
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
      */
217 217
     public function write(OutputInterface $output, $format, $structuredOutput, FormatterOptions $options)
218 218
     {
219
-        $formatter = $this->getFormatter((string)$format);
219
+        $formatter = $this->getFormatter((string) $format);
220 220
         if (!is_string($structuredOutput) && !$this->isValidFormat($formatter, $structuredOutput)) {
221 221
             $validFormats = $this->validFormats($structuredOutput);
222
-            throw new InvalidFormatException((string)$format, $structuredOutput, $validFormats);
222
+            throw new InvalidFormatException((string) $format, $structuredOutput, $validFormats);
223 223
         }
224 224
         // Give the formatter a chance to override the options
225 225
         $options = $this->overrideOptions($formatter, $structuredOutput, $options);
Please login to merge, or discard this patch.