Completed
Push — 170-naming-strategies ( 8ec841 )
by
unknown
14:49
created

ResolveNameArgs::withName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace League\Plates\Template;
4
5
class ResolveNameArgs
6
{
7
    public $name;
8
    public $context;
9
    private $resolve_name;
10
11
    public function __construct($name, array $context, callable $resolve_name) {
12
        $this->name = $name;
13
        $this->context = $context;
14
        $this->resolve_name = $resolve_name;
15
    }
16
17
    public function withName($name) {
18
        return new self($name, $this->context, $this->resolve_name);
19
    }
20
21
    public function withContext(array $context) {
22
        return new self($this->name, $context, $this->resolve_name);
23
    }
24
25
    public function resolveName($name = null, array $context = []) {
26
        return new self($name ?: $this->name, $context ?: $this->context, $this->resolve_name);
27
    }
28
}
29