@@ -31,13 +31,14 @@ |
||
| 31 | 31 | $guards = []; |
| 32 | 32 | if (!is_array($this->guard)) { |
| 33 | 33 | $guards[] = $this->guard; |
| 34 | + } else { |
|
| 35 | + $guards = $this->guard; |
|
| 34 | 36 | } |
| 35 | - else |
|
| 36 | - $guards = $this->guard; |
|
| 37 | 37 | |
| 38 | 38 | foreach ($guards as $guard) { |
| 39 | - if (!($guard instanceof GuardContract)) |
|
| 40 | - throw new UnexpectedTypeException($guard, GuardContract::class); |
|
| 39 | + if (!($guard instanceof GuardContract)) { |
|
| 40 | + throw new UnexpectedTypeException($guard, GuardContract::class); |
|
| 41 | + } |
|
| 41 | 42 | } |
| 42 | 43 | return $guards; |
| 43 | 44 | } |
@@ -45,10 +45,11 @@ |
||
| 45 | 45 | { |
| 46 | 46 | foreach ($this->guards as $guard) { |
| 47 | 47 | if ($guard->condition()) { |
| 48 | - if (isset($this->exception)) |
|
| 49 | - throw $this->exception; |
|
| 50 | - else |
|
| 51 | - throw $guard->exception(); |
|
| 48 | + if (isset($this->exception)) { |
|
| 49 | + throw $this->exception; |
|
| 50 | + } else { |
|
| 51 | + throw $guard->exception(); |
|
| 52 | + } |
|
| 52 | 53 | } |
| 53 | 54 | } |
| 54 | 55 | } |