| Conditions | 1 |
| Paths | 1 |
| Total Lines | 57 |
| Code Lines | 44 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 |
||
| 25 | public function dataProvider() |
||
| 26 | { |
||
| 27 | return [ |
||
| 28 | 'default' => [ |
||
| 29 | 'string' => 'test', |
||
| 30 | 'contentTransferEncoding' => null, |
||
| 31 | 'fromEncode' => null, |
||
| 32 | 'toEncode' => null, |
||
| 33 | 'expected' => 'test' |
||
| 34 | ], |
||
| 35 | 'simple base64' => [ |
||
| 36 | 'string' => 'dGVzdA==', |
||
| 37 | 'contentTransferEncoding' => 'base64', |
||
| 38 | 'fromEncode' => null, |
||
| 39 | 'toEncode' => null, |
||
| 40 | 'expected' => 'test' |
||
| 41 | ], |
||
| 42 | 'simple quoted-printable' => [ |
||
| 43 | 'string' => 'test', |
||
| 44 | 'contentTransferEncoding' => 'quoted-printable', |
||
| 45 | 'fromEncode' => null, |
||
| 46 | 'toEncode' => null, |
||
| 47 | 'expected' => 'test' |
||
| 48 | ], |
||
| 49 | 'simple quoted-printable encoded' => [ |
||
| 50 | 'string' => 'test', |
||
| 51 | 'contentTransferEncoding' => 'quoted-printable', |
||
| 52 | 'fromEncode' => 'UTF-8', |
||
| 53 | 'toEncode' => 'windows-1250', |
||
| 54 | 'expected' => 'test' |
||
| 55 | ], |
||
| 56 | 'UTF-8 quoted-printable' => [ |
||
| 57 | 'string' => '=D1=80=D1=83=D1=80=D1=83bubu', |
||
| 58 | 'contentTransferEncoding' => 'quoted-printable', |
||
| 59 | 'fromEncode' => 'UTF-8', |
||
| 60 | 'toEncode' => 'UTF-8', |
||
| 61 | 'expected' => 'руруbubu' |
||
| 62 | ], |
||
| 63 | 'koi8-r quoted-printable' => [ |
||
| 64 | 'string' => 'T. Čktesttest', |
||
| 65 | 'contentTransferEncoding' => 'quoted-printable', |
||
| 66 | 'fromEncode' => 'koi8-r', |
||
| 67 | 'toEncode' => 'UTF-8', |
||
| 68 | 'expected' => 'T. Čktesttest' |
||
| 69 | ], |
||
| 70 | 'windows-1250 quoted-printable' => [ |
||
| 71 | 'string' => '<DIV><FONT face=3DArial=20 |
||
| 72 | size=3D2>khsdkjdsljkdskl=9A=E8=9A=E8=9A=E8=F8=E8=F8=E8=E8=F8ffdssfdsfdsdf= |
||
| 73 | sdfsdf=E8dffdsd</FONT></DIV>', |
||
| 74 | 'contentTransferEncoding' => 'quoted-printable', |
||
| 75 | 'fromEncode' => 'windows-1250', |
||
| 76 | 'toEncode' => 'UTF-8', |
||
| 77 | 'expected' => '<DIV><FONT face=Arial |
||
| 78 | size=2>khsdkjdsljkdsklščščščřčřččřffdssfdsfdsdfsdfsdfčdffdsd</FONT></DIV>' |
||
| 79 | ], |
||
| 80 | ]; |
||
| 81 | } |
||
| 82 | } |
||
| 83 |