m160722_085418_init   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 7 1
A safeDown() 0 7 1
1
<?php
2
3
use yii2mod\rbac\migrations\Migration;
4
use yii2mod\rbac\rules\UserRule;
5
6
class m160722_085418_init extends Migration
7
{
8
    public function safeUp()
9
    {
10
        $this->createRule('user', UserRule::class);
11
12
        $this->createRole('admin', 'Admin has all available permissions.');
13
        $this->createRole('user', 'Authenticated user.', 'user');
14
    }
15
16
    public function safeDown()
17
    {
18
        $this->removeRule('user');
19
20
        $this->removeRole('admin');
21
        $this->removeRole('user');
22
    }
23
}
24