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