Passed
Push — task/upgrade-to-laravel-8 ( 06df3c...4c1b1e )
by Chris
03:46
created

TalentStreamSeeder::run()   B

Complexity

Conditions 4
Paths 8

Size

Total Lines 96
Code Lines 55

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 55
nc 8
nop 0
dl 0
loc 96
rs 8.9818
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Database\Seeders;
4
5
use Illuminate\Database\Seeder;
6
use Illuminate\Support\Facades\DB;
7
8
class TalentStreamSeeder extends Seeder // phpcs:ignore
9
{
10
    /**
11
     * Run the Skills Classification seeds.
12
     *
13
     * @return void
14
     */
15
    public function run()
16
    {
17
        $talent_streams = [
18
            [
19
                'key' => 'communications',
20
                'name' => json_encode([
21
                    'en' => 'Communication Positions',
22
                    'fr' => 'Positions de communications'
23
                ])
24
            ],
25
            [
26
                'key' => 'it',
27
                'name' => json_encode([
28
                    'en' => 'IT Positions',
29
                    'fr' => 'Positions de IT'
30
                ])
31
            ],
32
            [
33
                'key' => 'admin',
34
                'name' => json_encode([
35
                    'en' => 'Administrative Positions',
36
                    'fr' => 'Postes administratifs'
37
                ])
38
            ],
39
        ];
40
        foreach ($talent_streams as $stream) {
41
            DB::table('talent_streams')->updateOrInsert(
42
                ['key' => $stream['key']],
43
                ['name' => $stream['name']]
44
            );
45
        }
46
47
        $talent_categories = [
48
            [
49
                'key' => 'social_media',
50
                'name' => json_encode([
51
                    'en' => 'Social Media',
52
                    'fr' => 'Les médias sociaux'
53
                ])
54
            ],
55
            [
56
                'key' => 'video',
57
                'name' => json_encode([
58
                    'en' => 'Video Editing',
59
                    'fr' => 'Montage vidéo'
60
                ])
61
            ],
62
            [
63
                'key' => 'web_dev',
64
                'name' => json_encode([
65
                    'en' => 'Web Development',
66
                    'fr' => 'Développement web'
67
                ])
68
            ],
69
            [
70
                'key' => 'dev_ops',
71
                'name' => json_encode([
72
                    'en' => 'Dev Ops',
73
                    'fr' => 'Dev Ops (FR)'
74
                ])
75
            ],
76
        ];
77
        foreach ($talent_categories as $category) {
78
            DB::table('talent_stream_categories')->updateOrInsert(
79
                ['key' => $category['key']],
80
                ['name' => $category['name']]
81
            );
82
        }
83
84
        $job_skill_levels = [
85
            [
86
                'key' => 'junior',
87
                'name' => json_encode([
88
                    'en' => 'Junior',
89
                    'fr' => 'Junior'
90
                ])
91
            ],
92
            [
93
                'key' => 'medium',
94
                'name' => json_encode([
95
                    'en' => 'Mid Level',
96
                    'fr' => 'Niveau moyen'
97
                ])
98
            ],
99
            [
100
                'key' => 'expert',
101
                'name' => json_encode([
102
                    'en' => 'Expert',
103
                    'fr' => 'Expert'
104
                ])
105
            ],
106
        ];
107
        foreach ($job_skill_levels as $skill_level) {
108
            DB::table('job_skill_levels')->updateOrInsert(
109
                ['key' => $skill_level['key']],
110
                ['name' => $skill_level['name']]
111
            );
112
        }
113
    }
114
}
115