Completed
Push — master ( 1bff6a...345056 )
by
unknown
01:32
created

Builder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A render() 0 8 2
A getKey() 0 4 1
1
<?php
2
3
namespace EnergieProduction\Chart\Criterias;
4
5
use EnergieProduction\Chart\Expression;
6
7
abstract class Builder implements Criteria {
8
9
	protected $content;
10
11
	public function __construct($content)
12
	{
13
		$this->content = $content;
14
	}
15
16
	public function render()
17
	{
18
	    if ($this->content instanceof Expression) {
19
			return [$this->getKey() => "#!!" . $this->content->render() . "!!#"];
20
	    }
21
22
		return [$this->getKey() => $this->content];
23
	}
24
25
	protected function getKey()
26
	{
27
		return lcfirst(class_basename(get_class($this)));
28
	}
29
}
30