2 namespace Consolidation\OutputFormatters\StructuredData;
4 use Consolidation\OutputFormatters\Options\FormatterOptions;
5 use Consolidation\OutputFormatters\StructuredData\RestructureInterface;
6 use Consolidation\OutputFormatters\Transformations\UnstructuredDataTransformation;
9 * Represents aribtrary unstructured array data where the
10 * data to display in --list format comes from the array keys.
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.
16 class UnstructuredData extends AbstractListData implements UnstructuredInterface, RestructureInterface
18 public function __construct($data)
20 parent::__construct($data);
23 public function restructure(FormatterOptions $options)
25 $defaults = $this->defaultOptions();
26 $fields = $this->getFields($options, $defaults);
28 return new UnstructuredDataTransformation($this->getArrayCopy(), FieldProcessor::processFieldAliases($fields));