Completed
Pull Request — master (#58)
by Patrick
05:05 queued 02:04
created

YAMLSerializer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A serializeData() 0 9 2
1
<?php
2
namespace Serialize;
3
4
use Symfony\Component\Yaml\Yaml;
5
6
class YAMLSerializer extends Serializer
7
{
8
    protected $types = array('yaml', 'application/x-yaml', 'text/x-yaml');
9
10
    public function serializeData(&$type, $array)
11
    {
12
        if($this->supportsType($type) === false)
13
        {
14
            return null;
15
        }
16
        $type = 'text/x-yaml';
17
        return Yaml::dump($array, 2, 4, Yaml::DUMP_OBJECT_AS_MAP);
18
    }
19
}
20