YamlStrategy   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 4 1
A unserialize() 0 4 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