Completed
Push — v4.0 ( 488a49...f4158b )
by
unknown
01:49
created

Template::withContext()   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
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