Completed
Push — master ( bbaaf4...b053e7 )
by Carsten
02:50 queued 11s
created

OpeningTimes::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace Germania\OpeningTimes;
3
4
class OpeningTimes implements OpeningTimesInterface
5
{
6
	protected $days = array();
7
8
9
10
	/**
11
	 * @inheritDoc
12
	 */
13 2
	public function getIterator()
14
	{
15 2
		return new \ArrayIterator( $this->days, \ArrayIterator::ARRAY_AS_PROPS );
16
	}
17
18
19
	/**
20
	 * @inheritDoc
21
	 */
22 2
	public function jsonSerialize()
23
	{
24 2
		return $this->days;
25
	}
26
27
28
	/**
29
	 * @param  string $day   Day name, e.g. "monday", "tuesday"
30
	 * @return string|null   Opening times as text
31
	 */
32 30
	public function getDay( string $day ) : ?string
33
	{
34 30
		return ($this->days[ $day ] ?? null) ?: null;	
35
	}
36
37
38
	/**
39
	 * @param  string $day   Day name, e.g. "monday", "tuesday"
40
	 * @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...
41
	 */
42 32
	public function setDay( string $day, string $times = null ) : self
43
	{
44 32
		$this->days[ $day ] = $times;
45 32
		return $this;	
46
	}
47
48
49
50
51
52
	/**
53
	 * @inheritDoc
54
	 * @return string|null
55
	 */
56 4
	public function getMonday() : ?string
57
	{
58 4
		return $this->getDay("monday");
59
	}
60
61
62
	/**
63
	 * @param string|null $times Opening times as text
64
	 */
65 8
	public function setMonday( string $times = null )
66
	{
67 8
		return $this->setDay("monday", $times);
68
	}
69
70
71
72
73
74
	/**
75
	 * @inheritDoc
76
	 * @return string|null
77
	 */		
78 4
	public function getTuesday() : ?string
79
	{
80 4
		return $this->getDay("tuesday");
81
	}
82
83
84
	/**
85
	 * @param string|null $times Opening times as text
86
	 */
87 4
	public function setTuesday( string $times = null )
88
	{
89 4
		return $this->setDay("tuesday", $times);
90
	}
91
92
93
94
95
96
	/**
97
	 * @inheritDoc
98
	 * @return string|null
99
	 */		
100 4
	public function getWednesday() : ?string
101
	{
102 4
		return $this->getDay("wednesday");
103
	}
104
105
106
	/**
107
	 * @param string|null $times Opening times as text
108
	 */
109 4
	public function setWednesday( string $times = null )
110
	{
111 4
		return $this->setDay("wednesday", $times);
112
	}
113
114
115
116
117
118
	/**
119
	 * @inheritDoc
120
	 * @return string|null
121
	 */		
122 4
	public function getThursday() : ?string
123
	{
124 4
		return $this->getDay("thursday");
125
	}
126
127
128
	/**
129
	 * @param string|null $times Opening times as text
130
	 */
131 4
	public function setThursday( string $times = null )
132
	{
133 4
		return $this->setDay("thursday", $times);
134
	}
135
136
137
138
139
140
141
142
143
	/**
144
	 * @inheritDoc
145
	 * @return string|null
146
	 */		
147 4
	public function getFriday() : ?string
148
	{
149 4
		return $this->getDay("friday");
150
	}
151
152
153
154
	/**
155
	 * @param string|null $times Opening times as text
156
	 */
157 4
	public function setFriday( string $times = null )
158
	{
159 4
		return $this->setDay("friday", $times);
160
	}
161
162
163
164
165
166
167
	/**
168
	 * @inheritDoc
169
	 * @return string|null
170
	 */		
171 4
	public function getSaturday() : ?string
172
	{
173 4
		return $this->getDay("saturday");
174
	}
175
176
177
178
179
	/**
180
	 * @param string|null $times Opening times as text
181
	 */
182 4
	public function setSaturday( string $times = null )
183
	{
184 4
		return $this->setDay("saturday", $times);
185
	}
186
187
188
189
190
	/**
191
	 * @inheritDoc
192
	 * @return string|null
193
	 */		
194 4
	public function getSunday() : ?string
195
	{
196 4
		return $this->getDay("sunday");
197
	}
198
199
200
201
202
203
	/**
204
	 * @param string|null $times Opening times as text
205
	 */
206 4
	public function setSunday( string $times = null )
207
	{
208 4
		return $this->setDay("sunday", $times);
209
	}
210
211
212
}