Skip to content

Commit

Permalink
fix: define properties (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr committed Apr 3, 2024
1 parent f87a441 commit 00a7de7
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/ShippingPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ class ShippingPackage

protected $quantity;

protected $shape;

protected $weightunit;

protected $widthunit;

protected $defaultdimensions = [
'height' => 0,
'width' => 0,
Expand Down Expand Up @@ -78,6 +84,7 @@ public function __construct($weight = 0, $dimensions = [], $options = [])
$this->defaultdimensions,
['value' => null, 'quantity' => null]
);

foreach ($zerochecks as $dimension => $value) {
if ($this->$dimension < 0) {
$this->$dimension = 0;
Expand All @@ -98,9 +105,11 @@ public function toArray()
"currency" => $this->currency,
"quantity" => $this->quantity
];

return array_filter($data);
}


public function __toString()
{
$out = "";
Expand Down Expand Up @@ -147,4 +156,29 @@ public function quantity()
{
return $this->quantity;
}

public function shape()
{
return $this->shape;
}

public function weightunit()
{
return $this->weightunit;
}

public function widthunit()
{
return $this->widthunit;
}

public function diameter()
{
return $this->diameter;
}

public function currency()
{
return $this->currency;
}
}

0 comments on commit 00a7de7

Please sign in to comment.