Completed
Pull Request — master (#69)
by Greg
01:45
created

FieldProcessor::hasUnstructuredFieldAccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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\UnstructuredDataListTransformation;
7
8
/**
9
 * FieldProcessor will do various alterations on field sets.
10
 */
11
class FieldProcessor
12
{
13
    public static function processFieldAliases($fields)
14
    {
15
        if (!is_array($fields)) {
16
            $fields = array_filter(explode(',', $fields));
17
        }
18
        $transformed_fields = [];
19
        foreach ($fields as $field) {
20
            list($machine_name,$label) = explode(' as ', $field) + [$field, preg_replace('#.*\.#', '', $field)];
21
            $transformed_fields[$machine_name] = $label;
22
        }
23
        return $transformed_fields;
24
    }
25
26
    public static function hasUnstructuredFieldAccess($options)
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
27
    {
28
    }
29
}
30