Completed
Push — master ( 9af83e...139fb8 )
by Thomas
21s
created

AbstractCustomExtension   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 55
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 5 1
A __construct() 0 4 1
A unserialize() 0 3 1
A getRootPath() 0 3 1
A getMachineName() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the ekino Drupal Debug project.
7
 *
8
 * (c) ekino
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ekino\Drupal\Debug\Extension\Model;
15
16
abstract class AbstractCustomExtension implements CustomExtensionInterface
17
{
18
    /**
19
     * @var string
20
     */
21
    protected $rootPath;
22
23
    /**
24
     * @var string
25
     */
26
    protected $machineName;
27
28
    /**
29
     * @param string $rootPath
30
     * @param string $machineName
31
     */
32 36
    public function __construct(string $rootPath, string $machineName)
33
    {
34 36
        $this->rootPath = $rootPath;
35 36
        $this->machineName = $machineName;
36 36
    }
37
38
    /**
39
     * @return string
40
     */
41 1
    public function getRootPath(): string
42
    {
43 1
        return $this->rootPath;
44
    }
45
46
    /**
47
     * @return string
48
     */
49 1
    public function getMachineName(): string
50
    {
51 1
        return $this->machineName;
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 14
    public function serialize(): ?string
58
    {
59 14
        return \serialize(array(
60 14
            $this->rootPath,
61 14
            $this->machineName,
62
        ));
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68 10
    public function unserialize($serialized): void
69
    {
70 10
        list($this->rootPath, $this->machineName) = \unserialize($serialized);
71 10
    }
72
}
73