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

Subset   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 33
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setCascade() 0 4 1
A handle() 0 8 4
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
}