YamlStrategy::serialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/**
4
 * Author: Nil Portugués Calderó <[email protected]>
5
 * Date: 8/27/15
6
 * Time: 11:58 PM.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace NilPortugues\Serializer\Strategy;
12
13
use Symfony\Component\Yaml\Yaml;
14
15
class YamlStrategy implements StrategyInterface
16
{
17
    /**
18
     * @param mixed $value
19
     *
20
     * @return string
21
     */
22
    public function serialize($value)
23
    {
24
        return Yaml::dump($value);
25
    }
26
27
    /**
28
     * @param $value
29
     *
30
     * @return array
31
     */
32
    public function unserialize($value)
33
    {
34
        return Yaml::parse($value);
0 ignored issues
show
Bug Compatibility introduced by
The expression \Symfony\Component\Yaml\Yaml::parse($value); of type array|string adds the type string to the return on line 34 which is incompatible with the return type declared by the interface NilPortugues\Serializer\...yInterface::unserialize of type array.
Loading history...
35
    }
36
}
37