FileBasePermissionManager   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getRolesByOperation() 0 10 2
1
<?php
2
3
namespace App\Auth\PermissionManager;
4
5
use App\Auth\PermissionManagerAbstract;
6
use Core\Utils\ArrayUtils;
7
8
class FileBasePermissionManager extends PermissionManagerAbstract
9
{
10
    private $permission;
11
12
    public function __construct(array $settings = [])
13
    {
14
        $this->permission = $settings['permissions'];
15
    }
16
17
    /**
18
     * @return array|null
19
     */
20
    public function getRolesByOperation($operation)
21
    {
22
        $operationKey = ArrayUtils::find($this->permission, $operation);
23
24
        if($operationKey === false) {
25
            return null;
26
        }
27
28
        return $this->permission[$operationKey];
29
    }
30
}
31