cs SimpleFactory and Builder

This commit is contained in:
Dominik Liebler
2013-09-13 11:47:46 +02:00
parent ec6ed14767
commit 2d3fc40a39
9 changed files with 27 additions and 30 deletions

View File

@@ -9,7 +9,7 @@ namespace DesignPatterns\SimpleFactory;
/**
* Bicycle is a bicycle
*/
class Bicycle implements Vehicle
class Bicycle implements VehicleInterface
{
public function driveTo($destination)

View File

@@ -36,7 +36,7 @@ class ConcreteFactory
* Creates a vehicle
*
* @param string $type a known type key
* @return Vehicle a new instance of Vehicle
* @return VehicleInterface a new instance of VehicleInterface
* @throws \InvalidArgumentException
*/
public function createVehicle($type)

View File

@@ -1,20 +1,17 @@
<?php
/*
* DesignPatternPHP
*/
namespace DesignPatterns\SimpleFactory;
/**
* Scooter is a Scooter
*/
class Scooter implements Vehicle
class Scooter implements VehicleInterface
{
/**
* @param mixed $destination
*/
public function driveTo($destination)
{
}
}
}
}

View File

@@ -1,16 +0,0 @@
<?php
/*
* DesignPatternPHP
*/
namespace DesignPatterns\SimpleFactory;
/**
* Vehicle is a contract for a vehicle
*/
interface Vehicle
{
function driveTo($destination);
}

View File

@@ -0,0 +1,16 @@
<?php
namespace DesignPatterns\SimpleFactory;
/**
* VehicleInterface is a contract for a vehicle
*/
interface VehicleInterface
{
/**
* @param mixed $destination
*
* @return mixed
*/
public function driveTo($destination);
}