Completed
Push — master ( db89a0...661260 )
by
unknown
02:00
created

Builder::setOption()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 8
loc 8
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
Namespace EnergieProduction\Chart;
4
5
use Closure;
6
use Exception;
7
use EnergieProduction\Chart\Exceptions\CallbackNotValidException;
8
9
Class Builder {
10
11
	protected $class;
12
13
	public function __construct($class)
14
	{
15
		$this->class = $class;
16
	}
17
18
	public function make($callback)
19
	{
20
		$this->callFunc($callback, $this->class);
21
22
		return $this->class->render();
23
	}
24
25
	protected function callFunc($callback, $option)
26
	{
27
		if (! $callback instanceof Closure)
28
		{
29
			throw new CallbackNotValidException();
30
		}
31
32
		return call_user_func($callback, $option);
33
	}
34
}
35