Yaml   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 1
cbo 5
dl 0
loc 58
ccs 0
cts 11
cp 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A serialise() 0 4 1
A unserialise() 0 4 1
A write() 0 4 1
A read() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of Payload.
5
 *
6
 * (c) DraperStudio <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace DraperStudio\Payload;
13
14
use DraperStudio\Payload\Normalisers\YamlNormaliser;
15
16
/**
17
 * Class Yaml.
18
 */
19
class Yaml
20
{
21
    /**
22
     * @var YamlNormaliser
23
     */
24
    protected $normaliser;
25
26
    /**
27
     * Yaml constructor.
28
     */
29
    public function __construct()
30
    {
31
        $this->normaliser = new YamlNormaliser();
32
    }
33
34
    /**
35
     * @param $input
36
     *
37
     * @return mixed|string
38
     */
39
    public function serialise($input)
40
    {
41
        return $this->normaliser->serialiser()->serialise($input);
42
    }
43
44
    /**
45
     * @param $input
46
     * @param null $class
47
     *
48
     * @return mixed
49
     */
50
    public function unserialise($input, $class = null)
51
    {
52
        return $this->normaliser->unserialiser()->unserialise($input, $class);
53
    }
54
55
    /**
56
     * @param $path
57
     * @param $input
58
     *
59
     * @return bool|mixed
60
     */
61
    public function write($path, $input)
62
    {
63
        return $this->normaliser->writer()->write($path, $input);
64
    }
65
66
    /**
67
     * @param $path
68
     * @param null $class
69
     *
70
     * @return mixed
71
     */
72
    public function read($path, $class = null)
73
    {
74
        return $this->normaliser->reader()->read($path, $class);
75
    }
76
}
77