| 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 |
||
| 14 | public function schemeDataProvider(): array |
||
| 15 | { |
||
| 16 | return [ |
||
| 17 | 'httpNotModify' => ['http', [], null, 'http'], |
||
| 18 | 'httpsNotModify' => ['https', [], null, 'https'], |
||
| 19 | 'httpNotMatchedProtocolHeader' => [ |
||
| 20 | 'http', |
||
| 21 | ['x-forwarded-proto' => ['https']], |
||
| 22 | ['test' => ['https' => 'https']], |
||
| 23 | 'http' |
||
| 24 | ], |
||
| 25 | 'httpNotMatchedProtocolHeaderValue' => [ |
||
| 26 | 'http', |
||
| 27 | ['x-forwarded-proto' => ['https']], |
||
| 28 | ['x-forwarded-proto' => ['https' => 'test']], |
||
| 29 | 'http' |
||
| 30 | ], |
||
| 31 | 'httpToHttps' => [ |
||
| 32 | 'http', |
||
| 33 | ['x-forwarded-proto' => ['https']], |
||
| 34 | ['x-forwarded-proto' => ['https' => 'https']], |
||
| 35 | 'https' |
||
| 36 | ], |
||
| 37 | 'httpToHttpsDefault' => [ |
||
| 38 | 'http', |
||
| 39 | ['x-forwarded-proto' => ['https']], |
||
| 40 | ['x-forwarded-proto' => null], |
||
| 41 | 'https' |
||
| 42 | ], |
||
| 43 | 'httpToHttpsUpperCase' => [ |
||
| 44 | 'http', |
||
| 45 | ['x-forwarded-proto' => ['https']], |
||
| 46 | ['x-forwarded-proto' => ['https' => 'HTTPS']], |
||
| 47 | 'https' |
||
| 48 | ], |
||
| 49 | 'httpToHttpsMultiValue' => [ |
||
| 50 | 'http', |
||
| 51 | ['x-forwarded-proto' => ['https']], |
||
| 52 | ['x-forwarded-proto' => ['https' => ['on', 's', 'https']]], |
||
| 53 | 'https' |
||
| 54 | ], |
||
| 55 | 'httpsToHttp' => [ |
||
| 56 | 'https', |
||
| 57 | ['x-forwarded-proto' => 'http'], |
||
| 58 | ['x-forwarded-proto' => ['http' => 'http']], |
||
| 59 | 'http' |
||
| 60 | ], |
||
| 61 | 'httpToHttpsWithCallback' => [ |
||
| 62 | 'http', |
||
| 63 | ['x-forwarded-proto' => 'test any-https **'], |
||
| 64 | [ |
||
| 65 | 'x-forwarded-proto' => function (array $values, String $header, ServerRequestInterface $request) { |
||
| 66 | return stripos($values[0], 'https') !== false ? 'https' : 'http'; |
||
| 67 | }, |
||
| 68 | ], |
||
| 69 | 'https', |
||
| 70 | ], |
||
| 71 | 'httpWithCallbackNull' => [ |
||
| 72 | 'http', |
||
| 73 | ['x-forwarded-proto' => 'test any-https **'], |
||
| 74 | [ |
||
| 75 | 'x-forwarded-proto' => function (array $values, String $header, ServerRequestInterface $request) { |
||
| 76 | return null; |
||
| 77 | }, |
||
| 78 | ], |
||
| 79 | 'http', |
||
| 80 | ] |
||
| 174 |