mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-30 19:50:12 +02:00
28 lines
521 B
PHP
28 lines
521 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Creational\AbstractFactory;
|
|
|
|
class ShippableProduct implements Product
|
|
{
|
|
/**
|
|
* @var float
|
|
*/
|
|
private $productPrice;
|
|
|
|
/**
|
|
* @var float
|
|
*/
|
|
private $shippingCosts;
|
|
|
|
public function __construct(int $productPrice, int $shippingCosts)
|
|
{
|
|
$this->productPrice = $productPrice;
|
|
$this->shippingCosts = $shippingCosts;
|
|
}
|
|
|
|
public function calculatePrice(): int
|
|
{
|
|
return $this->productPrice + $this->shippingCosts;
|
|
}
|
|
}
|