Files
DesignPatternsPHP/Creational/FactoryMethod/FactoryMethod.php
Dominik Liebler 4760d898a0 PHP7 FactoryMethod
2016-09-22 13:28:46 +02:00

20 lines
395 B
PHP

<?php
namespace DesignPatterns\Creational\FactoryMethod;
abstract class FactoryMethod
{
const CHEAP = 'cheap';
const FAST = 'fast';
abstract protected function createVehicle(string $type): VehicleInterface;
public function create(string $type): VehicleInterface
{
$obj = $this->createVehicle($type);
$obj->setColor('black');
return $obj;
}
}