PHP Class DVDoug\BoxPacker\Packer

Author: Doug Wright
Inheritance: implements Psr\Log\LoggerAwareInterface, use trait Psr\Log\LoggerAwareTrait
Datei anzeigen Open project: dvdoug/boxpacker Class Usage Examples

Protected Properties

Property Type Description
$boxes DVDoug\BoxPacker\BoxList List of box sizes available to pack items into
$items ItemList List of items to be packed

Public Methods

Method Description
__construct ( ) Constructor
addBox ( DVDoug\BoxPacker\Box $box ) Add box size
addItem ( DVDoug\BoxPacker\Item $item, integer $qty = 1 ) Add item to be packed
doVolumePacking ( ) : DVDoug\BoxPacker\PackedBoxList Pack items into boxes using the principle of largest volume item first
pack ( ) : DVDoug\BoxPacker\PackedBoxList Pack items into boxes
setBoxes ( DVDoug\BoxPacker\BoxList $boxList ) Add a pre-prepared set of boxes all at once
setItems ( Traversable | array $items ) Set a list of items all at once

Method Details

__construct() public method

Constructor
public __construct ( )

addBox() public method

Add box size
public addBox ( DVDoug\BoxPacker\Box $box )
$box DVDoug\BoxPacker\Box

addItem() public method

Add item to be packed
public addItem ( DVDoug\BoxPacker\Item $item, integer $qty = 1 )
$item DVDoug\BoxPacker\Item
$qty integer

doVolumePacking() public method

Pack items into boxes using the principle of largest volume item first
public doVolumePacking ( ) : DVDoug\BoxPacker\PackedBoxList
return DVDoug\BoxPacker\PackedBoxList

pack() public method

Pack items into boxes
public pack ( ) : DVDoug\BoxPacker\PackedBoxList
return DVDoug\BoxPacker\PackedBoxList

setBoxes() public method

Add a pre-prepared set of boxes all at once
public setBoxes ( DVDoug\BoxPacker\BoxList $boxList )
$boxList DVDoug\BoxPacker\BoxList

setItems() public method

Set a list of items all at once
public setItems ( Traversable | array $items )
$items Traversable | array

Property Details

$boxes protected_oe property

List of box sizes available to pack items into
protected BoxList,DVDoug\BoxPacker $boxes
return DVDoug\BoxPacker\BoxList

$items protected_oe property

List of items to be packed
protected ItemList,DVDoug\BoxPacker $items
return ItemList