Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #132

Merged
merged 1 commit into from
Feb 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/OrientatedItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getBestOrientation(
$usableOrientations = $this->getUsableOrientations($possibleOrientations, $isLastItem);

if (empty($usableOrientations)) {
return null;
return;
}

usort($usableOrientations, function (OrientatedItem $a, OrientatedItem $b) use ($widthLeft, $lengthLeft, $depthLeft, $nextItem) {
Expand Down
3 changes: 3 additions & 0 deletions src/PackedBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public function getWeight()
{
return $this->box->getEmptyWeight() + $this->getItemWeight();
}

/**
* Get packed weight of the items only.
*
Expand All @@ -135,6 +136,7 @@ public function getItemWeight()
foreach (clone $this->items as $item) {
$this->itemWeight += $item->getWeight();
}

return $this->itemWeight;
}

Expand Down Expand Up @@ -228,6 +230,7 @@ public function getUsedVolume()
foreach (clone $this->items as $item) {
$volume += ($item->getWidth() * $item->getLength() * $item->getDepth());
}

return $volume;
}

Expand Down
1 change: 1 addition & 0 deletions src/PackedBoxList.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function compare($boxA, $boxB)
if ($choice == 0) {
$choice = $boxA->getWeight() - $boxB->getWeight();
}

return $choice;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/PackerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function testIssue52C()

/**
* Where 2 perfectly filled boxes are a choice, need to ensure we pick the larger one or there is a cascading
* failure of many small boxes instead of a few larger ones
* failure of many small boxes instead of a few larger ones.
*/
public function testIssue38()
{
Expand Down