| Conditions | 1 |
| Paths | 1 |
| Total Lines | 52 |
| 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 |
||
| 44 | private function getData(): array |
||
| 45 | { |
||
| 46 | return [ |
||
| 47 | [ |
||
| 48 | 'client_id' => 'CLIENT_ID_1', |
||
| 49 | 'owner_id' => 'USER_ACCOUNT_1', |
||
| 50 | 'parameter' => [ |
||
| 51 | 'token_endpoint_auth_method' => 'none', |
||
| 52 | 'grant_types' => [], |
||
| 53 | ], |
||
| 54 | ], |
||
| 55 | [ |
||
| 56 | 'client_id' => 'CLIENT_ID_2', |
||
| 57 | 'owner_id' => 'USER_ACCOUNT_1', |
||
| 58 | 'parameter' => [ |
||
| 59 | 'token_endpoint_auth_method' => 'none', |
||
| 60 | 'grant_types' => ['client_credentials', 'refresh_token', 'authorization_code', 'password', 'implicit'], |
||
| 61 | 'response_types' => ['code'], |
||
| 62 | 'redinect_uris' => [ |
||
| 63 | 'https://exxample.com/cb/?foo=bar', |
||
| 64 | ], |
||
| 65 | ], |
||
| 66 | ], |
||
| 67 | [ |
||
| 68 | 'client_id' => 'CLIENT_ID_3', |
||
| 69 | 'owner_id' => 'USER_ACCOUNT_1', |
||
| 70 | 'parameter' => [ |
||
| 71 | 'token_endpoint_auth_method' => 'client_secret_post', |
||
| 72 | 'grant_types' => ['client_credentials', 'refresh_token', 'authorization_code', 'password', 'implicit'], |
||
| 73 | 'client_secret' => 'secret', |
||
| 74 | ], |
||
| 75 | ], |
||
| 76 | [ |
||
| 77 | 'client_id' => 'CLIENT_ID_4', |
||
| 78 | 'owner_id' => 'USER_ACCOUNT_1', |
||
| 79 | 'parameter' => [ |
||
| 80 | 'token_endpoint_auth_method' => 'client_secret_jwt', |
||
| 81 | 'grant_types' => ['urn:ietf:params:oauth:grant-type:jwt-bearer'], |
||
| 82 | 'client_secret' => 'secret', |
||
| 83 | ], |
||
| 84 | ], |
||
| 85 | [ |
||
| 86 | 'client_id' => 'CLIENT_ID_5', |
||
| 87 | 'owner_id' => 'USER_ACCOUNT_1', |
||
| 88 | 'parameter' => [ |
||
| 89 | 'token_endpoint_auth_method' => 'client_secret_basic', |
||
| 90 | 'grant_types' => ['client_credentials', 'refresh_token', 'authorization_code', 'password', 'implicit'], |
||
| 91 | 'client_secret' => 'secret', |
||
| 92 | ], |
||
| 93 | ], |
||
| 94 | ]; |
||
| 95 | } |
||
| 96 | } |
||
| 97 |