@@ -15,7 +15,7 @@ |
||
| 15 | 15 | if ($this->duration !== null) { |
| 16 | 16 | $toDatetime = $fromDatetime->addMinutes($this->duration); |
| 17 | 17 | |
| 18 | - $results = $results->reject(function ($vacancy) use ($fromDatetime, $toDatetime) { |
|
| 18 | + $results = $results->reject(function($vacancy) use ($fromDatetime, $toDatetime) { |
|
| 19 | 19 | return !$vacancy->hasRoomBetween($fromDatetime, $toDatetime); |
| 20 | 20 | }); |
| 21 | 21 | } |
@@ -97,6 +97,9 @@ |
||
| 97 | 97 | return $vacancy !== null; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | + /** |
|
| 101 | + * @param string $key |
|
| 102 | + */ |
|
| 100 | 103 | protected function arrayGroupBy($key, $array) |
| 101 | 104 | { |
| 102 | 105 | $grouped = []; |
@@ -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 | { |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | ]; |
| 103 | 103 | |
| 104 | 104 | // If capacity is a slug, grab the humanresource |
| 105 | - if(!is_numeric($statement['capacity'])) |
|
| 105 | + if (!is_numeric($statement['capacity'])) |
|
| 106 | 106 | { |
| 107 | 107 | $vacancyValues['humanresource_id'] = $business->humanresources() |
| 108 | 108 | ->where('slug', $statement['capacity']) |
@@ -108,8 +108,7 @@ |
||
| 108 | 108 | ->where('slug', $statement['capacity']) |
| 109 | 109 | ->first() |
| 110 | 110 | ->id; |
| 111 | - } |
|
| 112 | - else |
|
| 111 | + } else |
|
| 113 | 112 | { |
| 114 | 113 | $vacancyValues['capacity'] = intval($statement['capacity']); |
| 115 | 114 | } |
@@ -54,16 +54,16 @@ |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $fromTime = $this->wrappedObject |
| 57 | - ->vacancy |
|
| 58 | - ->start_at |
|
| 59 | - ->timezone($this->wrappedObject->business->timezone) |
|
| 60 | - ->format($timeFormat); |
|
| 57 | + ->vacancy |
|
| 58 | + ->start_at |
|
| 59 | + ->timezone($this->wrappedObject->business->timezone) |
|
| 60 | + ->format($timeFormat); |
|
| 61 | 61 | |
| 62 | 62 | $toTime = $this->wrappedObject |
| 63 | - ->vacancy |
|
| 64 | - ->finish_at |
|
| 65 | - ->timezone($this->wrappedObject->business->timezone) |
|
| 66 | - ->format($timeFormat); |
|
| 63 | + ->vacancy |
|
| 64 | + ->finish_at |
|
| 65 | + ->timezone($this->wrappedObject->business->timezone) |
|
| 66 | + ->format($timeFormat); |
|
| 67 | 67 | |
| 68 | 68 | return ['from' => $fromTime, 'to' => $toTime]; |
| 69 | 69 | } |
@@ -68,8 +68,7 @@ |
||
| 68 | 68 | */ |
| 69 | 69 | public function industryIcon() |
| 70 | 70 | { |
| 71 | - $src = ($this->wrappedObject->pref('cover_photo_url')) ?: |
|
| 72 | - asset('/img/industries/'.$this->wrappedObject->category->slug.'.png'); |
|
| 71 | + $src = ($this->wrappedObject->pref('cover_photo_url')) ?: asset('/img/industries/'.$this->wrappedObject->category->slug.'.png'); |
|
| 73 | 72 | |
| 74 | 73 | return "<img class=\"img-responsive center-block\" src=\"{$src}\"/>"; |
| 75 | 74 | } |
@@ -33,6 +33,9 @@ |
||
| 33 | 33 | $this->addStatement(' '.$startAt.' - '.$finishAt); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | + /** |
|
| 37 | + * @param string $statement |
|
| 38 | + */ |
|
| 36 | 39 | protected function addStatement($statement) |
| 37 | 40 | { |
| 38 | 41 | $this->statement[] = $statement; |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('humanresources', function (Blueprint $table) { |
|
| 15 | + Schema::create('humanresources', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->string('name'); |
| 18 | 18 | $table->string('slug', 50)->index(); |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | public function hasRoomBetween(Carbon $startAt, Carbon $finishAt) |
| 222 | 222 | { |
| 223 | 223 | return $this->capacity > $this->business |
| 224 | - ->bookings() |
|
| 225 | - ->active() |
|
| 226 | - ->affectingInterval($startAt, $finishAt) |
|
| 227 | - ->affectingHumanresource($this->humanresource_id) |
|
| 228 | - ->count() && |
|
| 224 | + ->bookings() |
|
| 225 | + ->active() |
|
| 226 | + ->affectingInterval($startAt, $finishAt) |
|
| 227 | + ->affectingHumanresource($this->humanresource_id) |
|
| 228 | + ->count() && |
|
| 229 | 229 | ($this->start_at <= $startAt && $this->finish_at >= $finishAt); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -241,12 +241,12 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | $count = $this->business |
| 244 | - ->bookings() |
|
| 245 | - ->with('humanresource') |
|
| 246 | - ->active() |
|
| 247 | - ->affectingHumanresource($this->humanresource_id) |
|
| 248 | - ->affectingInterval($startAt, $finishAt) |
|
| 249 | - ->count(); |
|
| 244 | + ->bookings() |
|
| 245 | + ->with('humanresource') |
|
| 246 | + ->active() |
|
| 247 | + ->affectingHumanresource($this->humanresource_id) |
|
| 248 | + ->affectingInterval($startAt, $finishAt) |
|
| 249 | + ->count(); |
|
| 250 | 250 | |
| 251 | 251 | return $this->capacity - intval($count); |
| 252 | 252 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @param int $interval timestamp interval |
| 36 | 36 | * @param DateTime $interval the first date |
| 37 | - * @param DateTime $last_date the last date so we can find the interval of |
|
| 37 | + * @param \DateTime $last_date the last date so we can find the interval of |
|
| 38 | 38 | * the first and the last date |
| 39 | 39 | * |
| 40 | 40 | * @return self object |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param string $format rounding method after we reveal the readable |
| 119 | 119 | * interval. You can use PHP_ROUND_HALF_UP and PHP_ROUND_HALF_DOWN |
| 120 | 120 | * |
| 121 | - * @return well formatted output |
|
| 121 | + * @return string formatted output |
|
| 122 | 122 | */ |
| 123 | 123 | public function format($format = []) |
| 124 | 124 | { |
@@ -160,6 +160,7 @@ discard block |
||
| 160 | 160 | /** |
| 161 | 161 | * @param int $round_method rounding method after we reveal the readable |
| 162 | 162 | * interval. You can use PHP_ROUND_HALF_UP and PHP_ROUND_HALF_DOWN |
| 163 | + * @param integer $result |
|
| 163 | 164 | * |
| 164 | 165 | * @return float current number of the result. if it is using $round_method, |
| 165 | 166 | * it will rounded up or down |
@@ -176,7 +177,7 @@ discard block |
||
| 176 | 177 | } |
| 177 | 178 | |
| 178 | 179 | /** |
| 179 | - * @return well formatted output |
|
| 180 | + * @return string formatted output |
|
| 180 | 181 | */ |
| 181 | 182 | public function __toString() |
| 182 | 183 | { |