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