@@ -71,7 +71,7 @@ |
||
71 | 71 | private function cookieQueue(ServerRequestInterface $request): CookieQueue |
72 | 72 | { |
73 | 73 | $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE, null); |
74 | - if ($cookieQueue === null) { |
|
74 | + if ($cookieQueue === null){ |
|
75 | 75 | throw new ScopeException("Unable to resolve CookieQueue, invalid request scope"); |
76 | 76 | } |
77 | 77 |
@@ -71,7 +71,8 @@ |
||
71 | 71 | private function cookieQueue(ServerRequestInterface $request): CookieQueue |
72 | 72 | { |
73 | 73 | $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE, null); |
74 | - if ($cookieQueue === null) { |
|
74 | + if ($cookieQueue === null) |
|
75 | + { |
|
75 | 76 | throw new ScopeException("Unable to resolve CookieQueue, invalid request scope"); |
76 | 77 | } |
77 | 78 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | private function route(ServerRequestInterface $request): RouteInterface |
57 | 57 | { |
58 | 58 | $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null); |
59 | - if ($route === null) { |
|
59 | + if ($route === null){ |
|
60 | 60 | throw new ScopeException("Unable to resolve Route, invalid request scope"); |
61 | 61 | } |
62 | 62 |
@@ -56,7 +56,8 @@ |
||
56 | 56 | private function route(ServerRequestInterface $request): RouteInterface |
57 | 57 | { |
58 | 58 | $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null); |
59 | - if ($route === null) { |
|
59 | + if ($route === null) |
|
60 | + { |
|
60 | 61 | throw new ScopeException("Unable to resolve Route, invalid request scope"); |
61 | 62 | } |
62 | 63 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | PermissionsInterface $permissions, |
41 | 41 | ContainerInterface $actorScope, |
42 | 42 | array $roles = [] |
43 | - ) { |
|
43 | + ){ |
|
44 | 44 | $this->roles = $roles; |
45 | 45 | $this->container = $actorScope; |
46 | 46 | $this->permissions = $permissions; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | public function allows(string $permission, array $context = []): bool |
53 | 53 | { |
54 | 54 | $allows = false; |
55 | - foreach ($this->getRoles() as $role) { |
|
56 | - if (!$this->permissions->hasRole($role)) { |
|
55 | + foreach ($this->getRoles() as $role){ |
|
56 | + if (!$this->permissions->hasRole($role)){ |
|
57 | 57 | continue; |
58 | 58 | } |
59 | 59 | |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function getActor(): ActorInterface |
101 | 101 | { |
102 | - if (!is_null($this->actor)) { |
|
102 | + if (!is_null($this->actor)){ |
|
103 | 103 | return $this->actor; |
104 | 104 | } |
105 | 105 | |
106 | - try { |
|
106 | + try{ |
|
107 | 107 | return $this->container->get(ActorInterface::class); |
108 | - } catch (ContainerException $e) { |
|
108 | + }catch (ContainerException $e){ |
|
109 | 109 | throw new ScopeException("Unable to resolve Actor from the scope", $e->getCode(), $e); |
110 | 110 | } |
111 | 111 | } |
@@ -52,8 +52,10 @@ discard block |
||
52 | 52 | public function allows(string $permission, array $context = []): bool |
53 | 53 | { |
54 | 54 | $allows = false; |
55 | - foreach ($this->getRoles() as $role) { |
|
56 | - if (!$this->permissions->hasRole($role)) { |
|
55 | + foreach ($this->getRoles() as $role) |
|
56 | + { |
|
57 | + if (!$this->permissions->hasRole($role)) |
|
58 | + { |
|
57 | 59 | continue; |
58 | 60 | } |
59 | 61 | |
@@ -99,13 +101,17 @@ discard block |
||
99 | 101 | */ |
100 | 102 | public function getActor(): ActorInterface |
101 | 103 | { |
102 | - if (!is_null($this->actor)) { |
|
104 | + if (!is_null($this->actor)) |
|
105 | + { |
|
103 | 106 | return $this->actor; |
104 | 107 | } |
105 | 108 | |
106 | - try { |
|
109 | + try |
|
110 | + { |
|
107 | 111 | return $this->container->get(ActorInterface::class); |
108 | - } catch (ContainerException $e) { |
|
112 | + } |
|
113 | + catch (ContainerException $e) |
|
114 | + { |
|
109 | 115 | throw new ScopeException("Unable to resolve Actor from the scope", $e->getCode(), $e); |
110 | 116 | } |
111 | 117 | } |