Passed
Push — master ( 43a084...7e18cf )
by Jon
01:56
created

Table::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php namespace FlatPlan\Components;
2
3
class Table extends AbstractComponent {
4
5
    protected $data;
6
7
    protected $roles = ['htmltable'];
8
9
    /**
10
     * @param string $role
11
     * @return void
12
     */
13
    public function __construct($role, $data)
14
    {
15
        $this->setRole($role);
16
        $this->setData($data);
17
    }
18
19
    public function setData($data)
20
    {
21
        $this->data = $data;
22
    }
23
24
    public function getData()
25
    {
26
        return $this->data;
27
    }
28
29
    public function getComponent()
30
    {
31
        $component = new \stdClass();
32
        $component->role      = $this->getRole();
33
        $component->data      = $this->getData();
34
        $component->layout    = $this->layout;
35
        $component->style     = $this->style;
36
        $component->textStyle = $this->textStyle;
37
        if (!is_null($this->behaviour)) {
38
            $component->behaviour = $this->getBehaviour();
39
        }
40
        return $component;
41
    }
42
}
43