| Conditions | 1 |
| Paths | 1 |
| Total Lines | 70 |
| Code Lines | 60 |
| 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 |
||
| 75 | public function string_to_amount_provider() { |
||
| 76 | return array( |
||
| 77 | // Thousands separator is '' and decimal separator is '.'. |
||
| 78 | array( '', '.', '1', 1 ), |
||
| 79 | array( '', '.', '2,5', 2.5 ), |
||
| 80 | array( '', '.', '2,50', 2.5 ), |
||
| 81 | array( '', '.', '1250,00', 1250 ), |
||
| 82 | array( '', '.', '1250,75', 1250.75 ), |
||
| 83 | array( '', '.', '1250.75', 1250.75 ), |
||
| 84 | array( '', '.', '1.250,00', 1250 ), |
||
| 85 | array( '', '.', '2.500,75', 2500.75 ), |
||
| 86 | array( '', '.', '2500,75-', -2500.75 ), |
||
| 87 | array( '', '.', '-2500,75', -2500.75 ), |
||
| 88 | array( '', '.', '2500-', -2500 ), |
||
| 89 | array( '', '.', '-2500', -2500 ), |
||
| 90 | array( '', '.', '1-', -1 ), |
||
| 91 | // Thousands separator is '.' and decimal separator is ','. |
||
| 92 | array( '.', ',', '1', 1 ), |
||
| 93 | array( '.', ',', '2,5', 2.5 ), |
||
| 94 | array( '.', ',', '2,50', 2.5 ), |
||
| 95 | array( '.', ',', '1250,00', 1250 ), |
||
| 96 | array( '.', ',', '2500,75', 2500.75 ), |
||
| 97 | array( '.', ',', '1.250,00', 1250 ), |
||
| 98 | array( '.', ',', '2.500,75', 2500.75 ), |
||
| 99 | array( '.', ',', '2.500,750', 2500.75 ), |
||
| 100 | array( '.', ',', '1.234.567.890', 1234567890 ), |
||
| 101 | array( '.', ',', '2.500,75-', -2500.75 ), |
||
| 102 | array( '.', ',', '-2.500,75', -2500.75 ), |
||
| 103 | array( '.', ',', '2.500-', -2500 ), |
||
| 104 | array( '.', ',', '-2.500', -2500 ), |
||
| 105 | array( '.', ',', '1-', -1 ), |
||
| 106 | // Thousands separator is ',' and decimal separator is '.'. |
||
| 107 | array( ',', '.', '1', 1 ), |
||
| 108 | array( ',', '.', '2.5', 2.5 ), |
||
| 109 | array( ',', '.', '2.50', 2.5 ), |
||
| 110 | array( ',', '.', '1250.00', 1250 ), |
||
| 111 | array( ',', '.', '1250.75', 1250.75 ), |
||
| 112 | array( ',', '.', '1,250.00', 1250 ), |
||
| 113 | array( ',', '.', '2,500.75', 2500.75 ), |
||
| 114 | array( ',', '.', '2,500.', 2500 ), |
||
| 115 | array( ',', '.', '2,500.75-', -2500.75 ), |
||
| 116 | array( ',', '.', '-2,500.75', -2500.75 ), |
||
| 117 | array( ',', '.', '2,500-', -2500 ), |
||
| 118 | array( ',', '.', '-2,500', -2500 ), |
||
| 119 | array( ',', '.', '1-', -1 ), |
||
| 120 | // Thousands separator is ' ' and decimal separator is '.'. |
||
| 121 | array( ' ', '.', '2 500.75', 2500.75 ), |
||
| 122 | // Thousands separator is 't' and decimal separator is '.'. |
||
| 123 | array( 't', '.', '2t500.75', 2500.75 ), |
||
| 124 | array( 't', '.', '2t500.7', 2500.7 ), |
||
| 125 | // Thousands separator is 't' and decimal separator is '-'. |
||
| 126 | array( 't', '-', '2t500-75', 2500.75 ), |
||
| 127 | array( 't', '-', '2t500-7', 2500.7 ), |
||
| 128 | // Thousands separator is 't' and decimal separator is ' '. |
||
| 129 | array( 't', ' ', '2t500 75', 2500.75 ), |
||
| 130 | array( 't', ' ', '2t500 7', 2500.7 ), |
||
| 131 | // Thousands separator is ' ' and decimal separator is 'd'. |
||
| 132 | array( ' ', 'd', '2 500d75', 2500.75 ), |
||
| 133 | array( ' ', 'd', '2 500d7', 2500.7 ), |
||
| 134 | array( ' ', 'd', '-2 500d75', -2500.75 ), |
||
| 135 | array( ' ', 'd', '-2 500d7', -2500.7 ), |
||
| 136 | // Other. |
||
| 137 | array( '.', ',', 'EUR 1.250', 1250 ), |
||
| 138 | array( '.', ',', 'EUR 1.250,75', 1250.75 ), |
||
| 139 | array( '.', ',', 'EUR -1.250', -1250 ), |
||
| 140 | array( '.', ',', 'EUR -1.250,75', -1250.75 ), |
||
| 141 | array( '.', ',', '1.250,-', 1250 ), |
||
| 142 | array( '.', ',', '-1.250,-', -1250 ), |
||
| 143 | array( '', '', '123456789', 123456789 ), |
||
| 144 | array( false, false, '123 456 789', 123456789 ), |
||
| 145 | ); |
||
| 148 |