@@ -8,7 +8,7 @@ |
||
8 | 8 | global $db; |
9 | 9 | |
10 | 10 | return [ |
11 | - new Guard('get_one_damage', function(User $user){ |
|
11 | + new Guard('get_one_damage', function(User $user) { |
|
12 | 12 | return $user->rights->flightlog->vol->financial; |
13 | 13 | }), |
14 | 14 | ]; |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @throws \Exception |
40 | 40 | */ |
41 | - public function add(Route $route){ |
|
42 | - if(isset($this->routes[$route->getName()])){ |
|
41 | + public function add(Route $route) { |
|
42 | + if (isset($this->routes[$route->getName()])) { |
|
43 | 43 | throw new \Exception('Route exists'); |
44 | 44 | } |
45 | 45 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @throws \Exception |
53 | 53 | */ |
54 | - public function load(array $routes){ |
|
55 | - foreach($routes as $currentRoute){ |
|
54 | + public function load(array $routes) { |
|
55 | + foreach ($routes as $currentRoute) { |
|
56 | 56 | $this->add($currentRoute); |
57 | 57 | } |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function loadGuards($routesGuards) |
64 | 64 | { |
65 | - foreach($routesGuards as $guard){ |
|
65 | + foreach ($routesGuards as $guard) { |
|
66 | 66 | $this->guards[$guard->getRouteName()] = $guard; |
67 | 67 | } |
68 | 68 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @param $routeName |
74 | 74 | * @return bool |
75 | 75 | */ |
76 | - public function isAuthorized(User $user, $routeName){ |
|
77 | - if(!isset($this->guards[$routeName])){ |
|
76 | + public function isAuthorized(User $user, $routeName) { |
|
77 | + if (!isset($this->guards[$routeName])) { |
|
78 | 78 | return true; |
79 | 79 | } |
80 | 80 | |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function __invoke($name, User $user) |
94 | 94 | { |
95 | - if(!isset($this->routes[$name])){ |
|
95 | + if (!isset($this->routes[$name])) { |
|
96 | 96 | throw new \Exception('Route not found'); |
97 | 97 | } |
98 | 98 | |
99 | - if(!$this->isAuthorized($user, $name)){ |
|
99 | + if (!$this->isAuthorized($user, $name)) { |
|
100 | 100 | throw new \Exception('Action not allowed'); |
101 | 101 | } |
102 | 102 |