| Conditions | 2 |
| Paths | 1 |
| Total Lines | 66 |
| Code Lines | 50 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 15 | public function schemeDataProvider(): array |
||
| 16 | { |
||
| 17 | return [ |
||
| 18 | 'httpNotModify' => ['http', [], null, 'http'], |
||
| 19 | 'httpsNotModify' => ['https', [], null, 'https'], |
||
| 20 | 'httpNotMatchedProtocolHeader' => [ |
||
| 21 | 'http', |
||
| 22 | ['x-forwarded-proto' => ['https']], |
||
| 23 | ['test' => ['https' => 'https']], |
||
| 24 | 'http' |
||
| 25 | ], |
||
| 26 | 'httpNotMatchedProtocolHeaderValue' => [ |
||
| 27 | 'http', |
||
| 28 | ['x-forwarded-proto' => ['https']], |
||
| 29 | ['x-forwarded-proto' => ['https' => 'test']], |
||
| 30 | 'http' |
||
| 31 | ], |
||
| 32 | 'httpToHttps' => [ |
||
| 33 | 'http', |
||
| 34 | ['x-forwarded-proto' => ['https']], |
||
| 35 | ['x-forwarded-proto' => ['https' => 'https']], |
||
| 36 | 'https' |
||
| 37 | ], |
||
| 38 | 'httpToHttpsDefault' => [ |
||
| 39 | 'http', |
||
| 40 | ['x-forwarded-proto' => ['https']], |
||
| 41 | ['x-forwarded-proto' => null], |
||
| 42 | 'https' |
||
| 43 | ], |
||
| 44 | 'httpToHttpsUpperCase' => [ |
||
| 45 | 'http', |
||
| 46 | ['x-forwarded-proto' => ['https']], |
||
| 47 | ['x-forwarded-proto' => ['https' => 'HTTPS']], |
||
| 48 | 'https' |
||
| 49 | ], |
||
| 50 | 'httpToHttpsMultiValue' => [ |
||
| 51 | 'http', |
||
| 52 | ['x-forwarded-proto' => ['https']], |
||
| 53 | ['x-forwarded-proto' => ['https' => ['on', 's', 'https']]], |
||
| 54 | 'https' |
||
| 55 | ], |
||
| 56 | 'httpsToHttp' => [ |
||
| 57 | 'https', |
||
| 58 | ['x-forwarded-proto' => 'http'], |
||
| 59 | ['x-forwarded-proto' => ['http' => 'http']], |
||
| 60 | 'http' |
||
| 61 | ], |
||
| 62 | 'httpToHttpsWithCallback' => [ |
||
| 63 | 'http', |
||
| 64 | ['x-forwarded-proto' => 'test any-https **'], |
||
| 65 | [ |
||
| 66 | 'x-forwarded-proto' => function (array $values, String $header, ServerRequestInterface $request) { |
||
| 67 | return stripos($values[0], 'https') !== false ? 'https' : 'http'; |
||
| 68 | }, |
||
| 69 | ], |
||
| 70 | 'https', |
||
| 71 | ], |
||
| 72 | 'httpWithCallbackNull' => [ |
||
| 73 | 'http', |
||
| 74 | ['x-forwarded-proto' => 'test any-https **'], |
||
| 75 | [ |
||
| 76 | 'x-forwarded-proto' => function (array $values, String $header, ServerRequestInterface $request) { |
||
| 77 | return null; |
||
| 78 | }, |
||
| 79 | ], |
||
| 80 | 'http', |
||
| 81 | ] |
||
| 176 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.