mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-09-29 07:49:09 +02:00
cs
This commit is contained in:
@@ -5,35 +5,51 @@ namespace DesignPatterns\Builder;
|
||||
/**
|
||||
* BikeBuilder builds bike
|
||||
*/
|
||||
class BikeBuilder implements Builder
|
||||
class BikeBuilder implements BuilderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Parts\Bike
|
||||
*/
|
||||
protected $bike;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addDoors()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addEngine()
|
||||
{
|
||||
$this->bike->setPart('engine', new Parts\Engine());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addWheel()
|
||||
{
|
||||
$this->bike->setPart('forwardWheel', new Parts\Wheel());
|
||||
$this->bike->setPart('rearWheel', new Parts\Wheel());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createVehicle()
|
||||
{
|
||||
$this->bike = new Parts\Bike();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getVehicle()
|
||||
{
|
||||
return $this->bike;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user