Files
portal/app/Classes/Modules/Packages/DataTransferObjects/PackageObject.php
T
2021-01-28 12:57:40 +05:30

88 lines
1.9 KiB
PHP

<?php
namespace App\Classes\Modules\Packages\DataTransferObjects;
use App\Classes\Interfaces\DataTransferObject;
use App\Classes\Modules\Packages\DataTransferObjects\ItemObject;
class PackageObject implements DataTransferObject
{
/** @var int */
private $type;
/** @var float */
private $width;
/** @var float */
private $height;
/** @var float */
private $length;
/** @var array */
private $items;
/**
* PackageObject constructor.
* @param int $type
* @param float $width
* @param float $height
* @param float $length
* @param 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->length = $length;
$this->items = $items;
}
/**
* @return int
*/
public function getType(): int
{
return $this->type;
}
/**
* @return float
*/
public function getWidth(): float
{
return $this->width;
}
/**
* @return float
*/
public function getHeight(): float
{
return $this->height;
}
/**
* @return float
*/
public function getLength(): float
{
return $this->length;
}
/**
* @return array
*/
public function getItems(): array
{
return array_map(function($item){
return new ItemObject($item['description'],$item['unitOfMeasurment'],$item['quantity'],$item['price'],$item['currency']);
},$this->items);
}
}