| Conditions | 1 |
| Paths | 1 |
| Total Lines | 99 |
| Code Lines | 73 |
| 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 |
||
| 41 | public function testItAddsTransactionDetailsIfThereArePresentInXml(): void |
||
| 42 | { |
||
| 43 | $entry = $this->createMock(DTO\Entry::class); |
||
| 44 | |||
| 45 | $this->mockedEntryTransactionDetailDecoder |
||
| 46 | ->expects(self::once()) |
||
| 47 | ->method('addReference') |
||
| 48 | ->with( |
||
| 49 | self::isInstanceOf(DTO\EntryTransactionDetail::class), |
||
| 50 | self::isInstanceOf(SimpleXMLElement::class) |
||
| 51 | ); |
||
| 52 | |||
| 53 | $this->mockedEntryTransactionDetailDecoder |
||
| 54 | ->expects(self::once()) |
||
| 55 | ->method('addRelatedParties') |
||
| 56 | ->with( |
||
| 57 | self::isInstanceOf(DTO\EntryTransactionDetail::class), |
||
| 58 | self::isInstanceOf(SimpleXMLElement::class), |
||
| 59 | ); |
||
| 60 | |||
| 61 | $this->mockedEntryTransactionDetailDecoder |
||
| 62 | ->expects(self::once()) |
||
| 63 | ->method('addRelatedAgents') |
||
| 64 | ->with( |
||
| 65 | self::isInstanceOf(DTO\EntryTransactionDetail::class), |
||
| 66 | self::isInstanceOf(SimpleXMLElement::class), |
||
| 67 | ); |
||
| 68 | |||
| 69 | $this->mockedEntryTransactionDetailDecoder |
||
| 70 | ->expects(self::once()) |
||
| 71 | ->method('addRemittanceInformation') |
||
| 72 | ->with( |
||
| 73 | self::isInstanceOf(DTO\EntryTransactionDetail::class), |
||
| 74 | self::isInstanceOf(SimpleXMLElement::class), |
||
| 75 | ); |
||
| 76 | |||
| 77 | $this->mockedEntryTransactionDetailDecoder |
||
| 78 | ->expects(self::once()) |
||
| 79 | ->method('addRelatedDates') |
||
| 80 | ->with( |
||
| 81 | self::isInstanceOf(DTO\EntryTransactionDetail::class), |
||
| 82 | self::isInstanceOf(SimpleXMLElement::class), |
||
| 83 | ); |
||
| 84 | |||
| 85 | $this->mockedEntryTransactionDetailDecoder |
||
| 86 | ->expects(self::once()) |
||
| 87 | ->method('addReturnInformation') |
||
| 88 | ->with( |
||
| 89 | self::isInstanceOf(DTO\EntryTransactionDetail::class), |
||
| 90 | self::isInstanceOf(SimpleXMLElement::class), |
||
| 91 | ); |
||
| 92 | |||
| 93 | $this->mockedEntryTransactionDetailDecoder |
||
| 94 | ->expects(self::once()) |
||
| 95 | ->method('addAdditionalTransactionInformation') |
||
| 96 | ->with( |
||
| 97 | self::isInstanceOf(DTO\EntryTransactionDetail::class), |
||
| 98 | self::isInstanceOf(SimpleXMLElement::class), |
||
| 99 | ); |
||
| 100 | |||
| 101 | $this->mockedEntryTransactionDetailDecoder |
||
| 102 | ->expects(self::once()) |
||
| 103 | ->method('addBankTransactionCode') |
||
| 104 | ->with( |
||
| 105 | self::isInstanceOf(DTO\EntryTransactionDetail::class), |
||
| 106 | self::isInstanceOf(SimpleXMLElement::class), |
||
| 107 | ); |
||
| 108 | |||
| 109 | $this->mockedEntryTransactionDetailDecoder |
||
| 110 | ->expects(self::once()) |
||
| 111 | ->method('addCharges') |
||
| 112 | ->with( |
||
| 113 | self::isInstanceOf(DTO\EntryTransactionDetail::class), |
||
| 114 | self::isInstanceOf(SimpleXMLElement::class), |
||
| 115 | ); |
||
| 116 | |||
| 117 | $this->mockedEntryTransactionDetailDecoder |
||
| 118 | ->expects(self::once()) |
||
| 119 | ->method('addAmountDetails') |
||
| 120 | ->with( |
||
| 121 | self::isInstanceOf(DTO\EntryTransactionDetail::class), |
||
| 122 | self::isInstanceOf(SimpleXMLElement::class), |
||
| 123 | ); |
||
| 124 | |||
| 125 | $this->mockedEntryTransactionDetailDecoder |
||
| 126 | ->expects(self::once()) |
||
| 127 | ->method('addAmount') |
||
| 128 | ->with( |
||
| 129 | self::isInstanceOf(DTO\EntryTransactionDetail::class), |
||
| 130 | self::isInstanceOf(SimpleXMLElement::class), |
||
| 131 | self::isInstanceOf(SimpleXMLElement::class), |
||
| 132 | ); |
||
| 133 | |||
| 134 | $entry |
||
| 135 | ->expects(self::once()) |
||
| 136 | ->method('addTransactionDetail') |
||
| 137 | ->with(self::isInstanceOf(DTO\EntryTransactionDetail::class)); |
||
| 138 | |||
| 139 | $this->decoder->addTransactionDetails($entry, $this->getXmlEntry()); |
||
| 140 | } |
||
| 157 |