@@ -65,17 +65,17 @@ |
||
| 65 | 65 | |
| 66 | 66 | do { //Keep moving items from most overweight box to most underweight box |
| 67 | 67 | $tryRepack = false; |
| 68 | - $this->logger->log(LogLevel::DEBUG, 'boxes under/over target: ' . count($underWeightBoxes) . '/' . count($overWeightBoxes)); |
|
| 68 | + $this->logger->log(LogLevel::DEBUG, 'boxes under/over target: '.count($underWeightBoxes).'/'.count($overWeightBoxes)); |
|
| 69 | 69 | |
| 70 | 70 | foreach ($underWeightBoxes as $u => $underWeightBox) { |
| 71 | - $this->logger->log(LogLevel::DEBUG, 'Underweight Box ' . $u); |
|
| 71 | + $this->logger->log(LogLevel::DEBUG, 'Underweight Box '.$u); |
|
| 72 | 72 | foreach ($overWeightBoxes as $o => $overWeightBox) { |
| 73 | - $this->logger->log(LogLevel::DEBUG, 'Overweight Box ' . $o); |
|
| 73 | + $this->logger->log(LogLevel::DEBUG, 'Overweight Box '.$o); |
|
| 74 | 74 | $overWeightBoxItems = $overWeightBox->getItems()->asArray(); |
| 75 | 75 | |
| 76 | 76 | //For each item in the heavier box, try and move it to the lighter one |
| 77 | 77 | foreach ($overWeightBoxItems as $oi => $overWeightBoxItem) { |
| 78 | - $this->logger->log(LogLevel::DEBUG, 'Overweight Item ' . $oi); |
|
| 78 | + $this->logger->log(LogLevel::DEBUG, 'Overweight Item '.$oi); |
|
| 79 | 79 | if ($underWeightBox->getWeight() + $overWeightBoxItem->getWeight() > $targetWeight) { |
| 80 | 80 | $this->logger->log(LogLevel::DEBUG, 'Skipping item for hindering weight distribution'); |
| 81 | 81 | continue; //skip if moving this item would hinder rather than help weight distribution |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | |
| 149 | 149 | //Check iteration was productive |
| 150 | 150 | if ($packedBoxesIteration->isEmpty()) { |
| 151 | - throw new ItemTooLargeException('Item ' . $this->items->top()->getDescription() . ' is too large to fit into any box', $this->items->top()); |
|
| 151 | + throw new ItemTooLargeException('Item '.$this->items->top()->getDescription().' is too large to fit into any box', $this->items->top()); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | //Find best box of iteration, and remove packed items from unpacked list |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $orientationFits = []; |
| 81 | 81 | /** @var OrientatedItem $orientation */ |
| 82 | 82 | foreach ($orientationsToUse as $o => $orientation) { |
| 83 | - $orientationFit = min($widthLeft - $orientation->getWidth(), $lengthLeft - $orientation->getLength()); |
|
| 83 | + $orientationFit = min($widthLeft - $orientation->getWidth(), $lengthLeft - $orientation->getLength()); |
|
| 84 | 84 | $orientationFits[$o] = $orientationFit; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | //remove any that simply don't fit |
| 130 | - return array_filter($orientations, function (OrientatedItem $i) use ($widthLeft, $lengthLeft, $depthLeft) { |
|
| 130 | + return array_filter($orientations, function(OrientatedItem $i) use ($widthLeft, $lengthLeft, $depthLeft) { |
|
| 131 | 131 | return $i->getWidth() <= $widthLeft && $i->getLength() <= $lengthLeft && $i->getDepth() <= $depthLeft; |
| 132 | 132 | }); |
| 133 | 133 | } |