ResolvePathArgs::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 0
loc 5
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace League\Plates\Extension\Path;
4
5
use League\Plates\Template;
6
7
class ResolvePathArgs
8
{
9
    public $path;
10
    public $context;
11
    public $template;
12
13 76
    public function __construct($path, array $context, Template $template) {
14 76
        $this->path = $path;
15 76
        $this->context = $context;
16 76
        $this->template = $template;
17 76
    }
18
19 52
    public function withPath($path) {
20 52
        return new self($path, $this->context, $this->template);
21
    }
22
23
    public function withContext(array $context) {
24
        return new self($this->path, $context, $this->template);
25
    }
26
27 24
    public static function fromTemplate(Template $template) {
28 24
        return new self($template->name, [], clone $template);
29
    }
30
}
31