PHP7 Builder

This commit is contained in:
Dominik Liebler
2016-09-22 13:36:58 +02:00
parent 4760d898a0
commit 9f42521e8f
8 changed files with 28 additions and 102 deletions

View File

@@ -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();