Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 21 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
16 | View Code Duplication | public function run() |
|
17 | { |
||
18 | $video = Video::find(1); |
||
19 | $type = [ |
||
20 | 'like', |
||
21 | 'dislike', |
||
22 | ]; |
||
23 | |||
24 | for ($i = 0; $i < 100; $i++) { |
||
25 | $user = $this->createUser(); |
||
26 | $key = array_rand($type); |
||
27 | |||
28 | $data = [ |
||
29 | 'user_id' => $user->id, |
||
30 | 'video_id' => $video->id, |
||
31 | 'type' => $type[$key], |
||
32 | ]; |
||
33 | |||
34 | LikeDislike::create($data); |
||
35 | } |
||
36 | } |
||
37 | |||
62 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.