Completed
Push — v4.0-dev ( 6660e2...b14a8f )
by
unknown
11s
created

ResolveNameArgs   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 81.82%

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 9
cts 11
cp 0.8182
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 140
    public function __construct($name, array $context, callable $resolve_name) {
12 140
        $this->name = $name;
13 140
        $this->context = $context;
14 140
        $this->resolve_name = $resolve_name;
15 140
    }
16
17 24
    public function withName($name) {
18 24
        return new self($name, $this->context, $this->resolve_name);
19
    }
20
21 8
    public function withContext(array $context) {
22 8
        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