StringTransformation::apply()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Cerbero\Transformer\Transformations;
4
5
/**
6
 * Transform a value into a string.
7
 *
8
 */
9
class StringTransformation extends AbstractTransformation
10
{
11
    /**
12
     * Apply the transformation
13
     *
14
     * @param array $parameters
15
     * @return mixed
16
     */
17 3
    public function apply(array $parameters)
18
    {
19 3
        $value = json_encode($this->value);
20
21 3
        return is_string($value) ? $value : (string)$this->value;
0 ignored issues
show
introduced by
The condition is_string($value) is always true.
Loading history...
22
    }
23
}
24