mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-07 07:26:32 +02:00
more simple an concise example of AbstractFactory
This commit is contained in:
21
Creational/AbstractFactory/DigitalProduct.php
Normal file
21
Creational/AbstractFactory/DigitalProduct.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Creational\AbstractFactory;
|
||||
|
||||
class DigitalProduct implements Product
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $price;
|
||||
|
||||
public function __construct(int $price)
|
||||
{
|
||||
$this->price = $price;
|
||||
}
|
||||
|
||||
public function calculatePrice(): int
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user