| Conditions | 1 |
| Paths | 1 |
| Total Lines | 61 |
| Code Lines | 43 |
| 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 |
||
| 67 | protected function createAtHomeOrderObject() |
||
| 68 | { |
||
| 69 | // create order |
||
| 70 | $orderId = time(); |
||
| 71 | $order = new Order($orderId); |
||
| 72 | $order->setCostCenter('Cost Center'); |
||
| 73 | |||
| 74 | // add lines |
||
| 75 | $line1 = new OrderLine('Beer', 1); |
||
| 76 | $order->addLine($line1); |
||
| 77 | $line2 = new OrderLine('Whisky', 100); |
||
| 78 | $order->addLine($line2); |
||
| 79 | |||
| 80 | // add box |
||
| 81 | $address = new Address(); |
||
| 82 | $address->setStreetName('Afrikalaan'); |
||
| 83 | $address->setNumber('289'); |
||
| 84 | $address->setPostalCode('9000'); |
||
| 85 | $address->setLocality('Gent'); |
||
| 86 | $address->setCountryCode('BE'); |
||
| 87 | |||
| 88 | $sender = new Sender(); |
||
| 89 | $sender->setAddress($address); |
||
| 90 | $sender->setName('Tijs Verkoyen'); |
||
| 91 | $sender->setCompany('Sumo Coders'); |
||
| 92 | $sender->setPhoneNumber('+32 9 395 02 51'); |
||
| 93 | $sender->setEmailAddress('[email protected]'); |
||
| 94 | |||
| 95 | $box = new Box(); |
||
| 96 | $box->setSender($sender); |
||
| 97 | $box->setRemark('Remark'); |
||
| 98 | |||
| 99 | // add label |
||
| 100 | $address = new Address(); |
||
| 101 | $address->setStreetName('Kerkstraat'); |
||
| 102 | $address->setNumber('108'); |
||
| 103 | $address->setPostalCode('9050'); |
||
| 104 | $address->setLocality('Gentbrugge'); |
||
| 105 | $address->setCountryCode('BE'); |
||
| 106 | |||
| 107 | $receiver = new Receiver(); |
||
| 108 | $receiver->setAddress($address); |
||
| 109 | $receiver->setName('Tijs Verkoyen'); |
||
| 110 | $receiver->setCompany('Sumo Coders'); |
||
| 111 | $receiver->setPhoneNumber('+32 9 395 02 51'); |
||
| 112 | $receiver->setEmailAddress('[email protected]'); |
||
| 113 | |||
| 114 | // options |
||
| 115 | $option = new Messaging('infoDistributed', 'NL', '[email protected]'); |
||
| 116 | |||
| 117 | // @Home |
||
| 118 | $atHome = new AtHome(); |
||
| 119 | $atHome->setProduct('bpack 24h Pro'); |
||
| 120 | $atHome->setWeight(2000); |
||
| 121 | $atHome->setReceiver($receiver); |
||
| 122 | $atHome->addOption($option); |
||
| 123 | $box->setNationalBox($atHome); |
||
| 124 | |||
| 125 | $order->addBox($box); |
||
| 126 | |||
| 127 | return $order; |
||
| 128 | } |
||
| 234 |
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