Passed
Push — task/add-manager-resource ( c74771 )
by Chris
11:48
created
app/Policies/ApplicationPolicy.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function view(User $user, JobApplication $jobApplication)
22 22
     {
23
-        $authApplicant = ($user->isApplicant() &&
23
+        $authApplicant = ($user->isApplicant () &&
24 24
             $user->applicant->id === $jobApplication->applicant_id);
25
-        $authManager = ($user->isManager() &&
26
-            $jobApplication->job_poster->manager->user->is($user));
25
+        $authManager = ($user->isManager () &&
26
+            $jobApplication->job_poster->manager->user->is ($user));
27 27
 
28
-        return $authApplicant||$authManager;
28
+        return $authApplicant || $authManager;
29 29
     }
30 30
 
31 31
     /**
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function update(User $user, JobApplication $jobApplication)
50 50
     {
51
-        return $user->isApplicant() &&
51
+        return $user->isApplicant () &&
52 52
             $user->applicant->id === $jobApplication->applicant_id &&
53 53
             $jobApplication->application_status->name == 'draft' &&
54
-            $jobApplication->job_poster->isOpen();
54
+            $jobApplication->job_poster->isOpen ();
55 55
     }
56 56
 
57 57
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function delete(User $user, JobApplication $jobApplication)
65 65
     {
66
-        return $user->isApplicant() &&
66
+        return $user->isApplicant () &&
67 67
             $user->applicant->id === $jobApplication->applicant_id &&
68 68
             $jobApplication->application_status->name == 'draft';
69 69
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     {
80 80
         // Only the manager in charge of the accompanying job can review an application,
81 81
         // and only if it has been submitted
82
-        return $user->isManager() &&
82
+        return $user->isManager () &&
83 83
             $jobApplication->job_poster->manager->user->id == $user->id &&
84 84
             $jobApplication->application_status->name != 'draft';
85 85
     }
Please login to merge, or discard this patch.
app/Policies/WorkSamplePolicy.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public function view(User $user, WorkSample $workSample)
20 20
     {
21
-        return $user->isApplicant() && $workSample->applicant->user->is($user);
21
+        return $user->isApplicant () && $workSample->applicant->user->is ($user);
22 22
     }
23 23
 
24 24
     /**
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function create(User $user)
31 31
     {
32
-        return $user->isApplicant();
32
+        return $user->isApplicant ();
33 33
     }
34 34
 
35 35
     /**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function update(User $user, WorkSample $workSample)
43 43
     {
44
-        return $user->isApplicant() && $workSample->applicant->user->is($user);
44
+        return $user->isApplicant () && $workSample->applicant->user->is ($user);
45 45
     }
46 46
 
47 47
     /**
@@ -53,6 +53,6 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function delete(User $user, WorkSample $workSample)
55 55
     {
56
-        return $user->isApplicant() && $workSample->applicant->user->is($user);
56
+        return $user->isApplicant () && $workSample->applicant->user->is ($user);
57 57
     }
58 58
 }
Please login to merge, or discard this patch.
app/Helpers/Helper.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
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
      *
@@ -15,17 +15,17 @@  discard block
 block discarded – undo
15 15
      */
16 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
      *
@@ -35,23 +35,23 @@  discard block
 block discarded – undo
35 35
      */
36 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
      *
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 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
 block discarded – undo
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
      *
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
      */
103 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).
@@ -119,19 +119,19 @@  discard block
 block discarded – undo
119 119
      */
120 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).
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
      */
143 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
     }
Please login to merge, or discard this patch.
app/Mail/JobPosterReviewRequested.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,6 +56,6 @@
 block discarded – undo
56 56
      */
57 57
     public function build()
58 58
     {
59
-        return $this->text('emails.job_posters.review_requested_plain');
59
+        return $this->text ('emails.job_posters.review_requested_plain');
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
database/seeds/JobPosterSeeder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
      */
13 13
     public function run()
14 14
     {
15
-        factory(JobPoster::class, 5)->create();
15
+        factory (JobPoster::class, 5)->create ();
16 16
     }
17 17
 }
Please login to merge, or discard this patch.
database/seeds/DatabaseSeeder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      */
12 12
     public function run()
13 13
     {
14
-        $this->call([
14
+        $this->call ([
15 15
             DevSeeder::class,
16 16
             SkillClassificationSeeder::class
17 17
         ]);
Please login to merge, or discard this patch.
database/seeds/UsersSeeder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
      */
15 15
     public function run()
16 16
     {
17
-        factory(Manager::class, 10)->create();
18
-        factory(Applicant::class, 5)->create();
17
+        factory (Manager::class, 10)->create ();
18
+        factory (Applicant::class, 5)->create ();
19 19
     }
20 20
 
21 21
 }
Please login to merge, or discard this patch.
database/seeds/DevSeeder.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -44,86 +44,86 @@
 block discarded – undo
44 44
      */
45 45
     public function run() : void
46 46
     {
47
-        $adminUser = User::where('email', $this->adminEmail)->first();
47
+        $adminUser = User::where ('email', $this->adminEmail)->first ();
48 48
         if ($adminUser === null) {
49
-            $adminUser = factory(User::class)->state('admin')->create(['email' => $this->adminEmail]);
49
+            $adminUser = factory (User::class)->state ('admin')->create (['email' => $this->adminEmail]);
50 50
         }
51 51
 
52
-        $managerUser = User::where('email', $this->managerEmail)->first();
52
+        $managerUser = User::where ('email', $this->managerEmail)->first ();
53 53
         // Create the test manager if it does not exist yet.
54 54
         if ($managerUser === null) {
55
-            $managerUser = factory(User::class)->state('upgradedManager')->create(['email' => $this->managerEmail]);
56
-            $managerUser->manager()->save(factory(Manager::class)->create([
55
+            $managerUser = factory (User::class)->state ('upgradedManager')->create (['email' => $this->managerEmail]);
56
+            $managerUser->manager ()->save (factory (Manager::class)->create ([
57 57
                 'user_id' => $managerUser->id
58 58
             ]));
59 59
         }
60 60
 
61
-        factory(JobPoster::class, 3)->state('published')->create([
61
+        factory (JobPoster::class, 3)->state ('published')->create ([
62 62
             'manager_id' => $managerUser->manager->id
63
-        ])->each(function ($job) : void {
64
-            $job->job_applications()->saveMany(factory(JobApplication::class, 5))->create([
63
+        ])->each (function ($job) : void {
64
+            $job->job_applications ()->saveMany (factory (JobApplication::class, 5))->create ([
65 65
                 'job_poster_id' => $job->id
66 66
             ]);
67 67
             // Then create one application with a priority user.
68
-            $job->job_applications()->save(factory(JobApplication::class)->create([
68
+            $job->job_applications ()->save (factory (JobApplication::class)->create ([
69 69
                 'job_poster_id' => $job->id,
70
-                'applicant_id' => factory(Applicant::class)->create([
71
-                        'user_id' => factory(User::class)->state('priority')->create()->id
70
+                'applicant_id' => factory (Applicant::class)->create ([
71
+                        'user_id' => factory (User::class)->state ('priority')->create ()->id
72 72
                     ])->id
73 73
             ]));
74 74
         });
75
-        factory(JobPoster::class, 3)->state('closed')->create([
75
+        factory (JobPoster::class, 3)->state ('closed')->create ([
76 76
             'manager_id' => $managerUser->manager->id
77
-        ])->each(function ($job) : void {
78
-            $job->job_applications()->saveMany(factory(JobApplication::class, 5))->create([
77
+        ])->each (function ($job) : void {
78
+            $job->job_applications ()->saveMany (factory (JobApplication::class, 5))->create ([
79 79
                 'job_poster_id' => $job->id
80 80
             ]);
81 81
             // Then create one application with a priority user.
82
-            $job->job_applications()->save(factory(JobApplication::class)->create([
82
+            $job->job_applications ()->save (factory (JobApplication::class)->create ([
83 83
                 'job_poster_id' => $job->id,
84
-                'applicant_id' => factory(Applicant::class)->create([
85
-                    'user_id' => factory(User::class)->state('priority')->create()->id
84
+                'applicant_id' => factory (Applicant::class)->create ([
85
+                    'user_id' => factory (User::class)->state ('priority')->create ()->id
86 86
                 ])->id
87 87
             ]));
88 88
         });
89
-        factory(JobPoster::class, 3)->state('draft')->create([
89
+        factory (JobPoster::class, 3)->state ('draft')->create ([
90 90
             'manager_id' => $managerUser->manager->id
91 91
         ]);
92
-        factory(JobPoster::class, 3)->state('review_requested')->create([
92
+        factory (JobPoster::class, 3)->state ('review_requested')->create ([
93 93
             'manager_id' => $managerUser->manager->id
94 94
         ]);
95 95
 
96 96
         // Create a Job Poster with an Assessment Plan.
97
-        $jobWithAssessment = factory(JobPoster::class)->state('draft')->create([
97
+        $jobWithAssessment = factory (JobPoster::class)->state ('draft')->create ([
98 98
             'manager_id' => $managerUser->manager->id,
99 99
         ]);
100 100
         foreach ($jobWithAssessment->criteria as $criterion) {
101 101
             // Create an assessment for each criterion.
102
-            factory(Assessment::class)->state('withRatingGuide')->create([
102
+            factory (Assessment::class)->state ('withRatingGuide')->create ([
103 103
                 'criterion_id' => $criterion->id,
104 104
             ]);
105 105
         };
106 106
 
107
-        $applicantUser = User::where('email', $this->applicantEmail)->first();
107
+        $applicantUser = User::where ('email', $this->applicantEmail)->first ();
108 108
         if ($applicantUser === null) {
109
-            $applicantUser = factory(User::class)->state('applicant')->create([
109
+            $applicantUser = factory (User::class)->state ('applicant')->create ([
110 110
                 'email' => $this->applicantEmail
111 111
             ]);
112
-            $applicantUser->applicant()->save(factory(Applicant::class)->create([
112
+            $applicantUser->applicant ()->save (factory (Applicant::class)->create ([
113 113
                 'user_id' => $applicantUser->id
114 114
             ]));
115 115
         }
116 116
 
117 117
         // Add to application profile.
118
-        $applicantUser->applicant->references()->saveMany(factory(Reference::class, 3)->create([
118
+        $applicantUser->applicant->references ()->saveMany (factory (Reference::class, 3)->create ([
119 119
             'applicant_id' => $applicantUser->applicant->id
120 120
         ]));
121 121
 
122 122
         // Create several applications for test user.
123
-        $applicantUser->applicant->job_applications()->saveMany(factory(JobApplication::class, 3)->create([
123
+        $applicantUser->applicant->job_applications ()->saveMany (factory (JobApplication::class, 3)->create ([
124 124
             'applicant_id' => $applicantUser->applicant->id,
125 125
         ]));
126
-        $applicantUser->applicant->job_applications()->saveMany(factory(JobApplication::class, 2)->state('draft')->create([
126
+        $applicantUser->applicant->job_applications ()->saveMany (factory (JobApplication::class, 2)->state ('draft')->create ([
127 127
             'applicant_id' => $applicantUser->applicant->id,
128 128
         ]));
129 129
     }
Please login to merge, or discard this patch.
app/Models/Lookup/LanguageRequirement.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,6 +28,6 @@
 block discarded – undo
28 28
 
29 29
     public function job_posters() //phpcs:ignore
30 30
     {
31
-        return $this->hasMany(\App\Models\JobPoster::class);
31
+        return $this->hasMany (\App\Models\JobPoster::class);
32 32
     }
33 33
 }
Please login to merge, or discard this patch.