| Conditions | 1 |
| Paths | 1 |
| Total Lines | 62 |
| Code Lines | 47 |
| 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 |
||
| 62 | private function getOrder() |
||
| 63 | { |
||
| 64 | $order = new Order('ref_1'); |
||
| 65 | |||
| 66 | $order->setCostCenter('Cost Center'); |
||
| 67 | |||
| 68 | $order->setLines(array(new Line('Product 1', 1))); |
||
| 69 | $order->addLine(new Line('Product 1', 5)); |
||
| 70 | |||
| 71 | $senderAddress = new Address(); |
||
| 72 | $senderAddress->setStreetName('MUNT'); |
||
| 73 | $senderAddress->setNumber(1); |
||
| 74 | $senderAddress->setBox(1); |
||
| 75 | $senderAddress->setPostalCode(1000); |
||
| 76 | $senderAddress->setLocality('Brussel'); |
||
| 77 | $senderAddress->setCountryCode('BE'); |
||
| 78 | $senderAddress->setBox(1); |
||
| 79 | |||
| 80 | $pugoAddress = new PugoAddress(); |
||
| 81 | $pugoAddress->setStreetName('Turnhoutsebaan'); |
||
| 82 | $pugoAddress->setNumber(468); |
||
| 83 | $pugoAddress->setBox('A'); |
||
| 84 | $pugoAddress->setPostalCode(2110); |
||
| 85 | $pugoAddress->setLocality('Wijnegem'); |
||
| 86 | $pugoAddress->setCountryCode('BE'); |
||
| 87 | |||
| 88 | $sender = new Sender(); |
||
| 89 | $sender->setName('SENDER NAME'); |
||
| 90 | $sender->setCompany('SENDER COMPANY'); |
||
| 91 | $sender->setAddress($senderAddress); |
||
| 92 | $sender->setEmailAddress('[email protected]'); |
||
| 93 | $sender->setPhoneNumber('022011111'); |
||
| 94 | |||
| 95 | $atBpost = new AtBpost(); |
||
| 96 | |||
| 97 | $atBpost->setOptions(array( |
||
| 98 | new Messaging('infoDistributed', 'EN', null, '0476123456'), |
||
| 99 | new Messaging('keepMeInformed', 'EN', null, '0032475123456'), |
||
| 100 | )); |
||
| 101 | $atBpost->addOption(new SaturdayDelivery()); |
||
| 102 | $atBpost->addOption(new CashOnDelivery(1251, 'BE19210023508812', 'GEBABEBB')); |
||
| 103 | |||
| 104 | $atBpost->setWeight(2000); |
||
| 105 | |||
| 106 | $atBpost->setPugoId(207500); |
||
| 107 | $atBpost->setPugoName('WIJNEGEM'); |
||
| 108 | $atBpost->setPugoAddress($pugoAddress); |
||
| 109 | $atBpost->setReceiverName('RECEIVER NAME'); |
||
| 110 | $atBpost->setReceiverCompany('RECEIVER COMPANY'); |
||
| 111 | $atBpost->setRequestedDeliveryDate('2020-10-22'); |
||
| 112 | |||
| 113 | $box = new Box(); |
||
| 114 | $box->setSender($sender); |
||
| 115 | $box->setNationalBox($atBpost); |
||
| 116 | $box->setRemark('bpack@bpost VAS 038 - COD+SAT+iD'); |
||
| 117 | $box->setAdditionalCustomerReference('Reference that can be used for cross-referencing'); |
||
| 118 | |||
| 119 | $order->setBoxes(array()); |
||
| 120 | $this->assertCount(0, $order->getBoxes()); |
||
| 121 | $order->addBox($box); |
||
| 122 | |||
| 123 | return $order; |
||
| 124 | } |
||
| 198 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths