Completed
Push — master ( 8006bf...33a7c4 )
by Greg
02:08
created

PropertyParser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 10
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 7 2
1
<?php
2
namespace Consolidation\OutputFormatters\Transformations;
3
4
use Symfony\Component\Yaml\Yaml;
5
6
/**
7
 * Transform a string of properties into a PHP associative array.
8
 *
9
 * Input:
10
 *
11
 *   one: red
12
 *   two: white
13
 *   three: blue
14
 *
15
 * Output:
16
 *
17
 *   [
18
 *      'one' => 'red',
19
 *      'two' => 'white',
20
 *      'three' => 'blue',
21
 *   ]
22
 */
23
class PropertyParser
24
{
25
    public static function parse($data)
26
    {
27
        if (is_string($data)) {
28
            $data = Yaml::parse(trim($data));
29
        }
30
        return $data;
31
    }
32
}
33