| Conditions | 1 |
| Paths | 1 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 4 | public function getOpeningHoursAttribute() |
|
| 18 | { |
||
| 19 | 4 | $hours = $this->dayOpenTimeRanges |
|
|
|
|||
| 20 | ->groupBy('day')->map(function($day) { |
||
| 21 | 2 | return $day->map(function (DayOpenTimeRange $range) { |
|
| 22 | 2 | return $range->start.'-'.$range->end; |
|
| 23 | 2 | }); |
|
| 24 | 4 | }); |
|
| 25 | |||
| 26 | 4 | return OpeningHours::create($hours->toArray()); |
|
| 27 | } |
||
| 28 | |||
| 52 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: