@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | * @param \App\Models\Assessment $assessment |
| 17 | 17 | * @return boolean |
| 18 | 18 | */ |
| 19 | - public function view(User $user, Assessment $assessment): bool |
|
| 19 | + public function view (User $user, Assessment $assessment): bool |
|
| 20 | 20 | { |
| 21 | 21 | // Managers can view assessments tied to Jobs they own. |
| 22 | - return $user->isManager() && |
|
| 22 | + return $user->isManager () && |
|
| 23 | 23 | $assessment->criterion->job_poster->manager->user_id === $user->id; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | * @param \App\Models\User $user |
| 30 | 30 | * @return boolean |
| 31 | 31 | */ |
| 32 | - public function create(User $user): bool |
|
| 32 | + public function create (User $user): bool |
|
| 33 | 33 | { |
| 34 | 34 | //Any manager can create a new Assessment, but only for criteria they own. |
| 35 | - return $user->isManager(); |
|
| 35 | + return $user->isManager (); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | * @param \App\Models\Assessment $assessment |
| 43 | 43 | * @return boolean |
| 44 | 44 | */ |
| 45 | - public function update(User $user, Assessment $assessment): bool |
|
| 45 | + public function update (User $user, Assessment $assessment): bool |
|
| 46 | 46 | { |
| 47 | 47 | // Managers can edit assessments tied to Jobs they own. |
| 48 | - return $user->isManager() && |
|
| 48 | + return $user->isManager () && |
|
| 49 | 49 | $assessment->criterion->job_poster->manager->user_id === $user->id; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return boolean |
| 59 | 59 | */ |
| 60 | - public function delete(User $user, Assessment $assessment) : bool |
|
| 60 | + public function delete (User $user, Assessment $assessment) : bool |
|
| 61 | 61 | { |
| 62 | 62 | // Managers can delete assessments tied to Jobs they own. |
| 63 | - return $user->isManager() && |
|
| 63 | + return $user->isManager () && |
|
| 64 | 64 | $assessment->criterion->job_poster->manager->user_id === $user->id; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | * @param \App\Models\AssessmentPlanNotification $notification |
| 17 | 17 | * @return boolean |
| 18 | 18 | */ |
| 19 | - public function view(User $user, AssessmentPlanNotification $notification): bool |
|
| 19 | + public function view (User $user, AssessmentPlanNotification $notification): bool |
|
| 20 | 20 | { |
| 21 | 21 | // Managers can view notifications tied to Jobs they own. |
| 22 | - return $user->isManager() && |
|
| 22 | + return $user->isManager () && |
|
| 23 | 23 | $notification->job_poster->manager->user_id === $user->id; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | * @param \App\Models\User $user |
| 30 | 30 | * @return boolean |
| 31 | 31 | */ |
| 32 | - public function create(User $user): bool |
|
| 32 | + public function create (User $user): bool |
|
| 33 | 33 | { |
| 34 | 34 | //Any manager can create a new AssessmentPlanNotification, but only for job posters they own. |
| 35 | - return $user->isManager(); |
|
| 35 | + return $user->isManager (); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | * @param \App\Models\AssessmentPlanNotification $notification |
| 43 | 43 | * @return boolean |
| 44 | 44 | */ |
| 45 | - public function update(User $user, AssessmentPlanNotification $notification): bool |
|
| 45 | + public function update (User $user, AssessmentPlanNotification $notification): bool |
|
| 46 | 46 | { |
| 47 | 47 | // Managers can edit notifications tied to Jobs they own. |
| 48 | - return $user->isManager() && |
|
| 48 | + return $user->isManager () && |
|
| 49 | 49 | $notification->job_poster->manager->user_id === $user->id; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return boolean |
| 59 | 59 | */ |
| 60 | - public function delete(User $user, AssessmentPlanNotification $notification) : bool |
|
| 60 | + public function delete (User $user, AssessmentPlanNotification $notification) : bool |
|
| 61 | 61 | { |
| 62 | 62 | // Managers can delete notifications tied to Jobs they own. |
| 63 | - return $user->isManager() && |
|
| 63 | + return $user->isManager () && |
|
| 64 | 64 | $notification->job_poster->manager->user_id === $user->id; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @param \App\Models\Manager $manager |
| 17 | 17 | * @return mixed |
| 18 | 18 | */ |
| 19 | - public function view(User $user, Manager $manager) |
|
| 19 | + public function view (User $user, Manager $manager) |
|
| 20 | 20 | { |
| 21 | 21 | //Manager profiles are viewable by any logged-in user |
| 22 | 22 | return $user != null; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param \App\Models\User $user |
| 29 | 29 | * @return mixed |
| 30 | 30 | */ |
| 31 | - public function create(User $user) |
|
| 31 | + public function create (User $user) |
|
| 32 | 32 | { |
| 33 | 33 | return false; |
| 34 | 34 | } |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | * @param \App\Models\Manager $manager |
| 41 | 41 | * @return mixed |
| 42 | 42 | */ |
| 43 | - public function update(User $user, Manager $manager) |
|
| 43 | + public function update (User $user, Manager $manager) |
|
| 44 | 44 | { |
| 45 | 45 | //Mangers can only update their own profiles |
| 46 | - return $user->isManager() && |
|
| 46 | + return $user->isManager () && |
|
| 47 | 47 | $manager->user_id == $user->id; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param \App\Models\Manager $manager |
| 55 | 55 | * @return mixed |
| 56 | 56 | */ |
| 57 | - public function delete(User $user, Manager $manager) |
|
| 57 | + public function delete (User $user, Manager $manager) |
|
| 58 | 58 | { |
| 59 | 59 | return false; |
| 60 | 60 | } |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | * @param \App\Models\JobPoster $jobPoster |
| 18 | 18 | * @return mixed |
| 19 | 19 | */ |
| 20 | - public function view(?User $user, JobPoster $jobPoster) |
|
| 20 | + public function view (?User $user, JobPoster $jobPoster) |
|
| 21 | 21 | { |
| 22 | 22 | // Anyone can view a published job |
| 23 | 23 | // Only the manager that created it can view an unpublished job |
| 24 | - return $jobPoster->status() == 'published' || $jobPoster->status() == 'closed' || |
|
| 24 | + return $jobPoster->status () == 'published' || $jobPoster->status () == 'closed' || |
|
| 25 | 25 | ( |
| 26 | 26 | $user && |
| 27 | - $user->isManager() && |
|
| 27 | + $user->isManager () && |
|
| 28 | 28 | $jobPoster->manager->user_id == $user->id |
| 29 | 29 | ); |
| 30 | 30 | } |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | * @param \App\Models\User $user User to test against. |
| 36 | 36 | * @return mixed |
| 37 | 37 | */ |
| 38 | - public function create(User $user) |
|
| 38 | + public function create (User $user) |
|
| 39 | 39 | { |
| 40 | 40 | // Any manager can create a new job poster. |
| 41 | - return $user->isManager(); |
|
| 41 | + return $user->isManager (); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | * @param \App\Models\JobPoster $jobPoster |
| 49 | 49 | * @return mixed |
| 50 | 50 | */ |
| 51 | - public function update(User $user, JobPoster $jobPoster) |
|
| 51 | + public function update (User $user, JobPoster $jobPoster) |
|
| 52 | 52 | { |
| 53 | 53 | // Only managers can edit jobs, and only their own, managers can't publish jobs or edit published jobs |
| 54 | - return $user->isManager() && |
|
| 54 | + return $user->isManager () && |
|
| 55 | 55 | $jobPoster->manager->user->id == $user->id && |
| 56 | 56 | !$jobPoster->published; |
| 57 | 57 | } |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return boolean |
| 66 | 66 | */ |
| 67 | - public function delete(User $user, JobPoster $jobPoster) : bool |
|
| 67 | + public function delete (User $user, JobPoster $jobPoster) : bool |
|
| 68 | 68 | { |
| 69 | 69 | // Jobs can only be deleted when they're in the 'draft' |
| 70 | 70 | // state, and only by managers that created them. |
| 71 | - return $user->isManager() && |
|
| 71 | + return $user->isManager () && |
|
| 72 | 72 | $jobPoster->manager->user->id == $user->id && |
| 73 | 73 | !$jobPoster->published; |
| 74 | 74 | } |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | * @param \App\Models\JobPoster $jobPoster |
| 81 | 81 | * @return mixed |
| 82 | 82 | */ |
| 83 | - public function submitForReview(User $user, JobPoster $jobPoster) |
|
| 83 | + public function submitForReview (User $user, JobPoster $jobPoster) |
|
| 84 | 84 | { |
| 85 | 85 | // Only upgradedManagers can submit jobs for review, only their own jobs, and only if they're still drafts. |
| 86 | 86 | // NOTE: this is one of the only permissions to require an upgradedManager, as opposed to a demoManager.var |
| 87 | - return $user->isUpgradedManager() && |
|
| 87 | + return $user->isUpgradedManager () && |
|
| 88 | 88 | $jobPoster->manager->user->id == $user->id && |
| 89 | - $jobPoster->status() === 'draft'; |
|
| 89 | + $jobPoster->status () === 'draft'; |
|
| 90 | 90 | } |
| 91 | 91 | /** |
| 92 | 92 | * Determine whether the user can review applications to the job poster. |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | * @param \App\Models\JobPoster $jobPoster |
| 96 | 96 | * @return mixed |
| 97 | 97 | */ |
| 98 | - public function reviewApplicationsFor(User $user, JobPoster $jobPoster) |
|
| 98 | + public function reviewApplicationsFor (User $user, JobPoster $jobPoster) |
|
| 99 | 99 | { |
| 100 | 100 | // Only managers can review applications, and only for their own jobs. |
| 101 | - return $user->isManager() && |
|
| 101 | + return $user->isManager () && |
|
| 102 | 102 | $jobPoster->manager->user->id == $user->id && |
| 103 | - $jobPoster->isClosed(); |
|
| 103 | + $jobPoster->isClosed (); |
|
| 104 | 104 | } |
| 105 | 105 | } |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | * @param \App\Models\RatingGuideQuestion $question |
| 17 | 17 | * @return boolean |
| 18 | 18 | */ |
| 19 | - public function view(User $user, RatingGuideQuestion $question): bool |
|
| 19 | + public function view (User $user, RatingGuideQuestion $question): bool |
|
| 20 | 20 | { |
| 21 | 21 | // Managers can view questions tied to Jobs they own. |
| 22 | - return $user->isManager() && |
|
| 22 | + return $user->isManager () && |
|
| 23 | 23 | $question->job_poster->manager->user_id === $user->id; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | * @param \App\Models\User $user |
| 30 | 30 | * @return boolean |
| 31 | 31 | */ |
| 32 | - public function create(User $user): bool |
|
| 32 | + public function create (User $user): bool |
|
| 33 | 33 | { |
| 34 | 34 | //Any manager can create a new RatingGuideQuestion, but only for jobs they own. |
| 35 | - return $user->isManager(); |
|
| 35 | + return $user->isManager (); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | * @param \App\Models\RatingGuideQuestion $question |
| 43 | 43 | * @return boolean |
| 44 | 44 | */ |
| 45 | - public function update(User $user, RatingGuideQuestion $question): bool |
|
| 45 | + public function update (User $user, RatingGuideQuestion $question): bool |
|
| 46 | 46 | { |
| 47 | 47 | // Managers can edit questions tied to Jobs they own. |
| 48 | - return $user->isManager() && |
|
| 48 | + return $user->isManager () && |
|
| 49 | 49 | $question->job_poster->manager->user_id === $user->id; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return boolean |
| 59 | 59 | */ |
| 60 | - public function delete(User $user, RatingGuideQuestion $question) : bool |
|
| 60 | + public function delete (User $user, RatingGuideQuestion $question) : bool |
|
| 61 | 61 | { |
| 62 | 62 | // Managers can delete questions tied to Jobs they own. |
| 63 | - return $user->isManager() && |
|
| 63 | + return $user->isManager () && |
|
| 64 | 64 | $question->job_poster->manager->user_id === $user->id; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -17,21 +17,21 @@ discard block |
||
| 17 | 17 | * @param \App\Models\Applicant $applicant Applicant object used within applications submitted to Job Poster. |
| 18 | 18 | * @return boolean |
| 19 | 19 | */ |
| 20 | - protected function ownsJobApplicantAppliedTo(User $user, Applicant $applicant) |
|
| 20 | + protected function ownsJobApplicantAppliedTo (User $user, Applicant $applicant) |
|
| 21 | 21 | { |
| 22 | 22 | $applicant_id = $applicant->id; |
| 23 | 23 | $user_id = $user->id; |
| 24 | - return JobPoster::whereHas( |
|
| 24 | + return JobPoster::whereHas ( |
|
| 25 | 25 | 'manager', |
| 26 | 26 | function ($q) use ($user_id) { |
| 27 | - $q->where('user_id', $user_id); |
|
| 27 | + $q->where ('user_id', $user_id); |
|
| 28 | 28 | } |
| 29 | - )->whereHas( |
|
| 29 | + )->whereHas ( |
|
| 30 | 30 | 'submitted_applications', |
| 31 | 31 | function ($q) use ($applicant_id) { |
| 32 | - $q->where('applicant_id', $applicant_id); |
|
| 32 | + $q->where ('applicant_id', $applicant_id); |
|
| 33 | 33 | } |
| 34 | - )->get()->isNotEmpty(); |
|
| 34 | + )->get ()->isNotEmpty (); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | * @param \App\Models\Applicant $applicant Applicant object to be viewed. |
| 42 | 42 | * @return boolean |
| 43 | 43 | */ |
| 44 | - public function view(User $user, Applicant $applicant) |
|
| 44 | + public function view (User $user, Applicant $applicant) |
|
| 45 | 45 | { |
| 46 | - $authApplicant = $user->isApplicant() && |
|
| 47 | - $applicant->user->is($user); |
|
| 48 | - $authManager = $user->isManager() && $this->ownsJobApplicantAppliedTo($user, $applicant); |
|
| 46 | + $authApplicant = $user->isApplicant () && |
|
| 47 | + $applicant->user->is ($user); |
|
| 48 | + $authManager = $user->isManager () && $this->ownsJobApplicantAppliedTo ($user, $applicant); |
|
| 49 | 49 | return $authApplicant || $authManager; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param \App\Models\User $user User object making the create request. |
| 56 | 56 | * @return boolean |
| 57 | 57 | */ |
| 58 | - public function create(User $user) |
|
| 58 | + public function create (User $user) |
|
| 59 | 59 | { |
| 60 | 60 | return false; |
| 61 | 61 | } |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * @param \App\Models\Applicant $applicant Applicant object being updated. |
| 68 | 68 | * @return boolean |
| 69 | 69 | */ |
| 70 | - public function update(User $user, Applicant $applicant) |
|
| 70 | + public function update (User $user, Applicant $applicant) |
|
| 71 | 71 | { |
| 72 | - return $user->isApplicant() && |
|
| 72 | + return $user->isApplicant () && |
|
| 73 | 73 | $applicant->user_id === $user->id; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param \App\Models\Applicant $applicant Applicant object being deleted. |
| 81 | 81 | * @return void |
| 82 | 82 | */ |
| 83 | - public function delete(User $user, Applicant $applicant) |
|
| 83 | + public function delete (User $user, Applicant $applicant) |
|
| 84 | 84 | { |
| 85 | 85 | } |
| 86 | 86 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @param \App\Models\Applicant $applicant Applicant object being restored. |
| 92 | 92 | * @return void |
| 93 | 93 | */ |
| 94 | - public function restore(User $user, Applicant $applicant) |
|
| 94 | + public function restore (User $user, Applicant $applicant) |
|
| 95 | 95 | { |
| 96 | 96 | } |
| 97 | 97 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @param \App\Models\Applicant $applicant Applicant object being forceDeleted. |
| 103 | 103 | * @return void |
| 104 | 104 | */ |
| 105 | - public function forceDelete(User $user, Applicant $applicant) |
|
| 105 | + public function forceDelete (User $user, Applicant $applicant) |
|
| 106 | 106 | { |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -22,14 +22,14 @@ discard block |
||
| 22 | 22 | * @param \Illuminate\Console\Scheduling\Schedule $schedule |
| 23 | 23 | * @return void |
| 24 | 24 | */ |
| 25 | - protected function schedule(Schedule $schedule): void |
|
| 25 | + protected function schedule (Schedule $schedule): void |
|
| 26 | 26 | { |
| 27 | 27 | // $schedule->command('inspire') |
| 28 | 28 | // ->hourly(); |
| 29 | 29 | |
| 30 | 30 | // start the queue daemon, if its not running |
| 31 | - if (!$this->osProcessIsRunning('queue:work')) { |
|
| 32 | - $schedule->command('queue:work')->everyMinute(); |
|
| 31 | + if (!$this->osProcessIsRunning ('queue:work')) { |
|
| 32 | + $schedule->command ('queue:work')->everyMinute (); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return void |
| 40 | 40 | */ |
| 41 | - protected function commands(): void |
|
| 41 | + protected function commands (): void |
|
| 42 | 42 | { |
| 43 | - $this->load(__DIR__.'/Commands'); |
|
| 43 | + $this->load (__DIR__.'/Commands'); |
|
| 44 | 44 | |
| 45 | - require base_path('routes/console.php'); |
|
| 45 | + require base_path ('routes/console.php'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | * @param string $needle |
| 52 | 52 | * @return boolean |
| 53 | 53 | */ |
| 54 | - protected function osProcessIsRunning(string $needle): bool |
|
| 54 | + protected function osProcessIsRunning (string $needle): bool |
|
| 55 | 55 | { |
| 56 | 56 | // get process status. the "-ww"-option is important to get the full output! |
| 57 | - exec('ps aux -ww', $process_status); |
|
| 57 | + exec ('ps aux -ww', $process_status); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | // search $needle in process status |
| 61 | - $result = array_filter( |
|
| 61 | + $result = array_filter ( |
|
| 62 | 62 | $process_status, |
| 63 | 63 | function ($var) use ($needle) { |
| 64 | - return strpos($var, $needle); |
|
| 64 | + return strpos ($var, $needle); |
|
| 65 | 65 | } |
| 66 | 66 | ); |
| 67 | 67 | |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | use Illuminate\Support\Facades\Config; |
| 6 | 6 | use Illuminate\Support\Facades\Lang; |
| 7 | 7 | |
| 8 | -if (!function_exists('humanizeDate')) { |
|
| 8 | +if (!function_exists ('humanizeDate')) { |
|
| 9 | 9 | /** |
| 10 | 10 | * Computes a human readable localized date. |
| 11 | 11 | * |
@@ -13,19 +13,19 @@ discard block |
||
| 13 | 13 | * |
| 14 | 14 | * @return string |
| 15 | 15 | */ |
| 16 | - function humanizeDate(Date $datetime) : string |
|
| 16 | + function humanizeDate (Date $datetime) : string |
|
| 17 | 17 | { |
| 18 | - $dateFormat = Config::get('app.date_format'); |
|
| 19 | - $locale = App::getLocale(); |
|
| 20 | - $timezone = Config::get('app.local_timezone'); |
|
| 18 | + $dateFormat = Config::get ('app.date_format'); |
|
| 19 | + $locale = App::getLocale (); |
|
| 20 | + $timezone = Config::get ('app.local_timezone'); |
|
| 21 | 21 | |
| 22 | - $datetime->setTimezone(new \DateTimeZone($timezone)); |
|
| 22 | + $datetime->setTimezone (new \DateTimeZone ($timezone)); |
|
| 23 | 23 | |
| 24 | - return $datetime->format($dateFormat[$locale]); |
|
| 24 | + return $datetime->format ($dateFormat[$locale]); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | -if (!function_exists('humanizeTime')) { |
|
| 28 | +if (!function_exists ('humanizeTime')) { |
|
| 29 | 29 | /** |
| 30 | 30 | * Computes a human readable localized time. |
| 31 | 31 | * |
@@ -33,25 +33,25 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @return string |
| 35 | 35 | */ |
| 36 | - function humanizeTime(Date $datetime) : string |
|
| 36 | + function humanizeTime (Date $datetime) : string |
|
| 37 | 37 | { |
| 38 | - $timeFormat = Config::get('app.time_format'); |
|
| 39 | - $locale = App::getLocale(); |
|
| 40 | - $timezone = Config::get('app.local_timezone'); |
|
| 38 | + $timeFormat = Config::get ('app.time_format'); |
|
| 39 | + $locale = App::getLocale (); |
|
| 40 | + $timezone = Config::get ('app.local_timezone'); |
|
| 41 | 41 | |
| 42 | - $datetime->setTimezone(new \DateTimeZone($timezone)); |
|
| 42 | + $datetime->setTimezone (new \DateTimeZone ($timezone)); |
|
| 43 | 43 | |
| 44 | - $displayTime = $datetime->format($timeFormat[$locale]); |
|
| 44 | + $displayTime = $datetime->format ($timeFormat[$locale]); |
|
| 45 | 45 | |
| 46 | 46 | if ($locale == 'fr') { |
| 47 | - $displayTime = str_replace(['EST', 'EDT'], ['HNE', 'HAE'], $displayTime); |
|
| 47 | + $displayTime = str_replace (['EST', 'EDT'], ['HNE', 'HAE'], $displayTime); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | return $displayTime; |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -if (!function_exists('humanizeDateDiff')) { |
|
| 54 | +if (!function_exists ('humanizeDateDiff')) { |
|
| 55 | 55 | /** |
| 56 | 56 | * Computes a human readable time difference between two dates. |
| 57 | 57 | * |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - function humanizeDateDiff(Date $datetime, Date $origin = null) : string |
|
| 63 | + function humanizeDateDiff (Date $datetime, Date $origin = null) : string |
|
| 64 | 64 | { |
| 65 | 65 | if (!isset($origin)) { |
| 66 | - $origin = new Date(); |
|
| 66 | + $origin = new Date (); |
|
| 67 | 67 | } |
| 68 | - $interval = $datetime->diff($origin); |
|
| 68 | + $interval = $datetime->diff ($origin); |
|
| 69 | 69 | |
| 70 | 70 | $d = $interval->d; |
| 71 | 71 | $h = $interval->h; |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $key = "common/time.$unit"; |
| 90 | 90 | |
| 91 | - return Lang::choice($key, $count); |
|
| 91 | + return Lang::choice ($key, $count); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | -if (!function_exists('humanizeLastDay')) { |
|
| 95 | +if (!function_exists ('humanizeLastDay')) { |
|
| 96 | 96 | /** |
| 97 | 97 | * Returns the date of the last full day a person has before a deadline time. |
| 98 | 98 | * |
@@ -100,15 +100,15 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @return string |
| 102 | 102 | */ |
| 103 | - function humanizeLastDay(Date $datetime) : string |
|
| 103 | + function humanizeLastDay (Date $datetime) : string |
|
| 104 | 104 | { |
| 105 | - $lastday = $datetime->sub('1 day'); |
|
| 105 | + $lastday = $datetime->sub ('1 day'); |
|
| 106 | 106 | |
| 107 | - return humanizeDate($lastday); |
|
| 107 | + return humanizeDate ($lastday); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | -if (!function_exists('ptDayStartToUtcTime')) { |
|
| 111 | +if (!function_exists ('ptDayStartToUtcTime')) { |
|
| 112 | 112 | /** |
| 113 | 113 | * Given a date, creates a datetime object representing the start of day |
| 114 | 114 | * in the most Western timezone in Canada (America/Vancouver). |
@@ -117,21 +117,21 @@ discard block |
||
| 117 | 117 | * |
| 118 | 118 | * @return Date |
| 119 | 119 | */ |
| 120 | - function ptDayStartToUtcTime(string $date) : Date |
|
| 120 | + function ptDayStartToUtcTime (string $date) : Date |
|
| 121 | 121 | { |
| 122 | - $jobTimezone = Config::get('app.job_timezone'); |
|
| 123 | - $dbTimezone = Config::get('app.timezone'); |
|
| 122 | + $jobTimezone = Config::get ('app.job_timezone'); |
|
| 123 | + $dbTimezone = Config::get ('app.timezone'); |
|
| 124 | 124 | // Create a new date that's the beginning of the day in |
| 125 | 125 | // Pacific Daylight/Standard Time. |
| 126 | - $date = new Date("$date 00:00:00", new \DateTimeZone($jobTimezone)); |
|
| 126 | + $date = new Date ("$date 00:00:00", new \DateTimeZone ($jobTimezone)); |
|
| 127 | 127 | // Convert to UTC for correct offset. |
| 128 | - $date->setTimezone($dbTimezone); |
|
| 128 | + $date->setTimezone ($dbTimezone); |
|
| 129 | 129 | |
| 130 | 130 | return $date; |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | -if (!function_exists('ptDayEndToUtcTime')) { |
|
| 134 | +if (!function_exists ('ptDayEndToUtcTime')) { |
|
| 135 | 135 | /** |
| 136 | 136 | * Given a date, creates a datetime object representing the start of day |
| 137 | 137 | * in the most Western timezone in Canada (America/Vancouver). |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return Date |
| 142 | 142 | */ |
| 143 | - function ptDayEndToUtcTime(string $date) : Date |
|
| 143 | + function ptDayEndToUtcTime (string $date) : Date |
|
| 144 | 144 | { |
| 145 | - $jobTimezone = Config::get('app.job_timezone'); |
|
| 146 | - $dbTimezone = Config::get('app.timezone'); |
|
| 145 | + $jobTimezone = Config::get ('app.job_timezone'); |
|
| 146 | + $dbTimezone = Config::get ('app.timezone'); |
|
| 147 | 147 | // Create a new date that's the beginning of the day in |
| 148 | 148 | // Pacific Daylight/Standard Time. |
| 149 | - $date = new Date("$date 23:59:59", new \DateTimeZone($jobTimezone)); |
|
| 149 | + $date = new Date ("$date 23:59:59", new \DateTimeZone ($jobTimezone)); |
|
| 150 | 150 | // Convert to UTC for correct offset. |
| 151 | - $date->setTimezone($dbTimezone); |
|
| 151 | + $date->setTimezone ($dbTimezone); |
|
| 152 | 152 | |
| 153 | 153 | return $date; |
| 154 | 154 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | - public function __construct(User $user) |
|
| 19 | + public function __construct (User $user) |
|
| 20 | 20 | { |
| 21 | 21 | $this->user = $user; |
| 22 | 22 | } |