Completed
Push — v4.0-dev ( b01e70 )
by
unknown
01:53
created

Template::resolveName()   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;
4
5
/** Template value object */
6
final class Template
7
{
8
    public $name;
9
    public $data;
10
    public $context;
11
    // public $content;
12
13
    public function __construct(
14
        $name,
15
        array $data = [],
16
        array $context = [],
17
        Content $content = null
0 ignored issues
show
Unused Code introduced by
The parameter $content is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    ) {
19
        $this->name = $name;
20
        $this->data = $data;
21
        $this->context = $context;
22
        // $this->content = $content ?: Content\StringContent::empty();
23
    }
24
25
    public function addData(array $data) {
26
        $this->data = array_merge($this->data, $data);
27
        return $this;
28
    }
29
    public function addContext(array $context) {
30
        $this->context = array_merge($this->context, $context);
31
        return $this;
32
    }
33
34
    public function resolveName(callable $resolve_name) {
35
        return $resolve_name($this->name, $this->context);
36
    }
37
38
    public function resolveData(callable $resolve_data) {
39
        return $resolve_data($this->data, $this->context);
40
    }
41
}
42