for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Box packing (3D bin packing, knapsack problem).
*
* @author Doug Wright
*/
namespace DVDoug\BoxPacker;
use JsonSerializable;
* Class WorkingVolume.
* @internal
class WorkingVolume implements Box, JsonSerializable
{
* @var int
private $width;
private $length;
private $depth;
private $maxWeight;
* Constructor.
* @param int $width
* @param int $length
* @param int $depth
* @param int $maxWeight
public function __construct(
$width,
$length,
$depth,
$maxWeight
) {
$this->width = $width;
$this->length = $length;
$this->depth = $depth;
$this->maxWeight = $maxWeight;
}
* @return string
public function getReference()
return 'Working Volume';
* @return int
public function getOuterWidth()
return $this->width;
public function getOuterLength()
return $this->length;
public function getOuterDepth()
return $this->depth;
public function getEmptyWeight()
return 0;
public function getInnerWidth()
public function getInnerLength()
public function getInnerDepth()
public function getMaxWeight()
return $this->maxWeight;
public function getInnerVolume()
return $this->width * $this->length * $this->depth;
* {@inheritdoc}
public function jsonSerialize()
return [
'reference' => $this->getReference(),
'width' => $this->width,
'length' => $this->length,
'depth' => $this->depth,
'maxWeight' => $this->maxWeight,
];