mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-11 09:24:01 +02:00
PHP7 Builder
This commit is contained in:
@@ -2,22 +2,17 @@
|
||||
|
||||
namespace DesignPatterns\Creational\Builder;
|
||||
|
||||
use DesignPatterns\Creational\Builder\Parts\Vehicle;
|
||||
|
||||
/**
|
||||
* Director is part of the builder pattern. It knows the interface of the builder
|
||||
* and builds a complex object with the help of the builder.
|
||||
* and builds a complex object with the help of the builder
|
||||
*
|
||||
* You can also inject many builders instead of one to build more complex objects
|
||||
*/
|
||||
class Director
|
||||
{
|
||||
/**
|
||||
* The director don't know about concrete part.
|
||||
*
|
||||
* @param BuilderInterface $builder
|
||||
*
|
||||
* @return Parts\Vehicle
|
||||
*/
|
||||
public function build(BuilderInterface $builder)
|
||||
public function build(BuilderInterface $builder): Vehicle
|
||||
{
|
||||
$builder->createVehicle();
|
||||
$builder->addDoors();
|
||||
|
Reference in New Issue
Block a user