Conditions | 2 |
Paths | 2 |
Total Lines | 208 |
Code Lines | 178 |
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 |
||
11 | public function run(): void |
||
12 | { |
||
13 | //Action when run the seed |
||
14 | |||
15 | $data = [ |
||
16 | 0 => [ |
||
17 | 'id' => 1, |
||
18 | 'code' => 'permission_list', |
||
19 | 'description' => 'View permissions', |
||
20 | 'depend' => NULL, |
||
21 | 'created_at' => '2023-12-06 00:21:14', |
||
22 | 'updated_at' => NULL, |
||
23 | ], |
||
24 | 1 => [ |
||
25 | 'id' => 2, |
||
26 | 'code' => 'permission_create', |
||
27 | 'description' => 'Create permission', |
||
28 | 'depend' => 'permission_list', |
||
29 | 'created_at' => '2023-12-06 00:38:47', |
||
30 | 'updated_at' => NULL, |
||
31 | ], |
||
32 | 2 => [ |
||
33 | 'id' => 3, |
||
34 | 'code' => 'permission_detail', |
||
35 | 'description' => 'View detail permission', |
||
36 | 'depend' => 'permission_list', |
||
37 | 'created_at' => '2023-12-06 00:39:33', |
||
38 | 'updated_at' => NULL, |
||
39 | ], |
||
40 | 3 => [ |
||
41 | 'id' => 4, |
||
42 | 'code' => 'permission_update', |
||
43 | 'description' => 'Edit permission', |
||
44 | 'depend' => 'permission_detail', |
||
45 | 'created_at' => '2023-12-06 00:39:54', |
||
46 | 'updated_at' => NULL, |
||
47 | ], |
||
48 | 4 => [ |
||
49 | 'id' => 5, |
||
50 | 'code' => 'permission_delete', |
||
51 | 'description' => 'Delete permission', |
||
52 | 'depend' => 'permission_detail', |
||
53 | 'created_at' => '2023-12-06 00:40:11', |
||
54 | 'updated_at' => '2023-12-06 00:46:18', |
||
55 | ], |
||
56 | 5 => [ |
||
57 | 'id' => 6, |
||
58 | 'code' => 'role_list', |
||
59 | 'description' => 'View roles', |
||
60 | 'depend' => NULL, |
||
61 | 'created_at' => '2023-12-06 00:21:14', |
||
62 | 'updated_at' => NULL, |
||
63 | ], |
||
64 | 6 => [ |
||
65 | 'id' => 7, |
||
66 | 'code' => 'role_create', |
||
67 | 'description' => 'Create role', |
||
68 | 'depend' => 'role_list', |
||
69 | 'created_at' => '2023-12-06 00:38:47', |
||
70 | 'updated_at' => NULL, |
||
71 | ], |
||
72 | 7 => [ |
||
73 | 'id' => 8, |
||
74 | 'code' => 'role_detail', |
||
75 | 'description' => 'View detail role', |
||
76 | 'depend' => 'role_list', |
||
77 | 'created_at' => '2023-12-06 00:39:33', |
||
78 | 'updated_at' => NULL, |
||
79 | ], |
||
80 | 8 => [ |
||
81 | 'id' => 9, |
||
82 | 'code' => 'role_update', |
||
83 | 'description' => 'Edit role', |
||
84 | 'depend' => 'role_detail', |
||
85 | 'created_at' => '2023-12-06 00:39:54', |
||
86 | 'updated_at' => NULL, |
||
87 | ], |
||
88 | 9 => [ |
||
89 | 'id' => 10, |
||
90 | 'code' => 'role_delete', |
||
91 | 'description' => 'Delete role', |
||
92 | 'depend' => 'role_detail', |
||
93 | 'created_at' => '2023-12-06 00:40:11', |
||
94 | 'updated_at' => '2023-12-06 00:46:18', |
||
95 | ], |
||
96 | 10 => [ |
||
97 | 'id' => 11, |
||
98 | 'code' => 'user_list', |
||
99 | 'description' => 'View users', |
||
100 | 'depend' => NULL, |
||
101 | 'created_at' => '2023-12-06 00:21:14', |
||
102 | 'updated_at' => NULL, |
||
103 | ], |
||
104 | 11 => [ |
||
105 | 'id' => 12, |
||
106 | 'code' => 'user_create', |
||
107 | 'description' => 'Create user', |
||
108 | 'depend' => 'user_list', |
||
109 | 'created_at' => '2023-12-06 00:38:47', |
||
110 | 'updated_at' => NULL, |
||
111 | ], |
||
112 | 12 => [ |
||
113 | 'id' => 13, |
||
114 | 'code' => 'user_detail', |
||
115 | 'description' => 'View detail user', |
||
116 | 'depend' => 'user_list', |
||
117 | 'created_at' => '2023-12-06 00:39:33', |
||
118 | 'updated_at' => NULL, |
||
119 | ], |
||
120 | 13 => [ |
||
121 | 'id' => 14, |
||
122 | 'code' => 'user_update', |
||
123 | 'description' => 'Edit user', |
||
124 | 'depend' => 'user_detail', |
||
125 | 'created_at' => '2023-12-06 00:39:54', |
||
126 | 'updated_at' => NULL, |
||
127 | ], |
||
128 | 14 => [ |
||
129 | 'id' => 15, |
||
130 | 'code' => 'user_delete', |
||
131 | 'description' => 'Delete user', |
||
132 | 'depend' => 'user_detail', |
||
133 | 'created_at' => '2023-12-06 00:40:11', |
||
134 | 'updated_at' => '2023-12-06 00:46:18', |
||
135 | ], |
||
136 | 15 => [ |
||
137 | 'id' => 16, |
||
138 | 'code' => 'product_category_list', |
||
139 | 'description' => 'View product categories', |
||
140 | 'depend' => NULL, |
||
141 | 'created_at' => '2023-12-06 00:21:14', |
||
142 | 'updated_at' => NULL, |
||
143 | ], |
||
144 | 16 => [ |
||
145 | 'id' => 17, |
||
146 | 'code' => 'product_category_create', |
||
147 | 'description' => 'Create product category', |
||
148 | 'depend' => 'product_category_list', |
||
149 | 'created_at' => '2023-12-06 00:38:47', |
||
150 | 'updated_at' => NULL, |
||
151 | ], |
||
152 | 17 => [ |
||
153 | 'id' => 18, |
||
154 | 'code' => 'product_category_detail', |
||
155 | 'description' => 'View detail product category', |
||
156 | 'depend' => 'product_category_list', |
||
157 | 'created_at' => '2023-12-06 00:39:33', |
||
158 | 'updated_at' => NULL, |
||
159 | ], |
||
160 | 18 => [ |
||
161 | 'id' => 19, |
||
162 | 'code' => 'product_category_update', |
||
163 | 'description' => 'Edit product category', |
||
164 | 'depend' => 'product_category_detail', |
||
165 | 'created_at' => '2023-12-06 00:39:54', |
||
166 | 'updated_at' => NULL, |
||
167 | ], |
||
168 | 19 => [ |
||
169 | 'id' => 20, |
||
170 | 'code' => 'product_category_delete', |
||
171 | 'description' => 'Delete product category', |
||
172 | 'depend' => 'product_category_detail', |
||
173 | 'created_at' => '2023-12-06 00:40:11', |
||
174 | 'updated_at' => '2023-12-06 00:46:18', |
||
175 | ], |
||
176 | 20 => [ |
||
177 | 'id' => 21, |
||
178 | 'code' => 'product_list', |
||
179 | 'description' => 'View products', |
||
180 | 'depend' => NULL, |
||
181 | 'created_at' => '2023-12-06 00:21:14', |
||
182 | 'updated_at' => NULL, |
||
183 | ], |
||
184 | 21 => [ |
||
185 | 'id' => 22, |
||
186 | 'code' => 'product_create', |
||
187 | 'description' => 'Create product', |
||
188 | 'depend' => 'product_list', |
||
189 | 'created_at' => '2023-12-06 00:38:47', |
||
190 | 'updated_at' => NULL, |
||
191 | ], |
||
192 | 22 => [ |
||
193 | 'id' => 23, |
||
194 | 'code' => 'product_detail', |
||
195 | 'description' => 'View detail product', |
||
196 | 'depend' => 'product_list', |
||
197 | 'created_at' => '2023-12-06 00:39:33', |
||
198 | 'updated_at' => NULL, |
||
199 | ], |
||
200 | 23 => [ |
||
201 | 'id' => 24, |
||
202 | 'code' => 'product_update', |
||
203 | 'description' => 'Edit product', |
||
204 | 'depend' => 'product_detail', |
||
205 | 'created_at' => '2023-12-06 00:39:54', |
||
206 | 'updated_at' => NULL, |
||
207 | ], |
||
208 | 24 => [ |
||
209 | 'id' => 25, |
||
210 | 'code' => 'product_delete', |
||
211 | 'description' => 'Delete product', |
||
212 | 'depend' => 'product_detail', |
||
213 | 'created_at' => '2023-12-06 00:40:11', |
||
214 | 'updated_at' => '2023-12-06 00:46:18', |
||
215 | ], |
||
216 | ]; |
||
217 | foreach ($data as $row) { |
||
218 | $this->insert($row)->into('permissions'); |
||
219 | } |
||
222 | } |