Passed
Pull Request — master (#243)
by
unknown
13:06
created

ThemeState   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 4
c 1
b 0
f 0
dl 0
loc 28
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getTheme() 0 3 1
A setTheme() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\View\State;
6
7
use Yiisoft\View\Theme;
8
9
/**
10
 * @internal
11
 */
12
final class ThemeState
13
{
14 130
    public function __construct(
15
        private ?Theme $theme = null
16
    ) {
17 130
    }
18
19
    /**
20
     * Set the specified view theme.
21
     *
22
     * @param Theme|null $theme
23
     * @return $this
24
     */
25 1
    public function setTheme(?Theme $theme): self
26
    {
27 1
        $this->theme = $theme;
28
29 1
        return $this;
30
    }
31
32
    /**
33
     * Gets the current theme or null if not set
34
     *
35
     * @return Theme|null
36
     */
37 65
    public function getTheme(): ?Theme
38
    {
39 65
        return $this->theme;
40
    }
41
}
42