Conditions | 1 |
Paths | 1 |
Total Lines | 137 |
Code Lines | 81 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
19 | public function run() |
||
20 | { |
||
21 | $data = [ |
||
22 | [ |
||
23 | 'id' => 1, |
||
24 | 'smiley_id' => 1, |
||
25 | 'code' => ':-)', |
||
26 | ], |
||
27 | [ |
||
28 | 'id' => 2, |
||
29 | 'smiley_id' => 1, |
||
30 | 'code' => ':)', |
||
31 | ], |
||
32 | [ |
||
33 | 'id' => 3, |
||
34 | 'smiley_id' => 2, |
||
35 | 'code' => ':-D', |
||
36 | ], |
||
37 | [ |
||
38 | 'id' => 4, |
||
39 | 'smiley_id' => 2, |
||
40 | 'code' => ':D', |
||
41 | ], |
||
42 | [ |
||
43 | 'id' => 5, |
||
44 | 'smiley_id' => 3, |
||
45 | 'code' => ';-)', |
||
46 | ], |
||
47 | [ |
||
48 | 'id' => 6, |
||
49 | 'smiley_id' => 3, |
||
50 | 'code' => ';)', |
||
51 | ], |
||
52 | [ |
||
53 | 'id' => 7, |
||
54 | 'smiley_id' => 4, |
||
55 | 'code' => 'O:]', |
||
56 | ], |
||
57 | [ |
||
58 | 'id' => 8, |
||
59 | 'smiley_id' => 5, |
||
60 | 'code' => '(-.-)zzZ', |
||
61 | ], |
||
62 | [ |
||
63 | 'id' => 9, |
||
64 | 'smiley_id' => 6, |
||
65 | 'code' => 'B-)', |
||
66 | ], |
||
67 | [ |
||
68 | 'id' => 10, |
||
69 | 'smiley_id' => 7, |
||
70 | 'code' => ':-*', |
||
71 | ], |
||
72 | [ |
||
73 | 'id' => 11, |
||
74 | 'smiley_id' => 8, |
||
75 | 'code' => ':grinw:', |
||
76 | ], |
||
77 | [ |
||
78 | 'id' => 12, |
||
79 | 'smiley_id' => 9, |
||
80 | 'code' => '[_]P', |
||
81 | ], |
||
82 | [ |
||
83 | 'id' => 13, |
||
84 | 'smiley_id' => 9, |
||
85 | 'code' => ':coffee:', |
||
86 | ], |
||
87 | [ |
||
88 | 'id' => 14, |
||
89 | 'smiley_id' => 10, |
||
90 | 'code' => ':P', |
||
91 | ], |
||
92 | [ |
||
93 | 'id' => 15, |
||
94 | 'smiley_id' => 10, |
||
95 | 'code' => ':-P', |
||
96 | ], |
||
97 | [ |
||
98 | 'id' => 16, |
||
99 | 'smiley_id' => 11, |
||
100 | 'code' => ':evil:', |
||
101 | ], |
||
102 | [ |
||
103 | 'id' => 17, |
||
104 | 'smiley_id' => 12, |
||
105 | 'code' => ':blush:', |
||
106 | ], |
||
107 | [ |
||
108 | 'id' => 18, |
||
109 | 'smiley_id' => 13, |
||
110 | 'code' => ':-O', |
||
111 | ], |
||
112 | [ |
||
113 | 'id' => 19, |
||
114 | 'smiley_id' => 14, |
||
115 | 'code' => ':emba:', |
||
116 | ], |
||
117 | [ |
||
118 | 'id' => 20, |
||
119 | 'smiley_id' => 14, |
||
120 | 'code' => ':oops:', |
||
121 | ], |
||
122 | [ |
||
123 | 'id' => 21, |
||
124 | 'smiley_id' => 15, |
||
125 | 'code' => ':-(', |
||
126 | ], |
||
127 | [ |
||
128 | 'id' => 22, |
||
129 | 'smiley_id' => 15, |
||
130 | 'code' => ':(', |
||
131 | ], |
||
132 | [ |
||
133 | 'id' => 23, |
||
134 | 'smiley_id' => 16, |
||
135 | 'code' => ':cry:', |
||
136 | ], |
||
137 | [ |
||
138 | 'id' => 24, |
||
139 | 'smiley_id' => 16, |
||
140 | 'code' => ':\'(', |
||
141 | ], |
||
142 | [ |
||
143 | 'id' => 25, |
||
144 | 'smiley_id' => 17, |
||
145 | 'code' => ':angry:', |
||
146 | ], |
||
147 | [ |
||
148 | 'id' => 26, |
||
149 | 'smiley_id' => 17, |
||
150 | 'code' => ':shout:', |
||
151 | ] |
||
152 | ]; |
||
153 | |||
154 | $table = $this->table('smiley_codes'); |
||
155 | $table->insert($data)->save(); |
||
156 | } |
||
158 |