PermissionManager::findPermissions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Eziat\PermissionBundle\Manager;
6
7
use Eziat\PermissionBundle\Model\PermissionInterface;
8
use Eziat\PermissionBundle\Model\PermissionManagerInterface;
9
10
/**
11
 * @author Tomas Jakl <[email protected]>
12
 */
13
abstract class PermissionManager implements PermissionManagerInterface
14
{
15
    /**
16
     * Creates an empty permission.
17
     */
18
    public function createPermission()
19
    {
20
        $class      = $this->getClass();
21
        $permission = new $class();
22
23
        return $permission;
24
    }
25
26
    /**
27
     * Gets an permission by the given id.
28
     */
29
    public function findPermissionById(int $id) : ?PermissionInterface
30
    {
31
        return $this->findPermissionBy(['id' => $id]);
32
    }
33
34
    /**
35
     * Returns the permission's fully qualified class name.
36
     */
37
    public function findPermissions() : array
38
    {
39
        return $this->findPermissionsBy([]);
40
    }
41
}