Conditions | 1 |
Paths | 1 |
Total Lines | 67 |
Code Lines | 56 |
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 |
||
97 | private function getData(): array |
||
98 | { |
||
99 | return [ |
||
100 | [ |
||
101 | 'authorization_code_id' => 'VALID_AUTHORIZATION_CODE', |
||
102 | 'client_id' => 'CLIENT_ID_3', |
||
103 | 'user_account_id' => 'john.1', |
||
104 | 'query_parameters' => [], |
||
105 | 'redirect_uri' => 'http://localhost/callback', |
||
106 | 'expires_at' => new \DateTimeImmutable('now +1 day'), |
||
107 | 'parameter' => [], |
||
108 | 'metadata' => [], |
||
109 | 'resource_server_id' => null, |
||
110 | 'is_revoked' => false, |
||
111 | 'is_used' => false, |
||
112 | ], |
||
113 | [ |
||
114 | 'authorization_code_id' => 'VALID_AUTHORIZATION_CODE_FOR_CONFIDENTIAL_CLIENT', |
||
115 | 'client_id' => 'CLIENT_ID_5', |
||
116 | 'user_account_id' => 'john.1', |
||
117 | 'query_parameters' => [], |
||
118 | 'redirect_uri' => 'http://localhost/callback', |
||
119 | 'expires_at' => new \DateTimeImmutable('now +1 day'), |
||
120 | 'parameter' => [], |
||
121 | 'metadata' => [], |
||
122 | 'resource_server_id' => null, |
||
123 | 'is_revoked' => false, |
||
124 | 'is_used' => false, |
||
125 | ], |
||
126 | [ |
||
127 | 'authorization_code_id' => 'REVOKED_AUTHORIZATION_CODE', |
||
128 | 'client_id' => 'CLIENT_ID_3', |
||
129 | 'user_account_id' => 'john.1', |
||
130 | 'query_parameters' => [], |
||
131 | 'redirect_uri' => 'http://localhost/callback', |
||
132 | 'expires_at' => new \DateTimeImmutable('now +1 day'), |
||
133 | 'parameter' => [], |
||
134 | 'metadata' => [], |
||
135 | 'resource_server_id' => null, |
||
136 | 'is_revoked' => true, |
||
137 | 'is_used' => false, |
||
138 | ], |
||
139 | [ |
||
140 | 'authorization_code_id' => 'EXPIRED_AUTHORIZATION_CODE', |
||
141 | 'client_id' => 'CLIENT_ID_3', |
||
142 | 'user_account_id' => 'john.1', |
||
143 | 'query_parameters' => [], |
||
144 | 'redirect_uri' => 'http://localhost/callback', |
||
145 | 'expires_at' => new \DateTimeImmutable('now -1 day'), |
||
146 | 'parameter' => [], |
||
147 | 'metadata' => [], |
||
148 | 'resource_server_id' => null, |
||
149 | 'is_revoked' => false, |
||
150 | 'is_used' => false, |
||
151 | ], |
||
152 | [ |
||
153 | 'authorization_code_id' => 'USED_AUTHORIZATION_CODE', |
||
154 | 'client_id' => 'CLIENT_ID_3', |
||
155 | 'user_account_id' => 'john.1', |
||
156 | 'query_parameters' => [], |
||
157 | 'redirect_uri' => 'http://localhost/callback', |
||
158 | 'expires_at' => new \DateTimeImmutable('now +1 day'), |
||
159 | 'parameter' => [], |
||
160 | 'metadata' => [], |
||
161 | 'resource_server_id' => null, |
||
162 | 'is_revoked' => false, |
||
163 | 'is_used' => true, |
||
164 | ], |
||
168 |