GermaniaKG /
OpeningTimes
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | namespace Germania\OpeningTimes; |
||
| 3 | |||
| 4 | class OpeningTimes implements OpeningTimesInterface |
||
| 5 | { |
||
| 6 | protected $days = array(); |
||
| 7 | |||
| 8 | |||
| 9 | /** |
||
| 10 | * Stores text hint regarding opening times |
||
| 11 | * @var string|null |
||
| 12 | */ |
||
| 13 | public $description = null; |
||
| 14 | |||
| 15 | |||
| 16 | /** |
||
| 17 | * @inheritDoc |
||
| 18 | */ |
||
| 19 | 2 | public function getDescription() : ?string |
|
| 20 | { |
||
| 21 | 2 | return $this->description; |
|
| 22 | } |
||
| 23 | |||
| 24 | |||
| 25 | /** |
||
| 26 | * @inheritDoc |
||
| 27 | */ |
||
| 28 | 2 | public function setDescription( string $text = null) : self |
|
| 29 | { |
||
| 30 | 2 | $this->description = $text; |
|
| 31 | 2 | return $this; |
|
| 32 | } |
||
| 33 | |||
| 34 | |||
| 35 | /** |
||
| 36 | * @inheritDoc |
||
| 37 | */ |
||
| 38 | 2 | public function getIterator() |
|
| 39 | { |
||
| 40 | 2 | return new \ArrayIterator( $this->days, \ArrayIterator::ARRAY_AS_PROPS ); |
|
| 41 | } |
||
| 42 | |||
| 43 | |||
| 44 | /** |
||
| 45 | * @inheritDoc |
||
| 46 | */ |
||
| 47 | 2 | public function jsonSerialize() |
|
| 48 | { |
||
| 49 | 2 | return $this->days; |
|
| 50 | } |
||
| 51 | |||
| 52 | |||
| 53 | /** |
||
| 54 | * @param string $day Day name, e.g. "monday", "tuesday" |
||
| 55 | * @return string|null Opening times as text |
||
| 56 | */ |
||
| 57 | 30 | public function getDay( string $day ) : ?string |
|
| 58 | { |
||
| 59 | 30 | return ($this->days[ $day ] ?? null) ?: null; |
|
| 60 | } |
||
| 61 | |||
| 62 | |||
| 63 | /** |
||
| 64 | * @param string $day Day name, e.g. "monday", "tuesday" |
||
| 65 | * @param string $times|null Opening times as text |
||
|
0 ignored issues
–
show
|
|||
| 66 | */ |
||
| 67 | 32 | public function setDay( string $day, string $times = null ) : self |
|
| 68 | { |
||
| 69 | 32 | $this->days[ $day ] = $times; |
|
| 70 | 32 | return $this; |
|
| 71 | } |
||
| 72 | |||
| 73 | |||
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | /** |
||
| 78 | * @inheritDoc |
||
| 79 | * @return string|null |
||
| 80 | */ |
||
| 81 | 4 | public function getMonday() : ?string |
|
| 82 | { |
||
| 83 | 4 | return $this->getDay("monday"); |
|
| 84 | } |
||
| 85 | |||
| 86 | |||
| 87 | /** |
||
| 88 | * @param string|null $times Opening times as text |
||
| 89 | */ |
||
| 90 | 8 | public function setMonday( string $times = null ) |
|
| 91 | { |
||
| 92 | 8 | return $this->setDay("monday", $times); |
|
| 93 | } |
||
| 94 | |||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | /** |
||
| 100 | * @inheritDoc |
||
| 101 | * @return string|null |
||
| 102 | */ |
||
| 103 | 4 | public function getTuesday() : ?string |
|
| 104 | { |
||
| 105 | 4 | return $this->getDay("tuesday"); |
|
| 106 | } |
||
| 107 | |||
| 108 | |||
| 109 | /** |
||
| 110 | * @param string|null $times Opening times as text |
||
| 111 | */ |
||
| 112 | 4 | public function setTuesday( string $times = null ) |
|
| 113 | { |
||
| 114 | 4 | return $this->setDay("tuesday", $times); |
|
| 115 | } |
||
| 116 | |||
| 117 | |||
| 118 | |||
| 119 | |||
| 120 | |||
| 121 | /** |
||
| 122 | * @inheritDoc |
||
| 123 | * @return string|null |
||
| 124 | */ |
||
| 125 | 4 | public function getWednesday() : ?string |
|
| 126 | { |
||
| 127 | 4 | return $this->getDay("wednesday"); |
|
| 128 | } |
||
| 129 | |||
| 130 | |||
| 131 | /** |
||
| 132 | * @param string|null $times Opening times as text |
||
| 133 | */ |
||
| 134 | 4 | public function setWednesday( string $times = null ) |
|
| 135 | { |
||
| 136 | 4 | return $this->setDay("wednesday", $times); |
|
| 137 | } |
||
| 138 | |||
| 139 | |||
| 140 | |||
| 141 | |||
| 142 | |||
| 143 | /** |
||
| 144 | * @inheritDoc |
||
| 145 | * @return string|null |
||
| 146 | */ |
||
| 147 | 4 | public function getThursday() : ?string |
|
| 148 | { |
||
| 149 | 4 | return $this->getDay("thursday"); |
|
| 150 | } |
||
| 151 | |||
| 152 | |||
| 153 | /** |
||
| 154 | * @param string|null $times Opening times as text |
||
| 155 | */ |
||
| 156 | 4 | public function setThursday( string $times = null ) |
|
| 157 | { |
||
| 158 | 4 | return $this->setDay("thursday", $times); |
|
| 159 | } |
||
| 160 | |||
| 161 | |||
| 162 | |||
| 163 | |||
| 164 | |||
| 165 | |||
| 166 | |||
| 167 | |||
| 168 | /** |
||
| 169 | * @inheritDoc |
||
| 170 | * @return string|null |
||
| 171 | */ |
||
| 172 | 4 | public function getFriday() : ?string |
|
| 173 | { |
||
| 174 | 4 | return $this->getDay("friday"); |
|
| 175 | } |
||
| 176 | |||
| 177 | |||
| 178 | |||
| 179 | /** |
||
| 180 | * @param string|null $times Opening times as text |
||
| 181 | */ |
||
| 182 | 4 | public function setFriday( string $times = null ) |
|
| 183 | { |
||
| 184 | 4 | return $this->setDay("friday", $times); |
|
| 185 | } |
||
| 186 | |||
| 187 | |||
| 188 | |||
| 189 | |||
| 190 | |||
| 191 | |||
| 192 | /** |
||
| 193 | * @inheritDoc |
||
| 194 | * @return string|null |
||
| 195 | */ |
||
| 196 | 4 | public function getSaturday() : ?string |
|
| 197 | { |
||
| 198 | 4 | return $this->getDay("saturday"); |
|
| 199 | } |
||
| 200 | |||
| 201 | |||
| 202 | |||
| 203 | |||
| 204 | /** |
||
| 205 | * @param string|null $times Opening times as text |
||
| 206 | */ |
||
| 207 | 4 | public function setSaturday( string $times = null ) |
|
| 208 | { |
||
| 209 | 4 | return $this->setDay("saturday", $times); |
|
| 210 | } |
||
| 211 | |||
| 212 | |||
| 213 | |||
| 214 | |||
| 215 | /** |
||
| 216 | * @inheritDoc |
||
| 217 | * @return string|null |
||
| 218 | */ |
||
| 219 | 4 | public function getSunday() : ?string |
|
| 220 | { |
||
| 221 | 4 | return $this->getDay("sunday"); |
|
| 222 | } |
||
| 223 | |||
| 224 | |||
| 225 | |||
| 226 | |||
| 227 | |||
| 228 | /** |
||
| 229 | * @param string|null $times Opening times as text |
||
| 230 | */ |
||
| 231 | 4 | public function setSunday( string $times = null ) |
|
| 232 | { |
||
| 233 | 4 | return $this->setDay("sunday", $times); |
|
| 234 | } |
||
| 235 | |||
| 236 | |||
| 237 | } |
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
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.