Passed
Push — master ( 255048...7caf1f )
by
01:56
created

YamlType::getter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of the PhpMob package.
5
 *
6
 * (c) Ishmael Doss <[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
declare(strict_types=1);
13
14
namespace PhpMob\Settings\Type;
15
16
use Symfony\Component\Yaml\Yaml;
17
18
/**
19
 * @author Ishmael Doss <[email protected]>
20
 */
21
class YamlType implements TypeInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     *
26
     * value: |
27
            user_registration:
28
                subject: "User Registration"
29
                template: "@PhpMobCms/tpls/email/registration.html.twig"
30
            verification_token:
31
                subject: "User Verification"
32
                template: "@PhpMobCms/tpls/email/verification.html.twig"
33
     */
34
    public static function getName()
35
    {
36
        return 'yaml';
37
    }
38
39
    /**
40
     * @param mixed $value
41
     *
42
     * @return array
43
     */
44
    public function getter($value)
45
    {
46
        return Yaml::parse($value);
47
    }
48
49
    /**
50
     * @param mixed $value
51
     *
52
     * @return string
53
     */
54
    public function setter($value)
55
    {
56
        return Yaml::dump($value);
57
    }
58
}
59