Completed
Push — master ( 22af80...72b000 )
by Derek Stephen
09:26
created

PassportControl   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isAuthorized() 0 4 1
A grantEntitlement() 0 4 1
A revokeEntitlement() 0 4 1
A createNewPassport() 0 6 1
1
<?php
2
3
namespace Del\Passport;
4
5
use Del\Passport\Entity\Passport;
6
use Doctrine\ORM\EntityManager;
7
8
class PassportControl
9
{
10
    /** @var EntityManager */
11
    private $entityManager;
12
13
    /**
14
     * PassportControl constructor.
15
     * @param EntityManager $entityManager
16
     */
17
    public function __construct(EntityManager $entityManager)
18
    {
19
        $this->entityManager = $entityManager;
20
    }
21
22
    /**
23
     * @param PassportInterface $passport
24
     * @param ActionInterface $action
25
     * @param ResourceInterface $resource
26
     * @return bool
27
     */
28
    public function isAuthorized(PassportInterface $passport, ActionInterface $action, ResourceInterface $resource): bool
0 ignored issues
show
Unused Code introduced by
The parameter $passport is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $action is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $resource is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
        return true;
31
    }
32
33
    /**
34
     * @param PassportInterface $passport
35
     * @param RoleInterface $role
36
     * @param ResourceInterface $resource
37
     * @return bool
38
     */
39
    public function grantEntitlement(PassportInterface $passport, RoleInterface $role, ResourceInterface $resource): bool
0 ignored issues
show
Unused Code introduced by
The parameter $passport is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $role is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $resource is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
40
    {
41
        return true;
42
    }
43
44
    /**
45
     * @param PassportInterface $passport
46
     * @param RoleInterface $role
47
     * @param ResourceInterface $resource
48
     * @return bool
49
     */
50
    public function revokeEntitlement(PassportInterface $passport, RoleInterface $role, ResourceInterface $resource): bool
0 ignored issues
show
Unused Code introduced by
The parameter $passport is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $role is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $resource is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
51
    {
52
        return true;
53
    }
54
55
    /**
56
     * @param int $userId
57
     * @return PassportInterface
58
     */
59
    public function createNewPassport(int $userId): PassportInterface
0 ignored issues
show
Unused Code introduced by
The parameter $userId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
60
    {
61
        $passport = new Passport();
62
63
        return $passport;
64
    }
65
}
66