Passed
Push — master ( 7af984...1466de )
by Carsten
08:31 queued 11s
created

OpeningTimes   A

Complexity

Total Complexity 21

Size/Duplication

Total Lines 222
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 21
lcom 1
cbo 0
dl 0
loc 222
ccs 42
cts 42
cp 1
rs 10
c 0
b 0
f 0

20 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 4 1
A setDescription() 0 5 1
A getIterator() 0 4 1
A jsonSerialize() 0 4 1
A getDay() 0 4 2
A setDay() 0 5 1
A getMonday() 0 4 1
A setMonday() 0 4 1
A getTuesday() 0 4 1
A setTuesday() 0 4 1
A getWednesday() 0 4 1
A setWednesday() 0 4 1
A getThursday() 0 4 1
A setThursday() 0 4 1
A getFriday() 0 4 1
A setFriday() 0 4 1
A getSaturday() 0 4 1
A setSaturday() 0 4 1
A getSunday() 0 4 1
A setSunday() 0 4 1
1
<?php
2
namespace Germania\OpeningTimes;
3
4
class OpeningTimes implements OpeningTimesInterface
5
{
6
	protected $days = array();
7
8
	public $description = null;
9
10
11 2
	public function getDescription() : ?string
12
	{
13 2
		return $this->description;
14
	}
15
16 2
	public function setDescription( string $text = null) : self
17
	{
18 2
		$this->description = $text;
19 2
		return $this;
20
	}
21
22
23
	/**
24
	 * @inheritDoc
25
	 */
26 2
	public function getIterator()
27
	{
28 2
		return new \ArrayIterator( $this->days, \ArrayIterator::ARRAY_AS_PROPS );
29
	}
30
31
32
	/**
33
	 * @inheritDoc
34
	 */
35 2
	public function jsonSerialize()
36
	{
37 2
		return $this->days;
38
	}
39
40
41
	/**
42
	 * @param  string $day   Day name, e.g. "monday", "tuesday"
43
	 * @return string|null   Opening times as text
44
	 */
45 30
	public function getDay( string $day ) : ?string
46
	{
47 30
		return ($this->days[ $day ] ?? null) ?: null;	
48
	}
49
50
51
	/**
52
	 * @param  string $day   Day name, e.g. "monday", "tuesday"
53
	 * @param string $times|null  Opening times as text
0 ignored issues
show
Bug introduced by
There is no parameter named $times|null. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
54
	 */
55 32
	public function setDay( string $day, string $times = null ) : self
56
	{
57 32
		$this->days[ $day ] = $times;
58 32
		return $this;	
59
	}
60
61
62
63
64
65
	/**
66
	 * @inheritDoc
67
	 * @return string|null
68
	 */
69 4
	public function getMonday() : ?string
70
	{
71 4
		return $this->getDay("monday");
72
	}
73
74
75
	/**
76
	 * @param string|null $times Opening times as text
77
	 */
78 8
	public function setMonday( string $times = null )
79
	{
80 8
		return $this->setDay("monday", $times);
81
	}
82
83
84
85
86
87
	/**
88
	 * @inheritDoc
89
	 * @return string|null
90
	 */		
91 4
	public function getTuesday() : ?string
92
	{
93 4
		return $this->getDay("tuesday");
94
	}
95
96
97
	/**
98
	 * @param string|null $times Opening times as text
99
	 */
100 4
	public function setTuesday( string $times = null )
101
	{
102 4
		return $this->setDay("tuesday", $times);
103
	}
104
105
106
107
108
109
	/**
110
	 * @inheritDoc
111
	 * @return string|null
112
	 */		
113 4
	public function getWednesday() : ?string
114
	{
115 4
		return $this->getDay("wednesday");
116
	}
117
118
119
	/**
120
	 * @param string|null $times Opening times as text
121
	 */
122 4
	public function setWednesday( string $times = null )
123
	{
124 4
		return $this->setDay("wednesday", $times);
125
	}
126
127
128
129
130
131
	/**
132
	 * @inheritDoc
133
	 * @return string|null
134
	 */		
135 4
	public function getThursday() : ?string
136
	{
137 4
		return $this->getDay("thursday");
138
	}
139
140
141
	/**
142
	 * @param string|null $times Opening times as text
143
	 */
144 4
	public function setThursday( string $times = null )
145
	{
146 4
		return $this->setDay("thursday", $times);
147
	}
148
149
150
151
152
153
154
155
156
	/**
157
	 * @inheritDoc
158
	 * @return string|null
159
	 */		
160 4
	public function getFriday() : ?string
161
	{
162 4
		return $this->getDay("friday");
163
	}
164
165
166
167
	/**
168
	 * @param string|null $times Opening times as text
169
	 */
170 4
	public function setFriday( string $times = null )
171
	{
172 4
		return $this->setDay("friday", $times);
173
	}
174
175
176
177
178
179
180
	/**
181
	 * @inheritDoc
182
	 * @return string|null
183
	 */		
184 4
	public function getSaturday() : ?string
185
	{
186 4
		return $this->getDay("saturday");
187
	}
188
189
190
191
192
	/**
193
	 * @param string|null $times Opening times as text
194
	 */
195 4
	public function setSaturday( string $times = null )
196
	{
197 4
		return $this->setDay("saturday", $times);
198
	}
199
200
201
202
203
	/**
204
	 * @inheritDoc
205
	 * @return string|null
206
	 */		
207 4
	public function getSunday() : ?string
208
	{
209 4
		return $this->getDay("sunday");
210
	}
211
212
213
214
215
216
	/**
217
	 * @param string|null $times Opening times as text
218
	 */
219 4
	public function setSunday( string $times = null )
220
	{
221 4
		return $this->setDay("sunday", $times);
222
	}
223
224
225
}