UsersSeeder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 21
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 14 2
1
<?php
2
3
namespace Database\Seeders;
4
5
use Illuminate\Database\Seeder;
6
use LaravelFreelancerNL\Aranguent\Auth\User;
7
8
class UsersSeeder extends Seeder
9
{
10
    /**
11
     * Run the database Seeds.
12
     *
13
     * @return void
14
     */
15
    public function run()
16
    {
17
        $users = '[
18
           {
19
              "_key":"LyannaStark",
20
              "username":"Lyanna Stark",
21
              "email":"[email protected]"
22
           }
23
        ]';
24
25
        $users = json_decode($users, JSON_OBJECT_AS_ARRAY);
0 ignored issues
show
Bug introduced by
Database\Seeders\JSON_OBJECT_AS_ARRAY of type integer is incompatible with the type boolean|null expected by parameter $associative of json_decode(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
        $users = json_decode($users, /** @scrutinizer ignore-type */ JSON_OBJECT_AS_ARRAY);
Loading history...
26
27
        foreach ($users as $user) {
28
            User::insertOrIgnore($user);
29
        }
30
    }
31
}
32