@@ -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 |
@@ -66,7 +66,7 @@ |
||
66 | 66 | if (!$this->isSorted) { |
67 | 67 | usort( |
68 | 68 | $this->list, |
69 | - function (PackedBox $boxA, PackedBox $boxB) { |
|
69 | + function(PackedBox $boxA, PackedBox $boxB) { |
|
70 | 70 | $choice = $boxB->getItems()->count() - $boxA->getItems()->count(); |
71 | 71 | if ($choice === 0) { |
72 | 72 | $choice = $boxA->getBox()->getInnerVolume() - $boxB->getBox()->getInnerVolume(); |
@@ -146,7 +146,7 @@ |
||
146 | 146 | |
147 | 147 | //Check iteration was productive |
148 | 148 | if (count($packedBoxesIteration) === 0) { |
149 | - throw new ItemTooLargeException('Item ' . $this->items->top()->getDescription() . ' is too large to fit into any box'); |
|
149 | + throw new ItemTooLargeException('Item '.$this->items->top()->getDescription().' is too large to fit into any box'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | //Find best box of iteration, and remove packed items from unpacked list |
@@ -61,7 +61,7 @@ |
||
61 | 61 | if (!$this->isSorted) { |
62 | 62 | usort( |
63 | 63 | $this->list, |
64 | - function (Box $boxA, Box $boxB) { |
|
64 | + function(Box $boxA, Box $boxB) { |
|
65 | 65 | if ($boxB->getInnerVolume() > $boxA->getInnerVolume()) { |
66 | 66 | return -1; |
67 | 67 | } elseif ($boxB->getInnerVolume() < $boxA->getInnerVolume()) { |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $orientationFits = []; |
254 | 254 | /** @var OrientatedItem $orientation */ |
255 | 255 | foreach ($orientationsToUse as $o => $orientation) { |
256 | - $orientationFit = min($widthLeft - $orientation->getWidth(), $lengthLeft - $orientation->getLength()); |
|
256 | + $orientationFit = min($widthLeft - $orientation->getWidth(), $lengthLeft - $orientation->getLength()); |
|
257 | 257 | $orientationFits[$o] = $orientationFit; |
258 | 258 | } |
259 | 259 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | //remove any that simply don't fit |
303 | - return array_filter($orientations, function (OrientatedItem $i) use ($widthLeft, $lengthLeft, $depthLeft) { |
|
303 | + return array_filter($orientations, function(OrientatedItem $i) use ($widthLeft, $lengthLeft, $depthLeft) { |
|
304 | 304 | return $i->getWidth() <= $widthLeft && $i->getLength() <= $lengthLeft && $i->getDepth() <= $depthLeft; |
305 | 305 | }); |
306 | 306 |