PermissionProviderBuildTask   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 13 5
1
<?php
2
3
4
class PermissionProviderBuildTask extends BuildTask
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...
5
{
6
    protected $title = 'Clean up Permissions';
7
8
    protected $description = 'Goes through all the permissions and cleans them up.';
9
10
    protected $_permissions = array();
11
12
    public function run($request)
13
    {
14
        $permissions = Permission::get();
15
        foreach ($permissions as $permission) {
16
            if ($permission->Arg == 0 && $permission->Type == 1) {
17
                if (isset($this->_permissions[$permission->Code])) {
18
                    DB::alteration_message("Deleting double permission with code: ".$permission->Code, 'deleted');
19
                    $permission->delete();
20
                }
21
                $this->_permissions[$permission->Code];
22
            }
23
        }
24
    }
25
}
26