YamlTypeEncoder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 10
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContentType() 0 3 1
A encode() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Serialization\Encoder;
6
7
use Symfony\Component\Yaml\Yaml;
8
9
final class YamlTypeEncoder implements TypeEncoderInterface
10
{
11
    public function getContentType(): string
12
    {
13
        return 'application/x-yaml';
14 1
    }
15
16 1
    public function encode(array $data): string
17
    {
18
        return trim(Yaml::dump($data, 10, 4));
19
    }
20
}
21