NodeToStringTransformer::transform()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 4
cts 4
cp 1
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 4
nc 2
nop 1
crap 3
1
<?php
2
3
namespace TreeHouse\Feeder\Modifier\Data\Transformer;
4
5
class NodeToStringTransformer implements TransformerInterface
6
{
7
    /**
8
     * @inheritdoc
9
     */
10 6
    public function transform($value)
11
    {
12
        // if value is an array with a hash, that's a serialized node's text value
13 6
        if (is_array($value) && array_key_exists('#', $value)) {
14 2
            return $value['#'];
15
        }
16
17 4
        return $value;
18
    }
19
}
20