Conditions | 12 |
Paths | 86 |
Total Lines | 51 |
Code Lines | 36 |
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 |
||
75 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
||
76 | { |
||
77 | try { |
||
78 | $authorization = $this->authorizationFactory->createAuthorizationFromRequest($request); |
||
79 | $authorization = $this->userAccountDiscoveryManager->find($authorization); |
||
80 | $this->userAccountDiscoveryManager->check($authorization); |
||
81 | |||
82 | if (null === $authorization->getUserAccount()) { |
||
83 | return $this->redirectToLoginPage($authorization, $request); |
||
84 | } |
||
85 | |||
86 | $authorization = $this->consentScreenExtensionManager->processBefore($request, $authorization); |
||
87 | |||
88 | return $this->processConsentScreen($request, $authorization); |
||
89 | } catch (OAuth2AuthorizationException $e) { |
||
90 | $data = $e->getData(); |
||
|
|||
91 | if (null !== $e->getAuthorization()) { |
||
92 | $redirectUri = $e->getAuthorization()->getRedirectUri(); |
||
93 | $responseMode = $e->getAuthorization()->getResponseMode(); |
||
94 | if (null !== $redirectUri && null !== $responseMode) { |
||
95 | $data['redirect_uri'] = $redirectUri; |
||
96 | $data['response_mode'] = $responseMode; |
||
97 | |||
98 | throw new OAuth2AuthorizationException(302, $data, $e->getAuthorization(), $e); |
||
99 | } |
||
100 | } |
||
101 | |||
102 | throw $e; |
||
103 | } catch (Exception\ProcessAuthorizationException $e) { |
||
104 | $authorization = $e->getAuthorization(); |
||
105 | $authorization = $this->consentScreenExtensionManager->processAfter($request, $authorization); |
||
106 | if (false === $authorization->isAuthorized()) { |
||
107 | $this->throwRedirectionException($authorization, OAuth2Exception::ERROR_ACCESS_DENIED, 'The resource owner denied access to your client.'); |
||
108 | } |
||
109 | |||
110 | try { |
||
111 | $responseType = $authorization->getResponseType(); |
||
112 | $authorization = $responseType->process($authorization); |
||
113 | } catch (OAuth2Exception $e) { |
||
114 | $this->throwRedirectionException($authorization, $e->getData()['error'], $e->getData()['error_description']); |
||
115 | } |
||
116 | |||
117 | return $this->buildResponse($authorization); |
||
118 | } catch (Exception\CreateRedirectionException $e) { |
||
119 | $this->throwRedirectionException($e->getAuthorization(), $e->getMessage(), $e->getDescription()); |
||
120 | } catch (Exception\ShowConsentScreenException $e) { |
||
121 | return $this->processConsentScreen($request, $e->getAuthorization()); |
||
122 | } catch (Exception\RedirectToLoginPageException $e) { |
||
123 | return $this->redirectToLoginPage($e->getAuthorization(), $request); |
||
124 | } |
||
125 | } |
||
126 | |||
172 |
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.