From f25a4fcc8f3e692b07b618fd19916658e7217efe Mon Sep 17 00:00:00 2001 From: Doug Wright Date: Sun, 11 Aug 2013 16:54:03 +0100 Subject: [PATCH] Avoid unnecessary calculations --- Packer.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Packer.php b/Packer.php index cf364a50..2cfb3bce 100644 --- a/Packer.php +++ b/Packer.php @@ -24,7 +24,7 @@ class Packer { /** * List of box sizes available to pack items into - * @var Box[] + * @var BoxList */ protected $boxes; @@ -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; @@ -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");