Skip to content

Commit 7bf6593

Browse files
it was created the Creational namespace and append its patterns
1 parent 646e0e2 commit 7bf6593

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+77
-95
lines changed

Creational/AbstractFactory/AbstractFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\AbstractFactory;
3+
namespace DesignPatterns\Creational\AbstractFactory;
44

55
/**
66
* class AbstractFactory

Creational/AbstractFactory/Test/AbstractFactoryTest.php Creational/AbstractFactory/AbstractFactoryTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

3-
namespace DesignPatterns\Tests\AbstractFactory;
3+
namespace DesignPatterns\Creational\AbstractFactory;
44

5-
use DesignPatterns\AbstractFactory\AbstractFactory;
6-
use DesignPatterns\AbstractFactory\HtmlFactory;
7-
use DesignPatterns\AbstractFactory\JsonFactory;
5+
use DesignPatterns\Creational\AbstractFactory\AbstractFactory;
6+
use DesignPatterns\Creational\AbstractFactory\HtmlFactory;
7+
use DesignPatterns\Creational\AbstractFactory\JsonFactory;
88

99
/**
1010
* AbstractFactoryTest tests concrete factories
@@ -34,7 +34,7 @@ public function testComponentCreation(AbstractFactory $factory)
3434
$factory->createText('footnotes')
3535
);
3636

37-
$this->assertContainsOnly('DesignPatterns\AbstractFactory\MediaInterface', $article);
37+
$this->assertContainsOnly('DesignPatterns\Creational\AbstractFactory\MediaInterface', $article);
3838

3939
/* this is the time to look at the Builder pattern. This pattern
4040
* helps you to create complex object like that article above with

Creational/AbstractFactory/Html/Picture.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
namespace DesignPatterns\AbstractFactory\Html;
3+
namespace DesignPatterns\Creational\AbstractFactory\Html;
44

5-
use DesignPatterns\AbstractFactory\Picture as BasePicture;
5+
use DesignPatterns\Creational\AbstractFactory\Picture as BasePicture;
66

77
/**
88
* Class Picture

Creational/AbstractFactory/Html/Text.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
namespace DesignPatterns\AbstractFactory\Html;
3+
namespace DesignPatterns\Creational\AbstractFactory\Html;
44

5-
use DesignPatterns\AbstractFactory\Text as BaseText;
5+
use DesignPatterns\Creational\AbstractFactory\Text as BaseText;
66

77
/**
88
* Class Text

Creational/AbstractFactory/HtmlFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\AbstractFactory;
3+
namespace DesignPatterns\Creational\AbstractFactory;
44

55
/**
66
* Class HtmlFactory

Creational/AbstractFactory/Json/Picture.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
namespace DesignPatterns\AbstractFactory\Json;
3+
namespace DesignPatterns\Creational\AbstractFactory\Json;
44

5-
use DesignPatterns\AbstractFactory\Picture as BasePicture;
5+
use DesignPatterns\Creational\AbstractFactory\Picture as BasePicture;
66

77
/**
88
* Class Picture

Creational/AbstractFactory/Json/Text.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
namespace DesignPatterns\AbstractFactory\Json;
3+
namespace DesignPatterns\Creational\AbstractFactory\Json;
44

5-
use DesignPatterns\AbstractFactory\Text as BaseText;
5+
use DesignPatterns\Creational\AbstractFactory\Text as BaseText;
66

77
/**
88
* Class Text

Creational/AbstractFactory/JsonFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\AbstractFactory;
3+
namespace DesignPatterns\Creational\AbstractFactory;
44

55
/**
66
* Class JsonFactory

Creational/AbstractFactory/MediaInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\AbstractFactory;
3+
namespace DesignPatterns\Creational\AbstractFactory;
44

55
/**
66
* Interface MediaInterface

Creational/AbstractFactory/Picture.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\AbstractFactory;
3+
namespace DesignPatterns\Creational\AbstractFactory;
44

55
/**
66
* Class Picture

Creational/AbstractFactory/Text.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\AbstractFactory;
3+
namespace DesignPatterns\Creational\AbstractFactory;
44

55
/**
66
* Class Text

Creational/Builder/BikeBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Builder;
3+
namespace DesignPatterns\Creational\Builder;
44

55
/**
66
* BikeBuilder builds bike

Creational/Builder/BuilderInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Builder;
3+
namespace DesignPatterns\Creational\Builder;
44

55
/**
66
*

Creational/Builder/CarBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Builder;
3+
namespace DesignPatterns\Creational\Builder;
44

55
/**
66
* CarBuilder builds car

Creational/Builder/Director.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Builder;
3+
namespace DesignPatterns\Creational\Builder;
44

55
/**
66
* Director is part of the builder pattern. It knows the interface of the builder

Creational/Builder/Test/DirectorTest.php Creational/Builder/DirectorTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace DesignPatterns\Tests\Builder;
3+
namespace DesignPatterns\Creational\Builder;
44

5-
use DesignPatterns\Builder\Director;
6-
use DesignPatterns\Builder\CarBuilder;
7-
use DesignPatterns\Builder\BikeBuilder;
8-
use DesignPatterns\Builder\BuilderInterface;
5+
use DesignPatterns\Creational\Builder\Director;
6+
use DesignPatterns\Creational\Builder\CarBuilder;
7+
use DesignPatterns\Creational\Builder\BikeBuilder;
8+
use DesignPatterns\Creational\Builder\BuilderInterface;
99

1010
/**
1111
* DirectorTest tests the builder pattern
@@ -37,6 +37,6 @@ public function getBuilder()
3737
public function testBuild(BuilderInterface $builder)
3838
{
3939
$newVehicle = $this->director->build($builder);
40-
$this->assertInstanceOf('DesignPatterns\Builder\Parts\Vehicle', $newVehicle);
40+
$this->assertInstanceOf('DesignPatterns\Creational\Builder\Parts\Vehicle', $newVehicle);
4141
}
4242
}

Creational/Builder/Parts/Bike.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Builder\Parts;
3+
namespace DesignPatterns\Creational\Builder\Parts;
44

55
/**
66
* Bike is a bike

Creational/Builder/Parts/Car.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Builder\Parts;
3+
namespace DesignPatterns\Creational\Builder\Parts;
44

55
/**
66
* Car is a car

Creational/Builder/Parts/Door.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Builder\Parts;
3+
namespace DesignPatterns\Creational\Builder\Parts;
44

55
/**
66
* Class Door

Creational/Builder/Parts/Engine.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Builder\Parts;
3+
namespace DesignPatterns\Creational\Builder\Parts;
44

55
/**
66
* Class Engine

Creational/Builder/Parts/Vehicle.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Builder\Parts;
3+
namespace DesignPatterns\Creational\Builder\Parts;
44

55
/**
66
* VehicleInterface is a contract for a vehicle

Creational/Builder/Parts/Wheel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Builder\Parts;
3+
namespace DesignPatterns\Creational\Builder\Parts;
44

55
/**
66
* Class Wheel

Creational/FactoryMethod/Bicycle.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\FactoryMethod;
3+
namespace DesignPatterns\Creational\FactoryMethod;
44

55
/**
66
* Bicycle is a bicycle

Creational/FactoryMethod/FactoryMethod.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\FactoryMethod;
3+
namespace DesignPatterns\Creational\FactoryMethod;
44

55
/**
66
* class FactoryMethod

Creational/FactoryMethod/Test/FactoryMethodTest.php Creational/FactoryMethod/FactoryMethodTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

3-
namespace DesignPatterns\Tests\FactoryMethod;
3+
namespace DesignPatterns\Creational\FactoryMethod;
44

5-
use DesignPatterns\FactoryMethod\FactoryMethod;
6-
use DesignPatterns\FactoryMethod\GermanFactory;
7-
use DesignPatterns\FactoryMethod\ItalianFactory;
5+
use DesignPatterns\Creational\FactoryMethod\FactoryMethod;
6+
use DesignPatterns\Creational\FactoryMethod\GermanFactory;
7+
use DesignPatterns\Creational\FactoryMethod\ItalianFactory;
88

99
/**
1010
* FactoryMethodTest tests the factory method pattern
@@ -34,7 +34,7 @@ public function testCreation(FactoryMethod $shop)
3434
// about the factory, all we know is it can produce vehicle
3535
foreach ($this->type as $oneType) {
3636
$vehicle = $shop->create($oneType);
37-
$this->assertInstanceOf('DesignPatterns\FactoryMethod\VehicleInterface', $vehicle);
37+
$this->assertInstanceOf('DesignPatterns\Creational\FactoryMethod\VehicleInterface', $vehicle);
3838
}
3939
}
4040

Creational/FactoryMethod/Ferrari.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\FactoryMethod;
3+
namespace DesignPatterns\Creational\FactoryMethod;
44

55
/**
66
* Ferrari is a italian car

Creational/FactoryMethod/GermanFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\FactoryMethod;
3+
namespace DesignPatterns\Creational\FactoryMethod;
44

55
/**
66
* GermanFactory is a vehicle factory in Germany

Creational/FactoryMethod/ItalianFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\FactoryMethod;
3+
namespace DesignPatterns\Creational\FactoryMethod;
44

55
/**
66
* ItalianFactory is vehicle factory in Italy

Creational/FactoryMethod/Porsche.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\FactoryMethod;
3+
namespace DesignPatterns\Creational\FactoryMethod;
44

55
/**
66
* Porsche is a german car

Creational/FactoryMethod/VehicleInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\FactoryMethod;
3+
namespace DesignPatterns\Creational\FactoryMethod;
44

55
/**
66
* VehicleInterface is a contract for a vehicle

Creational/Multiton/Multiton.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns;
3+
namespace DesignPatterns\Creational\Multiton;
44

55
/**
66
* class Multiton

Pool/Pool.php Creational/Pool/Pool.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Pool;
3+
namespace DesignPatterns\Creational\Pool;
44

55
class Pool
66
{
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
<?php
22

3-
namespace DesignPatterns\Tests\Pool;
3+
namespace DesignPatterns\Creational\Pool;
44

5-
use DesignPatterns\Pool\Pool;
5+
use DesignPatterns\Creational\Pool\Pool;
66

77
class TestWorker
88
{
99

1010
public $id = 1;
11-
1211
}
1312

1413
class PoolTest extends \PHPUnit_Framework_TestCase
1514
{
1615

1716
public function testPool()
1817
{
19-
$pool = new Pool('DesignPatterns\Tests\Pool\TestWorker');
18+
$pool = new Pool('DesignPatterns\Creational\Pool\TestWorker');
2019
$worker = $pool->get();
2120

2221
$this->assertEquals(1, $worker->id);
@@ -27,6 +26,5 @@ public function testPool()
2726
$this->assertEquals(5, $pool->get()->id);
2827
$this->assertEquals(1, $pool->get()->id);
2928
}
30-
3129
}
3230

Pool/Processor.php Creational/Pool/Processor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Pool;
3+
namespace DesignPatterns\Creational\Pool;
44

55
class Processor
66
{
File renamed without changes.

Pool/Worker.php Creational/Pool/Worker.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Pool;
3+
namespace DesignPatterns\Creational\Pool;
44

55
class Worker
66
{

Creational/Prototype/BarBookPrototype.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Prototype;
3+
namespace DesignPatterns\Creational\Prototype;
44

55
/**
66
* Class BarBookPrototype

Creational/Prototype/BookPrototype.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Prototype;
3+
namespace DesignPatterns\Creational\Prototype;
44

55
/**
66
* class BookPrototype

Creational/Prototype/FooBookPrototype.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Prototype;
3+
namespace DesignPatterns\Creational\Prototype;
44

55
/**
66
* Class FooBookPrototype

Creational/Prototype/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Prototype;
3+
namespace DesignPatterns\Creational\Prototype;
44

55
$fooPrototype = new FooBookPrototype();
66
$barPrototype = new BarBookPrototype();

0 commit comments

Comments
 (0)