Completed
Pull Request — master (#20)
by Greg
03:00
created

AssociativeList   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 2
Metric Value
wmc 2
c 5
b 0
f 2
lcom 1
cbo 2
dl 0
loc 15
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A restructure() 0 7 1
A getListData() 0 4 1
1
<?php
2
namespace Consolidation\OutputFormatters\StructuredData;
3
4
use Consolidation\OutputFormatters\RestructureInterface;
5
use Consolidation\OutputFormatters\FormatterOptions;
6
use Consolidation\OutputFormatters\StructuredData\ListDataInterface;
7
use Consolidation\OutputFormatters\Transformations\PropertyParser;
8
use Consolidation\OutputFormatters\Transformations\ReorderFields;
9
use Consolidation\OutputFormatters\Transformations\TableTransformation;
10
11
/**
12
 * Holds an array where each element of the array is one
13
 * key : value pair.  The keys must be unique, as is typically
14
 * the case for associative arrays.
15
 */
16
class AssociativeList extends AbstractStructuredList
17
{
18
    public function restructure(FormatterOptions $options)
19 4
    {
20
        $data = [$this->getArrayCopy()];
21 4
        $options->setConfigurationDefault('list-orientation', true);
22 4
        $tableTransformer = $this->createTableTransformation($data, $options);
23
        return $tableTransformer;
24 3
    }
25
26 3
    public function getListData()
27 3
    {
28 3
        return $this->getArrayCopy();
29 3
    }
30
}
31