AbstractCustomExtension::getMachineName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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 41
    public function __construct(string $rootPath, string $machineName)
33
    {
34 41
        $this->rootPath = $rootPath;
35 41
        $this->machineName = $machineName;
36 41
    }
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 5
    public function getMachineName(): string
50
    {
51 5
        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