Completed
Push — master ( adc156...83e564 )
by
unknown
01:30
created

Builder   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 33
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A pushCriteria() 0 4 1
A render() 0 12 2
A setCascade() 0 4 1
1
<?php
2
3
namespace EnergieProduction\Chart\Subsets;
4
5
use EnergieProduction\Chart\Rendered;
6
use EnergieProduction\Chart\Criterias\Criteria;
7
8
abstract class Builder implements Subset {
9
10
	protected $criteriaList;
11
	public $cascade = null;
12
13
	public function __construct()
14
	{
15
		$this->criteriaList = collect();
16
	}
17
18
	public function pushCriteria(Criteria $criteria)
19
	{
20
		$this->criteriaList->push($criteria);
21
	}
22
23
	public function render()
24
	{
25
		$formatedSubset = [];
26
27
		foreach ($this->criteriaList as $criteria) {
28
			$formatedSubset = array_merge($formatedSubset, $criteria->render());
29
		}
30
31
		$render = new Rendered\Subset(new Rendered\Render($this));
32
33
		return $render->handle($formatedSubset);
34
	}
35
36
	public function setCascade($cascade)
37
	{
38
		$this->cascade = $cascade;
39
	}
40
}
41
42
43