HasRoleAndPermission   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 3
dl 0
loc 21
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Yajra\Acl\Traits;
4
5
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
6
use Yajra\Acl\Models\Permission;
7
8
trait HasRoleAndPermission
9
{
10
    use HasRole {
11
        HasRole::getPermissions as getRolePermissions;
12
    }
13
14
    use InteractsWithPermission;
15
16
    /**
17
     * Get all user permissions slug.
18
     *
19
     * @return array|null
20
     */
21
    public function getPermissions(): array
22
    {
23
        $rolePermissions = $this->getRolePermissions();
0 ignored issues
show
Bug introduced by
The method getRolePermissions() does not exist on Yajra\Acl\Traits\HasRoleAndPermission. Did you maybe mean permissions()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
24
        $userPermissions = $this->permissions->pluck('slug')->toArray();
25
26
        return collect($userPermissions)->merge($rolePermissions)->unique()->toArray();
27
    }
28
}
29