Completed
Push — master ( c99aca...a1fe04 )
by Carsten
05:24
created

Website::setController()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
namespace Germania\Websites;
3
4
class Website extends WebsiteAbstract implements WebsiteInterface
5
{
6
7
8
    /**
9
     * Sets the page ID.
10
     *
11
     * @param mixed $id the id
12
     *
13
     * @return self
14
     */
15 1
    public function setId($id)
16
    {
17 1
        $this->id = $id;
18
19 1
        return $this;
20
    }
21
22
23
    /**
24
     * Sets the page title.
25
     *
26
     * @param mixed $title the title
27
     *
28
     * @return self
29
     */
30 1
    public function setTitle($title)
31
    {
32 1
        $this->title = $title;
33
34 1
        return $this;
35
    }
36
37
38
    /**
39
     * Sets the page route.
40
     *
41
     * @param mixed $route the route
42
     *
43
     * @return self
44
     */
45 1
    public function setRoute($route)
46
    {
47 1
        $this->route = $route;
48
49 1
        return $this;
50
    }
51
52
53
    /**
54
     * Sets the page route name.
55
     *
56
     * @param mixed $route_name the route name
57
     *
58
     * @return self
59
     */
60 1
    public function setRouteName($route_name)
61
    {
62 1
        $this->route_name = $route_name;
63
64 1
        return $this;
65
    }
66
67
68
    /**
69
     * Sets the content file for this page.
70
     *
71
     * @param mixed $content_file the php include
72
     *
73
     * @return self
74
     */
75 1
    public function setContentFile($content_file)
76
    {
77 1
        $this->content_file = $content_file;
78
79 1
        return $this;
80
    }
81
82
83
    /**
84
     * Sets the Controller class for this page.
85
     *
86
     * @param mixed $controller the php class
87
     *
88
     * @return self
89
     */
90 1
    public function setController($controller)
91
    {
92 1
        $this->controller = $controller;
93
94 1
        return $this;
95
    }
96
97
98
    /**
99
     * Sets the page template file.
100
     *
101
     * @param mixed $template the template
102
     *
103
     * @return self
104
     */
105 1
    public function setTemplate($template)
106
    {
107 1
        $this->template = $template;
108
109 1
        return $this;
110
    }
111
112
113
    /**
114
     * Sets the DOM ID for this page.
115
     *
116
     * @param mixed $dom_id the dom id
117
     *
118
     * @return self
119
     */
120 1
    public function setDomId($dom_id)
121
    {
122 1
        $this->dom_id = $dom_id;
123
124 1
        return $this;
125
    }
126
127
128
129
    /**
130
     * Sets custom Stylesheets
131
     *
132
     * @param array $css
133
     *
134
     * @return self
135
     */
136 1
    public function setStylesheets( $css )
137
    {
138 1
        $this->stylesheets = $css;
139
140 1
        return $this;
141
    }
142
143
144
    /**
145
     * Sets custom Javascripts
146
     *
147
     * @param array $js
148
     *
149
     * @return self
150
     */
151 1
    public function setJavascripts( $js )
152
    {
153 1
        $this->javascripts = $js;
154
155 1
        return $this;
156
    }
157
158
159
160
161
    /**
162
     * Checks if the page is marked 'active'.
163
     *
164
     * If no parameter is set, the current active state will be returned.
165
     *
166
     * @param mixed $is_active 'active' flag. Defaults to null.
167
     *
168
     * @return self|bool The page instance or active state (TRUE id greater than 0, else FALSE)
169
     */
170 3
    public function isActive($is_active = null)
171
    {
172 3
        if (is_null($is_active)) {
173 3
            return $this->is_active > 0;
174
        }
175 3
        $this->is_active = $is_active;
176 3
        return $this;
177
    }
178
}
179