Completed
Pull Request — master (#3)
by David
02:24
created

SubThemeDescriptor::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 6
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
4
namespace TheCodingMachine\CMS\Theme;
5
6
7 View Code Duplication
class SubThemeDescriptor implements ThemeDescriptorInterface, \JsonSerializable
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    /**
10
     * @var mixed[]
11
     */
12
    private $additionalContext;
13
    /**
14
     * @var ThemeDescriptorInterface
15
     */
16
    private $themeDescriptor;
17
18
    /**
19
     * @param mixed[] $additionalContext
20
     */
21
    public function __construct(ThemeDescriptorInterface $themeDescriptor, array $additionalContext)
22
    {
23
        $this->additionalContext = $additionalContext;
24
        $this->themeDescriptor = $themeDescriptor;
25
    }
26
27
    /**
28
     * @return ThemeDescriptorInterface
29
     */
30
    public function getThemeDescriptor(): ThemeDescriptorInterface
31
    {
32
        return $this->themeDescriptor;
33
    }
34
35
    /**
36
     * @return mixed[]
37
     */
38
    public function getAdditionalContext(): array
39
    {
40
        return $this->additionalContext;
41
    }
42
43
    public function jsonSerialize()
44
    {
45
        return [
46
            'type' => 'subTheme',
47
            'additionalContext' => $this->additionalContext,
48
            'theme' => $this->themeDescriptor
49
        ];
50
    }
51
}
52