Conditions | 1 |
Paths | 1 |
Total Lines | 63 |
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 |
||
61 | public function __construct(Config $config, |
||
62 | StorageManager $storageManager, |
||
63 | ScopePolicyManager $scopePolicyManager, |
||
64 | EndUserInterface $endUser |
||
65 | ) |
||
66 | { |
||
67 | $this->config = $config; |
||
68 | $this->storageManager = $storageManager; |
||
69 | $this->scopePolicyManager = $scopePolicyManager; |
||
70 | $this->endUser = $endUser; |
||
71 | |||
72 | $this->responseTypeManager = new ResponseTypeManager(); |
||
73 | |||
74 | $this->grantTypeManager = new GrantTypeManager(); |
||
75 | $this->grantTypeManager->setGrantType('refresh_token', new RefreshTokenGrantType( |
||
76 | $this->storageManager->getAccessTokenStorage(), |
||
77 | $this->storageManager->getRefreshTokenStorage(), |
||
78 | $config, |
||
79 | $this->scopePolicyManager |
||
80 | )); |
||
81 | |||
82 | $this->responseModeManager = new ResponseModeManager(); |
||
83 | $this->responseModeManager |
||
84 | ->setResponseMode('query', new QueryResponseMode()) |
||
85 | ->setResponseMode('fragment', new FragmentResponseMode()); |
||
86 | |||
87 | $this->flowManager = new FlowManager($this->responseTypeManager, $this->grantTypeManager); |
||
88 | $this->flowManager |
||
89 | ->addFlow('authorization_code', new AuthorizationCodeFlow( |
||
90 | $config, |
||
91 | $this->storageManager->getAuthorizationCodeStorage(), |
||
92 | $this->storageManager->getAccessTokenStorage(), |
||
93 | $this->storageManager->getRefreshTokenStorage() |
||
94 | )) |
||
95 | ->addFlow('implicit', new ImplicitFlow( |
||
96 | $this->storageManager->getAccessTokenStorage(), |
||
97 | $this->storageManager->getRefreshTokenStorage() |
||
98 | )) |
||
99 | ->addFlow('resource_owner_password_credentials', new ResourceOwnerPasswordCredentialsFlow( |
||
100 | $this->scopePolicyManager, |
||
101 | $this->storageManager->getResourceOwnerStorage(), |
||
102 | $this->storageManager->getAccessTokenStorage(), |
||
103 | $this->storageManager->getRefreshTokenStorage())) |
||
104 | ->addFlow('client_credentials', new ClientCredentialsFlow( |
||
105 | $this->scopePolicyManager, |
||
106 | $this->storageManager->getAccessTokenStorage(), |
||
107 | $this->storageManager->getRefreshTokenStorage() |
||
108 | )); |
||
109 | |||
110 | $this->clientAuthenticationMethodManager = new ClientAuthenticationMethodManager($storageManager->getClientStorage()); |
||
111 | $this->clientAuthenticationMethodManager |
||
112 | ->setClientAuthenticationMethod('client_secret_basic', new ClientSecretBasicAuthenticationMethod( |
||
113 | $this->storageManager->getClientStorage() |
||
114 | )) |
||
115 | ->setClientAuthenticationMethod('client_secret_post', new ClientSecretPostAuthenticationMethod( |
||
116 | $this->storageManager->getClientStorage() |
||
117 | )); |
||
118 | |||
119 | $this->authorizationRequestBuilder = new AuthorizationRequestBuilder( |
||
120 | $this->storageManager->getClientStorage(), |
||
121 | $this->responseTypeManager, |
||
122 | $this->responseModeManager, |
||
123 | $this->scopePolicyManager |
||
124 | ); |
||
231 | } |