Conditions | 12 |
Paths | 62 |
Total Lines | 51 |
Code Lines | 35 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
82 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
||
83 | { |
||
84 | try { |
||
85 | $authorization = $this->authorizationFactory->createAuthorizationFromRequest($request); |
||
86 | $authorization = $this->userAccountDiscoveryManager->find($request, $authorization); |
||
87 | |||
88 | if (null === $authorization->getUserAccount()) { |
||
89 | return $this->redirectToLoginPage($authorization, $request); |
||
90 | } |
||
91 | |||
92 | $authorization = $this->beforeConsentScreenManager->process($request, $authorization); |
||
93 | |||
94 | return $this->processConsentScreen($request, $authorization); |
||
95 | } catch (OAuth2Exception $e) { |
||
96 | $data = $e->getData(); |
||
97 | if (null !== $e->getAuthorization()) { |
||
|
|||
98 | $redirectUri = $e->getAuthorization()->getRedirectUri(); |
||
99 | $responseMode = $e->getAuthorization()->getResponseMode(); |
||
100 | if (null !== $redirectUri && null !== $responseMode) { |
||
101 | $data['redirect_uri'] = $redirectUri; |
||
102 | $data['response_mode'] = $responseMode; |
||
103 | |||
104 | throw new OAuth2Exception(302, $data, $e->getAuthorization(), $e); |
||
105 | } |
||
106 | } |
||
107 | |||
108 | throw $e; |
||
109 | } catch (Exception\ProcessAuthorizationException $e) { |
||
110 | $authorization = $e->getAuthorization(); |
||
111 | $authorization = $this->afterConsentScreenManager->process($request, $authorization); |
||
112 | if (false === $authorization->isAuthorized()) { |
||
113 | $this->throwRedirectionException($authorization, OAuth2Exception::ERROR_ACCESS_DENIED, 'The resource owner denied access to your client.'); |
||
114 | } |
||
115 | |||
116 | $responseTypeProcessor = ResponseTypeProcessor::create($authorization); |
||
117 | |||
118 | try { |
||
119 | $authorization = $responseTypeProcessor->process(); |
||
120 | } catch (OAuth2Exception $e) { |
||
121 | $this->throwRedirectionException($authorization, $e->getData()['error'], $e->getData()['error_description']); |
||
122 | } |
||
123 | |||
124 | return $this->buildResponse($authorization); |
||
125 | } catch (Exception\CreateRedirectionException $e) { |
||
126 | $this->throwRedirectionException($e->getAuthorization(), $e->getMessage(), $e->getDescription()); |
||
127 | } catch (Exception\ShowConsentScreenException $e) { |
||
128 | return $this->processConsentScreen($request, $e->getAuthorization()); |
||
129 | } catch (Exception\RedirectToLoginPageException $e) { |
||
130 | return $this->redirectToLoginPage($e->getAuthorization(), $request); |
||
131 | } |
||
132 | } |
||
133 | |||
179 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.