Completed
Push — v4.0 ( 3a8f05...488a49 )
by
unknown
03:09
created

Template   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A getName() 0 3 1
A getData() 0 3 1
A getContext() 0 3 1
A getContent() 0 3 1
A withName() 0 3 1
A withData() 0 3 1
A withContext() 0 3 1
A withContent() 0 3 1
1
<?php
2
3
namespace League\Plates;
4
5
/** Template value object */
6
class Template
7
{
8
    private $name;
9
    private $data;
10
    private $context;
11
    private $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 getName() {
26
        return $this->name;
27
    }
28
29
    public function getData() {
30
        return $this->data;
31
    }
32
33
    public function getContext() {
34
        return $this->context;
35
    }
36
37
    public function getContent() {
38
        return $this->content;
39
    }
40
41
    public function withName($name) {
42
        return new self($name, $this->data, $this->context, $this->content);
43
    }
44
45
    public function withData(array $data) {
46
        return new self($this->name, $data, $this->context, $this->content);
47
    }
48
49
    public function withContext(array $context) {
50
        return new self($this->name, $this->data, $context, $this->content);
51
    }
52
53
    public function withContent(Content $content) {
54
        return new self($this->name, $this->data, $this->context, $content);
55
    }
56
}
57