mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-06 15:06:31 +02:00
Applied fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
3663603b80
commit
fe1f144ec3
@@ -3,7 +3,7 @@
|
||||
namespace DesignPatterns\Creational\FactoryMethod;
|
||||
|
||||
/**
|
||||
* Bicycle is a bicycle
|
||||
* Bicycle is a bicycle.
|
||||
*/
|
||||
class Bicycle implements VehicleInterface
|
||||
{
|
||||
@@ -13,7 +13,7 @@ class Bicycle implements VehicleInterface
|
||||
protected $color;
|
||||
|
||||
/**
|
||||
* sets the color of the bicycle
|
||||
* sets the color of the bicycle.
|
||||
*
|
||||
* @param string $rgb
|
||||
*/
|
||||
|
@@ -3,16 +3,15 @@
|
||||
namespace DesignPatterns\Creational\FactoryMethod;
|
||||
|
||||
/**
|
||||
* class FactoryMethod
|
||||
* class FactoryMethod.
|
||||
*/
|
||||
abstract class FactoryMethod
|
||||
{
|
||||
|
||||
const CHEAP = 1;
|
||||
const FAST = 2;
|
||||
|
||||
/**
|
||||
* The children of the class must implement this method
|
||||
* The children of the class must implement this method.
|
||||
*
|
||||
* Sometimes this method can be public to get "raw" object
|
||||
*
|
||||
@@ -23,7 +22,7 @@ abstract class FactoryMethod
|
||||
abstract protected function createVehicle($type);
|
||||
|
||||
/**
|
||||
* Creates a new vehicle
|
||||
* Creates a new vehicle.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
@@ -32,7 +31,7 @@ abstract class FactoryMethod
|
||||
public function create($type)
|
||||
{
|
||||
$obj = $this->createVehicle($type);
|
||||
$obj->setColor("#f00");
|
||||
$obj->setColor('#f00');
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace DesignPatterns\Creational\FactoryMethod;
|
||||
|
||||
/**
|
||||
* Ferrari is a italian car
|
||||
* Ferrari is a italian car.
|
||||
*/
|
||||
class Ferrari implements VehicleInterface
|
||||
{
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace DesignPatterns\Creational\FactoryMethod;
|
||||
|
||||
/**
|
||||
* GermanFactory is a vehicle factory in Germany
|
||||
* GermanFactory is a vehicle factory in Germany.
|
||||
*/
|
||||
class GermanFactory extends FactoryMethod
|
||||
{
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace DesignPatterns\Creational\FactoryMethod;
|
||||
|
||||
/**
|
||||
* ItalianFactory is vehicle factory in Italy
|
||||
* ItalianFactory is vehicle factory in Italy.
|
||||
*/
|
||||
class ItalianFactory extends FactoryMethod
|
||||
{
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace DesignPatterns\Creational\FactoryMethod;
|
||||
|
||||
/**
|
||||
* Porsche is a german car
|
||||
* Porsche is a german car.
|
||||
*/
|
||||
class Porsche implements VehicleInterface
|
||||
{
|
||||
|
@@ -7,21 +7,20 @@ use DesignPatterns\Creational\FactoryMethod\GermanFactory;
|
||||
use DesignPatterns\Creational\FactoryMethod\ItalianFactory;
|
||||
|
||||
/**
|
||||
* FactoryMethodTest tests the factory method pattern
|
||||
* FactoryMethodTest tests the factory method pattern.
|
||||
*/
|
||||
class FactoryMethodTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
protected $type = array(
|
||||
FactoryMethod::CHEAP,
|
||||
FactoryMethod::FAST
|
||||
FactoryMethod::FAST,
|
||||
);
|
||||
|
||||
public function getShop()
|
||||
{
|
||||
return array(
|
||||
array(new GermanFactory()),
|
||||
array(new ItalianFactory())
|
||||
array(new ItalianFactory()),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -3,12 +3,12 @@
|
||||
namespace DesignPatterns\Creational\FactoryMethod;
|
||||
|
||||
/**
|
||||
* VehicleInterface is a contract for a vehicle
|
||||
* VehicleInterface is a contract for a vehicle.
|
||||
*/
|
||||
interface VehicleInterface
|
||||
{
|
||||
/**
|
||||
* sets the color of the vehicle
|
||||
* sets the color of the vehicle.
|
||||
*
|
||||
* @param string $rgb
|
||||
*/
|
||||
|
Reference in New Issue
Block a user