Completed
Push — master ( aa3e09...85e896 )
by Mikołaj
04:06
created

Theme::setData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 1
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Rudolf\Modules\Appearance\One\Admin;
4
5
use Rudolf\Component\Forms\Validator;
6
use Rudolf\Component\Hooks;
7
use Rudolf\Component\Html\Text;
8
use Rudolf\Component\Images\Image;
9
10
class Theme
11
{
12
    /**
13
     * @var array Theme data
14
     */
15
    protected $theme;
16
17
    /**
18
     * Constructor.
19
     *
20
     * @param array $theme
21
     */
22
    public function __construct($theme = [])
23
    {
24
        $this->setData($theme);
25
    }
26
27
    /**
28
     * Set theme data.
29
     *
30
     * @param array $theme
31
     */
32
    public function setData($theme)
33
    {
34
        $this->theme = array_merge(
35
            [
36
                'id' => 0,
37
                'path' => '',
38
                'name' => '',
39
                'full-name' => '',
40
                'description' => '',
41
                'author' => '',
42
                'version' => '',
43
                'active' => false,
44
            ],
45
            (array) $theme
46
        );
47
48
        return $this->theme;
49
    }
50
51
    public function id()
52
    {
53
        return (int) $this->theme['id'];
54
    }
55
56
    public function path()
57
    {
58
        return $this->theme['path'];
59
    }
60
61
    public function urlPath()
62
    {
63
        return str_replace(APP_ROOT, '', $this->theme['path']);
64
    }
65
66
    public function fullName()
67
    {
68
        return $this->theme['full-name'];
69
    }
70
71
    public function name()
72
    {
73
        return $this->theme['name'];
74
    }
75
76
    public function description()
77
    {
78
        return $this->theme['description'];
79
    }
80
81
    public function author()
82
    {
83
        return $this->theme['author'];
84
    }
85
86
    public function version()
87
    {
88
        return $this->theme['version'];
89
    }
90
91
    public function isActive()
92
    {
93
        return $this->theme['active'];
94
    }
95
}
96