Conditions | 1 |
Paths | 1 |
Total Lines | 79 |
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 |
||
14 | public function run() |
||
15 | { |
||
16 | /** |
||
17 | * Insert the permissions related to users table. |
||
18 | */ |
||
19 | \DB::table('permissions')->insert( |
||
20 | [ |
||
21 | /** |
||
22 | * Users model permissions. |
||
23 | */ |
||
24 | [ |
||
25 | 'name' => 'index', |
||
26 | 'model' => 'user', |
||
27 | 'created_at' => \DB::raw('NOW()'), |
||
28 | 'updated_at' => \DB::raw('NOW()') |
||
29 | ], |
||
30 | [ |
||
31 | 'name' => 'find', |
||
32 | 'model' => 'user', |
||
33 | 'created_at' => \DB::raw('NOW()'), |
||
34 | 'updated_at' => \DB::raw('NOW()') |
||
35 | ], |
||
36 | [ |
||
37 | 'name' => 'insert', |
||
38 | 'model' => 'user', |
||
39 | 'created_at' => \DB::raw('NOW()'), |
||
40 | 'updated_at' => \DB::raw('NOW()') |
||
41 | ], |
||
42 | [ |
||
43 | 'name' => 'update', |
||
44 | 'model' => 'user', |
||
45 | 'created_at' => \DB::raw('NOW()'), |
||
46 | 'updated_at' => \DB::raw('NOW()') |
||
47 | ], |
||
48 | [ |
||
49 | 'name' => 'delete', |
||
50 | 'model' => 'user', |
||
51 | 'created_at' => \DB::raw('NOW()'), |
||
52 | 'updated_at' => \DB::raw('NOW()') |
||
53 | ], |
||
54 | [ |
||
55 | 'name' => 'deleted', |
||
56 | 'model' => 'user', |
||
57 | 'created_at' => \DB::raw('NOW()'), |
||
58 | 'updated_at' => \DB::raw('NOW()') |
||
59 | ], |
||
60 | [ |
||
61 | 'name' => 'restore', |
||
62 | 'model' => 'user', |
||
63 | 'created_at' => \DB::raw('NOW()'), |
||
64 | 'updated_at' => \DB::raw('NOW()') |
||
65 | ], |
||
66 | [ |
||
67 | 'name' => 'assignGroups', |
||
68 | 'model' => 'user', |
||
69 | 'created_at' => \DB::raw('NOW()'), |
||
70 | 'updated_at' => \DB::raw('NOW()') |
||
71 | ], |
||
72 | [ |
||
73 | 'name' => 'block', |
||
74 | 'model' => 'user', |
||
75 | 'created_at' => \DB::raw('NOW()'), |
||
76 | 'updated_at' => \DB::raw('NOW()') |
||
77 | ], |
||
78 | [ |
||
79 | 'name' => 'unblock', |
||
80 | 'model' => 'user', |
||
81 | 'created_at' => \DB::raw('NOW()'), |
||
82 | 'updated_at' => \DB::raw('NOW()') |
||
83 | ], |
||
84 | [ |
||
85 | 'name' => 'group', |
||
86 | 'model' => 'user', |
||
87 | 'created_at' => \DB::raw('NOW()'), |
||
88 | 'updated_at' => \DB::raw('NOW()') |
||
89 | ] |
||
90 | ] |
||
91 | ); |
||
92 | } |
||
93 | } |
||
94 |