for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Box packing (3D bin packing, knapsack problem)
* @package BoxPacker
* @author Doug Wright
*/
namespace DVDoug\BoxPacker;
* A packed item
class PackedItem
{
* @var int
protected $x;
protected $y;
protected $z;
* @var Item
protected $item;
protected $width;
protected $length;
protected $depth;
* PackedItem constructor.
*
* @param Item $item
* @param int $x
* @param int $y
* @param int $z
* @param int $width
* @param int $length
* @param int $depth
protected function __construct(Item $item, $x, $y, $z, $width, $length, $depth)
$this->item = $item;
$this->x = $x;
$this->y = $y;
$this->z = $z;
$this->width = $width;
$this->length = $length;
$this->depth = $depth;
}
* @return int
public function getX()
return $this->x;
public function getY()
return $this->y;
public function getZ()
return $this->z;
* @return Item
public function getItem()
return $this->item;
public function getWidth()
return $this->width;
public function getLength()
return $this->length;
public function getDepth()
return $this->depth;
* @param OrientatedItem $orientatedItem
* @return PackedItem
public static function fromOrientatedItem(OrientatedItem $orientatedItem, $x, $y, $z)
return new static(
$orientatedItem->getItem(),
$x,
$y,
$z,
$orientatedItem->getWidth(),
$orientatedItem->getLength(),
$orientatedItem->getDepth()
);