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

ResolveNameArgs   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A withName() 0 3 1
A withContext() 0 3 1
A resolveName() 0 3 3
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