Passed
Push — bugfix/random-ui-stuff ( 310aaf...d6d2ab )
by Josh
60:17 queued 49:01
created
app/Http/Controllers/Api/DepartmentController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
      *
13 13
      * @return mixed
14 14
      */
15
-    public function index()
15
+    public function index ()
16 16
     {
17
-        return Department::all()->map->toApiArray();
17
+        return Department::all ()->map->toApiArray ();
18 18
     }
19 19
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Api/JobTaskController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
      * @param  JobPosterKeyTask $model Incoming Job Poster Key Task object.
16 16
      * @return array
17 17
      */
18
-    public function toApiArray(JobPosterKeyTask $model)
18
+    public function toApiArray (JobPosterKeyTask $model)
19 19
     {
20
-        return array_merge($model->toArray(), $model->getTranslationsArray());
20
+        return array_merge ($model->toArray (), $model->getTranslationsArray ());
21 21
     }
22 22
 
23
-    public function indexByJob(JobPoster $jobPoster)
23
+    public function indexByJob (JobPoster $jobPoster)
24 24
     {
25 25
         $toApiArray = array($this, 'toApiArray');
26
-        $taskArray = JobPosterKeyTask::where('job_poster_id', $jobPoster->id)->get()->map($toApiArray);
27
-        return response()->json($taskArray);
26
+        $taskArray = JobPosterKeyTask::where ('job_poster_id', $jobPoster->id)->get ()->map ($toApiArray);
27
+        return response ()->json ($taskArray);
28 28
     }
29 29
 
30 30
     /**
@@ -34,39 +34,39 @@  discard block
 block discarded – undo
34 34
      * @param  \App\Models\JobPoster                 $jobPoster Incoming Job Poster object.
35 35
      * @return \Illuminate\Http\Response
36 36
      */
37
-    public function batchUpdate(BatchUpdateJobTask $request, JobPoster $jobPoster)
37
+    public function batchUpdate (BatchUpdateJobTask $request, JobPoster $jobPoster)
38 38
     {
39 39
         $toApiArray = array($this, 'toApiArray');
40 40
 
41
-        $newTasks = collect($request->validated()); // Collection of JobPosterKeyTasks.
41
+        $newTasks = collect ($request->validated ()); // Collection of JobPosterKeyTasks.
42 42
         $oldTasks = $jobPoster->job_poster_key_tasks;
43 43
 
44 44
         $savedNewTaskIds = [];
45 45
 
46 46
         // First, delete old tasks that weren't resubmitted, and update those that were.
47 47
         foreach ($oldTasks as $task) {
48
-            $newTask = $newTasks->firstWhere('id', $task['id']);
48
+            $newTask = $newTasks->firstWhere ('id', $task['id']);
49 49
             if ($newTask) {
50 50
                 $savedNewTaskIds[] = $newTask['id'];
51
-                $task->fill(collect($newTask)->only(['en', 'fr'])->toArray());
52
-                $task->save();
51
+                $task->fill (collect ($newTask)->only (['en', 'fr'])->toArray ());
52
+                $task->save ();
53 53
             } else {
54
-                $task->delete();
54
+                $task->delete ();
55 55
             }
56 56
         }
57 57
 
58 58
         // Now, save any new tasks that remain.
59 59
         foreach ($newTasks as $task) {
60
-            if ($this->isUnsaved($task, $savedNewTaskIds)) {
61
-                $jobPosterTask = new JobPosterKeyTask();
60
+            if ($this->isUnsaved ($task, $savedNewTaskIds)) {
61
+                $jobPosterTask = new JobPosterKeyTask ();
62 62
                 $jobPosterTask->job_poster_id = $jobPoster->id;
63
-                $jobPosterTask->fill(collect($task)->only(['en', 'fr'])->toArray());
64
-                $jobPosterTask->save();
63
+                $jobPosterTask->fill (collect ($task)->only (['en', 'fr'])->toArray ());
64
+                $jobPosterTask->save ();
65 65
             }
66 66
         }
67 67
 
68
-        $taskArray = $jobPoster->fresh()->job_poster_key_tasks->map($toApiArray);
69
-        return response()->json($taskArray);
68
+        $taskArray = $jobPoster->fresh ()->job_poster_key_tasks->map ($toApiArray);
69
+        return response ()->json ($taskArray);
70 70
     }
71 71
 
72 72
     /**
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
      * @param number[] $savedTaskIds Array of saved task IDs.
77 77
      * @return boolean
78 78
      */
79
-    private function isUnsaved($task, array $savedTaskIds): bool
79
+    private function isUnsaved ($task, array $savedTaskIds): bool
80 80
     {
81
-        return !array_key_exists('id', $task) || !in_array($task['id'], $savedTaskIds);
81
+        return !array_key_exists ('id', $task) || !in_array ($task['id'], $savedTaskIds);
82 82
     }
83 83
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Api/SkillController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,23 +12,23 @@
 block discarded – undo
12 12
      *
13 13
      * @return mixed
14 14
      */
15
-    public function index()
15
+    public function index ()
16 16
     {
17
-        $skills = Skill::with('classifications')->get();
17
+        $skills = Skill::with ('classifications')->get ();
18 18
         $skillsArray = [];
19 19
         // TODO: improve effiency of getting translations.
20 20
         foreach ($skills as $skill) {
21 21
             $translations = [
22 22
                 'en' => [
23
-                    'name' => $skill->getTranslation('name', 'en'),
24
-                    'description' => $skill->getTranslation('description', 'en'),
23
+                    'name' => $skill->getTranslation ('name', 'en'),
24
+                    'description' => $skill->getTranslation ('description', 'en'),
25 25
                 ],
26 26
                 'fr' => [
27
-                    'name' => $skill->getTranslation('name', 'fr'),
28
-                    'description' => $skill->getTranslation('description', 'fr'),
27
+                    'name' => $skill->getTranslation ('name', 'fr'),
28
+                    'description' => $skill->getTranslation ('description', 'fr'),
29 29
                 ]
30 30
             ];
31
-            $skillsArray[] = array_merge($skill->toArray(), $translations);
31
+            $skillsArray[] = array_merge ($skill->toArray (), $translations);
32 32
         }
33 33
         return ['skills' => $skillsArray];
34 34
     }
Please login to merge, or discard this patch.
app/Http/Controllers/WorkExperienceController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,17 +14,17 @@
 block discarded – undo
14 14
      * @param  \App\Models\WorkExperience $workExperience Incoming Work Experience.
15 15
      * @return \Illuminate\Http\Response
16 16
      */
17
-    public function destroy(Request $request, WorkExperience $workExperience)
17
+    public function destroy (Request $request, WorkExperience $workExperience)
18 18
     {
19
-        $this->authorize('delete', $workExperience);
20
-        $workExperience->delete();
19
+        $this->authorize ('delete', $workExperience);
20
+        $workExperience->delete ();
21 21
 
22
-        if ($request->ajax()) {
22
+        if ($request->ajax ()) {
23 23
             return [
24 24
                 'message' => 'Work Experience delete',
25 25
             ];
26 26
         }
27 27
 
28
-        return back();
28
+        return back ();
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
app/Http/Controllers/RatingGuideQuestionController.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -17,31 +17,31 @@  discard block
 block discarded – undo
17 17
      * @throws \InvalidArgumentException For missing $question.
18 18
      * @return mixed
19 19
      */
20
-    public function store(Request $request)
20
+    public function store (Request $request)
21 21
     {
22
-        $this->authorize('create', RatingGuideQuestion::class);
22
+        $this->authorize ('create', RatingGuideQuestion::class);
23 23
 
24
-        $job_poster_id = (int)$request->json('job_poster_id');
25
-        $assessment_type_id = (int)$request->json('assessment_type_id');
26
-        $question = $request->json('question');
24
+        $job_poster_id = (int) $request->json ('job_poster_id');
25
+        $assessment_type_id = (int) $request->json ('assessment_type_id');
26
+        $question = $request->json ('question');
27 27
 
28
-        JobPoster::findOrFail($job_poster_id);
29
-        AssessmentType::findOrFail($assessment_type_id);
28
+        JobPoster::findOrFail ($job_poster_id);
29
+        AssessmentType::findOrFail ($assessment_type_id);
30 30
 
31
-        $ratingGuideQuestion = new RatingGuideQuestion([
31
+        $ratingGuideQuestion = new RatingGuideQuestion ([
32 32
             'job_poster_id' => $job_poster_id,
33 33
             'assessment_type_id' => $assessment_type_id,
34 34
             'question' => $question,
35 35
         ]);
36 36
         // Check that this user is allowed to create an Assessment for this criterion.
37
-        $this->authorize('update', $ratingGuideQuestion);
37
+        $this->authorize ('update', $ratingGuideQuestion);
38 38
 
39
-        $ratingGuideQuestion->save();
40
-        $ratingGuideQuestion->refresh();
39
+        $ratingGuideQuestion->save ();
40
+        $ratingGuideQuestion->refresh ();
41 41
 
42 42
         return [
43 43
             'success' => "Successfully created rating guide question $ratingGuideQuestion->id",
44
-            'rating_guide_question' => $ratingGuideQuestion->toArray(),
44
+            'rating_guide_question' => $ratingGuideQuestion->toArray (),
45 45
         ];
46 46
     }
47 47
 
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
      * @param  \App\Models\RatingGuideQuestion $ratingGuideQuestion Incoming object.
52 52
      * @return mixed
53 53
      */
54
-    public function show(RatingGuideQuestion $ratingGuideQuestion)
54
+    public function show (RatingGuideQuestion $ratingGuideQuestion)
55 55
     {
56
-        $this->authorize('view', $ratingGuideQuestion);
57
-        $ratingGuideQuestion->load([
56
+        $this->authorize ('view', $ratingGuideQuestion);
57
+        $ratingGuideQuestion->load ([
58 58
             'job_poster',
59 59
             'assessment_type'
60 60
         ]);
61
-        return $ratingGuideQuestion->toArray();
61
+        return $ratingGuideQuestion->toArray ();
62 62
     }
63 63
 
64 64
     /**
@@ -69,25 +69,25 @@  discard block
 block discarded – undo
69 69
      * @throws \InvalidArgumentException For missing $question.
70 70
      * @return mixed
71 71
      */
72
-    public function update(Request $request, RatingGuideQuestion $ratingGuideQuestion)
72
+    public function update (Request $request, RatingGuideQuestion $ratingGuideQuestion)
73 73
     {
74
-        $this->authorize('update', $ratingGuideQuestion);
74
+        $this->authorize ('update', $ratingGuideQuestion);
75 75
 
76
-        $job_poster_id = (int)$request->json('job_poster_id');
77
-        $assessment_type_id = (int)$request->json('assessment_type_id');
78
-        $question = $request->json('question');
76
+        $job_poster_id = (int) $request->json ('job_poster_id');
77
+        $assessment_type_id = (int) $request->json ('assessment_type_id');
78
+        $question = $request->json ('question');
79 79
 
80
-        JobPoster::findOrFail($job_poster_id);
81
-        AssessmentType::findOrFail($assessment_type_id);
80
+        JobPoster::findOrFail ($job_poster_id);
81
+        AssessmentType::findOrFail ($assessment_type_id);
82 82
 
83 83
         $ratingGuideQuestion->job_poster_id = $job_poster_id;
84 84
         $ratingGuideQuestion->assessment_type_id = $assessment_type_id;
85 85
         $ratingGuideQuestion->question = $question;
86
-        $ratingGuideQuestion->save();
86
+        $ratingGuideQuestion->save ();
87 87
 
88 88
         return [
89 89
             'success' => "Successfully updated rating guide question $ratingGuideQuestion->id",
90
-            'rating_guide_question' => $ratingGuideQuestion->toArray(),
90
+            'rating_guide_question' => $ratingGuideQuestion->toArray (),
91 91
         ];
92 92
     }
93 93
 
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
      * @param  \App\Models\RatingGuideQuestion $ratingGuideQuestion Incoming object.
98 98
      * @return mixed
99 99
      */
100
-    public function destroy(RatingGuideQuestion $ratingGuideQuestion)
100
+    public function destroy (RatingGuideQuestion $ratingGuideQuestion)
101 101
     {
102
-        $this->authorize('delete', $ratingGuideQuestion);
103
-        $ratingGuideQuestion->delete();
102
+        $this->authorize ('delete', $ratingGuideQuestion);
103
+        $ratingGuideQuestion->delete ();
104 104
 
105 105
         return [
106 106
             'success' => "Successfully deleted rating guide question $ratingGuideQuestion->id"
Please login to merge, or discard this patch.
app/Http/Controllers/Controller.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 {
12 12
     use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
13 13
 
14
-    public function getRelativeIds($input, $relativeType)
14
+    public function getRelativeIds ($input, $relativeType)
15 15
     {
16 16
         $relativeIds = [];
17 17
         if (isset($input['relatives'])) {
@@ -25,30 +25,30 @@  discard block
 block discarded – undo
25 25
         return $relativeIds;
26 26
     }
27 27
 
28
-    public function shiftFirstLevelArrayKeysToBottom(array $nestedArray)
28
+    public function shiftFirstLevelArrayKeysToBottom (array $nestedArray)
29 29
     {
30
-        $expandedArray = $this->expandNestedArraysIntoKeyListAndValue($nestedArray);
31
-        $rotatedArray = $this->rotateKeys($expandedArray, 1);
32
-        $mergedArray = $this->mergeExpandedTrees($rotatedArray);
30
+        $expandedArray = $this->expandNestedArraysIntoKeyListAndValue ($nestedArray);
31
+        $rotatedArray = $this->rotateKeys ($expandedArray, 1);
32
+        $mergedArray = $this->mergeExpandedTrees ($rotatedArray);
33 33
         return $mergedArray;
34 34
     }
35 35
 
36
-    protected function addKeyAsFinalIndex($finalKey, $array)
36
+    protected function addKeyAsFinalIndex ($finalKey, $array)
37 37
     {
38
-        if (!is_array($array)) {
38
+        if (!is_array ($array)) {
39 39
             return [$finalKey => $array];
40 40
         } else {
41 41
             $newArray = [];
42 42
             foreach ($array as $key => $value) {
43
-                $newArray[$key] = $this->addKeyAsFinalIndex($finalKey, $value);
43
+                $newArray[$key] = $this->addKeyAsFinalIndex ($finalKey, $value);
44 44
             }
45 45
             return $newArray;
46 46
         }
47 47
     }
48 48
 
49
-    protected function expandNestedArraysIntoKeyListAndValue($nestedArray)
49
+    protected function expandNestedArraysIntoKeyListAndValue ($nestedArray)
50 50
     {
51
-        if (!is_array($nestedArray)) {
51
+        if (!is_array ($nestedArray)) {
52 52
             $expandedArray = [
53 53
                 [
54 54
                     'keys' => [],
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
         } else {
60 60
             $expandedArray = [];
61 61
             foreach ($nestedArray as $key => $value) {
62
-                $subArray = $this->expandNestedArraysIntoKeyListAndValue($value);
62
+                $subArray = $this->expandNestedArraysIntoKeyListAndValue ($value);
63 63
                 foreach ($subArray as $item) {
64
-                    array_unshift($item['keys'], $key);
64
+                    array_unshift ($item['keys'], $key);
65 65
                     $expandedArray[] = $item;
66 66
                 }
67 67
             }
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
         }
70 70
     }
71 71
 
72
-    protected function mergeExpandedTrees($expandedArray)
72
+    protected function mergeExpandedTrees ($expandedArray)
73 73
     {
74 74
         $mergedArray = [];
75 75
         foreach ($expandedArray as $item) {
76 76
             $tail = &$mergedArray;
77
-            $size = count($item['keys']);
77
+            $size = count ($item['keys']);
78 78
             $i = 0;
79 79
             foreach ($item['keys'] as $key) {
80 80
                 $i = ($i + 1);
@@ -82,17 +82,17 @@  discard block
 block discarded – undo
82 82
                 if ($i == ($size)) {
83 83
                     if (!isset($tail[$key])) {
84 84
                         $tail[$key] = $item['value'];
85
-                    } elseif (!is_array($tail[$key])) {
85
+                    } elseif (!is_array ($tail[$key])) {
86 86
                         $value = $tail[$key];
87 87
                         $tail[$key] = [$value, $item['value']];
88 88
                     } else {
89
-                        array_push($tail[$key], $item['value']);
89
+                        array_push ($tail[$key], $item['value']);
90 90
                     }
91 91
                 } else {
92 92
                     // If this is not the last key, it needs to contain an array.
93 93
                     if (!isset($tail[$key])) {
94 94
                         $tail[$key] = [];
95
-                    } elseif (!is_array($tail[$key])) {
95
+                    } elseif (!is_array ($tail[$key])) {
96 96
                         $value = $tail[$key];
97 97
                         $tail[$key] = [$value];
98 98
                     }
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
         return $mergedArray;
104 104
     }
105 105
 
106
-    protected function rotateKeys($expandedArray, $steps)
106
+    protected function rotateKeys ($expandedArray, $steps)
107 107
     {
108 108
         $rotatedArray = [];
109 109
         foreach ($expandedArray as $item) {
110
-            for ($i=0; $i<$steps; $i++) {
111
-                array_push($item['keys'], array_shift($item['keys']));
110
+            for ($i = 0; $i < $steps; $i++) {
111
+                array_push ($item['keys'], array_shift ($item['keys']));
112 112
             }
113 113
             $rotatedArray[] = $item;
114 114
         }
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
      * @param string[] $content The array being returned in response.
122 122
      * @return \Illuminate\Http\Response
123 123
      */
124
-    protected function formatAjaxResponse(array $content)
124
+    protected function formatAjaxResponse (array $content)
125 125
     {
126
-        return response()->json($content);
126
+        return response ()->json ($content);
127 127
     }
128 128
 }
Please login to merge, or discard this patch.
app/Http/Requests/DepartmentCrudRequest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
      *
12 12
      * @return boolean
13 13
      */
14
-    public function authorize() : bool
14
+    public function authorize () : bool
15 15
     {
16 16
         // Only allow updates if the user is a logged in Admin.
17
-        return backpack_auth()->check();
17
+        return backpack_auth ()->check ();
18 18
     }
19 19
 
20 20
     /**
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      *
23 23
      * @return string[]
24 24
      */
25
-    public function rules() : array
25
+    public function rules () : array
26 26
     {
27 27
         return [
28 28
             'name' => 'required',
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      *
36 36
      * @return string[]
37 37
      */
38
-    public function messages() : array
38
+    public function messages () : array
39 39
     {
40 40
         return [
41 41
             'name.required' => 'Please enter a department name.',
Please login to merge, or discard this patch.
app/Http/Requests/StoreJobPoster.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@
 block discarded – undo
11 11
      *
12 12
      * @return boolean
13 13
      */
14
-    public function authorize(): bool
14
+    public function authorize (): bool
15 15
     {
16 16
         // The STORE job poster method requires the user's manager id.
17
-        return $this->user()->manager !== null;
17
+        return $this->user ()->manager !== null;
18 18
     }
19 19
 }
Please login to merge, or discard this patch.
app/Http/Requests/BatchUpdateCriteria.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      *
16 16
      * @return boolean
17 17
      */
18
-    public function authorize(): bool
18
+    public function authorize (): bool
19 19
     {
20 20
         return true;
21 21
     }
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @return string[]
27 27
      */
28
-    public function rules(): array
28
+    public function rules (): array
29 29
     {
30 30
         return [
31 31
             '*.id' => 'present',
32
-            '*.criteria_type_id' => ['required', new ValidIdRule(CriteriaType::class)],
33
-            '*.skill_id' => ['required', new ValidIdRule(Skill::class)],
34
-            '*.skill_level_id' => ['required', new ValidIdRule(SkillLevel::class)],
32
+            '*.criteria_type_id' => ['required', new ValidIdRule (CriteriaType::class)],
33
+            '*.skill_id' => ['required', new ValidIdRule (Skill::class)],
34
+            '*.skill_level_id' => ['required', new ValidIdRule (SkillLevel::class)],
35 35
             '*.en.description' => 'nullable|string',
36 36
             '*.en.specificity' => 'nullable|string',
37 37
             '*.fr.description' => 'nullable|string',
Please login to merge, or discard this patch.