Passed
Push — dependabot/npm_and_yarn/dev/te... ( a08237 )
by
unknown
14:14
created
app/Services/Validation/ApplicationValidator.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
 use App\Services\Validation\Rules\ContainsObjectWithAttributeRule;
14 14
 use App\Services\Validation\JobApplicationAnswerValidator;
15 15
 
16
-class ApplicationValidator {
16
+class ApplicationValidator{
17 17
 
18 18
     protected $citizenship_ids;
19 19
     protected $veteran_status_ids;
20 20
     protected $preferred_language_ids;
21 21
 
22
-    public function __construct() {
22
+    public function __construct(){
23 23
         $this->citizenship_ids = CitizenshipDeclaration::all()->pluck('id')->toArray();
24 24
         $this->veteran_status_ids = VeteranStatus::all()->pluck('id')->toArray();
25 25
         $this->preferred_language_ids = PreferredLanguage::all()->pluck('id')->toArray();
26 26
     }
27 27
 
28
-    public function validate(JobApplication $application) {
28
+    public function validate(JobApplication $application){
29 29
 
30 30
         $backendRules = [
31 31
             'job_poster_id' => 'required',
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         return $newArray;
76 76
     }
77 77
 
78
-    protected function addNestedValidatorRules($nestedAttribute, $validatorRules, $rules = []) {
78
+    protected function addNestedValidatorRules($nestedAttribute, $validatorRules, $rules = []){
79 79
         // prepend the attribute name of each validator rule with the nested attribute name
80 80
         $newRules = $this->arrayMapKeys(function($key) use ($nestedAttribute) {
81 81
                 return implode('.', [$nestedAttribute, $key]);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         return $rules;
87 87
     }
88 88
 
89
-    public function basicsValidator(JobApplication $application) {
89
+    public function basicsValidator(JobApplication $application){
90 90
         // Validate the fields common to every application
91 91
         $rules = [
92 92
             'language_requirement_confirmed' => ['required', 'boolean'],
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 
101 101
         // Validate that each question has been answered
102 102
         $jobPosterQuestionRules = [];
103
-        foreach($application->job_poster->job_poster_questions as $question) {
103
+        foreach ($application->job_poster->job_poster_questions as $question) {
104 104
             $jobPosterQuestionRules[] = new ContainsObjectWithAttributeRule('job_poster_question_id', $question->id);
105 105
         }
106 106
         $rules['job_application_answers'] = $jobPosterQuestionRules;
107 107
         $answerValidatorFactory = new JobApplicationAnswerValidator($application);
108 108
 
109 109
         //Validate that each answer is complete
110
-        foreach($application->job_application_answers as $key=>$answer) {
110
+        foreach ($application->job_application_answers as $key=>$answer) {
111 111
             $attribute = implode('.', ['job_application_answers', $key]);
112 112
             $rules = $this->addNestedValidatorRules($attribute, $answerValidatorFactory->rules(), $rules);
113 113
         }
@@ -116,26 +116,26 @@  discard block
 block discarded – undo
116 116
         return $validator;
117 117
     }
118 118
 
119
-    public function basicsComplete(JobApplication $application) {
119
+    public function basicsComplete(JobApplication $application){
120 120
         $validator = $this->basicsValidator($application);
121 121
         return $validator->passes();
122 122
     }
123 123
 
124
-    public function experienceValidator(JobApplication $application) {
124
+    public function experienceValidator(JobApplication $application){
125 125
         $rules = ['experience_saved' => 'required|boolean|accepted'];
126 126
         return Validator::make($application->toArray(), $rules);
127 127
     }
128 128
 
129
-    public function experienceComplete(JobApplication $application) {
129
+    public function experienceComplete(JobApplication $application){
130 130
         return $this->experienceValidator($application)->passes();
131 131
     }
132 132
 
133
-    protected function skillsValidator(JobApplication $application, $criteria_type) {
133
+    protected function skillsValidator(JobApplication $application, $criteria_type){
134 134
         $rules = [];
135 135
 
136 136
         $skillDeclarationRules = [];
137 137
         $criteriaTypeId = CriteriaType::where('name', $criteria_type)->firstOrFail()->id;
138
-        foreach($application->job_poster->criteria->where('criteria_type_id', $criteriaTypeId) as $criteria) {
138
+        foreach ($application->job_poster->criteria->where('criteria_type_id', $criteriaTypeId) as $criteria) {
139 139
             //Validate that every essential skill has a corresponding declaration
140 140
             $skillDeclarationRules[] = new ContainsObjectWithAttributeRule('skill_id', $criteria->skill_id);
141 141
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         //Validate that those declarations are complete
146 146
         $skilDeclarationValidatorFactory = new SkillDeclarationValidator($application->applicant);
147 147
         $relevantSkillIds = $application->job_poster->criteria->where('criteria_type_id', $criteriaTypeId)->pluck('skill_id');
148
-        foreach( $application->skill_declarations as $key=>$declaration) {
148
+        foreach ($application->skill_declarations as $key=>$declaration) {
149 149
             if ($relevantSkillIds->contains($declaration->skill_id)) {
150 150
                 $attribute = implode('.', ['skill_declarations', $key]);
151 151
                 $skillDeclarationValidator = $skilDeclarationValidatorFactory->validator($declaration);
@@ -157,23 +157,23 @@  discard block
 block discarded – undo
157 157
         return $validator;
158 158
     }
159 159
 
160
-    public function essentialSkillsValidator(JobApplication $application) {
160
+    public function essentialSkillsValidator(JobApplication $application){
161 161
         return $this->skillsValidator($application, 'essential');
162 162
     }
163 163
 
164
-    public function essentialSkillsComplete(JobApplication $application) {
164
+    public function essentialSkillsComplete(JobApplication $application){
165 165
         return $this->essentialSkillsValidator($application)->passes();
166 166
     }
167 167
 
168
-    public function assetSkillsValidator(JobApplication $application) {
168
+    public function assetSkillsValidator(JobApplication $application){
169 169
         return $this->skillsValidator($application, 'asset');
170 170
     }
171 171
 
172
-    public function assetSkillsComplete(JobApplication $application) {
172
+    public function assetSkillsComplete(JobApplication $application){
173 173
         return $this->assetSkillsValidator($application)->passes();
174 174
     }
175 175
 
176
-    public function affirmationValidator(JobApplication $application) {
176
+    public function affirmationValidator(JobApplication $application){
177 177
         $rules = [
178 178
             'submission_signature' => [
179 179
                 'required',
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         return Validator::make($application->toArray(), $rules);
190 190
     }
191 191
 
192
-    public function affirmationComplete(JobApplication $application) {
192
+    public function affirmationComplete(JobApplication $application){
193 193
         return $this->affirmationValidator($application)->passes();
194 194
     }
195 195
 }
Please login to merge, or discard this patch.
app/Utilities/HandleNullState.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function getFunctions(): array
14 14
     {
15 15
         return [
16
-          new Twig_SimpleFunction('handleNullState', [$this, 'handleNullState']),
16
+            new Twig_SimpleFunction('handleNullState', [$this, 'handleNullState']),
17 17
         ];
18 18
     }
19 19
 
Please login to merge, or discard this patch.
app/Models/WorkplacePhoto.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  * 
20 20
  * @property \App\Models\WorkplacePhotoCaption $workplace_photo_caption
21 21
  */
22
-class WorkplacePhoto extends BaseModel {
22
+class WorkplacePhoto extends BaseModel{
23 23
 
24 24
     protected $casts = [
25 25
         'image' => 'boolean',
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         'image'
30 30
     ];
31 31
 
32
-    public function workplace_photo_caption() {
32
+    public function workplace_photo_caption(){
33 33
         return $this->hasOne(\App\Models\WorkplacePhotoCaption::class);
34 34
     }
35 35
 
Please login to merge, or discard this patch.
app/Models/JobApplication.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  * @property \Illuminate\Database\Eloquent\Collection $skill_declarations
47 47
  * @property \App\Models\ApplicationReview $application_review
48 48
  */
49
-class JobApplication extends BaseModel {
49
+class JobApplication extends BaseModel{
50 50
 
51 51
     use Notifiable;
52 52
 
@@ -85,51 +85,51 @@  discard block
 block discarded – undo
85 85
      */
86 86
     protected $appends = ['meets_essential_criteria'];
87 87
 
88
-    protected function createApplicantSnapshot($applicant_id) {
88
+    protected function createApplicantSnapshot($applicant_id){
89 89
         $applicant = Applicant::where('id', $applicant_id)->firstOrFail();
90 90
 
91 91
         $snapshot = $applicant->replicate();
92 92
 
93 93
     }
94 94
 
95
-    public function applicant() {
95
+    public function applicant(){
96 96
         return $this->belongsTo(\App\Models\Applicant::class);
97 97
     }
98 98
 
99
-    public function applicant_snapshot() {
99
+    public function applicant_snapshot(){
100 100
         return $this->belongsTo(\App\Models\Applicant::class, 'applicant_snapshot_id');
101 101
     }
102 102
 
103
-    public function application_status() {
103
+    public function application_status(){
104 104
         return $this->belongsTo(\App\Models\Lookup\ApplicationStatus::class);
105 105
     }
106 106
 
107
-    public function citizenship_declaration() {
107
+    public function citizenship_declaration(){
108 108
         return $this->belongsTo(\App\Models\Lookup\CitizenshipDeclaration::class);
109 109
     }
110 110
 
111
-    public function veteran_status() {
111
+    public function veteran_status(){
112 112
         return $this->belongsTo(\App\Models\Lookup\VeteranStatus::class);
113 113
     }
114 114
 
115
-    public function preferred_language() {
115
+    public function preferred_language(){
116 116
         return $this->belongsTo(\App\Models\Lookup\PreferredLanguage::class);
117 117
     }
118 118
 
119
-    public function job_poster() {
119
+    public function job_poster(){
120 120
         return $this->belongsTo(\App\Models\JobPoster::class);
121 121
     }
122 122
 
123
-    public function job_application_answers() {
123
+    public function job_application_answers(){
124 124
         return $this->hasMany(\App\Models\JobApplicationAnswer::class);
125 125
     }
126 126
 
127
-    public function skill_declarations() {
127
+    public function skill_declarations(){
128 128
         return $this->applicant->skill_declarations()
129 129
             ->whereIn('skill_id', $this->job_poster->criteria->pluck('skill_id'));
130 130
     }
131 131
 
132
-    public function application_review() {
132
+    public function application_review(){
133 133
         return $this->hasOne(ApplicationReview::class);
134 134
     }
135 135
 
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
      *
147 147
      * @return string $status   'complete', 'incomplete' or 'error'
148 148
      */
149
-    public function getSectionStatus(string $section) {
149
+    public function getSectionStatus(string $section){
150 150
         //TODO: determine whether sections are complete or invalid
151 151
         $validator = new ApplicationValidator();
152 152
         $status = 'incomplete';
153
-        switch($section) {
153
+        switch ($section) {
154 154
             case 'basics':
155 155
                 if ($validator->basicsComplete($this)) {
156 156
                     $status = 'complete';
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     public function meetsEssentialCriteria(): bool
202 202
     {
203 203
         $essentialCriteria = $this->job_poster->criteria->filter(
204
-            function ($value, $key) {
204
+            function($value, $key){
205 205
                 return $value->criteria_type->name == 'essential';
206 206
             }
207 207
         );
Please login to merge, or discard this patch.
app/Models/Criteria.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@
 block discarded – undo
28 28
  * @property string $level_description The localized description of the skill level (accounts for skill type).
29 29
  *
30 30
  *  Localized Properties:
31
-  * @property string $description
32
-  * @property string $specificity
31
+ * @property string $description
32
+ * @property string $specificity
33 33
  */
34 34
 class Criteria extends BaseModel
35 35
 {
Please login to merge, or discard this patch.
app/Models/User.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
     }
174 174
 
175 175
     /**
176
-    * Check if the user has the specified role.
177
-    * @param string $role This may be either 'applicant', 'manager' or 'admin'.
178
-    * @return boolean
179
-    */
176
+     * Check if the user has the specified role.
177
+     * @param string $role This may be either 'applicant', 'manager' or 'admin'.
178
+     * @return boolean
179
+     */
180 180
     public function hasRole($role)
181 181
     {
182 182
         switch ($role) {
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
      * Set this user to the specified role.
196 196
      *
197 197
      * @param string $role Must be either 'applicant', 'manager' or 'admin.
198
-    * @return void
199
-    */
198
+     * @return void
199
+     */
200 200
     public function setRole(string $role): void
201 201
     {
202 202
         $this->user_role()->associate(UserRole::where('name', $role)->firstOrFail());
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      * Returns a user's full name.
232 232
      *
233 233
      * @return string
234
-    */
234
+     */
235 235
     public function getFullNameAttribute(): string
236 236
     {
237 237
         return $this->first_name . ' ' . $this->last_name;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -234,6 +234,6 @@
 block discarded – undo
234 234
     */
235 235
     public function getFullNameAttribute(): string
236 236
     {
237
-        return $this->first_name . ' ' . $this->last_name;
237
+        return $this->first_name.' '.$this->last_name;
238 238
     }
239 239
 }
Please login to merge, or discard this patch.
app/Models/ApplicantProfileAnswer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @property \App\Models\Applicant $applicant
21 21
  * @property \App\Models\Lookup\ApplicantProfileQuestion $applicant_profile_question
22 22
  */
23
-class ApplicantProfileAnswer extends BaseModel {
23
+class ApplicantProfileAnswer extends BaseModel{
24 24
 
25 25
     protected $casts = [
26 26
         'applicant_id' => 'int',
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
         'applicant_profile_question'
35 35
     ];
36 36
 
37
-    public function applicant() {
37
+    public function applicant(){
38 38
         return $this->belongsTo(\App\Models\Applicant::class);
39 39
     }
40 40
 
41
-    public function applicant_profile_question() {
41
+    public function applicant_profile_question(){
42 42
         return $this->belongsTo(\App\Models\Lookup\ApplicantProfileQuestion::class);
43 43
     }
44 44
 
Please login to merge, or discard this patch.
app/Models/WorkplacePhotoCaption.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @property \App\Models\WorkEnvironment $work_environment
22 22
  * @property \App\Models\WorkplacePhoto $workplace_photo
23 23
  */
24
-class WorkplacePhotoCaption extends BaseModel {
24
+class WorkplacePhotoCaption extends BaseModel{
25 25
 
26 26
     protected $casts = [
27 27
         'work_environment_id' => 'int',
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
         'description'
33 33
     ];
34 34
 
35
-    public function work_environment() {
35
+    public function work_environment(){
36 36
         return $this->belongsTo(\App\Models\WorkEnvironment::class);
37 37
     }
38 38
 
39
-    public function workplace_photo() {
39
+    public function workplace_photo(){
40 40
         return $this->belongsTo(\App\Models\WorkplacePhoto::class);
41 41
     }
42 42
 
Please login to merge, or discard this patch.
app/Models/ApplicationReview.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@
 block discarded – undo
37 37
      */
38 38
     protected $with = ['review_status'];
39 39
 
40
-    public function job_application() {
40
+    public function job_application(){
41 41
         return $this->belongsTo(JobApplication::class);
42 42
     }
43 43
 
44
-    public function review_status() {
44
+    public function review_status(){
45 45
         return $this->belongsTo(ReviewStatus::class);
46 46
     }
47 47
 
48
-    public function getStatusAttribute() {
48
+    public function getStatusAttribute(){
49 49
         return $this->review_status->translation;
50 50
     }
51 51
 }
Please login to merge, or discard this patch.