@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function getActor(TokenInterface $token): ?object |
54 | 54 | { |
55 | - foreach ($this->getProviders() as $provider) { |
|
56 | - if (!$provider instanceof ActorProviderInterface) { |
|
55 | + foreach ($this->getProviders() as $provider){ |
|
56 | + if (!$provider instanceof ActorProviderInterface){ |
|
57 | 57 | throw new AuthException( |
58 | 58 | sprintf( |
59 | 59 | 'Expected `ActorProviderInterface`, got `%s`', |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | $actor = $provider->getActor($token); |
66 | - if ($actor !== null) { |
|
66 | + if ($actor !== null){ |
|
67 | 67 | return $actor; |
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | - if ($this->actorProvider === []) { |
|
71 | + if ($this->actorProvider === []){ |
|
72 | 72 | throw new AuthException('No actor provider'); |
73 | 73 | } |
74 | 74 | |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | */ |
91 | 91 | private function getProviders(): \Generator |
92 | 92 | { |
93 | - foreach ($this->actorProvider as $provider) { |
|
94 | - if ($provider instanceof Autowire) { |
|
93 | + foreach ($this->actorProvider as $provider){ |
|
94 | + if ($provider instanceof Autowire){ |
|
95 | 95 | yield $provider->resolve($this->factory); |
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | |
99 | - if (is_object($provider)) { |
|
99 | + if (is_object($provider)){ |
|
100 | 100 | yield $provider; |
101 | 101 | continue; |
102 | 102 | } |
@@ -52,8 +52,10 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function getActor(TokenInterface $token): ?object |
54 | 54 | { |
55 | - foreach ($this->getProviders() as $provider) { |
|
56 | - if (!$provider instanceof ActorProviderInterface) { |
|
55 | + foreach ($this->getProviders() as $provider) |
|
56 | + { |
|
57 | + if (!$provider instanceof ActorProviderInterface) |
|
58 | + { |
|
57 | 59 | throw new AuthException( |
58 | 60 | sprintf( |
59 | 61 | 'Expected `ActorProviderInterface`, got `%s`', |
@@ -63,12 +65,14 @@ discard block |
||
63 | 65 | } |
64 | 66 | |
65 | 67 | $actor = $provider->getActor($token); |
66 | - if ($actor !== null) { |
|
68 | + if ($actor !== null) |
|
69 | + { |
|
67 | 70 | return $actor; |
68 | 71 | } |
69 | 72 | } |
70 | 73 | |
71 | - if ($this->actorProvider === []) { |
|
74 | + if ($this->actorProvider === []) |
|
75 | + { |
|
72 | 76 | throw new AuthException('No actor provider'); |
73 | 77 | } |
74 | 78 | |
@@ -90,13 +94,16 @@ discard block |
||
90 | 94 | */ |
91 | 95 | private function getProviders(): \Generator |
92 | 96 | { |
93 | - foreach ($this->actorProvider as $provider) { |
|
94 | - if ($provider instanceof Autowire) { |
|
97 | + foreach ($this->actorProvider as $provider) |
|
98 | + { |
|
99 | + if ($provider instanceof Autowire) |
|
100 | + { |
|
95 | 101 | yield $provider->resolve($this->factory); |
96 | 102 | continue; |
97 | 103 | } |
98 | 104 | |
99 | - if (is_object($provider)) { |
|
105 | + if (is_object($provider)) |
|
106 | + { |
|
100 | 107 | yield $provider; |
101 | 108 | continue; |
102 | 109 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $values = $this->withValues($withFields); |
52 | 52 | $values[$field] = $value; |
53 | 53 | |
54 | - if ($this->isProvidedByContext($values)) { |
|
54 | + if ($this->isProvidedByContext($values)){ |
|
55 | 55 | return true; |
56 | 56 | } |
57 | 57 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | private function withValues(array $fields): array |
66 | 66 | { |
67 | 67 | $values = []; |
68 | - foreach ($fields as $field) { |
|
69 | - if ($this->getValidator()->hasValue($field)) { |
|
68 | + foreach ($fields as $field){ |
|
69 | + if ($this->getValidator()->hasValue($field)){ |
|
70 | 70 | $values[$field] = $this->getValidator()->getValue($field); |
71 | 71 | } |
72 | 72 | } |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | private function isProvidedByContext(array $values): bool |
82 | 82 | { |
83 | 83 | $context = $this->getValidator()->getContext()[static::class] ?? []; |
84 | - if (!is_array($context)) { |
|
84 | + if (!is_array($context)){ |
|
85 | 85 | return false; |
86 | 86 | } |
87 | 87 | |
88 | - foreach ($values as $field => $value) { |
|
89 | - if (!isset($context[$field]) || $context[$field] !== $value) { |
|
88 | + foreach ($values as $field => $value){ |
|
89 | + if (!isset($context[$field]) || $context[$field] !== $value){ |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | } |
@@ -51,7 +51,8 @@ discard block |
||
51 | 51 | $values = $this->withValues($withFields); |
52 | 52 | $values[$field] = $value; |
53 | 53 | |
54 | - if ($this->isProvidedByContext($values)) { |
|
54 | + if ($this->isProvidedByContext($values)) |
|
55 | + { |
|
55 | 56 | return true; |
56 | 57 | } |
57 | 58 | |
@@ -65,8 +66,10 @@ discard block |
||
65 | 66 | private function withValues(array $fields): array |
66 | 67 | { |
67 | 68 | $values = []; |
68 | - foreach ($fields as $field) { |
|
69 | - if ($this->getValidator()->hasValue($field)) { |
|
69 | + foreach ($fields as $field) |
|
70 | + { |
|
71 | + if ($this->getValidator()->hasValue($field)) |
|
72 | + { |
|
70 | 73 | $values[$field] = $this->getValidator()->getValue($field); |
71 | 74 | } |
72 | 75 | } |
@@ -81,12 +84,15 @@ discard block |
||
81 | 84 | private function isProvidedByContext(array $values): bool |
82 | 85 | { |
83 | 86 | $context = $this->getValidator()->getContext()[static::class] ?? []; |
84 | - if (!is_array($context)) { |
|
87 | + if (!is_array($context)) |
|
88 | + { |
|
85 | 89 | return false; |
86 | 90 | } |
87 | 91 | |
88 | - foreach ($values as $field => $value) { |
|
89 | - if (!isset($context[$field]) || $context[$field] !== $value) { |
|
92 | + foreach ($values as $field => $value) |
|
93 | + { |
|
94 | + if (!isset($context[$field]) || $context[$field] !== $value) |
|
95 | + { |
|
90 | 96 | return false; |
91 | 97 | } |
92 | 98 | } |