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

YamlType   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 38
ccs 0
cts 12
cp 0
rs 10
c 1
b 0
f 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A getter() 0 4 1
A setter() 0 4 1
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