| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| 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 |
||
| 62 | public function string_to_amount_provider() { |
||
| 63 | return array( |
||
| 64 | // Thousands seperator is '' and decimal seperator is '.'. |
||
| 65 | array( '', '.', '1', 1 ), |
||
| 66 | array( '', '.', '2,5', 2.5 ), |
||
| 67 | array( '', '.', '2,50', 2.5 ), |
||
| 68 | array( '', '.', '1250,00', 1250 ), |
||
| 69 | array( '', '.', '1250,75', 1250.75 ), |
||
| 70 | array( '', '.', '1250.75', 1250.75 ), |
||
| 71 | array( '', '.', '1.250,00', 1250 ), |
||
| 72 | array( '', '.', '2.500,75', 2500.75 ), |
||
| 73 | // Thousands seperator is '.' and decimal seperator is ','. |
||
| 74 | array( '.', ',', '1', 1 ), |
||
| 75 | array( '.', ',', '2,5', 2.5 ), |
||
| 76 | array( '.', ',', '2,50', 2.5 ), |
||
| 77 | array( '.', ',', '1250,00', 1250 ), |
||
| 78 | array( '.', ',', '2500,75', 2500.75 ), |
||
| 79 | array( '.', ',', '1.250,00', 1250 ), |
||
| 80 | array( '.', ',', '2.500,75', 2500.75 ), |
||
| 81 | array( '.', ',', '2.500,750', 2500.75 ), |
||
| 82 | array( '.', ',', '1.234.567.890', 1234567890 ), |
||
| 83 | // Thousands seperator is ',' and decimal seperator is '.'. |
||
| 84 | array( ',', '.', '1', 1 ), |
||
| 85 | array( ',', '.', '2.5', 2.5 ), |
||
| 86 | array( ',', '.', '2.50', 2.5 ), |
||
| 87 | array( ',', '.', '1250.00', 1250 ), |
||
| 88 | array( ',', '.', '1250.75', 1250.75 ), |
||
| 89 | array( ',', '.', '1,250.00', 1250 ), |
||
| 90 | array( ',', '.', '2,500.75', 2500.75 ), |
||
| 91 | array( ',', '.', '2,500.', 2500 ), |
||
| 92 | // Thousands seperator is ' ' and decimal seperator is '.'. |
||
| 93 | array( ' ', '.', '2 500.75', 2500.75 ), |
||
| 94 | // Thousands seperator is 't' and decimal seperator is '.'. |
||
| 95 | array( 't', '.', '2t500.75', 2500.75 ), |
||
| 96 | array( 't', '.', '2t500.7', 2500.7 ), |
||
| 97 | // Thousands seperator is 't' and decimal seperator is '-'. |
||
| 98 | array( 't', '-', '2t500-75', 2500.75 ), |
||
| 99 | array( 't', '-', '2t500-7', 2500.7 ), |
||
| 100 | // Thousands seperator is 't' and decimal seperator is ' '. |
||
| 101 | array( 't', ' ', '2t500 75', 2500.75 ), |
||
| 102 | array( 't', ' ', '2t500 7', 2500.7 ), |
||
| 103 | // Thousands seperator is ' ' and decimal seperator is 'd'. |
||
| 104 | array( ' ', 'd', '2 500d75', 2500.75 ), |
||
| 105 | array( ' ', 'd', '2 500d7', 2500.7 ), |
||
| 106 | array( ' ', 'd', '-2 500d75', -2500.75 ), |
||
| 107 | array( ' ', 'd', '-2 500d7', -2500.7 ), |
||
| 108 | // Other. |
||
| 109 | array( '', '', '123456789', 123456789 ), |
||
| 110 | array( false, false, '123 456 789', 123456789 ), |
||
| 111 | ); |
||
| 112 | } |
||
| 113 | } |
||
| 114 |