Conditions | 4 |
Paths | 8 |
Total Lines | 96 |
Code Lines | 55 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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:
If many parameters/temporary variables are present:
1 | <?php |
||
12 | public function run() |
||
13 | { |
||
14 | $talent_streams = [ |
||
15 | [ |
||
16 | 'key' => 'communications', |
||
17 | 'name' => json_encode([ |
||
18 | 'en' => 'Communication Positions', |
||
19 | 'fr' => 'Positions de communications' |
||
20 | ]) |
||
21 | ], |
||
22 | [ |
||
23 | 'key' => 'it', |
||
24 | 'name' => json_encode([ |
||
25 | 'en' => 'IT Positions', |
||
26 | 'fr' => 'Positions de IT' |
||
27 | ]) |
||
28 | ], |
||
29 | [ |
||
30 | 'key' => 'admin', |
||
31 | 'name' => json_encode([ |
||
32 | 'en' => 'Administrative Positions', |
||
33 | 'fr' => 'Postes administratifs' |
||
34 | ]) |
||
35 | ], |
||
36 | ]; |
||
37 | foreach ($talent_streams as $stream) { |
||
38 | DB::table('talent_streams')->updateOrInsert( |
||
39 | ['key' => $stream['key']], |
||
40 | ['name' => $stream['name']] |
||
41 | ); |
||
42 | } |
||
43 | |||
44 | $talent_categories = [ |
||
45 | [ |
||
46 | 'key' => 'social_media', |
||
47 | 'name' => json_encode([ |
||
48 | 'en' => 'Social Media', |
||
49 | 'fr' => 'Les médias sociaux' |
||
50 | ]) |
||
51 | ], |
||
52 | [ |
||
53 | 'key' => 'video', |
||
54 | 'name' => json_encode([ |
||
55 | 'en' => 'Video Editing', |
||
56 | 'fr' => 'Montage vidéo' |
||
57 | ]) |
||
58 | ], |
||
59 | [ |
||
60 | 'key' => 'web_dev', |
||
61 | 'name' => json_encode([ |
||
62 | 'en' => 'Web Development', |
||
63 | 'fr' => 'Développement web' |
||
64 | ]) |
||
65 | ], |
||
66 | [ |
||
67 | 'key' => 'dev_ops', |
||
68 | 'name' => json_encode([ |
||
69 | 'en' => 'Dev Ops', |
||
70 | 'fr' => 'Dev Ops (FR)' |
||
71 | ]) |
||
72 | ], |
||
73 | ]; |
||
74 | foreach ($talent_categories as $category) { |
||
75 | DB::table('talent_stream_categories')->updateOrInsert( |
||
76 | ['key' => $category['key']], |
||
77 | ['name' => $category['name']] |
||
78 | ); |
||
79 | } |
||
80 | |||
81 | $job_skill_levels = [ |
||
82 | [ |
||
83 | 'key' => 'junior', |
||
84 | 'name' => json_encode([ |
||
85 | 'en' => 'Junior', |
||
86 | 'fr' => 'Junior' |
||
87 | ]) |
||
88 | ], |
||
89 | [ |
||
90 | 'key' => 'medium', |
||
91 | 'name' => json_encode([ |
||
92 | 'en' => 'Mid Level', |
||
93 | 'fr' => 'Niveau moyen' |
||
94 | ]) |
||
95 | ], |
||
96 | [ |
||
97 | 'key' => 'expert', |
||
98 | 'name' => json_encode([ |
||
99 | 'en' => 'Expert', |
||
100 | 'fr' => 'Expert' |
||
101 | ]) |
||
102 | ], |
||
103 | ]; |
||
104 | foreach ($job_skill_levels as $skill_level) { |
||
105 | DB::table('job_skill_levels')->updateOrInsert( |
||
106 | ['key' => $skill_level['key']], |
||
107 | ['name' => $skill_level['name']] |
||
108 | ); |
||
112 |