| Conditions | 1 |
| Paths | 1 |
| Total Lines | 58 |
| Code Lines | 49 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 1 |
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 |
||
| 12 | public function testParseDescriptionLines() |
||
| 13 | { |
||
| 14 | $rawData = [ |
||
| 15 | ":20:STARTUMSE", |
||
| 16 | ":25:00000000/0221122370", |
||
| 17 | ":28C:00000/001", |
||
| 18 | ":60F:C170428EUR6670,54", |
||
| 19 | ":61:1705030503CR223,72N062NONREF", |
||
| 20 | ":86:166?00GUTSCHRIFT?109251?20EREF+CCB.122.UE.266455?21SVWZ+Re 17", |
||
| 21 | "-H-0005 vom 24.04?22.2017?30DRESDEFF850?31DE00000000000000000000?", |
||
| 22 | "32TEST TEST GBR", |
||
| 23 | ":62F:C170503EUR6894,26", |
||
| 24 | "-", |
||
| 25 | ":20:STARTUMSE", |
||
| 26 | ":25:00000000/0221122370", |
||
| 27 | ":28C:00000/001", |
||
| 28 | ":60M:C170428EUR6894,26", |
||
| 29 | ":61:1705030503CR3105.74N062NONREF", |
||
| 30 | ":86:166?00GUTSCHRIFT?109251?20EREF+CCB.122.UE.266455?21SVWZ+Re 17", |
||
| 31 | "-H-0005 vom 24.04?22.2017?30DRESDEFF850?31DE00000000000000000000?", |
||
| 32 | "32TEST TEST GBR", |
||
| 33 | ":62F:C170503EUR10000,00", |
||
| 34 | "-", |
||
| 35 | ":20:STARTUMSE", |
||
| 36 | ":25:00000000/0221122370", |
||
| 37 | ":28C:00000/001", |
||
| 38 | ":60F:C170429EUR10000,00", |
||
| 39 | ":61:1705030503CR100,00N062NONREF", |
||
| 40 | ":86:166?00GUTSCHRIFT?109251?20EREF+CCB.122.UE.266455?21SVWZ+Re 17", |
||
| 41 | "-H-0005 vom 24.04?22.2017?30DRESDEFF850?31DE00000000000000000000?", |
||
| 42 | "32TEST TEST GBR", |
||
| 43 | ":62F:C170503EUR10100,00", |
||
| 44 | "-" |
||
| 45 | ]; |
||
| 46 | |||
| 47 | $parser = new MT940(implode("\r\n", $rawData)); |
||
| 48 | $result = $parser->parse(MT940::TARGET_ARRAY); |
||
| 49 | $this->assertEquals( |
||
| 50 | 'EREF+CCB.122.UE.266455SVWZ+Re 17-H-0005 vom 24.04.2017', |
||
| 51 | $result[0]['transactions'][0]['description']['description_1'] |
||
| 52 | ); |
||
| 53 | $this->assertEquals( |
||
| 54 | '166', |
||
| 55 | $result[0]['transactions'][0]['transaction_code'] |
||
| 56 | ); |
||
| 57 | $this->assertEquals( |
||
| 58 | '223.72', |
||
| 59 | $result[0]['transactions'][0]['amount'] |
||
| 60 | ); |
||
| 61 | $this->assertEquals( |
||
| 62 | '2017-04-29', |
||
| 63 | $result[2]['date'] |
||
| 64 | ); |
||
| 65 | $this->assertEquals( |
||
| 66 | 10000.00, |
||
| 67 | $result[2]['start_balance']['amount'] |
||
| 68 | ); |
||
| 69 | } |
||
| 70 | } |
||
| 71 |