mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-18 04:31:16 +02:00
start a restructure
This commit is contained in:
30
Creational/Builder/Director.php
Normal file
30
Creational/Builder/Director.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Builder;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* You can also inject many builders instead of one to build more complex objects
|
||||
*/
|
||||
class Director
|
||||
{
|
||||
|
||||
/**
|
||||
* The director don't know 'bout concrete part
|
||||
*
|
||||
* @param BuilderInterface $builder
|
||||
*
|
||||
* @return Parts\Vehicle
|
||||
*/
|
||||
public function build(BuilderInterface $builder)
|
||||
{
|
||||
$builder->createVehicle();
|
||||
$builder->addDoors();
|
||||
$builder->addEngine();
|
||||
$builder->addWheel();
|
||||
|
||||
return $builder->getVehicle();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user