Completed
Push — master ( 81dd2f...193118 )
by Greg
8s
created

AssociativeList::restructure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
namespace Consolidation\OutputFormatters\StructuredData;
3
4
use Consolidation\OutputFormatters\RestructureInterface;
5
use Consolidation\OutputFormatters\Transformations\PropertyParser;
6
use Consolidation\OutputFormatters\Transformations\ReorderFields;
7
use Consolidation\OutputFormatters\Transformations\TableTransformation;
8
9
/**
10
 * Holds an array where each element of the array is one
11
 * key : value pair.  The keys must be unique, as is typically
12
 * the case for associative arrays.
13
 */
14
class AssociativeList extends RowsOfFields
15
{
16
    protected $data;
17
18
    public function __construct($data)
19
    {
20
        parent::__construct($data);
21
    }
22
23
    public function restructure($configurationData, $options)
24
    {
25
        $data = [$this->getArrayCopy()];
26
        $tableTransformer = $this->createTableTransformation($data, $configurationData, $options);
27
        $tableTransformer->setLayout(TableTransformation::LIST_LAYOUT);
28
        return $tableTransformer;
29
    }
30
}
31