Conditions | 1 |
Paths | 1 |
Total Lines | 53 |
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 |
||
55 | private function getData(): array |
||
56 | { |
||
57 | return [ |
||
58 | [ |
||
59 | 'authorization_code_id' => 'VALID_AUTHORIZATION_CODE', |
||
60 | 'client_id' => 'CLIENT_ID_3', |
||
61 | 'user_account_id' => 'john.1', |
||
62 | 'query_parameters' => [], |
||
63 | 'redirect_uri' => 'http://localhost/callback', |
||
64 | 'expires_at' => new \DateTimeImmutable('now +1 day'), |
||
65 | 'parameter' => [], |
||
66 | 'metadata' => [], |
||
67 | 'resource_server_id' => null, |
||
68 | 'is_revoked' => false, |
||
69 | ], |
||
70 | [ |
||
71 | 'authorization_code_id' => 'VALID_AUTHORIZATION_CODE_FOR_CONFIDENTIAL_CLIENT', |
||
72 | 'client_id' => 'CLIENT_ID_5', |
||
73 | 'user_account_id' => 'john.1', |
||
74 | 'query_parameters' => [], |
||
75 | 'redirect_uri' => 'http://localhost/callback', |
||
76 | 'expires_at' => new \DateTimeImmutable('now +1 day'), |
||
77 | 'parameter' => [], |
||
78 | 'metadata' => [], |
||
79 | 'resource_server_id' => null, |
||
80 | 'is_revoked' => false, |
||
81 | ], |
||
82 | [ |
||
83 | 'authorization_code_id' => 'REVOKED_AUTHORIZATION_CODE', |
||
84 | 'client_id' => 'CLIENT_ID_3', |
||
85 | 'user_account_id' => 'john.1', |
||
86 | 'query_parameters' => [], |
||
87 | 'redirect_uri' => 'http://localhost/callback', |
||
88 | 'expires_at' => new \DateTimeImmutable('now +1 day'), |
||
89 | 'parameter' => [], |
||
90 | 'metadata' => [], |
||
91 | 'resource_server_id' => null, |
||
92 | 'is_revoked' => true, |
||
93 | ], |
||
94 | [ |
||
95 | 'authorization_code_id' => 'EXPIRED_AUTHORIZATION_CODE', |
||
96 | 'client_id' => 'CLIENT_ID_3', |
||
97 | 'user_account_id' => 'john.1', |
||
98 | 'query_parameters' => [], |
||
99 | 'redirect_uri' => 'http://localhost/callback', |
||
100 | 'expires_at' => new \DateTimeImmutable('now -1 day'), |
||
101 | 'parameter' => [], |
||
102 | 'metadata' => [], |
||
103 | 'resource_server_id' => null, |
||
104 | 'is_revoked' => false, |
||
105 | ], |
||
106 | ]; |
||
107 | } |
||
108 | } |
||
109 |