| Conditions | 1 |
| Paths | 1 |
| Total Lines | 52 |
| 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 |
||
| 117 | public function testExport1() |
||
| 118 | { |
||
| 119 | // SET THESE TO TRUE TO DEBUG |
||
| 120 | $this->config['db_debug'] = false; |
||
| 121 | $this->config['file_debug'] = false; |
||
| 122 | //=========================== |
||
| 123 | $order = new Unit('order'); |
||
| 124 | $order->setMapping([]); |
||
| 125 | $order->setReversedMapping([]); |
||
| 126 | $invoice = new Unit('invoice'); |
||
| 127 | $invoice->setMapping([]); |
||
| 128 | $shipment = new Unit('shipment'); |
||
| 129 | $shipment->setMapping([]); |
||
| 130 | $address = new Unit('address'); |
||
| 131 | $address->setMapping([]); |
||
| 132 | $orderItem = new Unit('order_item'); |
||
| 133 | $orderItem->setMapping([]); |
||
| 134 | $invoiceItem = new Unit('invoice_item'); |
||
| 135 | $invoiceItem->setMapping([]); |
||
| 136 | $shipmentItem = new Unit('shipment_item'); |
||
| 137 | $shipmentItem->setMapping([]); |
||
| 138 | |||
| 139 | $invoiceItem->setParent($invoice); |
||
| 140 | $invoice->setParent($order); |
||
| 141 | $shipmentItem->setParent($shipment); |
||
| 142 | $shipment->setParent($invoice); |
||
| 143 | $address->setParent($order); |
||
| 144 | $orderItem->setParent($order); |
||
| 145 | $orderItem->addSibling($invoiceItem); |
||
| 146 | $orderItem->addSibling($shipmentItem); |
||
| 147 | |||
| 148 | $bag = new SimpleBag(); |
||
| 149 | $bag->addSet([$order, $invoice, $shipment, $address, $orderItem, $invoiceItem, $shipmentItem]); |
||
| 150 | |||
| 151 | $input = new ArrayInput(); |
||
| 152 | |||
| 153 | $reverseMove = new ReverseMove($bag, $this->config, $this->resource); |
||
| 154 | $dump = new Dump($bag, $this->config, $this->resource); |
||
| 155 | $assemble = new AssembleInput($bag, $this->config, $this->getLanguageAdapter(), $input, new ArrayMap()); |
||
| 156 | |||
| 157 | $result = new Result(); |
||
| 158 | $workflow = new QueueWorkflow($this->config, $result); |
||
| 159 | $workflow->add($reverseMove); |
||
| 160 | $workflow->add($dump); |
||
| 161 | $workflow->add($assemble); |
||
| 162 | |||
| 163 | // $workflow->execute(); |
||
| 164 | //===================================================================== |
||
| 165 | // assert that customers are in the file |
||
| 166 | |||
| 167 | // TODO assertions |
||
| 168 | } |
||
| 169 | } |
||
| 170 |