Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / consolidation / output-formatters / src / StructuredData / UnstructuredData.php
1 <?php
2 namespace Consolidation\OutputFormatters\StructuredData;
3
4 use Consolidation\OutputFormatters\Options\FormatterOptions;
5 use Consolidation\OutputFormatters\StructuredData\RestructureInterface;
6 use Consolidation\OutputFormatters\Transformations\UnstructuredDataTransformation;
7
8 /**
9  * Represents aribtrary unstructured array data where the
10  * data to display in --list format comes from the array keys.
11  *
12  * Unstructured list data can have variable keys in every rown (unlike
13  * RowsOfFields, which expects uniform rows), and the data elements may
14  * themselves be deep arrays.
15  */
16 class UnstructuredData extends AbstractListData implements UnstructuredInterface, RestructureInterface
17 {
18     public function __construct($data)
19     {
20         parent::__construct($data);
21     }
22
23     public function restructure(FormatterOptions $options)
24     {
25         $defaults = $this->defaultOptions();
26         $fields = $this->getFields($options, $defaults);
27
28         return new UnstructuredDataTransformation($this->getArrayCopy(), FieldProcessor::processFieldAliases($fields));
29     }
30 }