@@ -121,7 +121,6 @@ discard block |
||
| 121 | 121 | /** |
| 122 | 122 | * Setter for interval. |
| 123 | 123 | * |
| 124 | - * @param int $minutes |
|
| 125 | 124 | * |
| 126 | 125 | * @return $this |
| 127 | 126 | */ |
@@ -280,8 +279,8 @@ discard block |
||
| 280 | 279 | * Helper method for Arr::set |
| 281 | 280 | * |
| 282 | 281 | * @param array &$array |
| 283 | - * @param mixed $key |
|
| 284 | - * @param mixed $value |
|
| 282 | + * @param string $key |
|
| 283 | + * @param integer $value |
|
| 285 | 284 | * |
| 286 | 285 | * @return mixed |
| 287 | 286 | */ |
@@ -294,7 +293,7 @@ discard block |
||
| 294 | 293 | * Helper method for Arr::get |
| 295 | 294 | * |
| 296 | 295 | * @param array &$array |
| 297 | - * @param mixed $key |
|
| 296 | + * @param string $key |
|
| 298 | 297 | * @param mixed $default |
| 299 | 298 | * |
| 300 | 299 | * @return mixed |
@@ -304,6 +303,9 @@ discard block |
||
| 304 | 303 | return Arr::get($array, $key, $default); |
| 305 | 304 | } |
| 306 | 305 | |
| 306 | + /** |
|
| 307 | + * @param string $array1 |
|
| 308 | + */ |
|
| 307 | 309 | private function array_substitute(&$array1, $array2) |
| 308 | 310 | { |
| 309 | 311 | foreach ($array1 as $key => $value) { |
@@ -17,10 +17,10 @@ |
||
| 17 | 17 | protected function initTimetable($starting, $days) |
| 18 | 18 | { |
| 19 | 19 | $this->timetable |
| 20 | - ->format('date.service.time') |
|
| 21 | - ->from($starting) |
|
| 22 | - ->future($days) |
|
| 23 | - ->init(); |
|
| 20 | + ->format('date.service.time') |
|
| 21 | + ->from($starting) |
|
| 22 | + ->future($days) |
|
| 23 | + ->init(); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | /** |
| 20 | 20 | * Get or set preference value. |
| 21 | 21 | * |
| 22 | - * @param mixed $key |
|
| 22 | + * @param string $key |
|
| 23 | 23 | * @param mixed $value |
| 24 | 24 | * @param string $type |
| 25 | 25 | * |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | { |
| 31 | 31 | if (isset($value)) { |
| 32 | 32 | $this->preferences()->updateOrCreate(['key' => $key], ['value' => $this->cast($value, $type), |
| 33 | - 'type' => $type, ]); |
|
| 33 | + 'type' => $type, ]); |
|
| 34 | 34 | |
| 35 | 35 | Cache::put("{$this->slug}.'/'.{$key}", $value, 60); |
| 36 | 36 | return $value; |
@@ -105,9 +105,9 @@ |
||
| 105 | 105 | if(!is_numeric($statement['capacity'])) |
| 106 | 106 | { |
| 107 | 107 | $vacancyValues['humanresource_id'] = $business->humanresources() |
| 108 | - ->where('slug', $statement['capacity']) |
|
| 109 | - ->first() |
|
| 110 | - ->id; |
|
| 108 | + ->where('slug', $statement['capacity']) |
|
| 109 | + ->first() |
|
| 110 | + ->id; |
|
| 111 | 111 | } |
| 112 | 112 | else |
| 113 | 113 | { |
@@ -124,6 +124,9 @@ discard block |
||
| 124 | 124 | return $vacancy !== null; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | + /** |
|
| 128 | + * @param string $key |
|
| 129 | + */ |
|
| 127 | 130 | protected function arrayGroupBy($key, $array) |
| 128 | 131 | { |
| 129 | 132 | $grouped = []; |
@@ -156,7 +159,6 @@ discard block |
||
| 156 | 159 | /** |
| 157 | 160 | * [generateAvailability description]. |
| 158 | 161 | * |
| 159 | - * @param Illuminate\Database\Eloquent\Collection $vacancies |
|
| 160 | 162 | * @param string $startDate |
| 161 | 163 | * @param int $futureDays |
| 162 | 164 | * |
@@ -66,16 +66,16 @@ |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $fromTime = $this->wrappedObject |
| 69 | - ->vacancy |
|
| 70 | - ->start_at |
|
| 71 | - ->timezone($this->timezone) |
|
| 72 | - ->format($timeFormat); |
|
| 69 | + ->vacancy |
|
| 70 | + ->start_at |
|
| 71 | + ->timezone($this->timezone) |
|
| 72 | + ->format($timeFormat); |
|
| 73 | 73 | |
| 74 | 74 | $toTime = $this->wrappedObject |
| 75 | - ->vacancy |
|
| 76 | - ->finish_at |
|
| 77 | - ->timezone($this->timezone) |
|
| 78 | - ->format($timeFormat); |
|
| 75 | + ->vacancy |
|
| 76 | + ->finish_at |
|
| 77 | + ->timezone($this->timezone) |
|
| 78 | + ->format($timeFormat); |
|
| 79 | 79 | |
| 80 | 80 | return ['from' => $fromTime, 'to' => $toTime]; |
| 81 | 81 | } |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | public function hasRoomBetween(Carbon $startAt, Carbon $finishAt) |
| 267 | 267 | { |
| 268 | 268 | return $this->capacity > $this->business |
| 269 | - ->bookings() |
|
| 270 | - ->active() |
|
| 271 | - ->affectingInterval($startAt, $finishAt) |
|
| 272 | - ->affectingHumanresource($this->humanresource_id) |
|
| 273 | - ->count() && |
|
| 269 | + ->bookings() |
|
| 270 | + ->active() |
|
| 271 | + ->affectingInterval($startAt, $finishAt) |
|
| 272 | + ->affectingHumanresource($this->humanresource_id) |
|
| 273 | + ->count() && |
|
| 274 | 274 | ($this->start_at <= $startAt && $this->finish_at >= $finishAt); |
| 275 | 275 | } |
| 276 | 276 | |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | $count = $this->business |
| 289 | - ->bookings() |
|
| 290 | - ->active() |
|
| 291 | - ->affectingHumanresource($this->humanresource_id) |
|
| 292 | - ->affectingInterval($startAt, $finishAt) |
|
| 293 | - ->count(); |
|
| 289 | + ->bookings() |
|
| 290 | + ->active() |
|
| 291 | + ->affectingHumanresource($this->humanresource_id) |
|
| 292 | + ->affectingInterval($startAt, $finishAt) |
|
| 293 | + ->count(); |
|
| 294 | 294 | |
| 295 | 295 | return $this->capacity - intval($count); |
| 296 | 296 | } |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | $comments = $request['comments']; |
| 73 | 73 | |
| 74 | 74 | $vacancies = $this->calendar() |
| 75 | - ->forService($service->id) |
|
| 76 | - ->withDuration($service->duration) |
|
| 77 | - ->forDate($request['date']) |
|
| 78 | - ->atTime($request['time'], $request['timezone']) |
|
| 79 | - ->find(); |
|
| 75 | + ->forService($service->id) |
|
| 76 | + ->withDuration($service->duration) |
|
| 77 | + ->forDate($request['date']) |
|
| 78 | + ->atTime($request['time'], $request['timezone']) |
|
| 79 | + ->find(); |
|
| 80 | 80 | |
| 81 | 81 | if ($vacancies->count() == 0) { |
| 82 | 82 | // TODO: Log failure feedback message / raise exception |
@@ -160,10 +160,10 @@ discard block |
||
| 160 | 160 | $fromDate = Carbon::parse($fromDate)->timezone($this->business->timezone); |
| 161 | 161 | |
| 162 | 162 | $count = $this->business |
| 163 | - ->vacancies() |
|
| 164 | - ->future($fromDate) |
|
| 165 | - ->until($fromDate->addDays($days)) |
|
| 166 | - ->count(); |
|
| 163 | + ->vacancies() |
|
| 164 | + ->future($fromDate) |
|
| 165 | + ->until($fromDate->addDays($days)) |
|
| 166 | + ->count(); |
|
| 167 | 167 | |
| 168 | 168 | return $count > 0; |
| 169 | 169 | } |
@@ -19,11 +19,11 @@ |
||
| 19 | 19 | protected function initTimetable($starting, $days) |
| 20 | 20 | { |
| 21 | 21 | $this->timetable |
| 22 | - ->interval($this->interval) |
|
| 23 | - ->format('date.service.time') |
|
| 24 | - ->from($starting) |
|
| 25 | - ->future($days) |
|
| 26 | - ->init(); |
|
| 22 | + ->interval($this->interval) |
|
| 23 | + ->format('date.service.time') |
|
| 24 | + ->from($starting) |
|
| 25 | + ->future($days) |
|
| 26 | + ->init(); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |