Completed
Push — EZP-26057-permission-api ( b3fc4f )
by
unknown
25:48
created

PermissionService   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 61
rs 10
c 1
b 0
f 1
wmc 7
lcom 1
cbo 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getCurrentUser() 0 4 1
A getCurrentUserReference() 0 4 1
A setCurrentUser() 0 4 1
A hasAccess() 0 4 1
A canUser() 0 4 1
A sudo() 0 4 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
namespace eZ\Publish\Core\SignalSlot;
8
9
use eZ\Publish\API\Repository\PermissionService as PermissionServiceInterface;
10
use eZ\Publish\API\Repository\Values\User\UserReference;
11
use eZ\Publish\API\Repository\Values\ValueObject;
12
use Closure;
13
14
/**
15
 * SignalSlot implementation of PermissionService interface.
16
 */
17
class PermissionService implements PermissionServiceInterface
18
{
19
    /**
20
     * Aggregated service.
21
     *
22
     * @var \eZ\Publish\API\Repository\FieldTypeService
23
     */
24
    protected $service;
25
26
    /**
27
     * SignalDispatcher.
28
     *
29
     * @var \eZ\Publish\Core\SignalSlot\SignalDispatcher
30
     */
31
    protected $signalDispatcher;
32
33
    /**
34
     * Constructor.
35
     *
36
     * Construct service object from aggregated service and signal
37
     * dispatcher
38
     *
39
     * @param \eZ\Publish\API\Repository\PermissionService $service
40
     * @param \eZ\Publish\Core\SignalSlot\SignalDispatcher $signalDispatcher
41
     */
42
    public function __construct(PermissionServiceInterface $service, SignalDispatcher $signalDispatcher)
43
    {
44
        $this->service = $service;
0 ignored issues
show
Documentation Bug introduced by
It seems like $service of type object<eZ\Publish\API\Re...tory\PermissionService> is incompatible with the declared type object<eZ\Publish\API\Re...itory\FieldTypeService> of property $service.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
45
        $this->signalDispatcher = $signalDispatcher;
46
    }
47
48
    public function getCurrentUser()
49
    {
50
        return $this->service->getCurrentUser();
0 ignored issues
show
Bug introduced by
The method getCurrentUser() does not seem to exist on object<eZ\Publish\API\Re...itory\FieldTypeService>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
51
    }
52
53
    public function getCurrentUserReference()
54
    {
55
        return $this->service->getCurrentUserReference();
0 ignored issues
show
Bug introduced by
The method getCurrentUserReference() does not seem to exist on object<eZ\Publish\API\Re...itory\FieldTypeService>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
56
    }
57
58
    public function setCurrentUser(UserReference $user)
59
    {
60
        return $this->service->setCurrentUser($user);
0 ignored issues
show
Bug introduced by
The method setCurrentUser() does not seem to exist on object<eZ\Publish\API\Re...itory\FieldTypeService>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
61
    }
62
63
    public function hasAccess($module, $function, UserReference $user = null)
64
    {
65
        return $this->service->hasAccess($module, $function, $user);
0 ignored issues
show
Bug introduced by
The method hasAccess() does not seem to exist on object<eZ\Publish\API\Re...itory\FieldTypeService>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
66
    }
67
68
    public function canUser($module, $function, ValueObject $object, $targets = null)
69
    {
70
        return $this->service->canUser($module, $function, $object, $targets);
0 ignored issues
show
Bug introduced by
The method canUser() does not seem to exist on object<eZ\Publish\API\Re...itory\FieldTypeService>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
71
    }
72
73
    public function sudo(Closure $callback)
74
    {
75
        return $this->service->sudo($callback, $this);
0 ignored issues
show
Bug introduced by
The method sudo() does not seem to exist on object<eZ\Publish\API\Re...itory\FieldTypeService>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
76
    }
77
}
78