mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-30 03:30:14 +02:00
20 lines
404 B
PHP
20 lines
404 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\Creational\AbstractFactory;
|
|
|
|
class ProductFactory
|
|
{
|
|
const SHIPPING_COSTS = 50;
|
|
|
|
public function createShippableProduct(int $price): Product
|
|
{
|
|
return new ShippableProduct($price, self::SHIPPING_COSTS);
|
|
}
|
|
|
|
public function createDigitalProduct(int $price): Product
|
|
{
|
|
return new DigitalProduct($price);
|
|
}
|
|
}
|