This commit is contained in:
Dominik Liebler
2013-09-21 22:25:20 +02:00
parent 9484868299
commit f6651bafaa
9 changed files with 56 additions and 173 deletions

View File

@@ -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;
}
}
}