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

YAMLSerializer::serializeData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 9
rs 9.6666
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