@@ -4,7 +4,7 @@ |
||
| 4 | 4 | * @package BoxPacker |
| 5 | 5 | * @author Doug Wright |
| 6 | 6 | */ |
| 7 | -declare(strict_types=1); |
|
| 7 | +declare(strict_types = 1); |
|
| 8 | 8 | namespace DVDoug\BoxPacker; |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -7,9 +7,9 @@ |
||
| 7 | 7 | declare(strict_types=1); |
| 8 | 8 | namespace DVDoug\BoxPacker; |
| 9 | 9 | |
| 10 | +use Psr\Log\LogLevel; |
|
| 10 | 11 | use Psr\Log\LoggerAwareInterface; |
| 11 | 12 | use Psr\Log\LoggerAwareTrait; |
| 12 | -use Psr\Log\LogLevel; |
|
| 13 | 13 | use Psr\Log\NullLogger; |
| 14 | 14 | |
| 15 | 15 | /** |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * @package BoxPacker |
| 5 | 5 | * @author Doug Wright |
| 6 | 6 | */ |
| 7 | -declare(strict_types=1); |
|
| 7 | +declare(strict_types = 1); |
|
| 8 | 8 | namespace DVDoug\BoxPacker; |
| 9 | 9 | |
| 10 | 10 | use Psr\Log\LoggerAwareInterface; |
@@ -68,21 +68,21 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | do { //Keep moving items from most overweight box to most underweight box |
| 70 | 70 | $tryRepack = false; |
| 71 | - $this->logger->log(LogLevel::DEBUG, 'boxes under/over target: ' . count($underWeightBoxes) . '/' . count($overWeightBoxes)); |
|
| 71 | + $this->logger->log(LogLevel::DEBUG, 'boxes under/over target: '.count($underWeightBoxes).'/'.count($overWeightBoxes)); |
|
| 72 | 72 | |
| 73 | 73 | usort($overWeightBoxes, [$this, 'sortMoreSpaceFirst']); |
| 74 | 74 | usort($underWeightBoxes, [$this, 'sortMoreSpaceFirst']); |
| 75 | 75 | |
| 76 | 76 | foreach ($underWeightBoxes as $u => $underWeightBox) { |
| 77 | - $this->logger->log(LogLevel::DEBUG, 'Underweight Box ' . $u); |
|
| 77 | + $this->logger->log(LogLevel::DEBUG, 'Underweight Box '.$u); |
|
| 78 | 78 | foreach ($overWeightBoxes as $o => $overWeightBox) { |
| 79 | - $this->logger->log(LogLevel::DEBUG, 'Overweight Box ' . $o); |
|
| 79 | + $this->logger->log(LogLevel::DEBUG, 'Overweight Box '.$o); |
|
| 80 | 80 | $overWeightBoxItems = $overWeightBox->getItems()->asItemArray(); |
| 81 | 81 | |
| 82 | 82 | //For each item in the heavier box, try and move it to the lighter one |
| 83 | 83 | /** @var Item $overWeightBoxItem */ |
| 84 | 84 | foreach ($overWeightBoxItems as $oi => $overWeightBoxItem) { |
| 85 | - $this->logger->log(LogLevel::DEBUG, 'Overweight Item ' . $oi); |
|
| 85 | + $this->logger->log(LogLevel::DEBUG, 'Overweight Item '.$oi); |
|
| 86 | 86 | if ($underWeightBox->getWeight() + $overWeightBoxItem->getWeight() > $targetWeight) { |
| 87 | 87 | $this->logger->log(LogLevel::DEBUG, 'Skipping item for hindering weight distribution'); |
| 88 | 88 | continue; //skip if moving this item would hinder rather than help weight distribution |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | * @package BoxPacker |
| 5 | 5 | * @author Doug Wright |
| 6 | 6 | */ |
| 7 | -declare(strict_types=1); |
|
| 7 | +declare(strict_types = 1); |
|
| 8 | 8 | namespace DVDoug\BoxPacker; |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | * @package BoxPacker |
| 5 | 5 | * @author Doug Wright |
| 6 | 6 | */ |
| 7 | -declare(strict_types=1); |
|
| 7 | +declare(strict_types = 1); |
|
| 8 | 8 | namespace DVDoug\BoxPacker; |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | * @package BoxPacker |
| 5 | 5 | * @author Doug Wright |
| 6 | 6 | */ |
| 7 | -declare(strict_types=1); |
|
| 7 | +declare(strict_types = 1); |
|
| 8 | 8 | namespace DVDoug\BoxPacker; |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | * @package BoxPacker |
| 5 | 5 | * @author Doug Wright |
| 6 | 6 | */ |
| 7 | -declare(strict_types=1); |
|
| 7 | +declare(strict_types = 1); |
|
| 8 | 8 | namespace DVDoug\BoxPacker; |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | * @package BoxPacker |
| 5 | 5 | * @author Doug Wright |
| 6 | 6 | */ |
| 7 | -declare(strict_types=1); |
|
| 7 | +declare(strict_types = 1); |
|
| 8 | 8 | namespace DVDoug\BoxPacker; |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | * @package BoxPacker |
| 5 | 5 | * @author Doug Wright |
| 6 | 6 | */ |
| 7 | -declare(strict_types=1); |
|
| 7 | +declare(strict_types = 1); |
|
| 8 | 8 | namespace DVDoug\BoxPacker; |
| 9 | 9 | |
| 10 | 10 | /** |
@@ -7,7 +7,9 @@ |
||
| 7 | 7 | declare(strict_types=1); |
| 8 | 8 | namespace DVDoug\BoxPacker; |
| 9 | 9 | |
| 10 | -use ArrayIterator, Countable, IteratorAggregate, Traversable; |
|
| 10 | +use ArrayIterator; |
|
| 11 | +use IteratorAggregate; |
|
| 12 | +use Traversable; |
|
| 11 | 13 | use function reset; |
| 12 | 14 | |
| 13 | 15 | /** |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | * @package BoxPacker |
| 5 | 5 | * @author Doug Wright |
| 6 | 6 | */ |
| 7 | -declare(strict_types=1); |
|
| 7 | +declare(strict_types = 1); |
|
| 8 | 8 | namespace DVDoug\BoxPacker; |
| 9 | 9 | |
| 10 | 10 | use ArrayIterator, Countable, IteratorAggregate, Traversable; |