Website   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 204
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 85.37%

Importance

Changes 0
Metric Value
wmc 14
lcom 1
cbo 1
dl 0
loc 204
ccs 35
cts 41
cp 0.8537
rs 10
c 0
b 0
f 0

13 Methods

Rating   Name   Duplication   Size   Complexity  
A setId() 0 6 1
A setTitle() 0 6 1
A setRoute() 0 6 1
A setRouteName() 0 6 1
A setContentFile() 0 6 1
A setController() 0 6 1
A setVia() 0 6 1
A setMiddleware() 0 6 1
A setTemplate() 0 6 1
A setDomId() 0 6 1
A setStylesheets() 0 6 1
A setJavascripts() 0 6 1
A isActive() 0 8 2
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 5
    public function setId($id)
16
    {
17 5
        $this->id = $id;
18
19 5
        return $this;
20
    }
21
22
23
    /**
24
     * Sets the page title.
25
     *
26
     * @param mixed $title the title
27
     *
28
     * @return self
29
     */
30 5
    public function setTitle($title)
31
    {
32 5
        $this->title = $title;
33
34 5
        return $this;
35
    }
36
37
38
    /**
39
     * Sets the page route.
40
     *
41
     * @param mixed $route the route
42
     *
43
     * @return self
44
     */
45 5
    public function setRoute($route)
46
    {
47 5
        $this->route = $route;
48
49 5
        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 5
    public function setRouteName($route_name)
61
    {
62 5
        $this->route_name = $route_name;
63
64 5
        return $this;
65
    }
66
67
68
    /**
69
     * Sets the allowed HTTP methods to "call" this website with.
70
     *
71
     * @param array $via The HTTP verbs
72
     *
73
     * @return self
74
     */
75
    public function setVia( array $via )
76
    {
77
        $this->via = $via;
78
79
        return $this;
80
    }
81
82
83
    /**
84
     * Sets the content file for this page.
85
     *
86
     * @param mixed $content_file the php include
87
     *
88
     * @return self
89
     */
90 5
    public function setContentFile($content_file)
91
    {
92 5
        $this->content_file = $content_file;
93
94 5
        return $this;
95
    }
96
97
98
    /**
99
     * Sets the Middleware service name for this page.
100
     *
101
     * @param mixed $middleware Service name
102
     *
103
     * @return self
104
     */
105
    public function setMiddleware($middleware)
106
    {
107
        $this->middleware = $middleware;
108
109
        return $this;
110
    }
111
112
    /**
113
     * Sets the Controller class for this page.
114
     *
115
     * @param mixed $controller the php class
116
     *
117
     * @return self
118
     */
119 5
    public function setController($controller)
120
    {
121 5
        $this->controller = $controller;
122
123 5
        return $this;
124
    }
125
126
127
    /**
128
     * Sets the page template file.
129
     *
130
     * @param mixed $template the template
131
     *
132
     * @return self
133
     */
134 5
    public function setTemplate($template)
135
    {
136 5
        $this->template = $template;
137
138 5
        return $this;
139
    }
140
141
142
    /**
143
     * Sets the DOM ID for this page.
144
     *
145
     * @param mixed $dom_id the dom id
146
     *
147
     * @return self
148
     */
149 5
    public function setDomId($dom_id)
150
    {
151 5
        $this->dom_id = $dom_id;
152
153 5
        return $this;
154
    }
155
156
157
158
    /**
159
     * Sets custom Stylesheets
160
     *
161
     * @param array $css
162
     *
163
     * @return self
164
     */
165 5
    public function setStylesheets( $css )
166
    {
167 5
        $this->stylesheets = $css;
168
169 5
        return $this;
170
    }
171
172
173
    /**
174
     * Sets custom Javascripts
175
     *
176
     * @param array $js
177
     *
178
     * @return self
179
     */
180 5
    public function setJavascripts( $js )
181
    {
182 5
        $this->javascripts = $js;
183
184 5
        return $this;
185
    }
186
187
188
189
190
    /**
191
     * Checks if the page is marked 'active'.
192
     *
193
     * If no parameter is set, the current active state will be returned.
194
     *
195
     * @param mixed $is_active 'active' flag. Defaults to null.
196
     *
197
     * @return self|bool The page instance or active state (TRUE id greater than 0, else FALSE)
198
     */
199 15
    public function isActive($is_active = null)
200
    {
201 15
        if (is_null($is_active)) {
202 15
            return $this->is_active > 0;
203
        }
204 15
        $this->is_active = $is_active;
205 15
        return $this;
206
    }
207
}
208