1 | <?php |
||
36 | class PermissionVoter implements VoterInterface, WarmableInterface |
||
37 | { |
||
38 | /** |
||
39 | * The router. |
||
40 | * |
||
41 | * @var RouterInterface |
||
42 | */ |
||
43 | private $router; |
||
44 | |||
45 | /** |
||
46 | * The request stack. |
||
47 | * |
||
48 | * @var RequestStack |
||
49 | */ |
||
50 | private $requestStack; |
||
51 | |||
52 | /** |
||
53 | * The options. |
||
54 | * |
||
55 | * @var array |
||
56 | */ |
||
57 | protected $options = array(); |
||
58 | |||
59 | /** |
||
60 | * The config cache. |
||
61 | * |
||
62 | * @var ConfigCacheFactoryInterface|null |
||
63 | */ |
||
64 | private $configCacheFactory; |
||
65 | |||
66 | /** |
||
67 | * Create a new instance. |
||
68 | * |
||
69 | * @param RouterInterface $router The router component. |
||
70 | * |
||
71 | * @param RequestStack $requestStack The request stack. |
||
72 | */ |
||
73 | public function __construct(RouterInterface $router, RequestStack $requestStack, $options) |
||
79 | |||
80 | /** |
||
81 | * {@inheritDoc} |
||
82 | */ |
||
83 | public function supportsAttribute($attribute) |
||
87 | |||
88 | /** |
||
89 | * {@inheritDoc} |
||
90 | * |
||
91 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
92 | */ |
||
93 | public function supportsClass($class) |
||
97 | |||
98 | /** |
||
99 | * {@inheritDoc} |
||
100 | * |
||
101 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
102 | */ |
||
103 | public function vote(TokenInterface $token, $object, array $attributes) |
||
129 | |||
130 | /** |
||
131 | * {@inheritdoc} |
||
132 | */ |
||
133 | public function warmUp($cacheDir) |
||
143 | |||
144 | /** |
||
145 | * Test if we support any of the attributes. |
||
146 | * |
||
147 | * @param string[] $attributes The attributes to test. |
||
148 | * |
||
149 | * @return bool |
||
150 | */ |
||
151 | private function supportsAnyAttribute($attributes) |
||
161 | |||
162 | /** |
||
163 | * Provides the ConfigCache factory implementation, falling back to a default implementation if necessary. |
||
164 | * |
||
165 | * @return ConfigCacheFactoryInterface $configCacheFactory |
||
166 | */ |
||
167 | private function getConfigCacheFactory() |
||
175 | |||
176 | /** |
||
177 | * Get the required roles from cache if possible. |
||
178 | * |
||
179 | * @return array |
||
180 | */ |
||
181 | private function getRouteRoles() |
||
202 | |||
203 | /** |
||
204 | * Retrieve the required role for the current request (if any). |
||
205 | * |
||
206 | * @param mixed $object The object passed to the voter. |
||
207 | * |
||
208 | * @return string|null |
||
209 | */ |
||
210 | private function getRequiredRole($object) |
||
224 | } |
||
225 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.