Passed
Pull Request — master (#226)
by Rustam
02:29
created

Template   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 5
c 2
b 0
f 0
dl 0
loc 34
ccs 10
cts 10
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getView() 0 3 1
A getTemplate() 0 3 1
A getViewContext() 0 3 1
A getParameters() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\View;
6
7
final class Template
8
{
9
    /**
10
     * @param string $template The template file.
11
     * @param array $parameters The parameters to be passed to the view file.
12
     * @param ViewInterface $view The view instance used for rendering the file.
13
     * @param ViewContextInterface|null $viewContext The context instance of the view.
14
     */
15 61
    public function __construct(
16
        private string $template,
17
        private array $parameters,
18
        private ViewInterface $view,
19
        private ?ViewContextInterface $viewContext = null
20
    ) {
21 61
    }
22
23 61
    public function getTemplate(): string
24
    {
25 61
        return $this->template;
26
    }
27
28 61
    public function getParameters(): array
29
    {
30 61
        return $this->parameters;
31
    }
32
33 61
    public function getView(): ViewInterface
34
    {
35 61
        return $this->view;
36
    }
37
38 1
    public function getViewContext(): ?ViewContextInterface
39
    {
40 1
        return $this->viewContext;
41
    }
42
}
43