Completed
Push — 186-data ( 572d68...d14d7f )
by
unknown
10:34
created

ResolveNameArgs   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 7
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A withPath() 0 3 1
A withContext() 0 3 1
A resolvePath() 0 3 3
A fromTemplate() 0 3 1
1
<?php
2
3
namespace League\Plates\Extension\Path;
4
5
class ResolveNameArgs
6
{
7
    public $path;
8
    public $context;
9
    private $resolve_path;
10
11
    public function __construct($path, array $context, callable $resolve_path) {
12
        $this->path = $path;
13
        $this->context = $context;
14
        $this->resolve_path = $resolve_path;
15
    }
16
17
    public function withPath($path) {
18
        return new self($path, $this->context, $this->resolve_path);
19
    }
20
21
    public function withContext(array $context) {
22
        return new self($this->path, $context, $this->resolve_path);
23
    }
24
25
    public function resolvePath($path = null, array $context = []) {
26
        return new self($path ?: $this->path, $context ?: $this->context, $this->resolve_path);
27
    }
28
29
    public static function fromTemplate(Template $template, callable $resolve_path) {
30
        return new self($template->name, $template->context, $resolve_path);
31
    }
32
}
33