Conditions | 4 |
Paths | 6 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function isGranted($attributes, $subject = null): bool |
||
31 | { |
||
32 | if (null !== $subject) { |
||
33 | $key = md5(json_encode($attributes).'/'.spl_object_hash($subject)); |
||
34 | } else { |
||
35 | $key = md5(json_encode($attributes)); |
||
36 | } |
||
37 | |||
38 | if (array_key_exists($key, static::$cache)) { |
||
|
|||
39 | return static::$cache[$key]; |
||
40 | } |
||
41 | |||
42 | try { |
||
43 | $isGranted = $this->authorizationChecker->isGranted($attributes, $subject); |
||
44 | } catch (AuthenticationCredentialsNotFoundException $e) { |
||
45 | $isGranted = false; |
||
46 | } |
||
47 | |||
48 | return static::$cache[$key] = $isGranted; |
||
49 | } |
||
51 |