-
Notifications
You must be signed in to change notification settings - Fork 13
/
RowsOfFieldsWithMetadata.php
35 lines (30 loc) · 1.1 KB
/
RowsOfFieldsWithMetadata.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace Consolidation\OutputFormatters\StructuredData;
use Consolidation\OutputFormatters\Options\FormatterOptions;
/**
* A RowsOfFields data structure that also contains metadata.
* @see MetadataHolderTrait
*/
class RowsOfFieldsWithMetadata extends RowsOfFields implements MetadataInterface, MetadataHolderInterface
{
use MetadataHolderTrait;
/**
* Restructure this data for output by converting it into a table
* transformation object. First, though, remove any metadata items.
*
* @param FormatterOptions $options Options that affect output formatting.
* @return Consolidation\OutputFormatters\Transformations\TableTransformation
*/
public function restructure(FormatterOptions $options)
{
$originalData = $this->getArrayCopy();
$data = $this->extractData($originalData);
$tableTranformer = $this->createTableTransformation($data, $options);
$tableTranformer->setOriginalData($this);
return $tableTranformer;
}
public function getMetadata()
{
return $this->extractMetadata($this->getArrayCopy());
}
}