mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-30 03:30:14 +02:00
29 lines
546 B
PHP
29 lines
546 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
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;
|
|
}
|
|
}
|