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

CollectionContent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __toString() 0 5 1
A appendParts() 0 3 1
1
<?php
2
3
namespace League\Plates\Content;
4
5
use League\Plates\Content;
6
7
class CollectionContent implements Content
8
{
9
    private $parts;
10
11
    public function __construct(array $parts) {
12
        $this->parts = $parts;
13
    }
14
15
    public function __toString() {
16
        return array_reduce($this->parts, function($acc, $part) {
17
            return $acc . $part;
18
        }, '');
19
    }
20
21
    public function appendParts(array $parts) {
22
        return new self(array_merge($this->parts, $parts));
23
    }
24
}
25