packages backup

This commit is contained in:
Harish
2021-01-28 12:57:40 +05:30
parent c2f3c92393
commit 83c0f29b0d
7 changed files with 133 additions and 47 deletions
@@ -19,7 +19,7 @@ class PackageObject implements DataTransferObject
private $height;
/** @var float */
private $lenght;
private $length;
/** @var array */
private $items;
@@ -29,18 +29,16 @@ class PackageObject implements DataTransferObject
* @param int $type
* @param float $width
* @param float $height
* @param float $lenght
* @param float $length
* @param array $items
*/
public function __construct(int $type, float $width, float $height, float $lenght, array $items)
public function __construct(int $type, float $width, float $height, float $length, array $items)
{
$this->type = $type;
$this->width = $width;
$this->height = $height;
$this->lenght = $lenght;
foreach($items as $item){
$this->items=new ItemObject($item['description'],$item['unitOfMeasurment'],$item['quantity'],$item['price'],$item['currency']);
}
$this->length = $length;
$this->items = $items;
}
/**
@@ -70,9 +68,9 @@ class PackageObject implements DataTransferObject
/**
* @return float
*/
public function getLenght(): float
public function getLength(): float
{
return $this->lenght;
return $this->length;
}
/**
@@ -80,7 +78,9 @@ class PackageObject implements DataTransferObject
*/
public function getItems(): array
{
return $this->items;
return array_map(function($item){
return new ItemObject($item['description'],$item['unitOfMeasurment'],$item['quantity'],$item['price'],$item['currency']);
},$this->items);
}