CreateRolesRightsUsers   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B run() 0 29 1
1
<?php
2
use App\Model\Role;
3
use App\Model\User;
4
5
class CreateRolesRightsUsers
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
6
{
7
    public function run()
8
    {
9
        Role::create([
10
            'name'        => 'admin',
11
            'description' => 'Администратор',
12
        ]);
13
        Role::create([
14
            'name'        => 'user',
15
            'description' => 'Пользователь',
16
        ]);
17
18
        $user = new User();
19
20
        $user->email     = '[email protected]';
21
        $user->full_name = 'Администратор';
22
        $user->password  = password_hash('qwerty', PASSWORD_DEFAULT, ['cost' => 13]);
23
        $user->role_id   = User::ROLE_ADMIN;
24
        $user->status    = User::STATUS_ACTIVE;
25
        $user->save();
26
27
        $user = new User();
28
29
        $user->email     = '[email protected]';
30
        $user->full_name = 'Пользователь';
31
        $user->password  = password_hash('qwerty', PASSWORD_DEFAULT, ['cost' => 13]);
32
        $user->role_id   = User::ROLE_USER;
33
        $user->status    = User::STATUS_ACTIVE;
34
        $user->save();
35
    }
36
}
37