for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Kerox\Messenger\Model\Message\Attachment\Template\Receipt;
class Summary implements \JsonSerializable
{
/**
* @var float
*/
protected $subtotal;
protected $shippingCost;
protected $totalTax;
protected $totalCost;
* Summary constructor.
*
* @param float $totalCost
public function __construct(float $totalCost)
$this->totalCost = $totalCost;
}
* @return \Kerox\Messenger\Model\Message\Attachment\Template\Receipt\Summary
public static function create(float $totalCost): self
return new self($totalCost);
* @param float $subtotal
* @return Summary
public function setSubtotal(float $subtotal): self
$this->subtotal = $subtotal;
return $this;
* @param float $shippingCost
public function setShippingCost(float $shippingCost): self
$this->shippingCost = $shippingCost;
* @param float $totalTax
public function setTotalTax(float $totalTax): self
$this->totalTax = $totalTax;
* @return array
public function toArray(): array
$array = [
'subtotal' => $this->subtotal,
'shipping_cost' => $this->shippingCost,
'total_tax' => $this->totalTax,
'total_cost' => $this->totalCost,
];
return array_filter($array);
public function jsonSerialize(): array
return $this->toArray();