Skip to content

Commit

Permalink
Avoid unnecessary calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug committed Aug 11, 2013
1 parent 91624d5 commit f25a4fc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Packer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Packer {

/**
* List of box sizes available to pack items into
* @var Box[]
* @var BoxList
*/
protected $boxes;

Expand Down Expand Up @@ -222,6 +222,10 @@ public function packBox(Box $aBox, ItemList $aItems) {
$layerWidth = 0;
$layerLength = 0;
}
else {
$this->logger->debug("doesn't fit on layer even when empty");
break;
}

$packedDepth += $layerDepth;
$layerDepth = 0;
Expand All @@ -236,10 +240,6 @@ public function packBox(Box $aBox, ItemList $aItems) {
$this->logger->debug("layerDepth: {$layerDepth}");
$this->logger->debug("packedDepth: {$packedDepth}");

if ($itemWidth > $horizontalDimensions[1] || $itemLength > $horizontalDimensions[1]) {
break; //item is oversize for box, move on
}

}
}
$this->logger->debug("done with this box");
Expand Down

0 comments on commit f25a4fc

Please sign in to comment.