Completed
Push — master ( a63c8f...c802db )
by
unknown
01:40
created

Subset::handle()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.2
c 0
b 0
f 0
cc 4
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace EnergieProduction\Chart\Rendered;
4
5
class Subset implements Rendered {
6
7
    protected $render;
8
    protected $cascade = null;
9
10
    /**
11
     * [__construct description]
12
     * @param \EnergieProduction\Chart\Rendered\Rendered $render
13
     */
14
    public function __construct(Rendered $render)
15
    {
16
        $this->render = $render;
17
    }
18
19
    /**
20
     * [setCascade description]
21
     * @param string
22
     * @return void
23
     */
24
    public function setCascade($cascade = null)
25
    {
26
        $this->cascade = $cascade;
27
    }
28
29
    public function handle($key, $content)
30
    {
31
        if ($key == 'series' && (! $this->cascade || starts_with($this->cascade, 'series.'))) {
32
            $content = [$content];
33
        }
34
35
        return $this->render->handle($key, $content);
36
    }
37
}