diff --git a/.gitignore b/.gitignore
index 601f317..c6fa3e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,8 @@
.idea
/nbproject
/vendor/
+_build/
+*.mo
+.vagrant/
+phpunit.xml
+composer.phar
diff --git a/.travis.yml b/.travis.yml
index 1eada0b..9f379f8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,19 +1,31 @@
language: php
+
+sudo: false
+
php:
- 5.3
- 5.4
- 5.5
+ - 5.6
+ - 7.0
- hhvm
-before_script:
- - composer self-update
- - composer install --prefer-source --no-interaction --dev
-
-branches:
- only:
- - master
-
matrix:
allow_failures:
- php: hhvm
+ - php: 7.0
fast_finish: true
+
+cache:
+ directories:
+ - $HOME/.composer/cache
+
+before_install:
+ - composer self-update
+ - composer validate
+
+install:
+ - composer install --prefer-dist --no-interaction
+
+script:
+ - vendor/bin/phpunit
diff --git a/Behavioral/ChainOfResponsibilities/Handler.php b/Behavioral/ChainOfResponsibilities/Handler.php
index f080e23..679734e 100644
--- a/Behavioral/ChainOfResponsibilities/Handler.php
+++ b/Behavioral/ChainOfResponsibilities/Handler.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\ChainOfResponsibilities;
/**
- * Handler is a generic handler in the chain of responsibilities
+ * Handler is a generic handler in the chain of responsibilities.
*
* Yes you could have a lighter CoR with a simpler handler but if you want your CoR
* to be extendable and decoupled, it's a better idea to do things like that in real
@@ -18,7 +18,7 @@ abstract class Handler
private $successor = null;
/**
- * Append a responsibility to the end of chain
+ * Append a responsibility to the end of chain.
*
* A prepend method could be done with the same spirit
*
@@ -68,7 +68,7 @@ abstract class Handler
}
/**
- * Each concrete handler has to implement the processing of the request
+ * Each concrete handler has to implement the processing of the request.
*
* @param Request $req
*
diff --git a/Behavioral/ChainOfResponsibilities/README.md b/Behavioral/ChainOfResponsibilities/README.md
deleted file mode 100644
index 7657e93..0000000
--- a/Behavioral/ChainOfResponsibilities/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# Chain Of Responsibilities
-
-## Purpose:
-
-To build a chain of objects to handle a call in sequential order. If one object cannot handle a call, it delegates the call to the next in the chain and so forth.
-
-## Examples:
-
-* logging framework, where each chain element decides autonomously what to do with a log message
-* a Spam filter
-* Caching: first object is an instance of e.g. a Memcached Interface, if that "misses" it delegates the call to the database interface
-* Yii Framework: CFilterChain is a chain of controller action filters. the executing point is passed from one filter to the next along the chain, and only if all filters say "yes", the action can be invoked at last.
-
-## UML Diagram
-
-
diff --git a/Behavioral/ChainOfResponsibilities/README.rst b/Behavioral/ChainOfResponsibilities/README.rst
new file mode 100644
index 0000000..b3f47b9
--- /dev/null
+++ b/Behavioral/ChainOfResponsibilities/README.rst
@@ -0,0 +1,70 @@
+`Chain Of Responsibilities`__
+=============================
+
+Purpose:
+--------
+
+To build a chain of objects to handle a call in sequential order. If one
+object cannot handle a call, it delegates the call to the next in the
+chain and so forth.
+
+Examples:
+---------
+
+- logging framework, where each chain element decides autonomously what
+ to do with a log message
+- a Spam filter
+- Caching: first object is an instance of e.g. a Memcached Interface,
+ if that "misses" it delegates the call to the database interface
+- Yii Framework: CFilterChain is a chain of controller action filters.
+ the executing point is passed from one filter to the next along the
+ chain, and only if all filters say "yes", the action can be invoked
+ at last.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt ChainOfResponsibility UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Request.php
+
+.. literalinclude:: Request.php
+ :language: php
+ :linenos:
+
+Handler.php
+
+.. literalinclude:: Handler.php
+ :language: php
+ :linenos:
+
+Responsible/SlowStorage.php
+
+.. literalinclude:: Responsible/SlowStorage.php
+ :language: php
+ :linenos:
+
+Responsible/FastStorage.php
+
+.. literalinclude:: Responsible/FastStorage.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/ChainTest.php
+
+.. literalinclude:: Tests/ChainTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/ChainOfResponsibilities
+.. __: http://en.wikipedia.org/wiki/Chain_of_responsibility_pattern
\ No newline at end of file
diff --git a/Behavioral/ChainOfResponsibilities/Responsible/FastStorage.php b/Behavioral/ChainOfResponsibilities/Responsible/FastStorage.php
index 4a74642..8acaad1 100644
--- a/Behavioral/ChainOfResponsibilities/Responsible/FastStorage.php
+++ b/Behavioral/ChainOfResponsibilities/Responsible/FastStorage.php
@@ -6,7 +6,7 @@ use DesignPatterns\Behavioral\ChainOfResponsibilities\Handler;
use DesignPatterns\Behavioral\ChainOfResponsibilities\Request;
/**
- * Class FastStorage
+ * Class FastStorage.
*/
class FastStorage extends Handler
{
diff --git a/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php b/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php
index bf21088..bd3f825 100644
--- a/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php
+++ b/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php
@@ -6,14 +6,13 @@ use DesignPatterns\Behavioral\ChainOfResponsibilities\Handler;
use DesignPatterns\Behavioral\ChainOfResponsibilities\Request;
/**
- * This is mostly the same code as FastStorage but in fact, it may greatly differs
+ * This is mostly the same code as FastStorage but in fact, it may greatly differs.
*
* One important fact about CoR: each item in the chain MUST NOT assume its position
* in the chain. A CoR is not responsible if the request is not handled UNLESS
- * you make an "ExceptionHandler" which throws execption if the request goes there.
+ * you make an "ExceptionHandler" which throws exception if the request goes there.
*
* To be really extendable, each handler doesn't know if there is something after it.
- *
*/
class SlowStorage extends Handler
{
diff --git a/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php b/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php
index 0e8357c..62d1172 100644
--- a/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php
+++ b/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php
@@ -3,16 +3,15 @@
namespace DesignPatterns\Behavioral\ChainOfResponsibilities\Tests;
use DesignPatterns\Behavioral\ChainOfResponsibilities\Request;
+use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible;
use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\FastStorage;
use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage;
-use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible;
/**
- * ChainTest tests the CoR
+ * ChainTest tests the CoR.
*/
class ChainTest extends \PHPUnit_Framework_TestCase
{
-
/**
* @var FastStorage
*/
@@ -30,7 +29,7 @@ class ChainTest extends \PHPUnit_Framework_TestCase
$request->verb = 'get';
return array(
- array($request)
+ array($request),
);
}
diff --git a/Behavioral/Command/AddMessageDateCommand.php b/Behavioral/Command/AddMessageDateCommand.php
new file mode 100644
index 0000000..11bb9af
--- /dev/null
+++ b/Behavioral/Command/AddMessageDateCommand.php
@@ -0,0 +1,46 @@
+output = $console;
+ }
+
+ /**
+ * Execute and make receiver to enable displaying messages date.
+ */
+ public function execute()
+ {
+ // sometimes, there is no receiver and this is the command which
+ // does all the work
+ $this->output->enableDate();
+ }
+
+ /**
+ * Undo the command and make receiver to disable displaying messages date.
+ */
+ public function undo()
+ {
+ // sometimes, there is no receiver and this is the command which
+ // does all the work
+ $this->output->disableDate();
+ }
+}
diff --git a/Behavioral/Command/CommandInterface.php b/Behavioral/Command/CommandInterface.php
index ad9117b..cd9d9c6 100644
--- a/Behavioral/Command/CommandInterface.php
+++ b/Behavioral/Command/CommandInterface.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Command;
/**
- * class CommandInterface
+ * class CommandInterface.
*/
interface CommandInterface
{
diff --git a/Behavioral/Command/HelloCommand.php b/Behavioral/Command/HelloCommand.php
index 3dd55b1..94d4723 100644
--- a/Behavioral/Command/HelloCommand.php
+++ b/Behavioral/Command/HelloCommand.php
@@ -4,7 +4,7 @@ namespace DesignPatterns\Behavioral\Command;
/**
* This concrete command calls "print" on the Receiver, but an external
- * invoker just know he can call "execute"
+ * invoker just knows that it can call "execute".
*/
class HelloCommand implements CommandInterface
{
@@ -14,8 +14,8 @@ class HelloCommand implements CommandInterface
protected $output;
/**
- * Each concrete command is builded with different receivers.
- * Can be one, many, none or even other Command in parameters
+ * Each concrete command is built with different receivers.
+ * There can be one, many or completely no receivers, but there can be other commands in the parameters.
*
* @param Receiver $console
*/
@@ -25,7 +25,7 @@ class HelloCommand implements CommandInterface
}
/**
- * execute and output "Hello World"
+ * execute and output "Hello World".
*/
public function execute()
{
diff --git a/Behavioral/Command/Invoker.php b/Behavioral/Command/Invoker.php
index 4461ee2..7942adb 100644
--- a/Behavioral/Command/Invoker.php
+++ b/Behavioral/Command/Invoker.php
@@ -4,7 +4,7 @@ namespace DesignPatterns\Behavioral\Command;
/**
* Invoker is using the command given to it.
- * Example : an Application in SF2
+ * Example : an Application in SF2.
*/
class Invoker
{
@@ -25,7 +25,7 @@ class Invoker
}
/**
- * executes the command
+ * executes the command.
*/
public function run()
{
diff --git a/Behavioral/Command/README.md b/Behavioral/Command/README.md
deleted file mode 100644
index adf2de3..0000000
--- a/Behavioral/Command/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# Command
-
-## Purpose
-
-To encapsulate invocation and decoupling.
-
-We have an Invoker and a Receiver. This pattern uses a "Command" to delegate the method call against the Receiver and presents the same method "execute".
-Therefore, the Invoker just knows to call "execute" to process the Command of the client. The Receiver is decoupled from the Invoker.
-
-The second aspect of this pattern is the undo(), which undoes the method execute().
-Command can also be aggregated to combine more complex commands with minimum copy-paste and relying on composition over inheritance.
-
-## Examples
-
-* A text editor : all events are Command which can be undone, stacked and saved.
-* Symfony2: SF2 Commands that can be run from the CLI are built with just the Command pattern in mind
-* big CLI tools use subcommands to distribute various tasks and pack them in "modules", each of these can be implemented with the Command pattern (e.g. vagrant)
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Behavioral/Command/README.rst b/Behavioral/Command/README.rst
new file mode 100644
index 0000000..ddd2164
--- /dev/null
+++ b/Behavioral/Command/README.rst
@@ -0,0 +1,77 @@
+`Command`__
+===========
+
+Purpose
+-------
+
+To encapsulate invocation and decoupling.
+
+We have an Invoker and a Receiver. This pattern uses a "Command" to
+delegate the method call against the Receiver and presents the same
+method "execute". Therefore, the Invoker just knows to call "execute" to
+process the Command of the client. The Receiver is decoupled from the
+Invoker.
+
+The second aspect of this pattern is the undo(), which undoes the method
+execute(). Command can also be aggregated to combine more complex
+commands with minimum copy-paste and relying on composition over
+inheritance.
+
+Examples
+--------
+
+- A text editor : all events are Command which can be undone, stacked
+ and saved.
+- Symfony2: SF2 Commands that can be run from the CLI are built with
+ just the Command pattern in mind
+- big CLI tools use subcommands to distribute various tasks and pack
+ them in "modules", each of these can be implemented with the Command
+ pattern (e.g. vagrant)
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Command UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+CommandInterface.php
+
+.. literalinclude:: CommandInterface.php
+ :language: php
+ :linenos:
+
+HelloCommand.php
+
+.. literalinclude:: HelloCommand.php
+ :language: php
+ :linenos:
+
+Receiver.php
+
+.. literalinclude:: Receiver.php
+ :language: php
+ :linenos:
+
+Invoker.php
+
+.. literalinclude:: Invoker.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/CommandTest.php
+
+.. literalinclude:: Tests/CommandTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Command
+.. __: http://en.wikipedia.org/wiki/Command_pattern
\ No newline at end of file
diff --git a/Behavioral/Command/Receiver.php b/Behavioral/Command/Receiver.php
index 9289369..956ce74 100644
--- a/Behavioral/Command/Receiver.php
+++ b/Behavioral/Command/Receiver.php
@@ -3,15 +3,44 @@
namespace DesignPatterns\Behavioral\Command;
/**
- * Receiver is specific service with its own contract and can be only concrete
+ * Receiver is specific service with its own contract and can be only concrete.
*/
class Receiver
{
+ private $enableDate = false;
+
+ private $output = array();
+
/**
* @param string $str
*/
public function write($str)
{
- echo $str;
+ if ($this->enableDate) {
+ $str .= ' ['.date('Y-m-d').']';
+ }
+
+ $this->output[] = $str;
+ }
+
+ public function getOutput()
+ {
+ return implode("\n", $this->output);
+ }
+
+ /**
+ * Enable receiver to display message date.
+ */
+ public function enableDate()
+ {
+ $this->enableDate = true;
+ }
+
+ /**
+ * Disable receiver to display message date.
+ */
+ public function disableDate()
+ {
+ $this->enableDate = false;
}
}
diff --git a/Behavioral/Command/Tests/CommandTest.php b/Behavioral/Command/Tests/CommandTest.php
index abf7317..3852495 100644
--- a/Behavioral/Command/Tests/CommandTest.php
+++ b/Behavioral/Command/Tests/CommandTest.php
@@ -2,16 +2,15 @@
namespace DesignPatterns\Behavioral\Command\Tests;
+use DesignPatterns\Behavioral\Command\HelloCommand;
use DesignPatterns\Behavioral\Command\Invoker;
use DesignPatterns\Behavioral\Command\Receiver;
-use DesignPatterns\Behavioral\Command\HelloCommand;
/**
- * CommandTest has the role of the Client in the Command Pattern
+ * CommandTest has the role of the Client in the Command Pattern.
*/
class CommandTest extends \PHPUnit_Framework_TestCase
{
-
/**
* @var Invoker
*/
@@ -31,7 +30,7 @@ class CommandTest extends \PHPUnit_Framework_TestCase
public function testInvocation()
{
$this->invoker->setCommand(new HelloCommand($this->receiver));
- $this->expectOutputString('Hello World');
$this->invoker->run();
+ $this->assertEquals($this->receiver->getOutput(), 'Hello World');
}
}
diff --git a/Behavioral/Command/Tests/UndoableCommandTest.php b/Behavioral/Command/Tests/UndoableCommandTest.php
new file mode 100644
index 0000000..5302a7b
--- /dev/null
+++ b/Behavioral/Command/Tests/UndoableCommandTest.php
@@ -0,0 +1,49 @@
+invoker = new Invoker();
+ $this->receiver = new Receiver();
+ }
+
+ public function testInvocation()
+ {
+ $this->invoker->setCommand(new HelloCommand($this->receiver));
+ $this->invoker->run();
+ $this->assertEquals($this->receiver->getOutput(), 'Hello World');
+
+ $messageDateCommand = new AddMessageDateCommand($this->receiver);
+ $messageDateCommand->execute();
+
+ $this->invoker->run();
+ $this->assertEquals($this->receiver->getOutput(), "Hello World\nHello World [".date('Y-m-d').']');
+
+ $messageDateCommand->undo();
+
+ $this->invoker->run();
+ $this->assertEquals($this->receiver->getOutput(), "Hello World\nHello World [".date('Y-m-d')."]\nHello World");
+ }
+}
diff --git a/Behavioral/Command/UndoableCommandInterface.php b/Behavioral/Command/UndoableCommandInterface.php
new file mode 100644
index 0000000..f9234ab
--- /dev/null
+++ b/Behavioral/Command/UndoableCommandInterface.php
@@ -0,0 +1,15 @@
+getTitle() . ' by ' . $this->getAuthor();
+ return $this->getTitle().' by '.$this->getAuthor();
}
}
diff --git a/Behavioral/Iterator/BookList.php b/Behavioral/Iterator/BookList.php
index 0dda925..6cc5e5e 100644
--- a/Behavioral/Iterator/BookList.php
+++ b/Behavioral/Iterator/BookList.php
@@ -4,35 +4,30 @@ namespace DesignPatterns\Behavioral\Iterator;
class BookList implements \Countable
{
-
private $books;
public function getBook($bookNumberToGet)
{
- if ((int)$bookNumberToGet <= $this->count()) {
+ if (isset($this->books[$bookNumberToGet])) {
return $this->books[$bookNumberToGet];
}
- return null;
+ return;
}
public function addBook(Book $book)
{
$this->books[] = $book;
-
- return $this->count();
}
public function removeBook(Book $bookToRemove)
{
- foreach ($this as $key => $book) {
+ foreach ($this->books as $key => $book) {
/** @var Book $book */
if ($book->getAuthorAndTitle() === $bookToRemove->getAuthorAndTitle()) {
unset($this->books[$key]);
}
}
-
- return $this->count();
}
public function count()
diff --git a/Behavioral/Iterator/BookListIterator.php b/Behavioral/Iterator/BookListIterator.php
index bc15ffb..ecedba6 100644
--- a/Behavioral/Iterator/BookListIterator.php
+++ b/Behavioral/Iterator/BookListIterator.php
@@ -4,11 +4,10 @@ namespace DesignPatterns\Behavioral\Iterator;
class BookListIterator implements \Iterator
{
-
/**
* @var BookList
*/
- protected $bookList;
+ private $bookList;
/**
* @var int
@@ -21,8 +20,10 @@ class BookListIterator implements \Iterator
}
/**
- * Return the current book
+ * Return the current book.
+ *
* @link http://php.net/manual/en/iterator.current.php
+ *
* @return Book Can return any type.
*/
public function current()
@@ -32,8 +33,10 @@ class BookListIterator implements \Iterator
/**
* (PHP 5 >= 5.0.0)
- * Move forward to next element
+ * Move forward to next element.
+ *
* @link http://php.net/manual/en/iterator.next.php
+ *
* @return void Any returned value is ignored.
*/
public function next()
@@ -43,8 +46,10 @@ class BookListIterator implements \Iterator
/**
* (PHP 5 >= 5.0.0)
- * Return the key of the current element
+ * Return the key of the current element.
+ *
* @link http://php.net/manual/en/iterator.key.php
+ *
* @return mixed scalar on success, or null on failure.
*/
public function key()
@@ -54,20 +59,24 @@ class BookListIterator implements \Iterator
/**
* (PHP 5 >= 5.0.0)
- * Checks if current position is valid
+ * Checks if current position is valid.
+ *
* @link http://php.net/manual/en/iterator.valid.php
- * @return boolean The return value will be casted to boolean and then evaluated.
- * Returns true on success or false on failure.
+ *
+ * @return bool The return value will be casted to boolean and then evaluated.
+ * Returns true on success or false on failure.
*/
public function valid()
{
- return $this->currentBook < $this->bookList->count();
+ return null !== $this->bookList->getBook($this->currentBook);
}
/**
* (PHP 5 >= 5.0.0)
- * Rewind the Iterator to the first element
+ * Rewind the Iterator to the first element.
+ *
* @link http://php.net/manual/en/iterator.rewind.php
+ *
* @return void Any returned value is ignored.
*/
public function rewind()
diff --git a/Behavioral/Iterator/BookListReverseIterator.php b/Behavioral/Iterator/BookListReverseIterator.php
index 973bd0b..94f34d9 100644
--- a/Behavioral/Iterator/BookListReverseIterator.php
+++ b/Behavioral/Iterator/BookListReverseIterator.php
@@ -2,8 +2,17 @@
namespace DesignPatterns\Behavioral\Iterator;
-class BookListReverseIterator extends BookListIterator
+class BookListReverseIterator implements \Iterator
{
+ /**
+ * @var BookList
+ */
+ private $bookList;
+
+ /**
+ * @var int
+ */
+ protected $currentBook = 0;
public function __construct(BookList $bookList)
{
@@ -11,13 +20,68 @@ class BookListReverseIterator extends BookListIterator
$this->currentBook = $this->bookList->count() - 1;
}
+ /**
+ * Return the current book.
+ *
+ * @link http://php.net/manual/en/iterator.current.php
+ *
+ * @return Book Can return any type.
+ */
+ public function current()
+ {
+ return $this->bookList->getBook($this->currentBook);
+ }
+
+ /**
+ * (PHP 5 >= 5.0.0)
+ * Move forward to next element.
+ *
+ * @link http://php.net/manual/en/iterator.next.php
+ *
+ * @return void Any returned value is ignored.
+ */
public function next()
{
$this->currentBook--;
}
+ /**
+ * (PHP 5 >= 5.0.0)
+ * Return the key of the current element.
+ *
+ * @link http://php.net/manual/en/iterator.key.php
+ *
+ * @return mixed scalar on success, or null on failure.
+ */
+ public function key()
+ {
+ return $this->currentBook;
+ }
+
+ /**
+ * (PHP 5 >= 5.0.0)
+ * Checks if current position is valid.
+ *
+ * @link http://php.net/manual/en/iterator.valid.php
+ *
+ * @return bool The return value will be casted to boolean and then evaluated.
+ * Returns true on success or false on failure.
+ */
public function valid()
{
- return 0 <= $this->currentBook;
+ return null !== $this->bookList->getBook($this->currentBook);
+ }
+
+ /**
+ * (PHP 5 >= 5.0.0)
+ * Rewind the Iterator to the first element.
+ *
+ * @link http://php.net/manual/en/iterator.rewind.php
+ *
+ * @return void Any returned value is ignored.
+ */
+ public function rewind()
+ {
+ $this->currentBook = $this->bookList->count() - 1;
}
}
diff --git a/Behavioral/Iterator/README.md b/Behavioral/Iterator/README.md
deleted file mode 100644
index 46e96b8..0000000
--- a/Behavioral/Iterator/README.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Iterator
-
-## Purpose
-
-To make an object iterable and to make it appear like a collection of objects.
-
-## Examples
-
-* to process a file line by line by just running over all lines (which have an object representation) for a file (which of course is an object, too)
-
-## Note
-
-Standard PHP Library (SPL) defines an interface Iterator which is best suited for this! Often you would want to implement the Countable interface too, to allow `count($object)` on your iterable object
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Behavioral/Iterator/README.rst b/Behavioral/Iterator/README.rst
new file mode 100644
index 0000000..9398350
--- /dev/null
+++ b/Behavioral/Iterator/README.rst
@@ -0,0 +1,70 @@
+`Iterator`__
+============
+
+Purpose
+-------
+
+To make an object iterable and to make it appear like a collection of
+objects.
+
+Examples
+--------
+
+- to process a file line by line by just running over all lines (which
+ have an object representation) for a file (which of course is an
+ object, too)
+
+Note
+----
+
+Standard PHP Library (SPL) defines an interface Iterator which is best
+suited for this! Often you would want to implement the Countable
+interface too, to allow ``count($object)`` on your iterable object
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Iterator UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Book.php
+
+.. literalinclude:: Book.php
+ :language: php
+ :linenos:
+
+BookList.php
+
+.. literalinclude:: BookList.php
+ :language: php
+ :linenos:
+
+BookListIterator.php
+
+.. literalinclude:: BookListIterator.php
+ :language: php
+ :linenos:
+
+BookListReverseIterator.php
+
+.. literalinclude:: BookListReverseIterator.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/IteratorTest.php
+
+.. literalinclude:: Tests/IteratorTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Iterator
+.. __: http://en.wikipedia.org/wiki/Iterator_pattern
\ No newline at end of file
diff --git a/Behavioral/Iterator/Tests/IteratorTest.php b/Behavioral/Iterator/Tests/IteratorTest.php
index 2e117d8..db386f0 100644
--- a/Behavioral/Iterator/Tests/IteratorTest.php
+++ b/Behavioral/Iterator/Tests/IteratorTest.php
@@ -9,7 +9,6 @@ use DesignPatterns\Behavioral\Iterator\BookListReverseIterator;
class IteratorTest extends \PHPUnit_Framework_TestCase
{
-
/**
* @var BookList
*/
@@ -30,8 +29,8 @@ class IteratorTest extends \PHPUnit_Framework_TestCase
array(
'Learning PHP Design Patterns by William Sanders',
'Professional Php Design Patterns by Aaron Saray',
- 'Clean Code by Robert C. Martin'
- )
+ 'Clean Code by Robert C. Martin',
+ ),
),
);
}
@@ -63,4 +62,13 @@ class IteratorTest extends \PHPUnit_Framework_TestCase
$iterator->next();
}
}
+
+ /**
+ * Test BookList Remove.
+ */
+ public function testBookRemove()
+ {
+ $this->bookList->removeBook($this->bookList->getBook(0));
+ $this->assertEquals($this->bookList->count(), 2);
+ }
}
diff --git a/Behavioral/Mediator/Colleague.php b/Behavioral/Mediator/Colleague.php
index 36dea5d..c74dee5 100644
--- a/Behavioral/Mediator/Colleague.php
+++ b/Behavioral/Mediator/Colleague.php
@@ -9,18 +9,12 @@ namespace DesignPatterns\Behavioral\Mediator;
abstract class Colleague
{
/**
- * this ensures no change in subclasses
+ * this ensures no change in subclasses.
*
* @var MediatorInterface
*/
private $mediator;
- // for subclasses
- protected function getMediator()
- {
- return $this->mediator;
- }
-
/**
* @param MediatorInterface $medium
*/
@@ -29,4 +23,11 @@ abstract class Colleague
// in this way, we are sure the concrete colleague knows the mediator
$this->mediator = $medium;
}
+
+ // for subclasses
+
+ protected function getMediator()
+ {
+ return $this->mediator;
+ }
}
diff --git a/Behavioral/Mediator/Mediator.php b/Behavioral/Mediator/Mediator.php
index ba1407e..98a7890 100644
--- a/Behavioral/Mediator/Mediator.php
+++ b/Behavioral/Mediator/Mediator.php
@@ -2,15 +2,12 @@
namespace DesignPatterns\Behavioral\Mediator;
-use DesignPatterns\Behavioral\Mediator\Subsystem;
-
/**
* Mediator is the concrete Mediator for this design pattern.
* In this example, I have made a "Hello World" with the Mediator Pattern.
*/
class Mediator implements MediatorInterface
{
-
/**
* @var Subsystem\Server
*/
@@ -39,7 +36,7 @@ class Mediator implements MediatorInterface
}
/**
- * make request
+ * make request.
*/
public function makeRequest()
{
@@ -47,7 +44,8 @@ class Mediator implements MediatorInterface
}
/**
- * query db
+ * query db.
+ *
* @return mixed
*/
public function queryDb()
@@ -56,7 +54,7 @@ class Mediator implements MediatorInterface
}
/**
- * send response
+ * send response.
*
* @param string $content
*/
diff --git a/Behavioral/Mediator/MediatorInterface.php b/Behavioral/Mediator/MediatorInterface.php
index b289cea..dbdd489 100644
--- a/Behavioral/Mediator/MediatorInterface.php
+++ b/Behavioral/Mediator/MediatorInterface.php
@@ -4,24 +4,24 @@ namespace DesignPatterns\Behavioral\Mediator;
/**
* MediatorInterface is a contract for the Mediator
- * This interface is not mandatory but it is better for LSP concerns
+ * This interface is not mandatory but it is better for LSP concerns.
*/
interface MediatorInterface
{
/**
- * sends the response
+ * sends the response.
*
* @param string $content
*/
public function sendResponse($content);
/**
- * makes a request
+ * makes a request.
*/
public function makeRequest();
/**
- * queries the DB
+ * queries the DB.
*/
public function queryDb();
}
diff --git a/Behavioral/Mediator/README.md b/Behavioral/Mediator/README.md
deleted file mode 100644
index 818ff4c..0000000
--- a/Behavioral/Mediator/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Mediator
-
-## Purpose
-
-This pattern provides an easy to decouple many components working together.
-It is a good alternative over Observer IF you have a "central intelligence",
-like a controller (but not in the sense of the MVC).
-
-All components (called Colleague) are only coupled to the MediatorInterface and
-it is a good thing because in OOP, one good friend is better than many. This
-is the key-feature of this pattern.
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Behavioral/Mediator/README.rst b/Behavioral/Mediator/README.rst
new file mode 100644
index 0000000..bc9485a
--- /dev/null
+++ b/Behavioral/Mediator/README.rst
@@ -0,0 +1,73 @@
+`Mediator`__
+============
+
+Purpose
+-------
+
+This pattern provides an easy way to decouple many components working
+together. It is a good alternative to Observer IF you have a "central
+intelligence", like a controller (but not in the sense of the MVC).
+
+All components (called Colleague) are only coupled to the
+MediatorInterface and it is a good thing because in OOP, one good friend
+is better than many. This is the key-feature of this pattern.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Mediator UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+MediatorInterface.php
+
+.. literalinclude:: MediatorInterface.php
+ :language: php
+ :linenos:
+
+Mediator.php
+
+.. literalinclude:: Mediator.php
+ :language: php
+ :linenos:
+
+Colleague.php
+
+.. literalinclude:: Colleague.php
+ :language: php
+ :linenos:
+
+Subsystem/Client.php
+
+.. literalinclude:: Subsystem/Client.php
+ :language: php
+ :linenos:
+
+Subsystem/Database.php
+
+.. literalinclude:: Subsystem/Database.php
+ :language: php
+ :linenos:
+
+Subsystem/Server.php
+
+.. literalinclude:: Subsystem/Server.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/MediatorTest.php
+
+.. literalinclude:: Tests/MediatorTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Mediator
+.. __: http://en.wikipedia.org/wiki/Mediator_pattern
diff --git a/Behavioral/Mediator/Subsystem/Client.php b/Behavioral/Mediator/Subsystem/Client.php
index cb4b020..f7a21c9 100644
--- a/Behavioral/Mediator/Subsystem/Client.php
+++ b/Behavioral/Mediator/Subsystem/Client.php
@@ -5,12 +5,12 @@ namespace DesignPatterns\Behavioral\Mediator\Subsystem;
use DesignPatterns\Behavioral\Mediator\Colleague;
/**
- * Client is a client that make request et get response
+ * Client is a client that make request et get response.
*/
class Client extends Colleague
{
/**
- * request
+ * request.
*/
public function request()
{
@@ -18,7 +18,7 @@ class Client extends Colleague
}
/**
- * output content
+ * output content.
*
* @param string $content
*/
diff --git a/Behavioral/Mediator/Subsystem/Database.php b/Behavioral/Mediator/Subsystem/Database.php
index 7cc9bc4..69ad6cf 100644
--- a/Behavioral/Mediator/Subsystem/Database.php
+++ b/Behavioral/Mediator/Subsystem/Database.php
@@ -5,7 +5,7 @@ namespace DesignPatterns\Behavioral\Mediator\Subsystem;
use DesignPatterns\Behavioral\Mediator\Colleague;
/**
- * Database is a database service
+ * Database is a database service.
*/
class Database extends Colleague
{
@@ -14,6 +14,6 @@ class Database extends Colleague
*/
public function getData()
{
- return "World";
+ return 'World';
}
}
diff --git a/Behavioral/Mediator/Subsystem/Server.php b/Behavioral/Mediator/Subsystem/Server.php
index 1638301..1602bcb 100644
--- a/Behavioral/Mediator/Subsystem/Server.php
+++ b/Behavioral/Mediator/Subsystem/Server.php
@@ -5,12 +5,12 @@ namespace DesignPatterns\Behavioral\Mediator\Subsystem;
use DesignPatterns\Behavioral\Mediator\Colleague;
/**
- * Server serves responses
+ * Server serves responses.
*/
class Server extends Colleague
{
/**
- * process on server
+ * process on server.
*/
public function process()
{
diff --git a/Behavioral/Mediator/Tests/MediatorTest.php b/Behavioral/Mediator/Tests/MediatorTest.php
index 13abe48..2bce947 100644
--- a/Behavioral/Mediator/Tests/MediatorTest.php
+++ b/Behavioral/Mediator/Tests/MediatorTest.php
@@ -3,16 +3,15 @@
namespace DesignPatterns\Tests\Mediator\Tests;
use DesignPatterns\Behavioral\Mediator\Mediator;
-use DesignPatterns\Behavioral\Mediator\Subsystem\Database;
use DesignPatterns\Behavioral\Mediator\Subsystem\Client;
+use DesignPatterns\Behavioral\Mediator\Subsystem\Database;
use DesignPatterns\Behavioral\Mediator\Subsystem\Server;
/**
- * MediatorTest tests hello world
+ * MediatorTest tests hello world.
*/
class MediatorTest extends \PHPUnit_Framework_TestCase
{
-
protected $client;
protected function setUp()
diff --git a/Behavioral/Memento/Caretaker.php b/Behavioral/Memento/Caretaker.php
index 340bb97..d80454a 100644
--- a/Behavioral/Memento/Caretaker.php
+++ b/Behavioral/Memento/Caretaker.php
@@ -4,30 +4,46 @@ namespace DesignPatterns\Behavioral\Memento;
class Caretaker
{
- public static function run()
+ protected $history = array();
+
+ /**
+ * @return Memento
+ */
+ public function getFromHistory($id)
{
- /* @var $savedStates Memento[] */
+ return $this->history[$id];
+ }
- $savedStates = array();
+ /**
+ * @param Memento $state
+ */
+ public function saveToHistory(Memento $state)
+ {
+ $this->history[] = $state;
+ }
+ public function runCustomLogic()
+ {
$originator = new Originator();
//Setting state to State1
- $originator->setState("State1");
+ $originator->setState('State1');
//Setting state to State2
- $originator->setState("State2");
+ $originator->setState('State2');
//Saving State2 to Memento
- $savedStates[] = $originator->saveToMemento();
+ $this->saveToHistory($originator->getStateAsMemento());
//Setting state to State3
- $originator->setState("State3");
+ $originator->setState('State3');
// We can request multiple mementos, and choose which one to roll back to.
// Saving State3 to Memento
- $savedStates[] = $originator->saveToMemento();
+ $this->saveToHistory($originator->getStateAsMemento());
//Setting state to State4
- $originator->setState("State4");
+ $originator->setState('State4');
- $originator->restoreFromMemento($savedStates[1]);
+ $originator->restoreFromMemento($this->getFromHistory(1));
//State after restoring from Memento: State3
+
+ return $originator->getStateAsMemento()->getState();
}
}
diff --git a/Behavioral/Memento/Originator.php b/Behavioral/Memento/Originator.php
index fec4e45..3acb0c1 100644
--- a/Behavioral/Memento/Originator.php
+++ b/Behavioral/Memento/Originator.php
@@ -15,14 +15,17 @@ class Originator
*/
public function setState($state)
{
+ // you must check type of state inside child of this class
+ // or use type-hinting for full pattern implementation
$this->state = $state;
}
/**
* @return Memento
*/
- public function saveToMemento()
+ public function getStateAsMemento()
{
+ // you must save a separate copy in Memento
$state = is_object($this->state) ? clone $this->state : $this->state;
return new Memento($state);
diff --git a/Behavioral/Memento/README.md b/Behavioral/Memento/README.md
deleted file mode 100644
index 4e3294e..0000000
--- a/Behavioral/Memento/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-# Memento
-
-## Purpose
-
-Provide the ability to restore an object to its previous state (undo via rollback).
-
-The memento pattern is implemented with three objects: the originator, a caretaker and a memento.
-The originator is some object that has an internal state.
-The caretaker is going to do something to the originator, but wants to be able to undo the change.
-The caretaker first asks the originator for a memento object. Then it does whatever operation (or sequence of operations) it was going to do.
-To roll back to the state before the operations, it returns the memento object to the originator.
-The memento object itself is an opaque object (one which the caretaker cannot, or should not, change).
-When using this pattern, care should be taken if the originator may change other objects or resources - the memento pattern operates on a single object.
-
-## Examples
-
-* The seed of a pseudorandom number generator
-* The state in a finite state machine
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Behavioral/Memento/README.rst b/Behavioral/Memento/README.rst
new file mode 100644
index 0000000..911e30e
--- /dev/null
+++ b/Behavioral/Memento/README.rst
@@ -0,0 +1,85 @@
+`Memento`__
+===========
+
+Purpose
+-------
+
+It provides the ability to restore an object to it's previous state (undo
+via rollback) or to gain access to state of the object, without revealing
+it's implementation (i.e., the object is not required to have a functional
+for return the current state).
+
+The memento pattern is implemented with three objects: the Originator, a
+Caretaker and a Memento.
+
+Memento – an object that *contains a concrete unique snapshot of state* of
+any object or resource: string, number, array, an instance of class and so on.
+The uniqueness in this case does not imply the prohibition existence of similar
+states in different snapshots. That means the state can be extracted as
+the independent clone. Any object stored in the Memento should be
+*a full copy of the original object rather than a reference* to the original
+object. The Memento object is a "opaque object" (the object that no one can
+or should change).
+
+Originator – it is an object that contains the *actual state of an external
+object is strictly specified type*. Originator is able to create a unique
+copy of this state and return it wrapped in a Memento. The Originator does
+not know the history of changes. You can set a concrete state to Originator
+from the outside, which will be considered as actual. The Originator must
+make sure that given state corresponds the allowed type of object. Originator
+may (but not should) have any methods, but they *they can't make changes to
+the saved object state*.
+
+Caretaker *controls the states history*. He may make changes to an object;
+take a decision to save the state of an external object in the Originator;
+ask from the Originator snapshot of the current state; or set the Originator
+state to equivalence with some snapshot from history.
+
+Examples
+--------
+
+- The seed of a pseudorandom number generator
+- The state in a finite state machine
+- Control for intermediate states of `ORM Model `_ before saving
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Momento UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Memento.php
+
+.. literalinclude:: Memento.php
+ :language: php
+ :linenos:
+
+Originator.php
+
+.. literalinclude:: Originator.php
+ :language: php
+ :linenos:
+
+Caretaker.php
+
+.. literalinclude:: Caretaker.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/MementoTest.php
+
+.. literalinclude:: Tests/MementoTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Memento
+.. __: http://en.wikipedia.org/wiki/Memento_pattern
\ No newline at end of file
diff --git a/Behavioral/Memento/Tests/MementoTest.php b/Behavioral/Memento/Tests/MementoTest.php
index 88110a6..722dbfa 100644
--- a/Behavioral/Memento/Tests/MementoTest.php
+++ b/Behavioral/Memento/Tests/MementoTest.php
@@ -2,68 +2,161 @@
namespace DesignPatterns\Behavioral\Memento\Tests;
+use DesignPatterns\Behavioral\Memento\Caretaker;
+use DesignPatterns\Behavioral\Memento\Memento;
use DesignPatterns\Behavioral\Memento\Originator;
/**
- * MementoTest tests the memento pattern
+ * MementoTest tests the memento pattern.
*/
class MementoTest extends \PHPUnit_Framework_TestCase
{
+ public function testUsageExample()
+ {
+ $originator = new Originator();
+ $caretaker = new Caretaker();
+
+ $character = new \stdClass();
+ // new object
+ $character->name = 'Gandalf';
+ // connect Originator to character object
+ $originator->setState($character);
+
+ // work on the object
+ $character->name = 'Gandalf the Grey';
+ // still change something
+ $character->race = 'Maia';
+ // time to save state
+ $snapshot = $originator->getStateAsMemento();
+ // put state to log
+ $caretaker->saveToHistory($snapshot);
+
+ // change something
+ $character->name = 'Sauron';
+ // and again
+ $character->race = 'Ainur';
+ // state inside the Originator was equally changed
+ $this->assertAttributeEquals($character, 'state', $originator);
+
+ // time to save another state
+ $snapshot = $originator->getStateAsMemento();
+ // put state to log
+ $caretaker->saveToHistory($snapshot);
+
+ $rollback = $caretaker->getFromHistory(0);
+ // return to first state
+ $originator->restoreFromMemento($rollback);
+ // use character from old state
+ $character = $rollback->getState();
+
+ // yes, that what we need
+ $this->assertEquals('Gandalf the Grey', $character->name);
+ // make new changes
+ $character->name = 'Gandalf the White';
+
+ // and Originator linked to actual object again
+ $this->assertAttributeEquals($character, 'state', $originator);
+ }
public function testStringState()
{
$originator = new Originator();
- $originator->setState("State1");
+ $originator->setState('State1');
- $this->assertAttributeEquals("State1", "state", $originator);
+ $this->assertAttributeEquals('State1', 'state', $originator);
- $originator->setState("State2");
+ $originator->setState('State2');
+ $this->assertAttributeEquals('State2', 'state', $originator);
- $this->assertAttributeEquals("State2", "state", $originator);
+ $snapshot = $originator->getStateAsMemento();
+ $this->assertAttributeEquals('State2', 'state', $snapshot);
- $savedState = $originator->saveToMemento();
+ $originator->setState('State3');
+ $this->assertAttributeEquals('State3', 'state', $originator);
- $this->assertAttributeEquals("State2", "state", $savedState);
-
- $originator->setState("State3");
-
- $this->assertAttributeEquals("State3", "state", $originator);
-
- $originator->restoreFromMemento($savedState);
-
- $this->assertAttributeEquals("State2", "state", $originator);
+ $originator->restoreFromMemento($snapshot);
+ $this->assertAttributeEquals('State2', 'state', $originator);
}
- public function testObjectState()
+ public function testSnapshotIsClone()
+ {
+ $originator = new Originator();
+ $object = new \stdClass();
+
+ $originator->setState($object);
+ $snapshot = $originator->getStateAsMemento();
+ $object->new_property = 1;
+
+ $this->assertAttributeEquals($object, 'state', $originator);
+ $this->assertAttributeNotEquals($object, 'state', $snapshot);
+
+ $originator->restoreFromMemento($snapshot);
+ $this->assertAttributeNotEquals($object, 'state', $originator);
+ }
+
+ public function testCanChangeActualState()
+ {
+ $originator = new Originator();
+ $first_state = new \stdClass();
+
+ $originator->setState($first_state);
+ $snapshot = $originator->getStateAsMemento();
+ $second_state = $snapshot->getState();
+
+ // still actual
+ $first_state->first_property = 1;
+ // just history
+ $second_state->second_property = 2;
+ $this->assertAttributeEquals($first_state, 'state', $originator);
+ $this->assertAttributeNotEquals($second_state, 'state', $originator);
+
+ $originator->restoreFromMemento($snapshot);
+ // now it lost state
+ $first_state->first_property = 11;
+ // must be actual
+ $second_state->second_property = 22;
+ $this->assertAttributeEquals($second_state, 'state', $originator);
+ $this->assertAttributeNotEquals($first_state, 'state', $originator);
+ }
+
+ public function testStateWithDifferentObjects()
{
$originator = new Originator();
- $foo = new \stdClass();
- $foo->data = "foo";
+ $first = new \stdClass();
+ $first->data = 'foo';
- $originator->setState($foo);
+ $originator->setState($first);
+ $this->assertAttributeEquals($first, 'state', $originator);
- $this->assertAttributeEquals($foo, "state", $originator);
+ $first_snapshot = $originator->getStateAsMemento();
+ $this->assertAttributeEquals($first, 'state', $first_snapshot);
- $savedState = $originator->saveToMemento();
+ $second = new \stdClass();
+ $second->data = 'bar';
+ $originator->setState($second);
+ $this->assertAttributeEquals($second, 'state', $originator);
- $this->assertAttributeEquals($foo, "state", $savedState);
+ $originator->restoreFromMemento($first_snapshot);
+ $this->assertAttributeEquals($first, 'state', $originator);
+ }
- $bar = new \stdClass();
- $bar->data = "bar";
+ public function testCaretaker()
+ {
+ $caretaker = new Caretaker();
+ $memento1 = new Memento('foo');
+ $memento2 = new Memento('bar');
+ $caretaker->saveToHistory($memento1);
+ $caretaker->saveToHistory($memento2);
+ $this->assertAttributeEquals(array($memento1, $memento2), 'history', $caretaker);
+ $this->assertEquals($memento1, $caretaker->getFromHistory(0));
+ $this->assertEquals($memento2, $caretaker->getFromHistory(1));
+ }
- $originator->setState($bar);
-
- $this->assertAttributeEquals($bar, "state", $originator);
-
- $originator->restoreFromMemento($savedState);
-
- $this->assertAttributeEquals($foo, "state", $originator);
-
- $foo->data = null;
-
- $this->assertAttributeNotEquals($foo, "state", $savedState);
-
- $this->assertAttributeNotEquals($foo, "state", $originator);
+ public function testCaretakerCustomLogic()
+ {
+ $caretaker = new Caretaker();
+ $result = $caretaker->runCustomLogic();
+ $this->assertEquals('State3', $result);
}
}
diff --git a/Behavioral/Memento/uml/uml.png b/Behavioral/Memento/uml/uml.png
index e96ea69..0fde074 100644
Binary files a/Behavioral/Memento/uml/uml.png and b/Behavioral/Memento/uml/uml.png differ
diff --git a/Behavioral/NullObject/LoggerInterface.php b/Behavioral/NullObject/LoggerInterface.php
index 250c5a3..99a28c7 100644
--- a/Behavioral/NullObject/LoggerInterface.php
+++ b/Behavioral/NullObject/LoggerInterface.php
@@ -3,8 +3,8 @@
namespace DesignPatterns\Behavioral\NullObject;
/**
- * LoggerInterface is a contract for logging something
- *
+ * LoggerInterface is a contract for logging something.
+ *
* Key feature: NullLogger MUST inherit from this interface like any other Loggers
*/
interface LoggerInterface
diff --git a/Behavioral/NullObject/NullLogger.php b/Behavioral/NullObject/NullLogger.php
index 49ff51e..a4bf469 100644
--- a/Behavioral/NullObject/NullLogger.php
+++ b/Behavioral/NullObject/NullLogger.php
@@ -5,7 +5,7 @@ namespace DesignPatterns\Behavioral\NullObject;
/**
* Performance concerns : ok there is a call for nothing but we spare an "if is_null"
* I didn't run a benchmark but I think it's equivalent.
- *
+ *
* Key feature : of course this logger MUST implement the same interface (or abstract)
* like the other loggers.
*/
diff --git a/Behavioral/NullObject/PrintLogger.php b/Behavioral/NullObject/PrintLogger.php
index a088145..371c1ab 100644
--- a/Behavioral/NullObject/PrintLogger.php
+++ b/Behavioral/NullObject/PrintLogger.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\NullObject;
/**
- * PrintLogger is a logger that prints the log entry to standard output
+ * PrintLogger is a logger that prints the log entry to standard output.
*/
class PrintLogger implements LoggerInterface
{
diff --git a/Behavioral/NullObject/README.md b/Behavioral/NullObject/README.md
deleted file mode 100644
index 108b07c..0000000
--- a/Behavioral/NullObject/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-# Null Object
-
-## Purpose
-
-NullObject is not a GoF design pattern but a schema which appears frequently enough to be considered a pattern. It has the following benefits:
-
-* Client code is simplified
-* Reduces the chance of null pointer exceptions
-* Fewer conditionals require less test cases
-
-Methods that return an object or null should instead return an object or `NullObject`. `NullObject`s simplify boilerplate code such as `if (!is_null($obj)) { $obj->callSomething(); }` to just `$obj->callSomething();` by eliminating the conditional check in client code.
-
-## Examples
-
-* Symfony2: null logger of profiler
-* Symfony2: null output in Symfony/Console
-* null handler in a Chain of Responsibilities pattern
-* null command in a Command pattern
-
-## UML Diagram
-
-
diff --git a/Behavioral/NullObject/README.rst b/Behavioral/NullObject/README.rst
new file mode 100644
index 0000000..ad7719c
--- /dev/null
+++ b/Behavioral/NullObject/README.rst
@@ -0,0 +1,75 @@
+`Null Object`__
+===============
+
+Purpose
+-------
+
+NullObject is not a GoF design pattern but a schema which appears
+frequently enough to be considered a pattern. It has the following
+benefits:
+
+- Client code is simplified
+- Reduces the chance of null pointer exceptions
+- Fewer conditionals require less test cases
+
+Methods that return an object or null should instead return an object or
+``NullObject``. ``NullObject``\ s simplify boilerplate code such as
+``if (!is_null($obj)) { $obj->callSomething(); }`` to just
+``$obj->callSomething();`` by eliminating the conditional check in
+client code.
+
+Examples
+--------
+
+- Symfony2: null logger of profiler
+- Symfony2: null output in Symfony/Console
+- null handler in a Chain of Responsibilities pattern
+- null command in a Command pattern
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt NullObject UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Service.php
+
+.. literalinclude:: Service.php
+ :language: php
+ :linenos:
+
+LoggerInterface.php
+
+.. literalinclude:: LoggerInterface.php
+ :language: php
+ :linenos:
+
+PrintLogger.php
+
+.. literalinclude:: PrintLogger.php
+ :language: php
+ :linenos:
+
+NullLogger.php
+
+.. literalinclude:: NullLogger.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/LoggerTest.php
+
+.. literalinclude:: Tests/LoggerTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/NullObject
+.. __: http://en.wikipedia.org/wiki/Null_Object_pattern
\ No newline at end of file
diff --git a/Behavioral/NullObject/Service.php b/Behavioral/NullObject/Service.php
index ae6d96d..56a3847 100644
--- a/Behavioral/NullObject/Service.php
+++ b/Behavioral/NullObject/Service.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\NullObject;
/**
- * Service is dummy service that uses a logger
+ * Service is dummy service that uses a logger.
*/
class Service
{
@@ -13,7 +13,7 @@ class Service
protected $logger;
/**
- * we inject the logger in ctor and it is mandatory
+ * we inject the logger in ctor and it is mandatory.
*
* @param LoggerInterface $log
*/
@@ -28,7 +28,7 @@ class Service
public function doSomething()
{
// no more check "if (!is_null($this->logger))..." with the NullObject pattern
- $this->logger->log('We are in ' . __METHOD__);
+ $this->logger->log('We are in '.__METHOD__);
// something to do...
}
}
diff --git a/Behavioral/NullObject/Tests/LoggerTest.php b/Behavioral/NullObject/Tests/LoggerTest.php
index a8e7bf5..034b577 100644
--- a/Behavioral/NullObject/Tests/LoggerTest.php
+++ b/Behavioral/NullObject/Tests/LoggerTest.php
@@ -3,15 +3,14 @@
namespace DesignPatterns\Behavioral\NullObject\Tests;
use DesignPatterns\Behavioral\NullObject\NullLogger;
-use DesignPatterns\Behavioral\NullObject\Service;
use DesignPatterns\Behavioral\NullObject\PrintLogger;
+use DesignPatterns\Behavioral\NullObject\Service;
/**
- * LoggerTest tests for different loggers
+ * LoggerTest tests for different loggers.
*/
class LoggerTest extends \PHPUnit_Framework_TestCase
{
-
public function testNullObject()
{
// one can use a singleton for NullObjet : I don't think it's a good idea
diff --git a/Behavioral/Observer/README.md b/Behavioral/Observer/README.md
deleted file mode 100644
index ccaeaca..0000000
--- a/Behavioral/Observer/README.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# Observer
-
-## Purpose
-
-To implement a publish/subscribe behaviour to an object, whenever a "Subject" object changes it's state, the attached
-"Observers" will be notified. It is used to shorten the amount of coupled objects and uses loose coupling instead.
-
-## Examples
-
-* a message queue system is observed to show the progress of a job in a GUI
-
-## Note
-
-PHP already defines two interfaces that can help to implement this pattern: SplObserver and SplSubject.
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Behavioral/Observer/README.rst b/Behavioral/Observer/README.rst
new file mode 100644
index 0000000..53398c2
--- /dev/null
+++ b/Behavioral/Observer/README.rst
@@ -0,0 +1,58 @@
+`Observer`__
+============
+
+Purpose
+-------
+
+To implement a publish/subscribe behaviour to an object, whenever a
+"Subject" object changes it's state, the attached "Observers" will be
+notified. It is used to shorten the amount of coupled objects and uses
+loose coupling instead.
+
+Examples
+--------
+
+- a message queue system is observed to show the progress of a job in a
+ GUI
+
+Note
+----
+
+PHP already defines two interfaces that can help to implement this
+pattern: SplObserver and SplSubject.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Observer UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+User.php
+
+.. literalinclude:: User.php
+ :language: php
+ :linenos:
+
+UserObserver.php
+
+.. literalinclude:: UserObserver.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/ObserverTest.php
+
+.. literalinclude:: Tests/ObserverTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Observer
+.. __: http://en.wikipedia.org/wiki/Observer_pattern
\ No newline at end of file
diff --git a/Behavioral/Observer/Tests/ObserverTest.php b/Behavioral/Observer/Tests/ObserverTest.php
index 233de28..d9dacec 100644
--- a/Behavioral/Observer/Tests/ObserverTest.php
+++ b/Behavioral/Observer/Tests/ObserverTest.php
@@ -2,15 +2,14 @@
namespace DesignPatterns\Behavioral\Observer\Tests;
-use DesignPatterns\Behavioral\Observer\UserObserver;
use DesignPatterns\Behavioral\Observer\User;
+use DesignPatterns\Behavioral\Observer\UserObserver;
/**
- * ObserverTest tests the Observer pattern
+ * ObserverTest tests the Observer pattern.
*/
class ObserverTest extends \PHPUnit_Framework_TestCase
{
-
protected $observer;
protected function setUp()
@@ -19,7 +18,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
}
/**
- * Tests the notification
+ * Tests the notification.
*/
public function testNotify()
{
@@ -31,20 +30,29 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
}
/**
- * Tests the subscribing
+ * Tests the subscribing.
*/
public function testAttachDetach()
{
$subject = new User();
- $this->assertAttributeEmpty('observers', $subject);
+ $reflection = new \ReflectionProperty($subject, 'observers');
+
+ $reflection->setAccessible(true);
+ /** @var \SplObjectStorage $observers */
+ $observers = $reflection->getValue($subject);
+
+ $this->assertInstanceOf('SplObjectStorage', $observers);
+ $this->assertFalse($observers->contains($this->observer));
+
$subject->attach($this->observer);
- $this->assertAttributeNotEmpty('observers', $subject);
+ $this->assertTrue($observers->contains($this->observer));
+
$subject->detach($this->observer);
- $this->assertAttributeEmpty('observers', $subject);
+ $this->assertFalse($observers->contains($this->observer));
}
/**
- * Tests the update() invocation on a mockup
+ * Tests the update() invocation on a mockup.
*/
public function testUpdateCalling()
{
diff --git a/Behavioral/Observer/User.php b/Behavioral/Observer/User.php
index b7ffd19..0d2a817 100644
--- a/Behavioral/Observer/User.php
+++ b/Behavioral/Observer/User.php
@@ -3,29 +3,33 @@
namespace DesignPatterns\Behavioral\Observer;
/**
- * Observer pattern : The observed object (the subject)
- *
- * The subject maintains a list of Observers and sends notifications.
+ * Observer pattern : The observed object (the subject).
*
+ * The subject maintains a list of Observers and sends notifications.
*/
class User implements \SplSubject
{
/**
- * user data
+ * user data.
*
* @var array
*/
protected $data = array();
/**
- * observers
+ * observers.
*
- * @var array
+ * @var \SplObjectStorage
*/
- protected $observers = array();
+ protected $observers;
+
+ public function __construct()
+ {
+ $this->observers = new \SplObjectStorage();
+ }
/**
- * attach a new observer
+ * attach a new observer.
*
* @param \SplObserver $observer
*
@@ -33,11 +37,11 @@ class User implements \SplSubject
*/
public function attach(\SplObserver $observer)
{
- $this->observers[] = $observer;
+ $this->observers->attach($observer);
}
/**
- * detach an observer
+ * detach an observer.
*
* @param \SplObserver $observer
*
@@ -45,15 +49,11 @@ class User implements \SplSubject
*/
public function detach(\SplObserver $observer)
{
- $index = array_search($observer, $this->observers);
-
- if (false !== $index) {
- unset($this->observers[$index]);
- }
+ $this->observers->detach($observer);
}
/**
- * notify observers
+ * notify observers.
*
* @return void
*/
@@ -67,7 +67,7 @@ class User implements \SplSubject
/**
* Ideally one would better write setter/getter for all valid attributes and only call notify()
- * on attributes that matter when changed
+ * on attributes that matter when changed.
*
* @param string $name
* @param mixed $value
diff --git a/Behavioral/Observer/UserObserver.php b/Behavioral/Observer/UserObserver.php
index 444a0eb..f2673ba 100644
--- a/Behavioral/Observer/UserObserver.php
+++ b/Behavioral/Observer/UserObserver.php
@@ -3,18 +3,18 @@
namespace DesignPatterns\Behavioral\Observer;
/**
- * class UserObserver
+ * class UserObserver.
*/
class UserObserver implements \SplObserver
{
/**
* This is the only method to implement as an observer.
- * It is called by the Subject (usually by SplSubject::notify() )
- *
+ * It is called by the Subject (usually by SplSubject::notify() ).
+ *
* @param \SplSubject $subject
*/
public function update(\SplSubject $subject)
{
- echo get_class($subject) . ' has been updated';
+ echo get_class($subject).' has been updated';
}
}
diff --git a/Behavioral/README.md b/Behavioral/README.md
index d9c264e..b98202b 100644
--- a/Behavioral/README.md
+++ b/Behavioral/README.md
@@ -9,6 +9,7 @@ communication.
* [Command](Command) [:notebook:](http://en.wikipedia.org/wiki/Command_pattern)
* [Iterator](Iterator) [:notebook:](http://en.wikipedia.org/wiki/Iterator_pattern)
* [Mediator](Mediator) [:notebook:](http://en.wikipedia.org/wiki/Mediator_pattern)
+* [Memento](Memento) [:notebook:](http://en.wikipedia.org/wiki/Memento_pattern)
* [NullObject](NullObject) [:notebook:](http://en.wikipedia.org/wiki/Null_Object_pattern)
* [Observer](Observer) [:notebook:](http://en.wikipedia.org/wiki/Observer_pattern)
* [Specification](Specification) [:notebook:](http://en.wikipedia.org/wiki/Specification_pattern)
diff --git a/Behavioral/README.rst b/Behavioral/README.rst
new file mode 100644
index 0000000..5577f4c
--- /dev/null
+++ b/Behavioral/README.rst
@@ -0,0 +1,25 @@
+`Behavioral`__
+==============
+
+In software engineering, behavioral design patterns are design patterns
+that identify common communication patterns between objects and realize
+these patterns. By doing so, these patterns increase flexibility in
+carrying out this communication.
+
+.. toctree::
+ :titlesonly:
+
+ ChainOfResponsibilities/README
+ Command/README
+ Iterator/README
+ Mediator/README
+ Memento/README
+ NullObject/README
+ Observer/README
+ Specification/README
+ State/README
+ Strategy/README
+ TemplateMethod/README
+ Visitor/README
+
+.. __: http://en.wikipedia.org/wiki/Behavioral_pattern
\ No newline at end of file
diff --git a/Behavioral/Specification/AbstractSpecification.php b/Behavioral/Specification/AbstractSpecification.php
index f297539..66d61b8 100644
--- a/Behavioral/Specification/AbstractSpecification.php
+++ b/Behavioral/Specification/AbstractSpecification.php
@@ -1,13 +1,14 @@
`__
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Specification UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Item.php
+
+.. literalinclude:: Item.php
+ :language: php
+ :linenos:
+
+SpecificationInterface.php
+
+.. literalinclude:: SpecificationInterface.php
+ :language: php
+ :linenos:
+
+AbstractSpecification.php
+
+.. literalinclude:: AbstractSpecification.php
+ :language: php
+ :linenos:
+
+Either.php
+
+.. literalinclude:: Either.php
+ :language: php
+ :linenos:
+
+PriceSpecification.php
+
+.. literalinclude:: PriceSpecification.php
+ :language: php
+ :linenos:
+
+Plus.php
+
+.. literalinclude:: Plus.php
+ :language: php
+ :linenos:
+
+Not.php
+
+.. literalinclude:: Not.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/SpecificationTest.php
+
+.. literalinclude:: Tests/SpecificationTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Specification
+.. __: http://en.wikipedia.org/wiki/Specification_pattern
diff --git a/Behavioral/Specification/SpecificationInterface.php b/Behavioral/Specification/SpecificationInterface.php
index e4e15a2..796af9f 100644
--- a/Behavioral/Specification/SpecificationInterface.php
+++ b/Behavioral/Specification/SpecificationInterface.php
@@ -1,13 +1,14 @@
order['updatedTime'] = time();
// Setting the new order status into database;
- return $this->updateOrder($order);
+ return $this->updateOrder($this->order);
}
}
diff --git a/Behavioral/Strategy/ComparatorInterface.php b/Behavioral/Strategy/ComparatorInterface.php
index 8e7de18..f472fd9 100644
--- a/Behavioral/Strategy/ComparatorInterface.php
+++ b/Behavioral/Strategy/ComparatorInterface.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Strategy;
/**
- * Class ComparatorInterface
+ * Class ComparatorInterface.
*/
interface ComparatorInterface
{
diff --git a/Behavioral/Strategy/DateComparator.php b/Behavioral/Strategy/DateComparator.php
index bc7ffea..fb3c408 100644
--- a/Behavioral/Strategy/DateComparator.php
+++ b/Behavioral/Strategy/DateComparator.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Strategy;
/**
- * Class DateComparator
+ * Class DateComparator.
*/
class DateComparator implements ComparatorInterface
{
diff --git a/Behavioral/Strategy/IdComparator.php b/Behavioral/Strategy/IdComparator.php
index 9076989..f829195 100644
--- a/Behavioral/Strategy/IdComparator.php
+++ b/Behavioral/Strategy/IdComparator.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Strategy;
/**
- * Class IdComparator
+ * Class IdComparator.
*/
class IdComparator implements ComparatorInterface
{
diff --git a/Behavioral/Strategy/ObjectCollection.php b/Behavioral/Strategy/ObjectCollection.php
index 1b4fa88..b5c1bd2 100644
--- a/Behavioral/Strategy/ObjectCollection.php
+++ b/Behavioral/Strategy/ObjectCollection.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Strategy;
/**
- * Class ObjectCollection
+ * Class ObjectCollection.
*/
class ObjectCollection
{
@@ -31,7 +31,7 @@ class ObjectCollection
public function sort()
{
if (!$this->comparator) {
- throw new \LogicException("Comparator is not set");
+ throw new \LogicException('Comparator is not set');
}
$callback = array($this->comparator, 'compare');
diff --git a/Behavioral/Strategy/README.md b/Behavioral/Strategy/README.md
deleted file mode 100644
index 9813487..0000000
--- a/Behavioral/Strategy/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# Strategy
-
-## Terminology:
-
-* Context
-* Strategy
-* Concrete Strategy
-
-## Purpose
-
-To separate strategies and to enable fast switching between them. Also this pattern is a good alternative to inheritance (instead of having an abstract class that is extended).
-
-## Examples
-
-* sorting a list of objects, one strategy by date, the other by id
-* simplify unit testing: e.g. switching between file and in-memory storage
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Behavioral/Strategy/README.rst b/Behavioral/Strategy/README.rst
new file mode 100644
index 0000000..c3ced8f
--- /dev/null
+++ b/Behavioral/Strategy/README.rst
@@ -0,0 +1,71 @@
+`Strategy`__
+============
+
+Terminology:
+------------
+
+- Context
+- Strategy
+- Concrete Strategy
+
+Purpose
+-------
+
+To separate strategies and to enable fast switching between them. Also
+this pattern is a good alternative to inheritance (instead of having an
+abstract class that is extended).
+
+Examples
+--------
+
+- sorting a list of objects, one strategy by date, the other by id
+- simplify unit testing: e.g. switching between file and in-memory
+ storage
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Strategy UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+ObjectCollection.php
+
+.. literalinclude:: ObjectCollection.php
+ :language: php
+ :linenos:
+
+ComparatorInterface.php
+
+.. literalinclude:: ComparatorInterface.php
+ :language: php
+ :linenos:
+
+DateComparator.php
+
+.. literalinclude:: DateComparator.php
+ :language: php
+ :linenos:
+
+IdComparator.php
+
+.. literalinclude:: IdComparator.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/StrategyTest.php
+
+.. literalinclude:: Tests/StrategyTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Strategy
+.. __: http://en.wikipedia.org/wiki/Strategy_pattern
\ No newline at end of file
diff --git a/Behavioral/Strategy/Tests/StrategyTest.php b/Behavioral/Strategy/Tests/StrategyTest.php
index 4831b18..1911ba4 100644
--- a/Behavioral/Strategy/Tests/StrategyTest.php
+++ b/Behavioral/Strategy/Tests/StrategyTest.php
@@ -8,21 +8,20 @@ use DesignPatterns\Behavioral\Strategy\ObjectCollection;
use DesignPatterns\Behavioral\Strategy\Strategy;
/**
- * Tests for Strategy pattern
+ * Tests for Strategy pattern.
*/
class StrategyTest extends \PHPUnit_Framework_TestCase
{
-
public function getIdCollection()
{
return array(
array(
array(array('id' => 2), array('id' => 1), array('id' => 3)),
- array('id' => 1)
+ array('id' => 1),
),
array(
array(array('id' => 3), array('id' => 2), array('id' => 1)),
- array('id' => 1)
+ array('id' => 1),
),
);
}
@@ -32,11 +31,11 @@ class StrategyTest extends \PHPUnit_Framework_TestCase
return array(
array(
array(array('date' => '2014-03-03'), array('date' => '2015-03-02'), array('date' => '2013-03-01')),
- array('date' => '2013-03-01')
+ array('date' => '2013-03-01'),
),
array(
array(array('date' => '2014-02-03'), array('date' => '2013-02-01'), array('date' => '2015-02-02')),
- array('date' => '2013-02-01')
+ array('date' => '2013-02-01'),
),
);
}
diff --git a/Behavioral/TemplateMethod/BeachJourney.php b/Behavioral/TemplateMethod/BeachJourney.php
index 94018f3..d19845c 100644
--- a/Behavioral/TemplateMethod/BeachJourney.php
+++ b/Behavioral/TemplateMethod/BeachJourney.php
@@ -3,12 +3,12 @@
namespace DesignPatterns\Behavioral\TemplateMethod;
/**
- * BeachJourney is vacation at the beach
+ * BeachJourney is vacation at the beach.
*/
class BeachJourney extends Journey
{
/**
- * prints what to do to enjoy your vacation
+ * prints what to do to enjoy your vacation.
*/
protected function enjoyVacation()
{
diff --git a/Behavioral/TemplateMethod/CityJourney.php b/Behavioral/TemplateMethod/CityJourney.php
index 89c2ef0..3f36b61 100644
--- a/Behavioral/TemplateMethod/CityJourney.php
+++ b/Behavioral/TemplateMethod/CityJourney.php
@@ -3,12 +3,12 @@
namespace DesignPatterns\Behavioral\TemplateMethod;
/**
- * CityJourney is a journey in a city
+ * CityJourney is a journey in a city.
*/
class CityJourney extends Journey
{
/**
- * prints what to do in your journey to enjoy vacation
+ * prints what to do in your journey to enjoy vacation.
*/
protected function enjoyVacation()
{
diff --git a/Behavioral/TemplateMethod/Journey.php b/Behavioral/TemplateMethod/Journey.php
index fbf79d4..6309e7f 100644
--- a/Behavioral/TemplateMethod/Journey.php
+++ b/Behavioral/TemplateMethod/Journey.php
@@ -10,7 +10,7 @@ abstract class Journey
/**
* This is the public service provided by this class and its subclasses.
* Notice it is final to "freeze" the global behavior of algorithm.
- * If you want to override this contract, make an interface with only takeATrip()
+ * If you want to override this contract, make an interface with only takeATrip()
* and subclass it.
*/
final public function takeATrip()
@@ -23,7 +23,7 @@ abstract class Journey
}
/**
- * This method must be implemented, this is the key-feature of this pattern
+ * This method must be implemented, this is the key-feature of this pattern.
*/
abstract protected function enjoyVacation();
@@ -37,7 +37,7 @@ abstract class Journey
}
/**
- * This method will be unknown by subclasses (better)
+ * This method will be unknown by subclasses (better).
*/
private function buyAFlight()
{
@@ -46,7 +46,7 @@ abstract class Journey
/**
* Subclasses will get access to this method but cannot override it and
- * compromise this algorithm (warning : cause of cyclic dependencies)
+ * compromise this algorithm (warning : cause of cyclic dependencies).
*/
final protected function takePlane()
{
diff --git a/Behavioral/TemplateMethod/README.md b/Behavioral/TemplateMethod/README.md
deleted file mode 100644
index c01c00c..0000000
--- a/Behavioral/TemplateMethod/README.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# Template Method
-
-## Purpose
-
-Template Method is a behavioral design pattern.
-
-Perhaps you have encountered it many times already. The idea is to let subclasses of this abstract template "finish" the behavior of an algorithm.
-
-A.k.a the "Hollywood principle": "Don't call us, we call you." This class is not called by subclasses but the inverse.
-How? With abstraction of course.
-
-In other words, this is a skeleton of algorithm, well-suited for framework libraries. The user has just to implement one method and the superclass do the job.
-
-It is an easy way to decouple concrete classes and reduce copy-paste, that's why you'll find it everywhere.
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Behavioral/TemplateMethod/README.rst b/Behavioral/TemplateMethod/README.rst
new file mode 100644
index 0000000..559cd36
--- /dev/null
+++ b/Behavioral/TemplateMethod/README.rst
@@ -0,0 +1,64 @@
+`Template Method`__
+===================
+
+Purpose
+-------
+
+Template Method is a behavioral design pattern.
+
+Perhaps you have encountered it many times already. The idea is to let
+subclasses of this abstract template "finish" the behavior of an
+algorithm.
+
+A.k.a the "Hollywood principle": "Don't call us, we call you." This
+class is not called by subclasses but the inverse. How? With abstraction
+of course.
+
+In other words, this is a skeleton of algorithm, well-suited for
+framework libraries. The user has just to implement one method and the
+superclass do the job.
+
+It is an easy way to decouple concrete classes and reduce copy-paste,
+that's why you'll find it everywhere.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt TemplateMethod UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Journey.php
+
+.. literalinclude:: Journey.php
+ :language: php
+ :linenos:
+
+BeachJourney.php
+
+.. literalinclude:: BeachJourney.php
+ :language: php
+ :linenos:
+
+CityJourney.php
+
+.. literalinclude:: CityJourney.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/JourneyTest.php
+
+.. literalinclude:: Tests/JourneyTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/TemplateMethod
+.. __: http://en.wikipedia.org/wiki/Template_method_pattern
\ No newline at end of file
diff --git a/Behavioral/TemplateMethod/Tests/JourneyTest.php b/Behavioral/TemplateMethod/Tests/JourneyTest.php
index d0b134c..82acef3 100644
--- a/Behavioral/TemplateMethod/Tests/JourneyTest.php
+++ b/Behavioral/TemplateMethod/Tests/JourneyTest.php
@@ -5,11 +5,10 @@ namespace DesignPatterns\Behavioral\TemplateMethod\Tests;
use DesignPatterns\Behavioral\TemplateMethod;
/**
- * JourneyTest tests all journeys
+ * JourneyTest tests all journeys.
*/
class JourneyTest extends \PHPUnit_Framework_TestCase
{
-
public function testBeach()
{
$journey = new TemplateMethod\BeachJourney();
@@ -25,7 +24,7 @@ class JourneyTest extends \PHPUnit_Framework_TestCase
}
/**
- * How to test an abstract template method with PHPUnit
+ * How to test an abstract template method with PHPUnit.
*/
public function testLasVegas()
{
diff --git a/Behavioral/Visitor/Group.php b/Behavioral/Visitor/Group.php
index 3990f9c..b2c9d90 100644
--- a/Behavioral/Visitor/Group.php
+++ b/Behavioral/Visitor/Group.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Visitor;
/**
- * An example of a Visitor: Group
+ * An example of a Visitor: Group.
*/
class Group extends Role
{
@@ -25,6 +25,6 @@ class Group extends Role
*/
public function getName()
{
- return "Group: " . $this->name;
+ return 'Group: '.$this->name;
}
}
diff --git a/Behavioral/Visitor/README.md b/Behavioral/Visitor/README.md
deleted file mode 100644
index 3db1d9c..0000000
--- a/Behavioral/Visitor/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Visitor
-
-## Purpose
-
-The Visitor Pattern lets you outsource operations on objects to other objects. The main reason to do this is to keep a separation of concerns.
-But classes have to define a contract to allow visitors (the `Role::accept` method in the example).
-
-The contract is an abstract class but you can have also a clean interface. In that case, each Visitor has to choose itself which method to invoke on the visitor.
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Behavioral/Visitor/README.rst b/Behavioral/Visitor/README.rst
new file mode 100644
index 0000000..ba256b9
--- /dev/null
+++ b/Behavioral/Visitor/README.rst
@@ -0,0 +1,68 @@
+`Visitor`__
+===========
+
+Purpose
+-------
+
+The Visitor Pattern lets you outsource operations on objects to other
+objects. The main reason to do this is to keep a separation of concerns.
+But classes have to define a contract to allow visitors (the
+``Role::accept`` method in the example).
+
+The contract is an abstract class but you can have also a clean
+interface. In that case, each Visitor has to choose itself which method
+to invoke on the visitor.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Visitor UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+RoleVisitorInterface.php
+
+.. literalinclude:: RoleVisitorInterface.php
+ :language: php
+ :linenos:
+
+RolePrintVisitor.php
+
+.. literalinclude:: RolePrintVisitor.php
+ :language: php
+ :linenos:
+
+Role.php
+
+.. literalinclude:: Role.php
+ :language: php
+ :linenos:
+
+User.php
+
+.. literalinclude:: User.php
+ :language: php
+ :linenos:
+
+Group.php
+
+.. literalinclude:: Group.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/VisitorTest.php
+
+.. literalinclude:: Tests/VisitorTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Visitor
+.. __: http://en.wikipedia.org/wiki/Visitor_pattern
\ No newline at end of file
diff --git a/Behavioral/Visitor/Role.php b/Behavioral/Visitor/Role.php
index fd0d0a4..011a0fb 100644
--- a/Behavioral/Visitor/Role.php
+++ b/Behavioral/Visitor/Role.php
@@ -3,12 +3,12 @@
namespace DesignPatterns\Behavioral\Visitor;
/**
- * class Role
+ * class Role.
*/
abstract class Role
{
/**
- * This method handles a double dispatch based on the short name of the Visitor
+ * This method handles a double dispatch based on the short name of the Visitor.
*
* Feel free to override it if your object must call another visiting behavior
*
@@ -21,10 +21,10 @@ abstract class Role
// this trick to simulate double-dispatch based on type-hinting
$klass = get_called_class();
preg_match('#([^\\\\]+)$#', $klass, $extract);
- $visitingMethod = 'visit' . $extract[1];
+ $visitingMethod = 'visit'.$extract[1];
// this ensures strong typing with visitor interface, not some visitor objects
- if (!method_exists(__NAMESPACE__ . '\RoleVisitorInterface', $visitingMethod)) {
+ if (!method_exists(__NAMESPACE__.'\RoleVisitorInterface', $visitingMethod)) {
throw new \InvalidArgumentException("The visitor you provide cannot visit a $klass instance");
}
diff --git a/Behavioral/Visitor/RolePrintVisitor.php b/Behavioral/Visitor/RolePrintVisitor.php
index 5f07d5c..49777cf 100644
--- a/Behavioral/Visitor/RolePrintVisitor.php
+++ b/Behavioral/Visitor/RolePrintVisitor.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Visitor;
/**
- * Visitor Pattern
+ * Visitor Pattern.
*
* An implementation of a concrete Visitor
*/
@@ -14,7 +14,7 @@ class RolePrintVisitor implements RoleVisitorInterface
*/
public function visitGroup(Group $role)
{
- echo "Role: " . $role->getName();
+ echo 'Role: '.$role->getName();
}
/**
@@ -22,6 +22,6 @@ class RolePrintVisitor implements RoleVisitorInterface
*/
public function visitUser(User $role)
{
- echo "Role: " . $role->getName();
+ echo 'Role: '.$role->getName();
}
}
diff --git a/Behavioral/Visitor/RoleVisitorInterface.php b/Behavioral/Visitor/RoleVisitorInterface.php
index 3c9e24a..e8ba0ec 100644
--- a/Behavioral/Visitor/RoleVisitorInterface.php
+++ b/Behavioral/Visitor/RoleVisitorInterface.php
@@ -3,28 +3,28 @@
namespace DesignPatterns\Behavioral\Visitor;
/**
- * Visitor Pattern
+ * Visitor Pattern.
*
* The contract for the visitor.
- *
- * Note 1 : in C++ or java, with method polymorphism based on type-hint, there are many
+ *
+ * Note 1 : in C++ or Java, with method polymorphism based on type-hint, there are many
* methods visit() with different type for the 'role' parameter.
- *
+ *
* Note 2 : the visitor must not choose itself which method to
* invoke, it is the Visitee that make this decision.
*/
interface RoleVisitorInterface
{
/**
- * Visit a User object
- *
+ * Visit a User object.
+ *
* @param \DesignPatterns\Behavioral\Visitor\User $role
*/
public function visitUser(User $role);
/**
- * Visit a Group object
- *
+ * Visit a Group object.
+ *
* @param \DesignPatterns\Behavioral\Visitor\Group $role
*/
public function visitGroup(Group $role);
diff --git a/Behavioral/Visitor/Tests/VisitorTest.php b/Behavioral/Visitor/Tests/VisitorTest.php
index 6d71658..f3b5bc7 100644
--- a/Behavioral/Visitor/Tests/VisitorTest.php
+++ b/Behavioral/Visitor/Tests/VisitorTest.php
@@ -5,11 +5,10 @@ namespace DesignPatterns\Tests\Visitor\Tests;
use DesignPatterns\Behavioral\Visitor;
/**
- * VisitorTest tests the visitor pattern
+ * VisitorTest tests the visitor pattern.
*/
class VisitorTest extends \PHPUnit_Framework_TestCase
{
-
protected $visitor;
protected function setUp()
@@ -20,8 +19,8 @@ class VisitorTest extends \PHPUnit_Framework_TestCase
public function getRole()
{
return array(
- array(new Visitor\User("Dominik"), 'Role: User Dominik'),
- array(new Visitor\Group("Administrators"), 'Role: Group: Administrators')
+ array(new Visitor\User('Dominik'), 'Role: User Dominik'),
+ array(new Visitor\Group('Administrators'), 'Role: Group: Administrators'),
);
}
diff --git a/Behavioral/Visitor/User.php b/Behavioral/Visitor/User.php
index e0cc4c7..5a95fbe 100644
--- a/Behavioral/Visitor/User.php
+++ b/Behavioral/Visitor/User.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Visitor;
/**
- * Visitor Pattern
+ * Visitor Pattern.
*
* One example for a visitee. Each visitee has to extends Role
*/
@@ -27,6 +27,6 @@ class User extends Role
*/
public function getName()
{
- return "User " . $this->name;
+ return 'User '.$this->name;
}
}
diff --git a/Creational/AbstractFactory/AbstractFactory.php b/Creational/AbstractFactory/AbstractFactory.php
index 84b4203..fd69448 100644
--- a/Creational/AbstractFactory/AbstractFactory.php
+++ b/Creational/AbstractFactory/AbstractFactory.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\AbstractFactory;
/**
- * class AbstractFactory
+ * class AbstractFactory.
*
* Sometimes also known as "Kit" in a GUI libraries.
*
@@ -11,17 +11,17 @@ namespace DesignPatterns\Creational\AbstractFactory;
* it is the concrete subclass which creates concrete components.
*
* In this case, the abstract factory is a contract for creating some components
- * for the web. There are two components : Text and Picture. There is two ways
+ * for the web. There are two components : Text and Picture. There are two ways
* of rendering : HTML or JSON.
*
- * Therefore 4 concretes classes, but the client just need to know this contract
- * to build a correct http response (for a html page or for an ajax request)
+ * Therefore 4 concrete classes, but the client just needs to know this contract
+ * to build a correct HTTP response (for a HTML page or for an AJAX request).
*/
abstract class AbstractFactory
{
/**
- * Creates a text component
- *
+ * Creates a text component.
+ *
* @param string $content
*
* @return Text
@@ -29,8 +29,8 @@ abstract class AbstractFactory
abstract public function createText($content);
/**
- * Creates a picture component
- *
+ * Creates a picture component.
+ *
* @param string $path
* @param string $name
*
diff --git a/Creational/AbstractFactory/Html/Picture.php b/Creational/AbstractFactory/Html/Picture.php
index 9d7f440..3abacb4 100644
--- a/Creational/AbstractFactory/Html/Picture.php
+++ b/Creational/AbstractFactory/Html/Picture.php
@@ -5,14 +5,14 @@ namespace DesignPatterns\Creational\AbstractFactory\Html;
use DesignPatterns\Creational\AbstractFactory\Picture as BasePicture;
/**
- * Class Picture
+ * Class Picture.
*
* Picture is a concrete image for HTML rendering
*/
class Picture extends BasePicture
{
/**
- * some crude rendering from HTML output
+ * some crude rendering from HTML output.
*
* @return string
*/
diff --git a/Creational/AbstractFactory/Html/Text.php b/Creational/AbstractFactory/Html/Text.php
index 120c043..8c33da6 100644
--- a/Creational/AbstractFactory/Html/Text.php
+++ b/Creational/AbstractFactory/Html/Text.php
@@ -5,19 +5,19 @@ namespace DesignPatterns\Creational\AbstractFactory\Html;
use DesignPatterns\Creational\AbstractFactory\Text as BaseText;
/**
- * Class Text
+ * Class Text.
*
* Text is a concrete text for HTML rendering
*/
class Text extends BaseText
{
/**
- * some crude rendering from HTML output
+ * some crude rendering from HTML output.
*
* @return string
*/
public function render()
{
- return '
' . htmlspecialchars($this->text) . '
';
+ return '
'.htmlspecialchars($this->text).'
';
}
}
diff --git a/Creational/AbstractFactory/HtmlFactory.php b/Creational/AbstractFactory/HtmlFactory.php
index 7982a24..5c22859 100644
--- a/Creational/AbstractFactory/HtmlFactory.php
+++ b/Creational/AbstractFactory/HtmlFactory.php
@@ -3,14 +3,14 @@
namespace DesignPatterns\Creational\AbstractFactory;
/**
- * Class HtmlFactory
+ * Class HtmlFactory.
*
* HtmlFactory is a concrete factory for HTML component
*/
class HtmlFactory extends AbstractFactory
{
/**
- * Creates a picture component
+ * Creates a picture component.
*
* @param string $path
* @param string $name
@@ -23,7 +23,7 @@ class HtmlFactory extends AbstractFactory
}
/**
- * Creates a text component
+ * Creates a text component.
*
* @param string $content
*
diff --git a/Creational/AbstractFactory/Json/Picture.php b/Creational/AbstractFactory/Json/Picture.php
index 13d191b..77bb150 100644
--- a/Creational/AbstractFactory/Json/Picture.php
+++ b/Creational/AbstractFactory/Json/Picture.php
@@ -5,14 +5,14 @@ namespace DesignPatterns\Creational\AbstractFactory\Json;
use DesignPatterns\Creational\AbstractFactory\Picture as BasePicture;
/**
- * Class Picture
+ * Class Picture.
*
* Picture is a concrete image for JSON rendering
*/
class Picture extends BasePicture
{
/**
- * some crude rendering from JSON output
+ * some crude rendering from JSON output.
*
* @return string
*/
diff --git a/Creational/AbstractFactory/Json/Text.php b/Creational/AbstractFactory/Json/Text.php
index 699fff3..4c51785 100644
--- a/Creational/AbstractFactory/Json/Text.php
+++ b/Creational/AbstractFactory/Json/Text.php
@@ -5,14 +5,14 @@ namespace DesignPatterns\Creational\AbstractFactory\Json;
use DesignPatterns\Creational\AbstractFactory\Text as BaseText;
/**
- * Class Text
+ * Class Text.
*
* Text is a text component with a JSON rendering
*/
class Text extends BaseText
{
/**
- * some crude rendering from JSON output
+ * some crude rendering from JSON output.
*
* @return string
*/
diff --git a/Creational/AbstractFactory/JsonFactory.php b/Creational/AbstractFactory/JsonFactory.php
index ab2bb6f..63a9979 100644
--- a/Creational/AbstractFactory/JsonFactory.php
+++ b/Creational/AbstractFactory/JsonFactory.php
@@ -3,16 +3,15 @@
namespace DesignPatterns\Creational\AbstractFactory;
/**
- * Class JsonFactory
+ * Class JsonFactory.
*
* JsonFactory is a factory for creating a family of JSON component
* (example for ajax)
*/
class JsonFactory extends AbstractFactory
{
-
/**
- * Creates a picture component
+ * Creates a picture component.
*
* @param string $path
* @param string $name
@@ -25,7 +24,7 @@ class JsonFactory extends AbstractFactory
}
/**
- * Creates a text component
+ * Creates a text component.
*
* @param string $content
*
diff --git a/Creational/AbstractFactory/MediaInterface.php b/Creational/AbstractFactory/MediaInterface.php
index 6bb5d3a..aa73f1b 100644
--- a/Creational/AbstractFactory/MediaInterface.php
+++ b/Creational/AbstractFactory/MediaInterface.php
@@ -3,16 +3,15 @@
namespace DesignPatterns\Creational\AbstractFactory;
/**
- * Interface MediaInterface
+ * Interface MediaInterface.
*
* This contract is not part of the pattern, in general case, each component
* are not related
*/
interface MediaInterface
{
-
/**
- * some crude rendering from JSON or html output (depended on concrete class)
+ * some crude rendering from JSON or html output (depended on concrete class).
*
* @return string
*/
diff --git a/Creational/AbstractFactory/Picture.php b/Creational/AbstractFactory/Picture.php
index 8a4f720..89fd66f 100644
--- a/Creational/AbstractFactory/Picture.php
+++ b/Creational/AbstractFactory/Picture.php
@@ -3,11 +3,10 @@
namespace DesignPatterns\Creational\AbstractFactory;
/**
- * Class Picture
+ * Class Picture.
*/
abstract class Picture implements MediaInterface
{
-
/**
* @var string
*/
diff --git a/Creational/AbstractFactory/README.md b/Creational/AbstractFactory/README.md
deleted file mode 100644
index 34d457d..0000000
--- a/Creational/AbstractFactory/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# Abstract Factory
-
-## Purpose
-
-To create series of related or dependent objects without specifying their concrete classes.
-Usually the created classes all implement the same interface. The client of the abstract factory does not care about how these objects are created, he just knows how they go together.
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Creational/AbstractFactory/README.rst b/Creational/AbstractFactory/README.rst
new file mode 100644
index 0000000..69980eb
--- /dev/null
+++ b/Creational/AbstractFactory/README.rst
@@ -0,0 +1,94 @@
+`Abstract Factory`__
+====================
+
+Purpose
+-------
+
+To create series of related or dependent objects without specifying
+their concrete classes. Usually the created classes all implement the
+same interface. The client of the abstract factory does not care about
+how these objects are created, he just knows how they go together.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt AbstractFactory UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+AbstractFactory.php
+
+.. literalinclude:: AbstractFactory.php
+ :language: php
+ :linenos:
+
+JsonFactory.php
+
+.. literalinclude:: JsonFactory.php
+ :language: php
+ :linenos:
+
+HtmlFactory.php
+
+.. literalinclude:: HtmlFactory.php
+ :language: php
+ :linenos:
+
+MediaInterface.php
+
+.. literalinclude:: MediaInterface.php
+ :language: php
+ :linenos:
+
+Picture.php
+
+.. literalinclude:: Picture.php
+ :language: php
+ :linenos:
+
+Text.php
+
+.. literalinclude:: Text.php
+ :language: php
+ :linenos:
+
+Json/Picture.php
+
+.. literalinclude:: Json/Picture.php
+ :language: php
+ :linenos:
+
+Json/Text.php
+
+.. literalinclude:: Json/Text.php
+ :language: php
+ :linenos:
+
+Html/Picture.php
+
+.. literalinclude:: Html/Picture.php
+ :language: php
+ :linenos:
+
+Html/Text.php
+
+.. literalinclude:: Html/Text.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/AbstractFactoryTest.php
+
+.. literalinclude:: Tests/AbstractFactoryTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Creational/AbstractFactory
+.. __: http://en.wikipedia.org/wiki/Abstract_factory_pattern
diff --git a/Creational/AbstractFactory/Tests/AbstractFactoryTest.php b/Creational/AbstractFactory/Tests/AbstractFactoryTest.php
index 9c61f96..97f4417 100644
--- a/Creational/AbstractFactory/Tests/AbstractFactoryTest.php
+++ b/Creational/AbstractFactory/Tests/AbstractFactoryTest.php
@@ -7,7 +7,7 @@ use DesignPatterns\Creational\AbstractFactory\HtmlFactory;
use DesignPatterns\Creational\AbstractFactory\JsonFactory;
/**
- * AbstractFactoryTest tests concrete factories
+ * AbstractFactoryTest tests concrete factories.
*/
class AbstractFactoryTest extends \PHPUnit_Framework_TestCase
{
@@ -15,15 +15,15 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase
{
return array(
array(new JsonFactory()),
- array(new HtmlFactory())
+ array(new HtmlFactory()),
);
}
/**
* This is the client of factories. Note that the client does not
- * care which factory is given to him, he can create any component he
+ * care which factory is given to him, he can create any component he
* wants and render how he wants.
- *
+ *
* @dataProvider getFactories
*/
public function testComponentCreation(AbstractFactory $factory)
@@ -31,7 +31,7 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase
$article = array(
$factory->createText('Lorem Ipsum'),
$factory->createPicture('/image.jpg', 'caption'),
- $factory->createText('footnotes')
+ $factory->createText('footnotes'),
);
$this->assertContainsOnly('DesignPatterns\Creational\AbstractFactory\MediaInterface', $article);
diff --git a/Creational/AbstractFactory/Text.php b/Creational/AbstractFactory/Text.php
index 5d2da89..30984f3 100644
--- a/Creational/AbstractFactory/Text.php
+++ b/Creational/AbstractFactory/Text.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\AbstractFactory;
/**
- * Class Text
+ * Class Text.
*/
abstract class Text implements MediaInterface
{
diff --git a/Creational/Builder/BikeBuilder.php b/Creational/Builder/BikeBuilder.php
index 477e1ad..f83c5db 100644
--- a/Creational/Builder/BikeBuilder.php
+++ b/Creational/Builder/BikeBuilder.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\Builder;
/**
- * BikeBuilder builds bike
+ * BikeBuilder builds bike.
*/
class BikeBuilder implements BuilderInterface
{
@@ -17,7 +17,6 @@ class BikeBuilder implements BuilderInterface
*/
public function addDoors()
{
-
}
/**
diff --git a/Creational/Builder/CarBuilder.php b/Creational/Builder/CarBuilder.php
index 7725176..a0693d0 100644
--- a/Creational/Builder/CarBuilder.php
+++ b/Creational/Builder/CarBuilder.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\Builder;
/**
- * CarBuilder builds car
+ * CarBuilder builds car.
*/
class CarBuilder implements BuilderInterface
{
diff --git a/Creational/Builder/Director.php b/Creational/Builder/Director.php
index 0c11877..642cd1b 100644
--- a/Creational/Builder/Director.php
+++ b/Creational/Builder/Director.php
@@ -4,15 +4,14 @@ namespace DesignPatterns\Creational\Builder;
/**
* Director is part of the builder pattern. It knows the interface of the builder
- * and builds a complex object with the help of the builder.
- *
+ * and builds a complex object with the help of the builder.
+ *
* You can also inject many builders instead of one to build more complex objects
*/
class Director
{
-
/**
- * The director don't know 'bout concrete part
+ * The director don't know about concrete part.
*
* @param BuilderInterface $builder
*
diff --git a/Creational/Builder/Parts/Bike.php b/Creational/Builder/Parts/Bike.php
index 307b3e0..e5adbba 100644
--- a/Creational/Builder/Parts/Bike.php
+++ b/Creational/Builder/Parts/Bike.php
@@ -3,9 +3,8 @@
namespace DesignPatterns\Creational\Builder\Parts;
/**
- * Bike is a bike
+ * Bike is a bike.
*/
class Bike extends Vehicle
{
-
}
diff --git a/Creational/Builder/Parts/Car.php b/Creational/Builder/Parts/Car.php
index a18b301..e345ea9 100644
--- a/Creational/Builder/Parts/Car.php
+++ b/Creational/Builder/Parts/Car.php
@@ -3,9 +3,8 @@
namespace DesignPatterns\Creational\Builder\Parts;
/**
- * Car is a car
+ * Car is a car.
*/
class Car extends Vehicle
{
-
}
diff --git a/Creational/Builder/Parts/Door.php b/Creational/Builder/Parts/Door.php
index aa08772..fc12608 100644
--- a/Creational/Builder/Parts/Door.php
+++ b/Creational/Builder/Parts/Door.php
@@ -3,9 +3,8 @@
namespace DesignPatterns\Creational\Builder\Parts;
/**
- * Class Door
+ * Class Door.
*/
class Door
{
-
}
diff --git a/Creational/Builder/Parts/Engine.php b/Creational/Builder/Parts/Engine.php
index 08d5bd0..5232ab3 100644
--- a/Creational/Builder/Parts/Engine.php
+++ b/Creational/Builder/Parts/Engine.php
@@ -3,9 +3,8 @@
namespace DesignPatterns\Creational\Builder\Parts;
/**
- * Class Engine
+ * Class Engine.
*/
class Engine
{
-
}
diff --git a/Creational/Builder/Parts/README.md b/Creational/Builder/Parts/README.md
deleted file mode 100644
index 9e802c8..0000000
--- a/Creational/Builder/Parts/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-
-# Purpose
-
-
-
-# Examples
-
-*
-
diff --git a/Creational/Builder/Parts/Vehicle.php b/Creational/Builder/Parts/Vehicle.php
index 492eade..18c47ba 100644
--- a/Creational/Builder/Parts/Vehicle.php
+++ b/Creational/Builder/Parts/Vehicle.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\Builder\Parts;
/**
- * VehicleInterface is a contract for a vehicle
+ * Vehicle class is an abstraction for a vehicle.
*/
abstract class Vehicle
{
diff --git a/Creational/Builder/Parts/Wheel.php b/Creational/Builder/Parts/Wheel.php
index 19ef7c3..0a1afbd 100644
--- a/Creational/Builder/Parts/Wheel.php
+++ b/Creational/Builder/Parts/Wheel.php
@@ -3,9 +3,8 @@
namespace DesignPatterns\Creational\Builder\Parts;
/**
- * Class Wheel
+ * Class Wheel.
*/
class Wheel
{
-
}
diff --git a/Creational/Builder/README.md b/Creational/Builder/README.md
deleted file mode 100644
index 573816a..0000000
--- a/Creational/Builder/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# Builder
-
-## Purpose
-
-Builder is an interface that build parts of a complex object.
-
-Sometimes, if the builder has a better knowledge of what it builds, this interface could be an abstract class with default methods (aka adapter).
-
-If you have a complex inheritance tree for objects, it is logical to have a complex inheritance tree for builders too.
-
-Note: Builders have often a fluent interface, see the mock builder of PHPUnit for example.
-
-## Examples
-
-* PHPUnit: Mock Builder
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Creational/Builder/README.rst b/Creational/Builder/README.rst
new file mode 100644
index 0000000..de8971b
--- /dev/null
+++ b/Creational/Builder/README.rst
@@ -0,0 +1,105 @@
+`Builder`__
+===========
+
+Purpose
+-------
+
+Builder is an interface that build parts of a complex object.
+
+Sometimes, if the builder has a better knowledge of what it builds, this
+interface could be an abstract class with default methods (aka adapter).
+
+If you have a complex inheritance tree for objects, it is logical to
+have a complex inheritance tree for builders too.
+
+Note: Builders have often a fluent interface, see the mock builder of
+PHPUnit for example.
+
+Examples
+--------
+
+- PHPUnit: Mock Builder
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Builder UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Director.php
+
+.. literalinclude:: Director.php
+ :language: php
+ :linenos:
+
+BuilderInterface.php
+
+.. literalinclude:: BuilderInterface.php
+ :language: php
+ :linenos:
+
+BikeBuilder.php
+
+.. literalinclude:: BikeBuilder.php
+ :language: php
+ :linenos:
+
+CarBuilder.php
+
+.. literalinclude:: CarBuilder.php
+ :language: php
+ :linenos:
+
+Parts/Vehicle.php
+
+.. literalinclude:: Parts/Vehicle.php
+ :language: php
+ :linenos:
+
+Parts/Bike.php
+
+.. literalinclude:: Parts/Bike.php
+ :language: php
+ :linenos:
+
+Parts/Car.php
+
+.. literalinclude:: Parts/Car.php
+ :language: php
+ :linenos:
+
+Parts/Engine.php
+
+.. literalinclude:: Parts/Engine.php
+ :language: php
+ :linenos:
+
+Parts/Wheel.php
+
+.. literalinclude:: Parts/Wheel.php
+ :language: php
+ :linenos:
+
+Parts/Door.php
+
+.. literalinclude:: Parts/Door.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/DirectorTest.php
+
+.. literalinclude:: Tests/DirectorTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Creational/Builder
+.. __: http://en.wikipedia.org/wiki/Builder_pattern
diff --git a/Creational/Builder/Tests/DirectorTest.php b/Creational/Builder/Tests/DirectorTest.php
index 90cdb39..9f07b83 100644
--- a/Creational/Builder/Tests/DirectorTest.php
+++ b/Creational/Builder/Tests/DirectorTest.php
@@ -2,17 +2,16 @@
namespace DesignPatterns\Creational\Builder\Tests;
-use DesignPatterns\Creational\Builder\Director;
-use DesignPatterns\Creational\Builder\CarBuilder;
use DesignPatterns\Creational\Builder\BikeBuilder;
use DesignPatterns\Creational\Builder\BuilderInterface;
+use DesignPatterns\Creational\Builder\CarBuilder;
+use DesignPatterns\Creational\Builder\Director;
/**
- * DirectorTest tests the builder pattern
+ * DirectorTest tests the builder pattern.
*/
class DirectorTest extends \PHPUnit_Framework_TestCase
{
-
protected $director;
protected function setUp()
@@ -24,14 +23,14 @@ class DirectorTest extends \PHPUnit_Framework_TestCase
{
return array(
array(new CarBuilder()),
- array(new BikeBuilder())
+ array(new BikeBuilder()),
);
}
/**
* Here we test the build process. Notice that the client don't know
- * anything about the contrete builder.
- *
+ * anything about the concrete builder.
+ *
* @dataProvider getBuilder
*/
public function testBuild(BuilderInterface $builder)
diff --git a/Creational/FactoryMethod/Bicycle.php b/Creational/FactoryMethod/Bicycle.php
index 01fa8a0..8e41f88 100644
--- a/Creational/FactoryMethod/Bicycle.php
+++ b/Creational/FactoryMethod/Bicycle.php
@@ -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
*/
diff --git a/Creational/FactoryMethod/FactoryMethod.php b/Creational/FactoryMethod/FactoryMethod.php
index e4f3771..fa3d4a3 100644
--- a/Creational/FactoryMethod/FactoryMethod.php
+++ b/Creational/FactoryMethod/FactoryMethod.php
@@ -3,36 +3,35 @@
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
- *
+ *
* @param string $type a generic type
- *
+ *
* @return VehicleInterface a new vehicle
*/
abstract protected function createVehicle($type);
/**
- * Creates a new vehicle
- *
+ * Creates a new vehicle.
+ *
* @param int $type
- *
+ *
* @return VehicleInterface a new vehicle
*/
public function create($type)
{
$obj = $this->createVehicle($type);
- $obj->setColor("#f00");
+ $obj->setColor('#f00');
return $obj;
}
diff --git a/Creational/FactoryMethod/Ferrari.php b/Creational/FactoryMethod/Ferrari.php
index c905f91..9434e3d 100644
--- a/Creational/FactoryMethod/Ferrari.php
+++ b/Creational/FactoryMethod/Ferrari.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\FactoryMethod;
/**
- * Ferrari is a italian car
+ * Ferrari is a italian car.
*/
class Ferrari implements VehicleInterface
{
diff --git a/Creational/FactoryMethod/GermanFactory.php b/Creational/FactoryMethod/GermanFactory.php
index 67306e9..1f65eb4 100644
--- a/Creational/FactoryMethod/GermanFactory.php
+++ b/Creational/FactoryMethod/GermanFactory.php
@@ -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
{
diff --git a/Creational/FactoryMethod/ItalianFactory.php b/Creational/FactoryMethod/ItalianFactory.php
index c7010e0..25eeaf1 100644
--- a/Creational/FactoryMethod/ItalianFactory.php
+++ b/Creational/FactoryMethod/ItalianFactory.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\FactoryMethod;
/**
- * ItalianFactory is vehicle factory in Italy
+ * ItalianFactory is vehicle factory in Italy.
*/
class ItalianFactory extends FactoryMethod
{
diff --git a/Creational/FactoryMethod/Porsche.php b/Creational/FactoryMethod/Porsche.php
index 818a082..bdabb87 100644
--- a/Creational/FactoryMethod/Porsche.php
+++ b/Creational/FactoryMethod/Porsche.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\FactoryMethod;
/**
- * Porsche is a german car
+ * Porsche is a german car.
*/
class Porsche implements VehicleInterface
{
@@ -26,6 +26,5 @@ class Porsche implements VehicleInterface
*/
public function addTuningAMG()
{
-
}
}
diff --git a/Creational/FactoryMethod/README.md b/Creational/FactoryMethod/README.md
deleted file mode 100644
index ae4cfb6..0000000
--- a/Creational/FactoryMethod/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Factory Method
-
-## Purpose
-
-The good point over the SimpleFactory is you can subclass it to implement different ways to create objects
-
-For simple case, this abstract class could be just an interface
-
-This pattern is a "real" Design Pattern because it achieves the "Dependency Inversion Principle" a.k.a the "D" in S.O.L.I.D principles.
-
-It means the FactoryMethod class depends on abstractions, not concrete classes. This is the real trick compared to SimpleFactory or StaticFactory.
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Creational/FactoryMethod/README.rst b/Creational/FactoryMethod/README.rst
new file mode 100644
index 0000000..7e69a8d
--- /dev/null
+++ b/Creational/FactoryMethod/README.rst
@@ -0,0 +1,83 @@
+`Factory Method`__
+==================
+
+Purpose
+-------
+
+The good point over the SimpleFactory is you can subclass it to
+implement different ways to create objects
+
+For simple case, this abstract class could be just an interface
+
+This pattern is a "real" Design Pattern because it achieves the
+"Dependency Inversion Principle" a.k.a the "D" in S.O.L.I.D principles.
+
+It means the FactoryMethod class depends on abstractions, not concrete
+classes. This is the real trick compared to SimpleFactory or
+StaticFactory.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt FactoryMethod UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+FactoryMethod.php
+
+.. literalinclude:: FactoryMethod.php
+ :language: php
+ :linenos:
+
+ItalianFactory.php
+
+.. literalinclude:: ItalianFactory.php
+ :language: php
+ :linenos:
+
+GermanFactory.php
+
+.. literalinclude:: GermanFactory.php
+ :language: php
+ :linenos:
+
+VehicleInterface.php
+
+.. literalinclude:: VehicleInterface.php
+ :language: php
+ :linenos:
+
+Porsche.php
+
+.. literalinclude:: Porsche.php
+ :language: php
+ :linenos:
+
+Bicycle.php
+
+.. literalinclude:: Bicycle.php
+ :language: php
+ :linenos:
+
+Ferrari.php
+
+.. literalinclude:: Ferrari.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/FactoryMethodTest.php
+
+.. literalinclude:: Tests/FactoryMethodTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Creational/FactoryMethod
+.. __: http://en.wikipedia.org/wiki/Factory_method_pattern
diff --git a/Creational/FactoryMethod/Tests/FactoryMethodTest.php b/Creational/FactoryMethod/Tests/FactoryMethodTest.php
index acbe0c6..6b1c4d2 100644
--- a/Creational/FactoryMethod/Tests/FactoryMethodTest.php
+++ b/Creational/FactoryMethod/Tests/FactoryMethodTest.php
@@ -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()),
);
}
diff --git a/Creational/FactoryMethod/VehicleInterface.php b/Creational/FactoryMethod/VehicleInterface.php
index a734b61..ccb05ee 100644
--- a/Creational/FactoryMethod/VehicleInterface.php
+++ b/Creational/FactoryMethod/VehicleInterface.php
@@ -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
*/
diff --git a/Creational/Multiton/Multiton.php b/Creational/Multiton/Multiton.php
index e10c513..5338e62 100644
--- a/Creational/Multiton/Multiton.php
+++ b/Creational/Multiton/Multiton.php
@@ -3,24 +3,22 @@
namespace DesignPatterns\Creational\Multiton;
/**
- * class Multiton
+ * class Multiton.
*/
class Multiton
{
/**
- *
- * the first instance
+ * the first instance.
*/
const INSTANCE_1 = '1';
/**
- *
- * the second instance
+ * the second instance.
*/
const INSTANCE_2 = '2';
/**
- * holds the named instances
+ * holds the named instances.
*
* @var array
*/
@@ -28,17 +26,15 @@ class Multiton
/**
* should not be called from outside: private!
- *
*/
private function __construct()
{
-
}
/**
* gets the instance with the given name, e.g. Multiton::INSTANCE_1
- * uses lazy initialization
- *
+ * uses lazy initialization.
+ *
* @param string $instanceName
*
* @return Multiton
@@ -53,22 +49,20 @@ class Multiton
}
/**
- * prevent instance from being cloned
+ * prevent instance from being cloned.
*
* @return void
*/
private function __clone()
{
-
}
/**
- * prevent instance from being unserialized
+ * prevent instance from being unserialized.
*
* @return void
*/
private function __wakeup()
{
-
}
}
diff --git a/Creational/Multiton/README.md b/Creational/Multiton/README.md
deleted file mode 100644
index 26c9a38..0000000
--- a/Creational/Multiton/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# Multiton
-
-**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND MAINTAINABILITY USE DEPENDENCY INJECTION!**
-
-# Purpose
-
-To have only a list of named instances that are used, like a singleton but with n instances.
-
-# Examples
-
-* 2 DB Connectors, e.g. one for MySQL, the other for SQLite
-* multiple Loggers (one for debug messages, one for errors)
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Creational/Multiton/README.rst b/Creational/Multiton/README.rst
new file mode 100644
index 0000000..3f5167e
--- /dev/null
+++ b/Creational/Multiton/README.rst
@@ -0,0 +1,40 @@
+Multiton
+========
+
+**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND
+MAINTAINABILITY USE DEPENDENCY INJECTION!**
+
+Purpose
+-------
+
+To have only a list of named instances that are used, like a singleton
+but with n instances.
+
+Examples
+--------
+
+- 2 DB Connectors, e.g. one for MySQL, the other for SQLite
+- multiple Loggers (one for debug messages, one for errors)
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Multiton UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Multiton.php
+
+.. literalinclude:: Multiton.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Creational/Multiton
diff --git a/Creational/Pool/Pool.php b/Creational/Pool/Pool.php
index e3a809b..7dcc6e3 100644
--- a/Creational/Pool/Pool.php
+++ b/Creational/Pool/Pool.php
@@ -4,7 +4,6 @@ namespace DesignPatterns\Creational\Pool;
class Pool
{
-
private $instances = array();
private $class;
diff --git a/Creational/Pool/Processor.php b/Creational/Pool/Processor.php
index 957e91f..89179b9 100644
--- a/Creational/Pool/Processor.php
+++ b/Creational/Pool/Processor.php
@@ -4,11 +4,10 @@ namespace DesignPatterns\Creational\Pool;
class Processor
{
-
private $pool;
private $processing = 0;
private $maxProcesses = 3;
- private $waitingQueue = [];
+ private $waitingQueue = array();
public function __construct(Pool $pool)
{
diff --git a/Creational/Pool/README.md b/Creational/Pool/README.md
deleted file mode 100644
index 7229a5a..0000000
--- a/Creational/Pool/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-Pool
-====
-
-The **object pool pattern** is a software creational design pattern that uses a set of initialized objects kept ready to use – a "pool" – rather than allocating and destroying them on demand. A client of the pool will request an object from the pool and perform operations on the returned object. When the client has finished, it returns the object, which is a specific type of factory object, to the pool rather than destroying it.
-
-Object pooling can offer a significant performance boost in situations where the cost of initializing a class instance is high, the rate of instantiation of a class is high, and the number of instances in use at any one time is low. The pooled object is obtained in predictable time when creation of the new objects (especially over network) may take variable time.
-
-However these benefits are mostly true for objects that are expensive with respect to time, such as database connections, socket connections, threads and large graphic objects like fonts or bitmaps. In certain situations, simple object pooling (that hold no external resources, but only occupy memory) may not be efficient and could decrease performance.
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Creational/Pool/README.rst b/Creational/Pool/README.rst
new file mode 100644
index 0000000..7b97b9b
--- /dev/null
+++ b/Creational/Pool/README.rst
@@ -0,0 +1,70 @@
+`Pool`__
+========
+
+The **object pool pattern** is a software creational design pattern that
+uses a set of initialized objects kept ready to use – a "pool" – rather
+than allocating and destroying them on demand. A client of the pool will
+request an object from the pool and perform operations on the returned
+object. When the client has finished, it returns the object, which is a
+specific type of factory object, to the pool rather than destroying it.
+
+Object pooling can offer a significant performance boost in situations
+where the cost of initializing a class instance is high, the rate of
+instantiation of a class is high, and the number of instances in use at
+any one time is low. The pooled object is obtained in predictable time
+when creation of the new objects (especially over network) may take
+variable time.
+
+However these benefits are mostly true for objects that are expensive
+with respect to time, such as database connections, socket connections,
+threads and large graphic objects like fonts or bitmaps. In certain
+situations, simple object pooling (that hold no external resources, but
+only occupy memory) may not be efficient and could decrease performance.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Pool UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Pool.php
+
+.. literalinclude:: Pool.php
+ :language: php
+ :linenos:
+
+Processor.php
+
+.. literalinclude:: Processor.php
+ :language: php
+ :linenos:
+
+Worker.php
+
+.. literalinclude:: Worker.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/PoolTest.php
+
+.. literalinclude:: Tests/PoolTest.php
+ :language: php
+ :linenos:
+
+Tests/TestWorker.php
+
+.. literalinclude:: Tests/TestWorker.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Creational/Pool
+.. __: http://en.wikipedia.org/wiki/Object_pool_pattern
diff --git a/Creational/Pool/Tests/TestWorker.php b/Creational/Pool/Tests/TestWorker.php
index 7c2c2db..3cfbef5 100644
--- a/Creational/Pool/Tests/TestWorker.php
+++ b/Creational/Pool/Tests/TestWorker.php
@@ -1,4 +1,4 @@
-setTitle('Foo Book No ' . $i);
+ $book->setTitle('Foo Book No '.$i);
}
for ($i = 0; $i < 5000; $i++) {
$book = clone $barPrototype;
- $book->setTitle('Bar Book No ' . $i);
+ $book->setTitle('Bar Book No '.$i);
}
diff --git a/Creational/README.rst b/Creational/README.rst
new file mode 100644
index 0000000..43b9c3b
--- /dev/null
+++ b/Creational/README.rst
@@ -0,0 +1,24 @@
+`Creational`__
+==============
+
+In software engineering, creational design patterns are design patterns
+that deal with object creation mechanisms, trying to create objects in a
+manner suitable to the situation. The basic form of object creation
+could result in design problems or added complexity to the design.
+Creational design patterns solve this problem by somehow controlling
+this object creation.
+
+.. toctree::
+ :titlesonly:
+
+ AbstractFactory/README
+ Builder/README
+ FactoryMethod/README
+ Multiton/README
+ Pool/README
+ Prototype/README
+ SimpleFactory/README
+ Singleton/README
+ StaticFactory/README
+
+.. __: http://en.wikipedia.org/wiki/Creational_pattern
diff --git a/Creational/SimpleFactory/Bicycle.php b/Creational/SimpleFactory/Bicycle.php
index 75cb413..defa801 100644
--- a/Creational/SimpleFactory/Bicycle.php
+++ b/Creational/SimpleFactory/Bicycle.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\SimpleFactory;
/**
- * Bicycle is a bicycle
+ * Bicycle is a bicycle.
*/
class Bicycle implements VehicleInterface
{
@@ -14,6 +14,5 @@ class Bicycle implements VehicleInterface
*/
public function driveTo($destination)
{
-
}
}
diff --git a/Creational/SimpleFactory/README.md b/Creational/SimpleFactory/README.md
deleted file mode 100644
index fedaa9d..0000000
--- a/Creational/SimpleFactory/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Simple Factory
-
-## Purpose
-
-ConcreteFactory is a simple factory pattern.
-
-It differs from the static factory because it is NOT static and as you know: static => global => evil!
-
-Therefore, you can have multiple factories, differently parametrized, you can subclass it and you can mock-up it.
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Creational/SimpleFactory/README.rst b/Creational/SimpleFactory/README.rst
new file mode 100644
index 0000000..8f6ce81
--- /dev/null
+++ b/Creational/SimpleFactory/README.rst
@@ -0,0 +1,69 @@
+Simple Factory
+==============
+
+Purpose
+-------
+
+SimpleFactory is a simple factory pattern.
+
+It differs from the static factory because it is NOT static and as you
+know: static => global => evil!
+
+Therefore, you can have multiple factories, differently parametrized,
+you can subclass it and you can mock-up it.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt SimpleFactory UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+SimpleFactory.php
+
+.. literalinclude:: SimpleFactory.php
+ :language: php
+ :linenos:
+
+VehicleInterface.php
+
+.. literalinclude:: VehicleInterface.php
+ :language: php
+ :linenos:
+
+Bicycle.php
+
+.. literalinclude:: Bicycle.php
+ :language: php
+ :linenos:
+
+Scooter.php
+
+.. literalinclude:: Scooter.php
+ :language: php
+ :linenos:
+
+Usage
+-----
+
+.. code:: php
+
+ $factory = new SimpleFactory();
+ $bicycle = $factory->createVehicle('bicycle');
+ $bicycle->driveTo('Paris');
+
+Test
+----
+
+Tests/SimpleFactoryTest.php
+
+.. literalinclude:: Tests/SimpleFactoryTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Creational/SimpleFactory
diff --git a/Creational/SimpleFactory/Scooter.php b/Creational/SimpleFactory/Scooter.php
index 710c8cd..e1db734 100644
--- a/Creational/SimpleFactory/Scooter.php
+++ b/Creational/SimpleFactory/Scooter.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\SimpleFactory;
/**
- * Scooter is a Scooter
+ * Scooter is a Scooter.
*/
class Scooter implements VehicleInterface
{
@@ -12,6 +12,5 @@ class Scooter implements VehicleInterface
*/
public function driveTo($destination)
{
-
}
}
diff --git a/Creational/SimpleFactory/ConcreteFactory.php b/Creational/SimpleFactory/SimpleFactory.php
similarity index 80%
rename from Creational/SimpleFactory/ConcreteFactory.php
rename to Creational/SimpleFactory/SimpleFactory.php
index 177290c..7de17a1 100644
--- a/Creational/SimpleFactory/ConcreteFactory.php
+++ b/Creational/SimpleFactory/SimpleFactory.php
@@ -3,9 +3,9 @@
namespace DesignPatterns\Creational\SimpleFactory;
/**
- * class ConcreteFactory
+ * class SimpleFactory.
*/
-class ConcreteFactory
+class SimpleFactory
{
/**
* @var array
@@ -19,18 +19,19 @@ class ConcreteFactory
public function __construct()
{
$this->typeList = array(
- 'bicycle' => __NAMESPACE__ . '\Bicycle',
- 'other' => __NAMESPACE__ . '\Scooter'
+ 'bicycle' => __NAMESPACE__.'\Bicycle',
+ 'other' => __NAMESPACE__.'\Scooter',
);
}
/**
- * Creates a vehicle
- *
+ * Creates a vehicle.
+ *
* @param string $type a known type key
*
- * @return VehicleInterface a new instance of VehicleInterface
* @throws \InvalidArgumentException
+ *
+ * @return VehicleInterface a new instance of VehicleInterface
*/
public function createVehicle($type)
{
diff --git a/Creational/SimpleFactory/Tests/SimpleFactoryTest.php b/Creational/SimpleFactory/Tests/SimpleFactoryTest.php
index 1fffda3..c2f5379 100644
--- a/Creational/SimpleFactory/Tests/SimpleFactoryTest.php
+++ b/Creational/SimpleFactory/Tests/SimpleFactoryTest.php
@@ -2,26 +2,25 @@
namespace DesignPatterns\Creational\SimpleFactory\Tests;
-use DesignPatterns\Creational\SimpleFactory\ConcreteFactory;
+use DesignPatterns\Creational\SimpleFactory\SimpleFactory;
/**
- * SimpleFactoryTest tests the Simple Factory pattern
+ * SimpleFactoryTest tests the Simple Factory pattern.
*/
class SimpleFactoryTest extends \PHPUnit_Framework_TestCase
{
-
protected $factory;
protected function setUp()
{
- $this->factory = new ConcreteFactory();
+ $this->factory = new SimpleFactory();
}
public function getType()
{
return array(
array('bicycle'),
- array('other')
+ array('other'),
);
}
diff --git a/Creational/SimpleFactory/VehicleInterface.php b/Creational/SimpleFactory/VehicleInterface.php
index eb13a66..f2c8d3f 100644
--- a/Creational/SimpleFactory/VehicleInterface.php
+++ b/Creational/SimpleFactory/VehicleInterface.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\SimpleFactory;
/**
- * VehicleInterface is a contract for a vehicle
+ * VehicleInterface is a contract for a vehicle.
*/
interface VehicleInterface
{
diff --git a/Creational/SimpleFactory/uml/SimpleFactory.uml b/Creational/SimpleFactory/uml/SimpleFactory.uml
index f51ce6c..5a586a5 100644
--- a/Creational/SimpleFactory/uml/SimpleFactory.uml
+++ b/Creational/SimpleFactory/uml/SimpleFactory.uml
@@ -1,10 +1,10 @@
PHP
- \DesignPatterns\Creational\SimpleFactory\ConcreteFactory
+ \DesignPatterns\Creational\SimpleFactory\SimpleFactory\DesignPatterns\Creational\SimpleFactory\Scooter
- \DesignPatterns\Creational\SimpleFactory\ConcreteFactory
+ \DesignPatterns\Creational\SimpleFactory\SimpleFactory\DesignPatterns\Creational\SimpleFactory\VehicleInterface\DesignPatterns\Creational\SimpleFactory\Bicycle
diff --git a/Creational/SimpleFactory/uml/uml.svg b/Creational/SimpleFactory/uml/uml.svg
index 7c966c2..7da8077 100644
--- a/Creational/SimpleFactory/uml/uml.svg
+++ b/Creational/SimpleFactory/uml/uml.svg
@@ -201,10 +201,10 @@
- ConcreteFactory
+ SimpleFactory
- ConcreteFactory
+ SimpleFactory
diff --git a/Creational/Singleton/README.md b/Creational/Singleton/README.md
deleted file mode 100644
index b90fcdc..0000000
--- a/Creational/Singleton/README.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Singleton
-
-**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND MAINTAINABILITY USE DEPENDENCY INJECTION!**
-
-## Purpose
-
-To have only one instance of this object in the application that will handle all calls.
-
-## Examples
-
-* DB Connector
-* Logger (may also be a Multiton if there are many log files for several purposes)
-* Lock file for the application (there is only one in the filesystem ...)
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Creational/Singleton/README.rst b/Creational/Singleton/README.rst
new file mode 100644
index 0000000..c8aad42
--- /dev/null
+++ b/Creational/Singleton/README.rst
@@ -0,0 +1,50 @@
+`Singleton`__
+=============
+
+**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND
+MAINTAINABILITY USE DEPENDENCY INJECTION!**
+
+Purpose
+-------
+
+To have only one instance of this object in the application that will
+handle all calls.
+
+Examples
+--------
+
+- DB Connector
+- Logger (may also be a Multiton if there are many log files for
+ several purposes)
+- Lock file for the application (there is only one in the filesystem
+ ...)
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Singleton UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Singleton.php
+
+.. literalinclude:: Singleton.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/SingletonTest.php
+
+.. literalinclude:: Tests/SingletonTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Creational/Singleton
+.. __: http://en.wikipedia.org/wiki/Singleton_pattern
diff --git a/Creational/Singleton/Singleton.php b/Creational/Singleton/Singleton.php
index 00f0440..650810e 100644
--- a/Creational/Singleton/Singleton.php
+++ b/Creational/Singleton/Singleton.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Creational\Singleton;
/**
- * class Singleton
+ * class Singleton.
*/
class Singleton
{
@@ -11,17 +11,16 @@ class Singleton
* @var Singleton reference to singleton instance
*/
private static $instance;
-
+
/**
- * gets the instance via lazy initialization (created on first usage)
+ * gets the instance via lazy initialization (created on first usage).
*
* @return self
*/
public static function getInstance()
{
-
if (null === static::$instance) {
- static::$instance = new static;
+ static::$instance = new static();
}
return static::$instance;
@@ -29,30 +28,32 @@ class Singleton
/**
* is not allowed to call from outside: private!
- *
*/
private function __construct()
{
-
}
/**
- * prevent the instance from being cloned
+ * prevent the instance from being cloned.
+ *
+ * @throws SingletonPatternViolationException
*
* @return void
*/
- private function __clone()
+ final public function __clone()
{
-
+ throw new SingletonPatternViolationException('This is a Singleton. Clone is forbidden');
}
/**
- * prevent from being unserialized
+ * prevent from being unserialized.
+ *
+ * @throws SingletonPatternViolationException
*
* @return void
*/
- private function __wakeup()
+ final public function __wakeup()
{
-
+ throw new SingletonPatternViolationException('This is a Singleton. __wakeup usage is forbidden');
}
}
diff --git a/Creational/Singleton/SingletonPatternViolationException.php b/Creational/Singleton/SingletonPatternViolationException.php
new file mode 100644
index 0000000..b025b4a
--- /dev/null
+++ b/Creational/Singleton/SingletonPatternViolationException.php
@@ -0,0 +1,7 @@
+getMethod('__construct');
$this->assertTrue($meth->isPrivate());
}
+
+ /**
+ * @expectedException \DesignPatterns\Creational\Singleton\SingletonPatternViolationException
+ *
+ * @return void
+ */
+ public function testNoCloneAllowed()
+ {
+ $obj1 = Singleton::getInstance();
+ $obj2 = clone $obj1;
+ }
+
+ /**
+ * @expectedException \DesignPatterns\Creational\Singleton\SingletonPatternViolationException
+ *
+ * @return void
+ */
+ public function testNoSerializationAllowed()
+ {
+ $obj1 = Singleton::getInstance();
+ $serialized = serialize($obj1);
+ $obj2 = unserialize($serialized);
+ }
}
diff --git a/Creational/StaticFactory/FormatNumber.php b/Creational/StaticFactory/FormatNumber.php
index 93ac7c7..e577ab2 100644
--- a/Creational/StaticFactory/FormatNumber.php
+++ b/Creational/StaticFactory/FormatNumber.php
@@ -3,9 +3,8 @@
namespace DesignPatterns\Creational\StaticFactory;
/**
- * Class FormatNumber
+ * Class FormatNumber.
*/
class FormatNumber implements FormatterInterface
{
-
}
diff --git a/Creational/StaticFactory/FormatString.php b/Creational/StaticFactory/FormatString.php
index 6578b68..5cb9e28 100644
--- a/Creational/StaticFactory/FormatString.php
+++ b/Creational/StaticFactory/FormatString.php
@@ -3,9 +3,8 @@
namespace DesignPatterns\Creational\StaticFactory;
/**
- * Class FormatString
+ * Class FormatString.
*/
class FormatString implements FormatterInterface
{
-
}
diff --git a/Creational/StaticFactory/FormatterInterface.php b/Creational/StaticFactory/FormatterInterface.php
index 969f047..349f8b6 100644
--- a/Creational/StaticFactory/FormatterInterface.php
+++ b/Creational/StaticFactory/FormatterInterface.php
@@ -3,9 +3,8 @@
namespace DesignPatterns\Creational\StaticFactory;
/**
- * Class FormatterInterface
+ * Class FormatterInterface.
*/
interface FormatterInterface
{
-
}
diff --git a/Creational/StaticFactory/README.md b/Creational/StaticFactory/README.md
deleted file mode 100644
index f5e2710..0000000
--- a/Creational/StaticFactory/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Static Factory
-
-## Purpose
-
-Similar to the AbstractFactory, this pattern is used to create series of related or dependent objects.
-The difference between this and the abstract factory pattern is that the static factory pattern uses just one static
-method to create all types of objects it can create. It is usually named `factory` or `build`.
-
-## Examples
-
-* Zend Framework: `Zend_Cache_Backend` or `_Frontend` use a factory method create cache backends or frontends
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Creational/StaticFactory/README.rst b/Creational/StaticFactory/README.rst
new file mode 100644
index 0000000..85cacf7
--- /dev/null
+++ b/Creational/StaticFactory/README.rst
@@ -0,0 +1,64 @@
+Static Factory
+==============
+
+Purpose
+-------
+
+Similar to the AbstractFactory, this pattern is used to create series of
+related or dependent objects. The difference between this and the
+abstract factory pattern is that the static factory pattern uses just
+one static method to create all types of objects it can create. It is
+usually named ``factory`` or ``build``.
+
+Examples
+--------
+
+- Zend Framework: ``Zend_Cache_Backend`` or ``_Frontend`` use a factory
+ method create cache backends or frontends
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt StaticFactory UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+StaticFactory.php
+
+.. literalinclude:: StaticFactory.php
+ :language: php
+ :linenos:
+
+FormatterInterface.php
+
+.. literalinclude:: FormatterInterface.php
+ :language: php
+ :linenos:
+
+FormatString.php
+
+.. literalinclude:: FormatString.php
+ :language: php
+ :linenos:
+
+FormatNumber.php
+
+.. literalinclude:: FormatNumber.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/StaticFactoryTest.php
+
+.. literalinclude:: Tests/StaticFactoryTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Creational/StaticFactory
diff --git a/Creational/StaticFactory/StaticFactory.php b/Creational/StaticFactory/StaticFactory.php
index e4f2f96..e4c4f4b 100644
--- a/Creational/StaticFactory/StaticFactory.php
+++ b/Creational/StaticFactory/StaticFactory.php
@@ -4,23 +4,24 @@ namespace DesignPatterns\Creational\StaticFactory;
/**
* Note1: Remember, static => global => evil
- * Note2: Cannot be subclassed or mock-upped or have multiple different instances
+ * Note2: Cannot be subclassed or mock-upped or have multiple different instances.
*/
class StaticFactory
{
/**
- * the parametrized function to get create an instance
+ * the parametrized function to get create an instance.
*
* @param string $type
*
* @static
*
* @throws \InvalidArgumentException
+ *
* @return FormatterInterface
*/
public static function factory($type)
{
- $className = __NAMESPACE__ . '\Format' . ucfirst($type);
+ $className = __NAMESPACE__.'\Format'.ucfirst($type);
if (!class_exists($className)) {
throw new \InvalidArgumentException('Missing format class.');
diff --git a/Creational/StaticFactory/Tests/StaticFactoryTest.php b/Creational/StaticFactory/Tests/StaticFactoryTest.php
index e8bb7a5..61f65af 100644
--- a/Creational/StaticFactory/Tests/StaticFactoryTest.php
+++ b/Creational/StaticFactory/Tests/StaticFactoryTest.php
@@ -5,17 +5,15 @@ namespace DesignPatterns\Creational\StaticFactory\Tests;
use DesignPatterns\Creational\StaticFactory\StaticFactory;
/**
- * Tests for Static Factory pattern
- *
+ * Tests for Static Factory pattern.
*/
class StaticFactoryTest extends \PHPUnit_Framework_TestCase
{
-
public function getTypeList()
{
return array(
array('string'),
- array('number')
+ array('number'),
);
}
@@ -27,4 +25,12 @@ class StaticFactoryTest extends \PHPUnit_Framework_TestCase
$obj = StaticFactory::factory($type);
$this->assertInstanceOf('DesignPatterns\Creational\StaticFactory\FormatterInterface', $obj);
}
+
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testException()
+ {
+ StaticFactory::factory('');
+ }
}
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..52169e6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,192 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
+
+help:
+ @echo "Please use \`make ' where is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " applehelp to make an Apple Help Book"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " xml to make Docutils-native XML files"
+ @echo " pseudoxml to make pseudoxml-XML files for display purposes"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+ @echo " coverage to run coverage check of the documentation (if enabled)"
+
+clean:
+ rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/DesignPatternsPHP.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/DesignPatternsPHP.qhc"
+
+applehelp:
+ $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
+ @echo
+ @echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
+ @echo "N.B. You won't be able to view it unless you put it in" \
+ "~/Library/Documentation/Help or install it in your application" \
+ "bundle."
+
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/DesignPatternsPHP"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/DesignPatternsPHP"
+ @echo "# devhelp"
+
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+latexpdfja:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through platex and dvipdfmx..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+coverage:
+ $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
+ @echo "Testing of coverage in the sources finished, look at the " \
+ "results in $(BUILDDIR)/coverage/python.txt."
+
+xml:
+ $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+ @echo
+ @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+pseudoxml:
+ $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+ @echo
+ @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/More/Delegation/JuniorDeveloper.php b/More/Delegation/JuniorDeveloper.php
index 7506181..0946dad 100644
--- a/More/Delegation/JuniorDeveloper.php
+++ b/More/Delegation/JuniorDeveloper.php
@@ -3,13 +3,12 @@
namespace DesignPatterns\More\Delegation;
/**
- * Class JuniorDeveloper
- * @package DesignPatterns\Delegation
+ * Class JuniorDeveloper.
*/
class JuniorDeveloper
{
public function writeBadCode()
{
- return "Some junior developer generated code...";
+ return 'Some junior developer generated code...';
}
}
diff --git a/More/Delegation/README.md b/More/Delegation/README.md
deleted file mode 100644
index c51128c..0000000
--- a/More/Delegation/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Delegation
-
-## Purpose
-
-...
-
-## Examples
-
-...
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/More/Delegation/README.rst b/More/Delegation/README.rst
new file mode 100644
index 0000000..69306ad
--- /dev/null
+++ b/More/Delegation/README.rst
@@ -0,0 +1,54 @@
+`Delegation`__
+==============
+
+Purpose
+-------
+
+Demonstrate the Delegator pattern, where an object, instead of performing one of its stated tasks, delegates that task to an associated helper object. In this case TeamLead professes to writeCode and Usage uses this, while TeamLead delegates writeCode to JuniorDeveloper's writeBadCode function. This inverts the responsibility so that Usage is unknowingly executing writeBadCode.
+
+Examples
+--------
+
+Please review JuniorDeveloper.php, TeamLead.php, and then Usage.php to see it all tied together.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Delegation UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Usage.php
+
+.. literalinclude:: Usage.php
+ :language: php
+ :linenos:
+
+TeamLead.php
+
+.. literalinclude:: TeamLead.php
+ :language: php
+ :linenos:
+
+JuniorDeveloper.php
+
+.. literalinclude:: JuniorDeveloper.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/DelegationTest.php
+
+.. literalinclude:: Tests/DelegationTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/More/Delegation
+.. __: http://en.wikipedia.org/wiki/Delegation_pattern
diff --git a/More/Delegation/TeamLead.php b/More/Delegation/TeamLead.php
index 315bd3b..9b75190 100644
--- a/More/Delegation/TeamLead.php
+++ b/More/Delegation/TeamLead.php
@@ -3,9 +3,7 @@
namespace DesignPatterns\More\Delegation;
/**
- * Class TeamLead
- * @package DesignPatterns\Delegation
- * The `TeamLead` class, he delegate work to `JuniorDeveloper`
+ * Class TeamLead.
*/
class TeamLead
{
@@ -13,7 +11,8 @@ class TeamLead
protected $slave;
/**
- * Give junior developer into teamlead submission
+ * Give junior developer into teamlead submission.
+ *
* @param JuniorDeveloper $junior
*/
public function __construct(JuniorDeveloper $junior)
@@ -22,7 +21,8 @@ class TeamLead
}
/**
- * TeamLead drink coffee, junior work
+ * TeamLead drink coffee, junior work.
+ *
* @return mixed
*/
public function writeCode()
diff --git a/More/Delegation/Tests/DelegationTest.php b/More/Delegation/Tests/DelegationTest.php
index b19f871..7d0a33b 100644
--- a/More/Delegation/Tests/DelegationTest.php
+++ b/More/Delegation/Tests/DelegationTest.php
@@ -5,7 +5,7 @@ namespace DesignPatterns\More\Delegation\Tests;
use DesignPatterns\More\Delegation;
/**
- * DelegationTest tests the delegation pattern
+ * DelegationTest tests the delegation pattern.
*/
class DelegationTest extends \PHPUnit_Framework_TestCase
{
diff --git a/More/EAV/Attribute.php b/More/EAV/Attribute.php
new file mode 100644
index 0000000..3874360
--- /dev/null
+++ b/More/EAV/Attribute.php
@@ -0,0 +1,82 @@
+values = new SplObjectStorage();
+ }
+
+ /**
+ * @return SplObjectStorage
+ */
+ public function getValues()
+ {
+ return $this->values;
+ }
+
+ /**
+ * @param ValueInterface $value
+ *
+ * @return $this
+ */
+ public function addValue(ValueInterface $value)
+ {
+ if (!$this->values->contains($value)) {
+ $this->values->attach($value);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param ValueInterface $value
+ *
+ * @return $this
+ */
+ public function removeValue(ValueInterface $value)
+ {
+ if ($this->values->contains($value)) {
+ $this->values->detach($value);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return $this
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+
+ return $this;
+ }
+}
diff --git a/More/EAV/Entity.php b/More/EAV/Entity.php
new file mode 100644
index 0000000..ff26589
--- /dev/null
+++ b/More/EAV/Entity.php
@@ -0,0 +1,82 @@
+values = new SplObjectStorage();
+ }
+
+ /**
+ * @return SplObjectStorage
+ */
+ public function getValues()
+ {
+ return $this->values;
+ }
+
+ /**
+ * @param ValueInterface $value
+ *
+ * @return $this
+ */
+ public function addValue(ValueInterface $value)
+ {
+ if (!$this->values->contains($value)) {
+ $this->values->attach($value);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param ValueInterface $value
+ *
+ * @return $this
+ */
+ public function removeValue(ValueInterface $value)
+ {
+ if ($this->values->contains($value)) {
+ $this->values->detach($value);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return $this
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+
+ return $this;
+ }
+}
diff --git a/More/EAV/README.rst b/More/EAV/README.rst
new file mode 100644
index 0000000..b8a8fbe
--- /dev/null
+++ b/More/EAV/README.rst
@@ -0,0 +1,125 @@
+`Entity-Attribute-Value (EAV)`__
+================================
+
+The Entity–attribute–value (EAV) pattern in order to implement EAV model with PHP.
+
+Purpose
+-------
+
+The Entity–attribute–value (EAV) model is a data model to describe entities
+where the number of attributes (properties, parameters) that can be used
+to describe them is potentially vast, but the number that will actually apply
+to a given entity is relatively modest.
+
+Examples
+--------
+
+Check full work example in `example.php`_ file.
+
+.. code-block:: php
+
+ use DesignPatterns\More\EAV\Entity;
+ use DesignPatterns\More\EAV\Attribute;
+ use DesignPatterns\More\EAV\Value;
+
+ // Create color attribute
+ $color = (new Attribute())->setName('Color');
+ // Create color values
+ $colorSilver = (new Value($color))->setName('Silver');
+ $colorGold = (new Value($color))->setName('Gold');
+ $colorSpaceGrey = (new Value($color))->setName('Space Grey');
+
+ // Create memory attribute
+ $memory = (new Attribute())->setName('Memory');
+ // Create memory values
+ $memory4Gb = (new Value($memory))->setName('4GB');
+ $memory8Gb = (new Value($memory))->setName('8GB');
+ $memory16Gb = (new Value($memory))->setName('16GB');
+
+ // Create storage attribute
+ $storage = (new Attribute())->setName('Storage');
+ // Create storage values
+ $storage128Gb = (new Value($storage))->setName('128GB');
+ $storage256Gb = (new Value($storage))->setName('256GB');
+ $storage512Gb = (new Value($storage))->setName('512GB');
+ $storage1Tb = (new Value($storage))->setName('1TB');
+
+ // Create entities with specific values
+ $mac = (new Entity())
+ ->setName('MacBook')
+ // colors
+ ->addValue($colorSilver)
+ ->addValue($colorGold)
+ ->addValue($colorSpaceGrey)
+ // memories
+ ->addValue($memory8Gb)
+ // storages
+ ->addValue($storage256Gb)
+ ->addValue($storage512Gb)
+ ;
+
+ $macAir = (new Entity())
+ ->setName('MacBook Air')
+ // colors
+ ->addValue($colorSilver)
+ // memories
+ ->addValue($memory4Gb)
+ ->addValue($memory8Gb)
+ // storages
+ ->addValue($storage128Gb)
+ ->addValue($storage256Gb)
+ ->addValue($storage512Gb)
+ ;
+
+ $macPro = (new Entity())
+ ->setName('MacBook Pro')
+ // colors
+ ->addValue($colorSilver)
+ // memories
+ ->addValue($memory8Gb)
+ ->addValue($memory16Gb)
+ // storages
+ ->addValue($storage128Gb)
+ ->addValue($storage256Gb)
+ ->addValue($storage512Gb)
+ ->addValue($storage1Tb)
+ ;
+
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: EAV UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Test
+----
+
+Tests/EntityTest.php
+
+.. literalinclude:: Tests/EntityTest.php
+ :language: php
+ :linenos:
+
+Tests/AttributeTest.php
+
+.. literalinclude:: Tests/AttributeTest.php
+ :language: php
+ :linenos:
+
+Tests/ValueTest.php
+
+.. literalinclude:: Tests/ValueTest.php
+ :language: php
+ :linenos:
+
+
+.. _`example.php`: https://github.com/domnikl/DesignPatternsPHP/tree/master/More/EAV/example.php
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/More/EAV
+.. __: https://en.wikipedia.org/wiki/Entity–attribute–value_model
diff --git a/More/EAV/Tests/AttributeTest.php b/More/EAV/Tests/AttributeTest.php
new file mode 100644
index 0000000..4affe41
--- /dev/null
+++ b/More/EAV/Tests/AttributeTest.php
@@ -0,0 +1,66 @@
+assertInstanceOf('\DesignPatterns\More\EAV\Attribute', $attribute);
+ }
+
+ /**
+ * @depends testCreationSuccess
+ */
+ public function testSetGetName()
+ {
+ $attribute = new Attribute();
+ $attribute->setName('Color');
+
+ $this->assertEquals('Color', $attribute->getName());
+ }
+
+ /**
+ * @depends testCreationSuccess
+ */
+ public function testAddValue()
+ {
+ $attribute = new Attribute();
+ $attribute->setName('Color');
+
+ $colorSilver = new Value($attribute);
+ $colorSilver->setName('Silver');
+ $colorGold = new Value($attribute);
+ $colorGold->setName('Gold');
+
+ $this->assertTrue($attribute->getValues()->contains($colorSilver));
+ $this->assertTrue($attribute->getValues()->contains($colorGold));
+ }
+
+ /**
+ * @depends testAddValue
+ */
+ public function testRemoveValue()
+ {
+ $attribute = new Attribute();
+ $attribute->setName('Color');
+
+ $colorSilver = new Value($attribute);
+ $colorSilver->setName('Silver');
+ $colorGold = new Value($attribute);
+ $colorGold->setName('Gold');
+
+ $attribute->removeValue($colorSilver);
+
+ $this->assertFalse($attribute->getValues()->contains($colorSilver));
+ $this->assertTrue($attribute->getValues()->contains($colorGold));
+ }
+}
diff --git a/More/EAV/Tests/EntityTest.php b/More/EAV/Tests/EntityTest.php
new file mode 100644
index 0000000..ecd6c40
--- /dev/null
+++ b/More/EAV/Tests/EntityTest.php
@@ -0,0 +1,145 @@
+setName($name);
+
+ $this->assertEquals($name, $macBook->getName());
+ }
+
+ /**
+ * @dataProvider valueProvider
+ *
+ * @var string
+ * @var Value[] $values
+ */
+ public function testAddValue($name, array $values)
+ {
+ $macBook = new Entity();
+ $macBook->setName($name);
+
+ foreach ($values as $value) {
+ $macBook->addValue($value);
+ $this->assertTrue($macBook->getValues()->contains($value));
+ }
+
+ $this->assertCount(count($values), $macBook->getValues());
+ }
+
+ /**
+ * @depends testAddValue
+ * @dataProvider valueProvider
+ *
+ * @var string
+ * @var Value[] $values
+ */
+ public function testRemoveValue($name, array $values)
+ {
+ $macBook = new Entity();
+ $macBook->setName($name);
+
+ foreach ($values as $value) {
+ $macBook->addValue($value);
+ }
+ $macBook->removeValue($values[0]);
+
+ $this->assertFalse($macBook->getValues()->contains($values[0]));
+ unset($values[0]);
+ $this->assertCount(count($values), $macBook->getValues());
+ }
+
+ /**
+ * @return array
+ */
+ public function valueProvider()
+ {
+ // color attribute
+ $color = new Attribute();
+ $color->setName('Color');
+ // color values
+ $colorSilver = new Value($color);
+ $colorSilver->setName('Silver');
+ $colorGold = new Value($color);
+ $colorGold->setName('Gold');
+ $colorSpaceGrey = new Value($color);
+ $colorSpaceGrey->setName('Space Grey');
+
+ // memory attribute
+ $memory = new Attribute();
+ $memory->setName('Memory');
+ // memory values
+ $memory4Gb = new Value($memory);
+ $memory4Gb->setName('4GB');
+ $memory8Gb = new Value($memory);
+ $memory8Gb->setName('8GB');
+ $memory16Gb = new Value($memory);
+ $memory16Gb->setName('16GB');
+
+ // storage attribute
+ $storage = new Attribute();
+ $storage->setName('Storage');
+ // storage values
+ $storage128Gb = new Value($storage);
+ $storage128Gb->setName('128GB');
+ $storage256Gb = new Value($storage);
+ $storage256Gb->setName('256GB');
+ $storage512Gb = new Value($storage);
+ $storage512Gb->setName('512GB');
+ $storage1Tb = new Value($storage);
+ $storage1Tb->setName('1TB');
+
+ return array(
+ array(
+ 'MacBook',
+ array(
+ $colorSilver,
+ $colorGold,
+ $colorSpaceGrey,
+ $memory8Gb,
+ $storage256Gb,
+ $storage512Gb,
+ ),
+ ),
+ array(
+ 'MacBook Air',
+ array(
+ $colorSilver,
+ $memory4Gb,
+ $memory8Gb,
+ $storage128Gb,
+ $storage256Gb,
+ $storage512Gb,
+ ),
+ ),
+ array(
+ 'MacBook Pro',
+ array(
+ $colorSilver,
+ $memory8Gb,
+ $memory16Gb,
+ $storage128Gb,
+ $storage256Gb,
+ $storage512Gb,
+ $storage1Tb,
+ ),
+ ),
+ );
+ }
+}
diff --git a/More/EAV/Tests/ValueTest.php b/More/EAV/Tests/ValueTest.php
new file mode 100644
index 0000000..f80f070
--- /dev/null
+++ b/More/EAV/Tests/ValueTest.php
@@ -0,0 +1,46 @@
+setName('Color');
+
+ $value = new Value($attribute);
+
+ $this->assertInstanceOf('\DesignPatterns\More\EAV\Value', $value);
+ }
+
+ public function testSetGetName()
+ {
+ $attribute = new Attribute();
+ $attribute->setName('Color');
+
+ $value = new Value($attribute);
+ $value->setName('Silver');
+
+ $this->assertEquals('Silver', $value->getName());
+ }
+
+ public function testSetGetAttribute()
+ {
+ $attribute = new Attribute();
+ $attribute->setName('Color');
+
+ $value = new Value($attribute);
+ $value->setName('Silver');
+ $this->assertSame($attribute, $value->getAttribute());
+
+ $value->setAttribute($attribute);
+ $this->assertSame($attribute, $value->getAttribute());
+ }
+}
diff --git a/More/EAV/Value.php b/More/EAV/Value.php
new file mode 100644
index 0000000..2c156a9
--- /dev/null
+++ b/More/EAV/Value.php
@@ -0,0 +1,70 @@
+addValue($this);
+ $this->attribute = $attribute;
+ }
+
+ /**
+ * @param Attribute $attribute
+ *
+ * @return $this
+ */
+ public function setAttribute(Attribute $attribute)
+ {
+ $this->attribute->removeValue($this); // Remove value from current attribute
+ $attribute->addValue($this); // Add value to new attribute
+ $this->attribute = $attribute;
+
+ return $this;
+ }
+
+ /**
+ * @return Attribute
+ */
+ public function getAttribute()
+ {
+ return $this->attribute;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return $this
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+
+ return $this;
+ }
+}
diff --git a/More/EAV/ValueAccessInterface.php b/More/EAV/ValueAccessInterface.php
new file mode 100644
index 0000000..dde67b2
--- /dev/null
+++ b/More/EAV/ValueAccessInterface.php
@@ -0,0 +1,24 @@
+setName('Color');
+// Create color values
+$colorSilver = (new Value($color))->setName('Silver');
+$colorGold = (new Value($color))->setName('Gold');
+$colorSpaceGrey = (new Value($color))->setName('Space Grey');
+
+// Create memory attribute
+$memory = (new Attribute())->setName('Memory');
+// Create memory values
+$memory4Gb = (new Value($memory))->setName('4GB');
+$memory8Gb = (new Value($memory))->setName('8GB');
+$memory16Gb = (new Value($memory))->setName('16GB');
+
+// Create storage attribute
+$storage = (new Attribute())->setName('Storage');
+// Create storage values
+$storage128Gb = (new Value($storage))->setName('128GB');
+$storage256Gb = (new Value($storage))->setName('256GB');
+$storage512Gb = (new Value($storage))->setName('512GB');
+$storage1Tb = (new Value($storage))->setName('1TB');
+
+// Create entities with specific values
+$mac = (new Entity())
+ ->setName('MacBook')
+ // colors
+ ->addValue($colorSilver)
+ ->addValue($colorGold)
+ ->addValue($colorSpaceGrey)
+ // memories
+ ->addValue($memory8Gb)
+ // storages
+ ->addValue($storage256Gb)
+ ->addValue($storage512Gb);
+
+$macAir = (new Entity())
+ ->setName('MacBook Air')
+ // colors
+ ->addValue($colorSilver)
+ // memories
+ ->addValue($memory4Gb)
+ ->addValue($memory8Gb)
+ // storages
+ ->addValue($storage128Gb)
+ ->addValue($storage256Gb)
+ ->addValue($storage512Gb);
+
+$macPro = (new Entity())
+ ->setName('MacBook Pro')
+ // colors
+ ->addValue($colorSilver)
+ // memories
+ ->addValue($memory8Gb)
+ ->addValue($memory16Gb)
+ // storages
+ ->addValue($storage128Gb)
+ ->addValue($storage256Gb)
+ ->addValue($storage512Gb)
+ ->addValue($storage1Tb);
diff --git a/More/EAV/uml/EAV.uml b/More/EAV/uml/EAV.uml
new file mode 100644
index 0000000..1b08466
--- /dev/null
+++ b/More/EAV/uml/EAV.uml
@@ -0,0 +1,43 @@
+
+
+ PHP
+ \DesignPatterns\More\Delegation\JuniorDeveloper
+
+ \DesignPatterns\More\EAV\Entity
+ \DesignPatterns\More\EAV\Value
+ \DesignPatterns\More\EAV\Attribute
+ \DesignPatterns\More\EAV\ValueAccessInterface
+ \DesignPatterns\More\EAV\ValueInterface
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ \DesignPatterns\More\EAV\ValueAccessInterface
+
+
+ Fields
+ Constants
+ Constructors
+ Methods
+
+ private
+
+
diff --git a/More/EAV/uml/uml.png b/More/EAV/uml/uml.png
new file mode 100644
index 0000000..22e9b77
Binary files /dev/null and b/More/EAV/uml/uml.png differ
diff --git a/More/EAV/uml/uml.svg b/More/EAV/uml/uml.svg
new file mode 100644
index 0000000..26ff3cc
--- /dev/null
+++ b/More/EAV/uml/uml.svg
@@ -0,0 +1,668 @@
+
diff --git a/More/README.md b/More/README.md
index 7667a62..cba33e7 100644
--- a/More/README.md
+++ b/More/README.md
@@ -3,3 +3,4 @@
* [Delegation](Delegation) [:notebook:](http://en.wikipedia.org/wiki/Delegation_pattern)
* [ServiceLocator](ServiceLocator) [:notebook:](http://en.wikipedia.org/wiki/Service_locator_pattern)
* [Repository](Repository)
+* [EAV](EAV) [:notebook:](https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model)
diff --git a/More/README.rst b/More/README.rst
new file mode 100644
index 0000000..dbab1f6
--- /dev/null
+++ b/More/README.rst
@@ -0,0 +1,9 @@
+More
+====
+
+.. toctree::
+ :titlesonly:
+
+ Delegation/README
+ ServiceLocator/README
+ Repository/README
diff --git a/More/Repository/MemoryStorage.php b/More/Repository/MemoryStorage.php
index 3021e96..44276d5 100644
--- a/More/Repository/MemoryStorage.php
+++ b/More/Repository/MemoryStorage.php
@@ -1,14 +1,12 @@
data[++$this->lastId] = $data;
+
return $this->lastId;
}
diff --git a/More/Repository/Post.php b/More/Repository/Post.php
index 227daaf..e9990b4 100644
--- a/More/Repository/Post.php
+++ b/More/Repository/Post.php
@@ -1,12 +1,11 @@
persistence->retrieve($id);
if (is_null($arrayData)) {
- return null;
+ return;
}
$post = new Post();
@@ -48,9 +48,10 @@ class PostRepository
}
/**
- * Save post object and populate it with id
+ * Save post object and populate it with id.
*
* @param Post $post
+ *
* @return Post
*/
public function save(Post $post)
@@ -59,17 +60,19 @@ class PostRepository
'author' => $post->getAuthor(),
'created' => $post->getCreated(),
'text' => $post->getText(),
- 'title' => $post->getTitle()
+ 'title' => $post->getTitle(),
));
$post->setId($id);
+
return $post;
}
/**
- * Deletes specified Post object
+ * Deletes specified Post object.
*
* @param Post $post
+ *
* @return bool
*/
public function delete(Post $post)
diff --git a/More/Repository/README.md b/More/Repository/README.md
deleted file mode 100644
index 0e2b188..0000000
--- a/More/Repository/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# Repository
-
-## Purpose
-
-Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.
-Repository encapsulates the set of objects persisted in a data store and the operations performed over them, providing a more object-oriented view of the persistence layer.
-Repository also supports the objective of achieving a clean separation and one-way dependency between the domain and data mapping layers.
-
-## Examples
-
-* Doctrine 2 ORM: there is Repository that mediates between Entity and DBAL and contains methods to retrieve objects
-* Laravel Framework
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/More/Repository/README.rst b/More/Repository/README.rst
new file mode 100644
index 0000000..48ac018
--- /dev/null
+++ b/More/Repository/README.rst
@@ -0,0 +1,61 @@
+Repository
+==========
+
+Purpose
+-------
+
+Mediates between the domain and data mapping layers using a
+collection-like interface for accessing domain objects. Repository
+encapsulates the set of objects persisted in a data store and the
+operations performed over them, providing a more object-oriented view of
+the persistence layer. Repository also supports the objective of
+achieving a clean separation and one-way dependency between the domain
+and data mapping layers.
+
+Examples
+--------
+
+- Doctrine 2 ORM: there is Repository that mediates between Entity and
+ DBAL and contains methods to retrieve objects
+- Laravel Framework
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Repository UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Post.php
+
+.. literalinclude:: Post.php
+ :language: php
+ :linenos:
+
+PostRepository.php
+
+.. literalinclude:: PostRepository.php
+ :language: php
+ :linenos:
+
+Storage.php
+
+.. literalinclude:: Storage.php
+ :language: php
+ :linenos:
+
+MemoryStorage.php
+
+.. literalinclude:: MemoryStorage.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/More/Repository
diff --git a/More/Repository/Storage.php b/More/Repository/Storage.php
index 58313b0..a730f09 100644
--- a/More/Repository/Storage.php
+++ b/More/Repository/Storage.php
@@ -1,40 +1,41 @@
-
- PHP
- \DesignPatterns\Repository\PostRepository
-
- \DesignPatterns\Repository\Storage
- \DesignPatterns\Repository\MemoryStorage
- \DesignPatterns\Repository\Post
- \DesignPatterns\Repository\PostRepository
-
-
-
-
-
-
-
-
-
-
-
- Fields
- Constants
- Constructors
- Methods
-
- private
-
-
+
+
+ PHP
+ \DesignPatterns\More\Repository\PostRepository
+
+ \DesignPatterns\More\Repository\Storage
+ \DesignPatterns\More\Repository\MemoryStorage
+ \DesignPatterns\More\Repository\Post
+ \DesignPatterns\More\Repository\PostRepository
+
+
+
+
+
+
+
+
+
+
+
+ Fields
+ Constants
+ Constructors
+ Methods
+
+ private
+
+
diff --git a/More/ServiceLocator/README.md b/More/ServiceLocator/README.md
deleted file mode 100644
index cdee496..0000000
--- a/More/ServiceLocator/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# Service Locator
-
-## Purpose
-
-To implement a loosely coupled architecture in order to get better testable, maintainable and extendable code.
-DI pattern and Service Locator pattern are an implementation of the Inverse of Control pattern.
-
-## Usage
-
-With `ServiceLocator` you can register a service for a given interface. By using the interface you can retrieve the service
-and use it in the classes of the application without knowing its implementation. You can configure and inject the
-Service Locator object on bootstrap.
-
-## Examples
-
-* Zend Framework 2 uses Service Locator to create and share services used in the framework(i.e. EventManager, ModuleManager, all custom user services provided by modules, etc...)
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/More/ServiceLocator/README.rst b/More/ServiceLocator/README.rst
new file mode 100644
index 0000000..bfeb1a9
--- /dev/null
+++ b/More/ServiceLocator/README.rst
@@ -0,0 +1,84 @@
+`Service Locator`__
+===================
+
+Purpose
+-------
+
+To implement a loosely coupled architecture in order to get better
+testable, maintainable and extendable code. DI pattern and Service
+Locator pattern are an implementation of the Inverse of Control pattern.
+
+Usage
+-----
+
+With ``ServiceLocator`` you can register a service for a given
+interface. By using the interface you can retrieve the service and use
+it in the classes of the application without knowing its implementation.
+You can configure and inject the Service Locator object on bootstrap.
+
+Examples
+--------
+
+- Zend Framework 2 uses Service Locator to create and share services
+ used in the framework(i.e. EventManager, ModuleManager, all custom
+ user services provided by modules, etc...)
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt ServiceLocator UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+ServiceLocatorInterface.php
+
+.. literalinclude:: ServiceLocatorInterface.php
+ :language: php
+ :linenos:
+
+ServiceLocator.php
+
+.. literalinclude:: ServiceLocator.php
+ :language: php
+ :linenos:
+
+LogServiceInterface.php
+
+.. literalinclude:: LogServiceInterface.php
+ :language: php
+ :linenos:
+
+LogService.php
+
+.. literalinclude:: LogService.php
+ :language: php
+ :linenos:
+
+DatabaseServiceInterface.php
+
+.. literalinclude:: DatabaseServiceInterface.php
+ :language: php
+ :linenos:
+
+DatabaseService.php
+
+.. literalinclude:: DatabaseService.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/ServiceLocatorTest.php
+
+.. literalinclude:: Tests/ServiceLocatorTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/More/ServiceLocator
+.. __: http://en.wikipedia.org/wiki/Service_locator_pattern
diff --git a/More/ServiceLocator/ServiceLocator.php b/More/ServiceLocator/ServiceLocator.php
index 6699eca..b631479 100644
--- a/More/ServiceLocator/ServiceLocator.php
+++ b/More/ServiceLocator/ServiceLocator.php
@@ -27,21 +27,21 @@ class ServiceLocator implements ServiceLocatorInterface
public function __construct()
{
- $this->services = array();
+ $this->services = array();
$this->instantiated = array();
- $this->shared = array();
+ $this->shared = array();
}
/**
* Registers a service with specific interface.
*
- * @param string $interface
+ * @param string $interface
* @param string|object $service
- * @param bool $share
+ * @param bool $share
*/
public function add($interface, $service, $share = true)
{
- /**
+ /*
* When you add a service, you should register it
* with its interface or with a string that you can use
* in the future even if you will change the service implementation.
@@ -51,7 +51,7 @@ class ServiceLocator implements ServiceLocatorInterface
$this->instantiated[$interface] = $service;
}
$this->services[$interface] = (is_object($service) ? get_class($service) : $service);
- $this->shared[$interface] = $share;
+ $this->shared[$interface] = $share;
}
/**
@@ -63,7 +63,7 @@ class ServiceLocator implements ServiceLocatorInterface
*/
public function has($interface)
{
- return (isset($this->services[$interface]) || isset($this->instantiated[$interface]));
+ return isset($this->services[$interface]) || isset($this->instantiated[$interface]);
}
/**
@@ -101,6 +101,7 @@ class ServiceLocator implements ServiceLocatorInterface
if ($this->shared[$interface]) {
$this->instantiated[$interface] = $object;
}
+
return $object;
}
}
diff --git a/More/ServiceLocator/Tests/ServiceLocatorTest.php b/More/ServiceLocator/Tests/ServiceLocatorTest.php
index d6b7ef6..72f8607 100644
--- a/More/ServiceLocator/Tests/ServiceLocatorTest.php
+++ b/More/ServiceLocator/Tests/ServiceLocatorTest.php
@@ -5,7 +5,7 @@ namespace DesignPatterns\More\ServiceLocator\Tests;
use DesignPatterns\More\ServiceLocator\DatabaseService;
use DesignPatterns\More\ServiceLocator\LogService;
use DesignPatterns\More\ServiceLocator\ServiceLocator;
-use \PHPUnit_Framework_TestCase as TestCase;
+use PHPUnit_Framework_TestCase as TestCase;
class ServiceLocatorTest extends TestCase
{
@@ -26,8 +26,8 @@ class ServiceLocatorTest extends TestCase
public function setUp()
{
- $this->serviceLocator = new ServiceLocator();
- $this->logService = new LogService();
+ $this->serviceLocator = new ServiceLocator();
+ $this->logService = new LogService();
$this->databaseService = new DatabaseService();
}
diff --git a/README.md b/README.md
index b35d4dd..a378e35 100755
--- a/README.md
+++ b/README.md
@@ -1,11 +1,44 @@
# DesignPatternsPHP
-[](https://travis-ci.org/domnikl/DesignPatternsPHP)
+[](https://travis-ci.org/domnikl/DesignPatternsPHP)
+
+[Read the Docs of DesignPatternsPHP](http://designpatternsphp.readthedocs.org)
+or [Download as PDF/Epub](https://readthedocs.org/projects/designpatternsphp/downloads/)
This is a collection of known design patterns and some sample code how to implement them in PHP. Every pattern has a small list of examples (most of them from Zend Framework, Symfony2 or Doctrine2 as I'm most familiar with this software).
I think the problem with patterns is that often people do know them but don't know when to apply which.
+## Installation
+You should look at and run the tests to see what happens in the example.
+To do this, you should install dependencies with `Composer` first:
+
+### [optional] Using a Virtual Machine (VM)
+
+If you wish to use a ready made VM environment, you can easily create one with Vagrant and Ansible.
+
+```bash
+$ vagrant up
+```
+
+Then `vagrant ssh` and `cd /vagrant`
+
+More information on [vagrant](https://www.vagrantup.com)
+
+### Install dependencies
+
+```bash
+$ composer install
+```
+
+Read more about how to install and use `Composer` on your local machine [here](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).
+
+### Running test suite
+
+```bash
+$ ./vendor/bin/phpunit
+```
+
## Patterns
The patterns can be structured in roughly three different categories. Please click on the [:notebook:](http://en.wikipedia.org/wiki/Software_design_pattern) for a full explanation of the pattern on Wikipedia.
@@ -54,6 +87,7 @@ The patterns can be structured in roughly three different categories. Please cli
* [Delegation](More/Delegation) [:notebook:](http://en.wikipedia.org/wiki/Delegation_pattern)
* [ServiceLocator](More/ServiceLocator) [:notebook:](http://en.wikipedia.org/wiki/Service_locator_pattern)
* [Repository](More/Repository)
+* [EAV](More/EAV) [:notebook:](https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model)
## Contribute
@@ -64,7 +98,7 @@ To establish a consistent code quality, please check your code using [PHP_CodeSn
(The MIT License)
-Copyright (c) 2014 Dominik Liebler and [contributors](https://github.com/domnikl/DesignPatternsPHP/graphs/contributors)
+Copyright (c) 2011 - 2016 Dominik Liebler and [contributors](https://github.com/domnikl/DesignPatternsPHP/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..3db54a9
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,73 @@
+.. DesignPatternsPHP
+
+=================
+DesignPatternsPHP
+=================
+
+.. image:: https://readthedocs.org/projects/designpatternsphp/badge/?version=latest
+ :target: https://readthedocs.org/projects/designpatternsphp/?badge=latest
+ :alt: Documentation Status
+
+This is a collection of known `design patterns`_ and some sample code how
+to implement them in PHP. Every pattern has a small list of examples
+(most of them from Zend Framework, Symfony2 or Doctrine2 as I'm most
+familiar with this software).
+
+I think the problem with patterns is that often people do know them but
+don't know when to apply which.
+
+Patterns
+--------
+
+The patterns can be structured in roughly three different categories.
+Please click on **the title of every pattern's page** for a full explanation of the pattern on Wikipedia.
+
+.. toctree::
+ :titlesonly:
+ :numbered:
+
+ Creational/README
+ Structural/README
+ Behavioral/README
+ More/README
+
+Contribute
+----------
+
+Please feel free to fork and extend existing or add your own examples
+and send a pull request with your changes! To establish a consistent
+code quality, please check your code using
+`PHP CodeSniffer`_ against `PSR2 standard`_
+using ``./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor .``.
+
+License
+-------
+
+(The MIT License)
+
+Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+.. _`design patterns`: http://en.wikipedia.org/wiki/Software_design_pattern
+.. _`PHP CodeSniffer`: https://github.com/squizlabs/PHP_CodeSniffer
+.. _`PSR2 standard`: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
+.. _`Dominik Liebler`: https://github.com/domnikl
+.. _`contributors`: https://github.com/domnikl/DesignPatternsPHP/graphs/contributors
diff --git a/Structural/Adapter/Book.php b/Structural/Adapter/Book.php
index f0ce83c..6458beb 100644
--- a/Structural/Adapter/Book.php
+++ b/Structural/Adapter/Book.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Structural\Adapter;
/**
- * Book is a concrete and standard paper book
+ * Book is a concrete and standard paper book.
*/
class Book implements PaperBookInterface
{
@@ -12,7 +12,6 @@ class Book implements PaperBookInterface
*/
public function open()
{
-
}
/**
@@ -20,6 +19,5 @@ class Book implements PaperBookInterface
*/
public function turnPage()
{
-
}
}
diff --git a/Structural/Adapter/EBookAdapter.php b/Structural/Adapter/EBookAdapter.php
index ed0fb17..3e4564a 100644
--- a/Structural/Adapter/EBookAdapter.php
+++ b/Structural/Adapter/EBookAdapter.php
@@ -3,8 +3,8 @@
namespace DesignPatterns\Structural\Adapter;
/**
- * EBookAdapter is an adapter to fit an e-book like a paper book
- *
+ * EBookAdapter is an adapter to fit an e-book like a paper book.
+ *
* This is the adapter here. Notice it implements PaperBookInterface,
* therefore you don't have to change the code of the client which using paper book.
*/
@@ -16,7 +16,7 @@ class EBookAdapter implements PaperBookInterface
protected $eBook;
/**
- * Notice the constructor, it "wraps" an electronic book
+ * Notice the constructor, it "wraps" an electronic book.
*
* @param EBookInterface $ebook
*/
@@ -26,7 +26,7 @@ class EBookAdapter implements PaperBookInterface
}
/**
- * This class makes the proper translation from one interface to another
+ * This class makes the proper translation from one interface to another.
*/
public function open()
{
@@ -34,7 +34,7 @@ class EBookAdapter implements PaperBookInterface
}
/**
- * turns pages
+ * turns pages.
*/
public function turnPage()
{
diff --git a/Structural/Adapter/EBookInterface.php b/Structural/Adapter/EBookInterface.php
index 15e0222..bd3dc26 100644
--- a/Structural/Adapter/EBookInterface.php
+++ b/Structural/Adapter/EBookInterface.php
@@ -3,19 +3,19 @@
namespace DesignPatterns\Structural\Adapter;
/**
- * EBookInterface is a contract for an electronic book
+ * EBookInterface is a contract for an electronic book.
*/
interface EBookInterface
{
/**
- * go to next page
+ * go to next page.
*
* @return mixed
*/
public function pressNext();
/**
- * start the book
+ * start the book.
*
* @return mixed
*/
diff --git a/Structural/Adapter/Kindle.php b/Structural/Adapter/Kindle.php
index 760e5f8..06d4489 100644
--- a/Structural/Adapter/Kindle.php
+++ b/Structural/Adapter/Kindle.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Structural\Adapter;
/**
- * Kindle is a concrete electronic book
+ * Kindle is a concrete electronic book.
*/
class Kindle implements EBookInterface
{
@@ -12,7 +12,6 @@ class Kindle implements EBookInterface
*/
public function pressNext()
{
-
}
/**
@@ -20,6 +19,5 @@ class Kindle implements EBookInterface
*/
public function pressStart()
{
-
}
}
diff --git a/Structural/Adapter/PaperBookInterface.php b/Structural/Adapter/PaperBookInterface.php
index 12f3103..4b62149 100644
--- a/Structural/Adapter/PaperBookInterface.php
+++ b/Structural/Adapter/PaperBookInterface.php
@@ -3,19 +3,19 @@
namespace DesignPatterns\Structural\Adapter;
/**
- * PaperBookInterface is a contract for a book
+ * PaperBookInterface is a contract for a book.
*/
interface PaperBookInterface
{
/**
- * method to turn pages
+ * method to turn pages.
*
* @return mixed
*/
public function turnPage();
/**
- * method to open the book
+ * method to open the book.
*
* @return mixed
*/
diff --git a/Structural/Adapter/README.md b/Structural/Adapter/README.md
deleted file mode 100644
index d2390df..0000000
--- a/Structural/Adapter/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Adapter / Wrapper
-
-## Purpose
-
-To translate one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces by providing it's interface to clients while using the original interface.
-
-## Examples
-
-* DB Client libraries adapter
-* using multiple different webservices and adapters normalize data so that the outcome is the same for all
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Structural/Adapter/README.rst b/Structural/Adapter/README.rst
new file mode 100644
index 0000000..1de8425
--- /dev/null
+++ b/Structural/Adapter/README.rst
@@ -0,0 +1,71 @@
+`Adapter / Wrapper`__
+=====================
+
+Purpose
+-------
+
+To translate one interface for a class into a compatible interface. An
+adapter allows classes to work together that normally could not because
+of incompatible interfaces by providing it's interface to clients while
+using the original interface.
+
+Examples
+--------
+
+- DB Client libraries adapter
+- using multiple different webservices and adapters normalize data so
+ that the outcome is the same for all
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Adapter UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+PaperBookInterface.php
+
+.. literalinclude:: PaperBookInterface.php
+ :language: php
+ :linenos:
+
+Book.php
+
+.. literalinclude:: Book.php
+ :language: php
+ :linenos:
+
+EBookAdapter.php
+
+.. literalinclude:: EBookAdapter.php
+ :language: php
+ :linenos:
+
+EBookInterface.php
+
+.. literalinclude:: EBookInterface.php
+ :language: php
+ :linenos:
+
+Kindle.php
+
+.. literalinclude:: Kindle.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/AdapterTest.php
+
+.. literalinclude:: Tests/AdapterTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/Adapter
+.. __: http://en.wikipedia.org/wiki/Adapter_pattern
diff --git a/Structural/Adapter/Tests/AdapterTest.php b/Structural/Adapter/Tests/AdapterTest.php
index 258e755..fd7713b 100644
--- a/Structural/Adapter/Tests/AdapterTest.php
+++ b/Structural/Adapter/Tests/AdapterTest.php
@@ -2,14 +2,14 @@
namespace DesignPatterns\Structural\Adapter\Tests;
+use DesignPatterns\Structural\Adapter\Book;
use DesignPatterns\Structural\Adapter\EBookAdapter;
use DesignPatterns\Structural\Adapter\Kindle;
use DesignPatterns\Structural\Adapter\PaperBookInterface;
-use DesignPatterns\Structural\Adapter\Book;
/**
* AdapterTest shows the use of an adapted e-book that behave like a book
- * You don't have to change the code of your client
+ * You don't have to change the code of your client.
*/
class AdapterTest extends \PHPUnit_Framework_TestCase
{
@@ -21,13 +21,13 @@ class AdapterTest extends \PHPUnit_Framework_TestCase
return array(
array(new Book()),
// we build a "wrapped" electronic book in the adapter
- array(new EBookAdapter(new Kindle()))
+ array(new EBookAdapter(new Kindle())),
);
}
/**
* This client only knows paper book but surprise, surprise, the second book
- * is in fact an electronic book, but both work the same way
+ * is in fact an electronic book, but both work the same way.
*
* @param PaperBookInterface $book
*
@@ -35,7 +35,7 @@ class AdapterTest extends \PHPUnit_Framework_TestCase
*/
public function testIAmAnOldClient(PaperBookInterface $book)
{
- $book->open();
- $book->turnPage();
+ $this->assertTrue(method_exists($book, 'open'));
+ $this->assertTrue(method_exists($book, 'turnPage'));
}
}
diff --git a/Structural/Bridge/Assemble.php b/Structural/Bridge/Assemble.php
index 2b60889..9b9d114 100644
--- a/Structural/Bridge/Assemble.php
+++ b/Structural/Bridge/Assemble.php
@@ -4,9 +4,8 @@ namespace DesignPatterns\Structural\Bridge;
class Assemble implements Workshop
{
-
public function work()
{
- print 'Assembled';
+ echo 'Assembled';
}
}
diff --git a/Structural/Bridge/Car.php b/Structural/Bridge/Car.php
index 2754199..89be431 100644
--- a/Structural/Bridge/Car.php
+++ b/Structural/Bridge/Car.php
@@ -3,11 +3,10 @@
namespace DesignPatterns\Structural\Bridge;
/**
- * Refined Abstraction
+ * Refined Abstraction.
*/
class Car extends Vehicle
{
-
public function __construct(Workshop $workShop1, Workshop $workShop2)
{
parent::__construct($workShop1, $workShop2);
@@ -15,7 +14,7 @@ class Car extends Vehicle
public function manufacture()
{
- print 'Car ';
+ echo 'Car ';
$this->workShop1->work();
$this->workShop2->work();
}
diff --git a/Structural/Bridge/Motorcycle.php b/Structural/Bridge/Motorcycle.php
index b021ce6..f008785 100644
--- a/Structural/Bridge/Motorcycle.php
+++ b/Structural/Bridge/Motorcycle.php
@@ -3,11 +3,10 @@
namespace DesignPatterns\Structural\Bridge;
/**
- * Refined Abstraction
+ * Refined Abstraction.
*/
class Motorcycle extends Vehicle
{
-
public function __construct(Workshop $workShop1, Workshop $workShop2)
{
parent::__construct($workShop1, $workShop2);
@@ -15,7 +14,7 @@ class Motorcycle extends Vehicle
public function manufacture()
{
- print 'Motorcycle ';
+ echo 'Motorcycle ';
$this->workShop1->work();
$this->workShop2->work();
}
diff --git a/Structural/Bridge/Produce.php b/Structural/Bridge/Produce.php
index b2b0505..a382f2d 100644
--- a/Structural/Bridge/Produce.php
+++ b/Structural/Bridge/Produce.php
@@ -3,13 +3,12 @@
namespace DesignPatterns\Structural\Bridge;
/**
- * Concrete Implementation
+ * Concrete Implementation.
*/
class Produce implements Workshop
{
-
public function work()
{
- print 'Produced ';
+ echo 'Produced ';
}
}
diff --git a/Structural/Bridge/README.md b/Structural/Bridge/README.md
deleted file mode 100644
index b4bf4fd..0000000
--- a/Structural/Bridge/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-## Purpose
-
-Decouple an abstraction from its implementation so that the two can vary
-independently. (http://en.wikipedia.org/wiki/Bridge_pattern)
-
-#### Sample:
-
-* [Symfony DoctrineBridge](https://github.com/symfony/DoctrineBridge)
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Structural/Bridge/README.rst b/Structural/Bridge/README.rst
new file mode 100644
index 0000000..f9b9551
--- /dev/null
+++ b/Structural/Bridge/README.rst
@@ -0,0 +1,74 @@
+`Bridge`__
+==========
+
+Purpose
+-------
+
+Decouple an abstraction from its implementation so that the two can vary
+independently.
+
+Sample:
+^^^^^^^
+
+- `Symfony
+ DoctrineBridge `__
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Bridge UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Workshop.php
+
+.. literalinclude:: Workshop.php
+ :language: php
+ :linenos:
+
+Assemble.php
+
+.. literalinclude:: Assemble.php
+ :language: php
+ :linenos:
+
+Produce.php
+
+.. literalinclude:: Produce.php
+ :language: php
+ :linenos:
+
+Vehicle.php
+
+.. literalinclude:: Vehicle.php
+ :language: php
+ :linenos:
+
+Motorcycle.php
+
+.. literalinclude:: Motorcycle.php
+ :language: php
+ :linenos:
+
+Car.php
+
+.. literalinclude:: Car.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/BridgeTest.php
+
+.. literalinclude:: Tests/BridgeTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/Bridge
+.. __: http://en.wikipedia.org/wiki/Bridge_pattern
diff --git a/Structural/Bridge/Tests/BridgeTest.php b/Structural/Bridge/Tests/BridgeTest.php
index e07afe9..0a89a86 100644
--- a/Structural/Bridge/Tests/BridgeTest.php
+++ b/Structural/Bridge/Tests/BridgeTest.php
@@ -9,7 +9,6 @@ use DesignPatterns\Structural\Bridge\Produce;
class BridgeTest extends \PHPUnit_Framework_TestCase
{
-
public function testCar()
{
$vehicle = new Car(new Produce(), new Assemble());
diff --git a/Structural/Bridge/Vehicle.php b/Structural/Bridge/Vehicle.php
index 10b0d03..f519d70 100644
--- a/Structural/Bridge/Vehicle.php
+++ b/Structural/Bridge/Vehicle.php
@@ -3,11 +3,10 @@
namespace DesignPatterns\Structural\Bridge;
/**
- * Abstraction
+ * Abstraction.
*/
abstract class Vehicle
{
-
protected $workShop1;
protected $workShop2;
diff --git a/Structural/Bridge/Workshop.php b/Structural/Bridge/Workshop.php
index dc62886..9cb26c5 100644
--- a/Structural/Bridge/Workshop.php
+++ b/Structural/Bridge/Workshop.php
@@ -3,10 +3,9 @@
namespace DesignPatterns\Structural\Bridge;
/**
- * Implementer
+ * Implementer.
*/
interface Workshop
{
-
public function work();
}
diff --git a/Structural/Composite/Form.php b/Structural/Composite/Form.php
index fbf3b50..42f1bc1 100644
--- a/Structural/Composite/Form.php
+++ b/Structural/Composite/Form.php
@@ -15,7 +15,7 @@ class Form extends FormElement
/**
* runs through all elements and calls render() on them, then returns the complete representation
- * of the form
+ * of the form.
*
* from the outside, one will not see this and the form will act like a single object instance
*
@@ -28,7 +28,7 @@ class Form extends FormElement
$formCode = '';
foreach ($this->elements as $element) {
- $formCode .= $element->render($indent + 1) . PHP_EOL;
+ $formCode .= $element->render($indent + 1).PHP_EOL;
}
return $formCode;
diff --git a/Structural/Composite/FormElement.php b/Structural/Composite/FormElement.php
index 8063c89..0055aee 100644
--- a/Structural/Composite/FormElement.php
+++ b/Structural/Composite/FormElement.php
@@ -3,12 +3,12 @@
namespace DesignPatterns\Structural\Composite;
/**
- * Class FormElement
+ * Class FormElement.
*/
abstract class FormElement
{
/**
- * renders the elements' code
+ * renders the elements' code.
*
* @param int $indent
*
diff --git a/Structural/Composite/InputElement.php b/Structural/Composite/InputElement.php
index 30d8615..19786d5 100644
--- a/Structural/Composite/InputElement.php
+++ b/Structural/Composite/InputElement.php
@@ -3,12 +3,12 @@
namespace DesignPatterns\Structural\Composite;
/**
- * Class InputElement
+ * Class InputElement.
*/
class InputElement extends FormElement
{
/**
- * renders the input element HTML
+ * renders the input element HTML.
*
* @param int $indent
*
@@ -16,6 +16,6 @@ class InputElement extends FormElement
*/
public function render($indent = 0)
{
- return str_repeat(' ', $indent) . '';
+ return str_repeat(' ', $indent).'';
}
}
diff --git a/Structural/Composite/README.md b/Structural/Composite/README.md
deleted file mode 100755
index f0ca01c..0000000
--- a/Structural/Composite/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Composite
-
-# Purpose
-
-To treat a group of objects the same way as a single instance of the object.
-
-# Examples
-
-* a form class instance handles all its form elements like a single instance of the form, when `render()` is called, it
- subsequently runs through all its child elements and calls `render()` on them
-* `Zend_Config`: a tree of configuration options, each one is a `Zend_Config` object itself
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Structural/Composite/README.rst b/Structural/Composite/README.rst
new file mode 100644
index 0000000..66d8f16
--- /dev/null
+++ b/Structural/Composite/README.rst
@@ -0,0 +1,65 @@
+`Composite`__
+=============
+
+Purpose
+-------
+
+To treat a group of objects the same way as a single instance of the
+object.
+
+Examples
+--------
+
+- a form class instance handles all its form elements like a single
+ instance of the form, when ``render()`` is called, it subsequently
+ runs through all its child elements and calls ``render()`` on them
+- ``Zend_Config``: a tree of configuration options, each one is a
+ ``Zend_Config`` object itself
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Composite UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+FormElement.php
+
+.. literalinclude:: FormElement.php
+ :language: php
+ :linenos:
+
+Form.php
+
+.. literalinclude:: Form.php
+ :language: php
+ :linenos:
+
+InputElement.php
+
+.. literalinclude:: InputElement.php
+ :language: php
+ :linenos:
+
+TextElement.php
+
+.. literalinclude:: TextElement.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/CompositeTest.php
+
+.. literalinclude:: Tests/CompositeTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/Composite
+.. __: http://en.wikipedia.org/wiki/Composite_pattern
diff --git a/Structural/Composite/Tests/CompositeTest.php b/Structural/Composite/Tests/CompositeTest.php
index 71aa98e..510a06b 100644
--- a/Structural/Composite/Tests/CompositeTest.php
+++ b/Structural/Composite/Tests/CompositeTest.php
@@ -1,15 +1,14 @@
1,
+ 'userid' => 1,
'username' => 'Odysseus',
- 'email' => 'Odysseus@ithaca.gr'
+ 'email' => 'Odysseus@ithaca.gr',
);
$rows = new \ArrayIterator(array($row));
$this->dbal->expects($this->once())
diff --git a/Structural/DataMapper/User.php b/Structural/DataMapper/User.php
index 78e60a8..8d8d2b2 100644
--- a/Structural/DataMapper/User.php
+++ b/Structural/DataMapper/User.php
@@ -3,12 +3,11 @@
namespace DesignPatterns\Structural\DataMapper;
/**
- * DataMapper pattern
+ * DataMapper pattern.
*
* This is our representation of a DataBase record in the memory (Entity)
*
* Validation would also go in this object
- *
*/
class User
{
diff --git a/Structural/DataMapper/UserMapper.php b/Structural/DataMapper/UserMapper.php
index 0ee5352..f147063 100644
--- a/Structural/DataMapper/UserMapper.php
+++ b/Structural/DataMapper/UserMapper.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Structural\DataMapper;
/**
- * class UserMapper
+ * class UserMapper.
*/
class UserMapper
{
@@ -21,19 +21,19 @@ class UserMapper
}
/**
- * saves a user object from memory to Database
+ * saves a user object from memory to Database.
*
* @param User $user
*
- * @return boolean
+ * @return bool
*/
public function save(User $user)
{
/* $data keys should correspond to valid Table columns on the Database */
$data = array(
- 'userid' => $user->getUserId(),
+ 'userid' => $user->getUserId(),
'username' => $user->getUsername(),
- 'email' => $user->getEmail(),
+ 'email' => $user->getEmail(),
);
/* if no ID specified create new user else update the one in the Database */
@@ -51,11 +51,12 @@ class UserMapper
/**
* finds a user from Database based on ID and returns a User object located
- * in memory
+ * in memory.
*
* @param int $id
*
* @throws \InvalidArgumentException
+ *
* @return User
*/
public function findById($id)
@@ -72,14 +73,14 @@ class UserMapper
/**
* fetches an array from Database and returns an array of User objects
- * located in memory
+ * located in memory.
*
* @return array
*/
public function findAll()
{
$resultSet = $this->adapter->findAll();
- $entries = array();
+ $entries = array();
foreach ($resultSet as $row) {
$entries[] = $this->mapObject($row);
@@ -89,7 +90,7 @@ class UserMapper
}
/**
- * Maps a table row to an object
+ * Maps a table row to an object.
*
* @param array $row
*
diff --git a/Structural/Decorator/Decorator.php b/Structural/Decorator/Decorator.php
index f6e377e..0b8fde3 100644
--- a/Structural/Decorator/Decorator.php
+++ b/Structural/Decorator/Decorator.php
@@ -9,7 +9,7 @@ namespace DesignPatterns\Structural\Decorator;
*/
/**
- * class Decorator
+ * class Decorator.
*/
abstract class Decorator implements RendererInterface
{
@@ -21,7 +21,7 @@ abstract class Decorator implements RendererInterface
/**
* You must type-hint the wrapped component :
* It ensures you can call renderData() in the subclasses !
- *
+ *
* @param RendererInterface $wrappable
*/
public function __construct(RendererInterface $wrappable)
diff --git a/Structural/Decorator/README.md b/Structural/Decorator/README.md
deleted file mode 100644
index 4eedd89..0000000
--- a/Structural/Decorator/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Decorator
-
-## Purpose
-
-To dynamically add new functionality to class instances.
-
-## Examples
-
-* Zend Framework: decorators for `Zend_Form_Element` instances
-* Web Service Layer: Decorators JSON and XML for a REST service (in this case, only one of these should be allowed of course)
-
-## UML Diagram
-
-
diff --git a/Structural/Decorator/README.rst b/Structural/Decorator/README.rst
new file mode 100644
index 0000000..b57a608
--- /dev/null
+++ b/Structural/Decorator/README.rst
@@ -0,0 +1,68 @@
+`Decorator`__
+=============
+
+Purpose
+-------
+
+To dynamically add new functionality to class instances.
+
+Examples
+--------
+
+- Zend Framework: decorators for ``Zend_Form_Element`` instances
+- Web Service Layer: Decorators JSON and XML for a REST service (in
+ this case, only one of these should be allowed of course)
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Decorator UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+RendererInterface.php
+
+.. literalinclude:: RendererInterface.php
+ :language: php
+ :linenos:
+
+Webservice.php
+
+.. literalinclude:: Webservice.php
+ :language: php
+ :linenos:
+
+Decorator.php
+
+.. literalinclude:: Decorator.php
+ :language: php
+ :linenos:
+
+RenderInXml.php
+
+.. literalinclude:: RenderInXml.php
+ :language: php
+ :linenos:
+
+RenderInJson.php
+
+.. literalinclude:: RenderInJson.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/DecoratorTest.php
+
+.. literalinclude:: Tests/DecoratorTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/Decorator
+.. __: http://en.wikipedia.org/wiki/Decorator_pattern
diff --git a/Structural/Decorator/RenderInJson.php b/Structural/Decorator/RenderInJson.php
index ebcc577..71943bd 100644
--- a/Structural/Decorator/RenderInJson.php
+++ b/Structural/Decorator/RenderInJson.php
@@ -3,12 +3,12 @@
namespace DesignPatterns\Structural\Decorator;
/**
- * Class RenderInJson
+ * Class RenderInJson.
*/
class RenderInJson extends Decorator
{
/**
- * render data as JSON
+ * render data as JSON.
*
* @return mixed|string
*/
diff --git a/Structural/Decorator/RenderInXml.php b/Structural/Decorator/RenderInXml.php
index f8e92a0..2eab7ca 100644
--- a/Structural/Decorator/RenderInXml.php
+++ b/Structural/Decorator/RenderInXml.php
@@ -3,12 +3,12 @@
namespace DesignPatterns\Structural\Decorator;
/**
- * Class RenderInXml
+ * Class RenderInXml.
*/
class RenderInXml extends Decorator
{
/**
- * render data as XML
+ * render data as XML.
*
* @return mixed|string
*/
diff --git a/Structural/Decorator/RendererInterface.php b/Structural/Decorator/RendererInterface.php
index 2957970..92b00ef 100644
--- a/Structural/Decorator/RendererInterface.php
+++ b/Structural/Decorator/RendererInterface.php
@@ -3,12 +3,12 @@
namespace DesignPatterns\Structural\Decorator;
/**
- * Class RendererInterface
+ * Class RendererInterface.
*/
interface RendererInterface
{
/**
- * render data
+ * render data.
*
* @return mixed
*/
diff --git a/Structural/Decorator/Tests/DecoratorTest.php b/Structural/Decorator/Tests/DecoratorTest.php
index a824625..689caf2 100644
--- a/Structural/Decorator/Tests/DecoratorTest.php
+++ b/Structural/Decorator/Tests/DecoratorTest.php
@@ -5,11 +5,10 @@ namespace DesignPatterns\Structural\Decorator\Tests;
use DesignPatterns\Structural\Decorator;
/**
- * DecoratorTest tests the decorator pattern
+ * DecoratorTest tests the decorator pattern.
*/
class DecoratorTest extends \PHPUnit_Framework_TestCase
{
-
protected $service;
protected function setUp()
@@ -27,7 +26,7 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase
public function testXmlDecorator()
{
- // Wrap service with a JSON decorator for renderers
+ // Wrap service with a XML decorator for renderers
$service = new Decorator\RenderInXml($this->service);
// Our Renderer will now output XML instead of an array
$xml = 'bar';
@@ -35,7 +34,7 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase
}
/**
- * The first key-point of this pattern :
+ * The first key-point of this pattern :.
*/
public function testDecoratorMustImplementsRenderer()
{
@@ -45,17 +44,32 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase
}
/**
- * Second key-point of this pattern : the decorator is type-hinted
- *
+ * Second key-point of this pattern : the decorator is type-hinted.
+ *
* @expectedException \PHPUnit_Framework_Error
*/
public function testDecoratorTypeHinted()
+ {
+ if (version_compare(PHP_VERSION, '7', '>=')) {
+ throw new \PHPUnit_Framework_Error('Skip test for PHP 7', 0, __FILE__, __LINE__);
+ }
+
+ $this->getMockForAbstractClass('DesignPatterns\Structural\Decorator\Decorator', array(new \stdClass()));
+ }
+
+ /**
+ * Second key-point of this pattern : the decorator is type-hinted.
+ *
+ * @requires PHP 7
+ * @expectedException TypeError
+ */
+ public function testDecoratorTypeHintedForPhp7()
{
$this->getMockForAbstractClass('DesignPatterns\Structural\Decorator\Decorator', array(new \stdClass()));
}
/**
- * The decorator implements and wraps the same interface
+ * The decorator implements and wraps the same interface.
*/
public function testDecoratorOnlyAcceptRenderer()
{
diff --git a/Structural/Decorator/Webservice.php b/Structural/Decorator/Webservice.php
index e6bf306..e2bcc69 100644
--- a/Structural/Decorator/Webservice.php
+++ b/Structural/Decorator/Webservice.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Structural\Decorator;
/**
- * Class Webservice
+ * Class Webservice.
*/
class Webservice implements RendererInterface
{
diff --git a/Structural/DependencyInjection/AbstractConfig.php b/Structural/DependencyInjection/AbstractConfig.php
index 85e5245..f2da4dc 100644
--- a/Structural/DependencyInjection/AbstractConfig.php
+++ b/Structural/DependencyInjection/AbstractConfig.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Structural\DependencyInjection;
/**
- * class AbstractConfig
+ * class AbstractConfig.
*/
abstract class AbstractConfig
{
diff --git a/Structural/DependencyInjection/ArrayConfig.php b/Structural/DependencyInjection/ArrayConfig.php
index 91bca33..f26c089 100644
--- a/Structural/DependencyInjection/ArrayConfig.php
+++ b/Structural/DependencyInjection/ArrayConfig.php
@@ -3,17 +3,18 @@
namespace DesignPatterns\Structural\DependencyInjection;
/**
- * class ArrayConfig
+ * class ArrayConfig.
*
* uses array as data source
*/
class ArrayConfig extends AbstractConfig implements Parameters
{
/**
- * Get parameter
+ * Get parameter.
*
* @param string|int $key
- * @param null $default
+ * @param null $default
+ *
* @return mixed
*/
public function get($key, $default = null)
@@ -21,14 +22,15 @@ class ArrayConfig extends AbstractConfig implements Parameters
if (isset($this->storage[$key])) {
return $this->storage[$key];
}
+
return $default;
}
/**
- * Set parameter
+ * Set parameter.
*
* @param string|int $key
- * @param mixed $value
+ * @param mixed $value
*/
public function set($key, $value)
{
diff --git a/Structural/DependencyInjection/Connection.php b/Structural/DependencyInjection/Connection.php
index 9e131c2..d389089 100644
--- a/Structural/DependencyInjection/Connection.php
+++ b/Structural/DependencyInjection/Connection.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Structural\DependencyInjection;
/**
- * Class Connection
+ * Class Connection.
*/
class Connection
{
@@ -26,7 +26,7 @@ class Connection
}
/**
- * connection using the injected config
+ * connection using the injected config.
*/
public function connect()
{
@@ -42,6 +42,7 @@ class Connection
*
* @return string
*/
+
public function getHost()
{
return $this->host;
diff --git a/Structural/DependencyInjection/Parameters.php b/Structural/DependencyInjection/Parameters.php
index dabe895..c49f4c7 100644
--- a/Structural/DependencyInjection/Parameters.php
+++ b/Structural/DependencyInjection/Parameters.php
@@ -3,12 +3,12 @@
namespace DesignPatterns\Structural\DependencyInjection;
/**
- * Parameters interface
+ * Parameters interface.
*/
interface Parameters
{
/**
- * Get parameter
+ * Get parameter.
*
* @param string|int $key
*
@@ -17,7 +17,7 @@ interface Parameters
public function get($key);
/**
- * Set parameter
+ * Set parameter.
*
* @param string|int $key
* @param mixed $value
diff --git a/Structural/DependencyInjection/README.md b/Structural/DependencyInjection/README.md
deleted file mode 100644
index 185a550..0000000
--- a/Structural/DependencyInjection/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# Dependency Injection
-
-## Purpose
-
-To implement a loosely coupled architecture in order to get better testable, maintainable and extendable code.
-
-## Usage
-
-Configuration gets injected and `Connection` will get all that it needs from `$config`. Without DI, the configuration would be created directly in `Connection`, which is not very good for testing and extending `Connection`.
-
-Notice we are following Inversion of control principle in `Connection` by asking `$config` to implement `Parameters` interface. This decouples our components. We don't care where the source of information comes from, we only care that `$config` has certain methods to retrieve that information. Read more about Inversion of control [here](http://en.wikipedia.org/wiki/Inversion_of_control).
-
-## Examples
-
-* The Doctrine2 ORM uses dependency injection e.g. for configuration that is injected into a `Connection` object. For testing purposes, one can easily create a mock object of the configuration and inject that into the `Connection` object
-* Symfony and Zend Framework 2 already have containers for DI that create objects via a configuration array and inject them where needed (i.e. in Controllers)
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Structural/DependencyInjection/README.rst b/Structural/DependencyInjection/README.rst
new file mode 100644
index 0000000..7e979b5
--- /dev/null
+++ b/Structural/DependencyInjection/README.rst
@@ -0,0 +1,88 @@
+`Dependency Injection`__
+========================
+
+Purpose
+-------
+
+To implement a loosely coupled architecture in order to get better
+testable, maintainable and extendable code.
+
+Usage
+-----
+
+Configuration gets injected and ``Connection`` will get all that it
+needs from ``$config``. Without DI, the configuration would be created
+directly in ``Connection``, which is not very good for testing and
+extending ``Connection``.
+
+Notice we are following Inversion of control principle in ``Connection``
+by asking ``$config`` to implement ``Parameters`` interface. This
+decouples our components. We don't care where the source of information
+comes from, we only care that ``$config`` has certain methods to
+retrieve that information. Read more about Inversion of control
+`here `__.
+
+Examples
+--------
+
+- The Doctrine2 ORM uses dependency injection e.g. for configuration
+ that is injected into a ``Connection`` object. For testing purposes,
+ one can easily create a mock object of the configuration and inject
+ that into the ``Connection`` object
+- Symfony and Zend Framework 2 already have containers for DI that
+ create objects via a configuration array and inject them where needed
+ (i.e. in Controllers)
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt DependencyInjection UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+AbstractConfig.php
+
+.. literalinclude:: AbstractConfig.php
+ :language: php
+ :linenos:
+
+Parameters.php
+
+.. literalinclude:: Parameters.php
+ :language: php
+ :linenos:
+
+ArrayConfig.php
+
+.. literalinclude:: ArrayConfig.php
+ :language: php
+ :linenos:
+
+Connection.php
+
+.. literalinclude:: Connection.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/DependencyInjectionTest.php
+
+.. literalinclude:: Tests/DependencyInjectionTest.php
+ :language: php
+ :linenos:
+
+Tests/config.php
+
+.. literalinclude:: Tests/config.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/DependencyInjection
+.. __: http://en.wikipedia.org/wiki/Dependency_injection
diff --git a/Structural/Facade/BiosInterface.php b/Structural/Facade/BiosInterface.php
index 869dcd9..8f1aa01 100644
--- a/Structural/Facade/BiosInterface.php
+++ b/Structural/Facade/BiosInterface.php
@@ -3,29 +3,29 @@
namespace DesignPatterns\Structural\Facade;
/**
- * Class BiosInterface
+ * Interface BiosInterface.
*/
interface BiosInterface
{
/**
- * execute the BIOS
+ * Execute the BIOS.
*/
public function execute();
/**
- * wait for halt
+ * Wait for halt.
*/
public function waitForKeyPress();
/**
- * launches the OS
+ * Launches the OS.
*
* @param OsInterface $os
*/
public function launch(OsInterface $os);
/**
- * power down BIOS
+ * Power down BIOS.
*/
public function powerDown();
}
diff --git a/Structural/Facade/Facade.php b/Structural/Facade/Facade.php
index d40d412..43d1bcb 100644
--- a/Structural/Facade/Facade.php
+++ b/Structural/Facade/Facade.php
@@ -3,8 +3,7 @@
namespace DesignPatterns\Structural\Facade;
/**
- *
- *
+ * Class Facade.
*/
class Facade
{
@@ -20,7 +19,7 @@ class Facade
/**
* This is the perfect time to use a dependency injection container
- * to create an instance of this class
+ * to create an instance of this class.
*
* @param BiosInterface $bios
* @param OsInterface $os
@@ -32,7 +31,7 @@ class Facade
}
/**
- * turn on the system
+ * Turn on the system.
*/
public function turnOn()
{
@@ -42,7 +41,7 @@ class Facade
}
/**
- * turn off the system
+ * Turn off the system.
*/
public function turnOff()
{
diff --git a/Structural/Facade/OsInterface.php b/Structural/Facade/OsInterface.php
index 3b09eb1..d8171e4 100644
--- a/Structural/Facade/OsInterface.php
+++ b/Structural/Facade/OsInterface.php
@@ -3,12 +3,12 @@
namespace DesignPatterns\Structural\Facade;
/**
- * Class OsInterface
+ * Interface OsInterface.
*/
interface OsInterface
{
/**
- * halt the OS
+ * Halt the OS.
*/
public function halt();
}
diff --git a/Structural/Facade/README.md b/Structural/Facade/README.md
deleted file mode 100644
index 4a9019c..0000000
--- a/Structural/Facade/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# Facade
-
-## Purpose
-
-The primary goal of a Facade Pattern is not to avoid you to read the manual of a complex API. It's only a side-effect.
-The first goal is to reduce coupling and follow the Law of Demeter.
-
-A Facade is meant to decouple a client and a sub-system by embedding many (but sometimes just one) interface, and of course to reduce complexity.
-
-* A facade does not forbid you the access to the sub-system
-* You can (you should) have multiple facades for one sub-system
-
-That's why a good facade has no `new` in it. If there are multiple creations for each method, it is not a Facade, it's a Builder or a
-[Abstract|Static|Simple] Factory [Method].
-
-The best facade has no `new` and a constructor with interface-type-hinted parameters.
-If you need creation of new instances, use a Factory as argument.
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Structural/Facade/README.rst b/Structural/Facade/README.rst
new file mode 100644
index 0000000..da20b13
--- /dev/null
+++ b/Structural/Facade/README.rst
@@ -0,0 +1,66 @@
+`Facade`__
+==========
+
+Purpose
+-------
+
+The primary goal of a Facade Pattern is not to avoid you to read the
+manual of a complex API. It's only a side-effect. The first goal is to
+reduce coupling and follow the Law of Demeter.
+
+A Facade is meant to decouple a client and a sub-system by embedding
+many (but sometimes just one) interface, and of course to reduce
+complexity.
+
+- A facade does not forbid you the access to the sub-system
+- You can (you should) have multiple facades for one sub-system
+
+That's why a good facade has no ``new`` in it. If there are multiple
+creations for each method, it is not a Facade, it's a Builder or a
+[Abstract\|Static\|Simple] Factory [Method].
+
+The best facade has no ``new`` and a constructor with
+interface-type-hinted parameters. If you need creation of new instances,
+use a Factory as argument.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Facade UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Facade.php
+
+.. literalinclude:: Facade.php
+ :language: php
+ :linenos:
+
+OsInterface.php
+
+.. literalinclude:: OsInterface.php
+ :language: php
+ :linenos:
+
+BiosInterface.php
+
+.. literalinclude:: BiosInterface.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/FacadeTest.php
+
+.. literalinclude:: Tests/FacadeTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/Facade
+.. __: http://en.wikipedia.org/wiki/Facade_pattern
diff --git a/Structural/Facade/Tests/FacadeTest.php b/Structural/Facade/Tests/FacadeTest.php
index eccb9be..0f1ea10 100644
--- a/Structural/Facade/Tests/FacadeTest.php
+++ b/Structural/Facade/Tests/FacadeTest.php
@@ -3,13 +3,13 @@
namespace DesignPatterns\Structural\Facade\Tests;
use DesignPatterns\Structural\Facade\Facade as Computer;
+use DesignPatterns\Structural\Facade\OsInterface;
/**
- * FacadeTest shows example of facades
+ * FacadeTest shows example of facades.
*/
class FacadeTest extends \PHPUnit_Framework_TestCase
{
-
public function getComputer()
{
$bios = $this->getMockBuilder('DesignPatterns\Structural\Facade\BiosInterface')
@@ -29,13 +29,16 @@ class FacadeTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue('Linux'));
$facade = new Computer($bios, $operatingSys);
+
return array(array($facade, $operatingSys));
}
/**
+ * @param Computer $facade
+ * @param OsInterface $os
* @dataProvider getComputer
*/
- public function testComputerOn(Computer $facade, $os)
+ public function testComputerOn(Computer $facade, OsInterface $os)
{
// interface is simpler :
$facade->turnOn();
diff --git a/Structural/FluentInterface/README.md b/Structural/FluentInterface/README.md
deleted file mode 100644
index 2ed92d3..0000000
--- a/Structural/FluentInterface/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Fluent Interface
-
-## Purpose
-
-To write code that is easy readable just like sentences in a natural language (like English).
-
-## Examples
-
-* Doctrine2's QueryBuilder works something like that example class below
-* PHPUnit uses fluent interfaces to build mock objects
-* Yii Framework: CDbCommand and CActiveRecord use this pattern, too
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Structural/FluentInterface/README.rst b/Structural/FluentInterface/README.rst
new file mode 100644
index 0000000..2fcef3b
--- /dev/null
+++ b/Structural/FluentInterface/README.rst
@@ -0,0 +1,46 @@
+`Fluent Interface`__
+====================
+
+Purpose
+-------
+
+To write code that is easy readable just like sentences in a natural
+language (like English).
+
+Examples
+--------
+
+- Doctrine2's QueryBuilder works something like that example class
+ below
+- PHPUnit uses fluent interfaces to build mock objects
+- Yii Framework: CDbCommand and CActiveRecord use this pattern, too
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt FluentInterface UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Sql.php
+
+.. literalinclude:: Sql.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/FluentInterfaceTest.php
+
+.. literalinclude:: Tests/FluentInterfaceTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/FluentInterface
+.. __: http://en.wikipedia.org/wiki/Fluent_interface
\ No newline at end of file
diff --git a/Structural/FluentInterface/Sql.php b/Structural/FluentInterface/Sql.php
index 3afd300..58ba491 100644
--- a/Structural/FluentInterface/Sql.php
+++ b/Structural/FluentInterface/Sql.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Structural\FluentInterface;
/**
- * class SQL
+ * class SQL.
*/
class Sql
{
@@ -23,7 +23,7 @@ class Sql
protected $where = array();
/**
- * adds select fields
+ * adds select fields.
*
* @param array $fields
*
@@ -37,7 +37,7 @@ class Sql
}
/**
- * adds a FROM clause
+ * adds a FROM clause.
*
* @param string $table
* @param string $alias
@@ -46,13 +46,13 @@ class Sql
*/
public function from($table, $alias)
{
- $this->from[] = $table . ' AS ' . $alias;
+ $this->from[] = $table.' AS '.$alias;
return $this;
}
/**
- * adds a WHERE condition
+ * adds a WHERE condition.
*
* @param string $condition
*
@@ -66,15 +66,15 @@ class Sql
}
/**
- * Gets the query, just an example of building a query,
- * no check on consistency
+ * Gets the query, just an example of building a query,
+ * no check on consistency.
*
* @return string
*/
public function getQuery()
{
- return 'SELECT ' . implode(',', $this->fields)
- . ' FROM ' . implode(',', $this->from)
- . ' WHERE ' . implode(' AND ', $this->where);
+ return 'SELECT '.implode(',', $this->fields)
+ .' FROM '.implode(',', $this->from)
+ .' WHERE '.implode(' AND ', $this->where);
}
}
diff --git a/Structural/FluentInterface/Tests/FluentInterfaceTest.php b/Structural/FluentInterface/Tests/FluentInterfaceTest.php
index 98ea99d..ae4e656 100644
--- a/Structural/FluentInterface/Tests/FluentInterfaceTest.php
+++ b/Structural/FluentInterface/Tests/FluentInterfaceTest.php
@@ -5,11 +5,10 @@ namespace DesignPatterns\Structural\FluentInterface\Tests;
use DesignPatterns\Structural\FluentInterface\Sql;
/**
- * FluentInterfaceTest tests the fluent interface SQL
+ * FluentInterfaceTest tests the fluent interface SQL.
*/
class FluentInterfaceTest extends \PHPUnit_Framework_TestCase
{
-
public function testBuildSQL()
{
$instance = new Sql();
diff --git a/Structural/Proxy/README.md b/Structural/Proxy/README.md
deleted file mode 100644
index b4c0e39..0000000
--- a/Structural/Proxy/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Proxy
-
-## Purpose
-
-To interface to anything that is expensive or impossible to duplicate.
-
-## Examples
-
-* Doctrine2 uses proxies to implement framework magic (e.g. lazy initialization) in them, while the user still works with his own entity classes and will never use nor touch the proxies
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Structural/Proxy/README.rst b/Structural/Proxy/README.rst
new file mode 100644
index 0000000..e65475b
--- /dev/null
+++ b/Structural/Proxy/README.rst
@@ -0,0 +1,44 @@
+`Proxy`__
+=========
+
+Purpose
+-------
+
+To interface to anything that is expensive or impossible to duplicate.
+
+Examples
+--------
+
+- Doctrine2 uses proxies to implement framework magic (e.g. lazy
+ initialization) in them, while the user still works with his own
+ entity classes and will never use nor touch the proxies
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Proxy UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Record.php
+
+.. literalinclude:: Record.php
+ :language: php
+ :linenos:
+
+RecordProxy.php
+
+.. literalinclude:: RecordProxy.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/Proxy
+.. __: http://en.wikipedia.org/wiki/Proxy_pattern
diff --git a/Structural/Proxy/Record.php b/Structural/Proxy/Record.php
index 38481aa..7ae4a3c 100644
--- a/Structural/Proxy/Record.php
+++ b/Structural/Proxy/Record.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Structural\Proxy;
/**
- * class Record
+ * class Record.
*/
class Record
{
@@ -21,7 +21,7 @@ class Record
}
/**
- * magic setter
+ * magic setter.
*
* @param string $name
* @param mixed $value
@@ -34,7 +34,7 @@ class Record
}
/**
- * magic getter
+ * magic getter.
*
* @param string $name
*
@@ -45,7 +45,7 @@ class Record
if (array_key_exists($name, $this->data)) {
return $this->data[(string) $name];
} else {
- return null;
+ return;
}
}
}
diff --git a/Structural/Proxy/RecordProxy.php b/Structural/Proxy/RecordProxy.php
index 1f68cff..f8c78a8 100644
--- a/Structural/Proxy/RecordProxy.php
+++ b/Structural/Proxy/RecordProxy.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Structural\Proxy;
/**
- * Class RecordProxy
+ * Class RecordProxy.
*/
class RecordProxy extends Record
{
@@ -35,7 +35,7 @@ class RecordProxy extends Record
}
/**
- * magic setter
+ * magic setter.
*
* @param string $name
* @param mixed $value
diff --git a/Structural/README.rst b/Structural/README.rst
new file mode 100644
index 0000000..fcf7c58
--- /dev/null
+++ b/Structural/README.rst
@@ -0,0 +1,22 @@
+`Structural`__
+==============
+
+In Software Engineering, Structural Design Patterns are Design Patterns
+that ease the design by identifying a simple way to realize
+relationships between entities.
+
+.. toctree::
+ :titlesonly:
+
+ Adapter/README
+ Bridge/README
+ Composite/README
+ DataMapper/README
+ Decorator/README
+ DependencyInjection/README
+ Facade/README
+ FluentInterface/README
+ Proxy/README
+ Registry/README
+
+.. __: http://en.wikipedia.org/wiki/Structural_pattern
\ No newline at end of file
diff --git a/Structural/Registry/README.md b/Structural/Registry/README.md
deleted file mode 100644
index 840d2cf..0000000
--- a/Structural/Registry/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Registry
-
-## Purpose
-
-To implement a central storage for objects often used throughout the application, is typically implemented using
-an abstract class with only static methods (or using the Singleton pattern)
-
-## Examples
-
-* Zend Framework: `Zend_Registry` holds the application's logger object, front controller etc.
-* Yii Framework: `CWebApplication` holds all the application components, such as `CWebUser`, `CUrlManager`, etc.
-
-## UML Diagram
-
-
\ No newline at end of file
diff --git a/Structural/Registry/README.rst b/Structural/Registry/README.rst
new file mode 100644
index 0000000..8a92604
--- /dev/null
+++ b/Structural/Registry/README.rst
@@ -0,0 +1,47 @@
+`Registry`__
+============
+
+Purpose
+-------
+
+To implement a central storage for objects often used throughout the
+application, is typically implemented using an abstract class with only
+static methods (or using the Singleton pattern)
+
+Examples
+--------
+
+- Zend Framework 1: ``Zend_Registry`` holds the application's logger
+ object, front controller etc.
+- Yii Framework: ``CWebApplication`` holds all the application
+ components, such as ``CWebUser``, ``CUrlManager``, etc.
+
+UML Diagram
+-----------
+
+.. image:: uml/uml.png
+ :alt: Alt Registry UML Diagram
+ :align: center
+
+Code
+----
+
+You can also find these code on `GitHub`_
+
+Registry.php
+
+.. literalinclude:: Registry.php
+ :language: php
+ :linenos:
+
+Test
+----
+
+Tests/RegistryTest.php
+
+.. literalinclude:: Tests/RegistryTest.php
+ :language: php
+ :linenos:
+
+.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/Registry
+.. __: http://en.wikipedia.org/wiki/Service_locator_pattern
diff --git a/Structural/Registry/Registry.php b/Structural/Registry/Registry.php
index d1c6b13..e40d0c3 100644
--- a/Structural/Registry/Registry.php
+++ b/Structural/Registry/Registry.php
@@ -3,7 +3,7 @@
namespace DesignPatterns\Structural\Registry;
/**
- * class Registry
+ * class Registry.
*/
abstract class Registry
{
@@ -15,12 +15,13 @@ abstract class Registry
protected static $storedValues = array();
/**
- * sets a value
+ * sets a value.
*
* @param string $key
* @param mixed $value
*
* @static
+ *
* @return void
*/
public static function set($key, $value)
@@ -29,11 +30,12 @@ abstract class Registry
}
/**
- * gets a value from the registry
+ * gets a value from the registry.
*
* @param string $key
*
* @static
+ *
* @return mixed
*/
public static function get($key)
diff --git a/Structural/Registry/Tests/RegistryTest.php b/Structural/Registry/Tests/RegistryTest.php
index 64685d4..9561abe 100644
--- a/Structural/Registry/Tests/RegistryTest.php
+++ b/Structural/Registry/Tests/RegistryTest.php
@@ -6,12 +6,15 @@ use DesignPatterns\Structural\Registry\Registry;
class RegistryTest extends \PHPUnit_Framework_TestCase
{
-
public function testSetAndGetLogger()
{
- Registry::set(Registry::LOGGER, new \StdClass());
+ $key = Registry::LOGGER;
+ $object = new \StdClass();
- $logger = Registry::get(Registry::LOGGER);
- $this->assertInstanceOf('StdClass', $logger);
+ Registry::set($key, $object);
+ $actual = Registry::get($key);
+
+ $this->assertEquals($object, $actual);
+ $this->assertInstanceOf('StdClass', $actual);
}
}
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100755
index 0000000..30f924c
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,59 @@
+##################################################
+# Generated by phansible.com
+##################################################
+
+#If your Vagrant version is lower than 1.5, you can still use this provisioning
+#by commenting or removing the line below and providing the config.vm.box_url parameter,
+#if it's not already defined in this Vagrantfile. Keep in mind that you won't be able
+#to use the Vagrant Cloud and other newer Vagrant features.
+Vagrant.require_version ">= 1.5"
+
+# Check to determine whether we're on a windows or linux/os-x host,
+# later on we use this to launch ansible in the supported way
+# source: https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
+def which(cmd)
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
+ exts.each { |ext|
+ exe = File.join(path, "#{cmd}#{ext}")
+ return exe if File.executable? exe
+ }
+ end
+ return nil
+end
+Vagrant.configure("2") do |config|
+
+ config.vm.provider :virtualbox do |v|
+ v.name = "design-patterns"
+ v.customize [
+ "modifyvm", :id,
+ "--name", "design-patterns",
+ "--memory", 512,
+ "--natdnshostresolver1", "on",
+ "--cpus", 1,
+ ]
+ end
+
+ config.vm.box = "ubuntu/trusty64"
+
+ config.vm.network :private_network, ip: "192.168.11.2"
+ config.ssh.forward_agent = true
+
+ #############################################################
+ # Ansible provisioning (you need to have ansible installed)
+ #############################################################
+
+
+ if which('ansible-playbook')
+ config.vm.provision "ansible" do |ansible|
+ ansible.playbook = "ansible/playbook.yml"
+ ansible.inventory_path = "ansible/inventories/dev"
+ ansible.limit = 'all'
+ end
+ else
+ config.vm.provision :shell, path: "ansible/windows.sh", args: ["default"]
+ end
+
+
+ config.vm.synced_folder "./", "/vagrant", type: "nfs"
+end
diff --git a/ansible/inventories/dev b/ansible/inventories/dev
new file mode 100755
index 0000000..86d8f3b
--- /dev/null
+++ b/ansible/inventories/dev
@@ -0,0 +1,2 @@
+[phansible-web]
+192.168.11.2
diff --git a/ansible/playbook.yml b/ansible/playbook.yml
new file mode 100755
index 0000000..33e3fda
--- /dev/null
+++ b/ansible/playbook.yml
@@ -0,0 +1,11 @@
+---
+- hosts: all
+ sudo: true
+ vars_files:
+ - vars/all.yml
+ roles:
+ - server
+ - vagrant_local
+ - php
+ - xdebug
+ - app
diff --git a/ansible/roles/app/tasks/main.yml b/ansible/roles/app/tasks/main.yml
new file mode 100755
index 0000000..c330e48
--- /dev/null
+++ b/ansible/roles/app/tasks/main.yml
@@ -0,0 +1,5 @@
+---
+# application tasks to be customized and to run after the main provision
+- name: update file db
+ sudo: yes
+ shell: updatedb
diff --git a/ansible/roles/php/tasks/configure.yml b/ansible/roles/php/tasks/configure.yml
new file mode 100755
index 0000000..1b093e7
--- /dev/null
+++ b/ansible/roles/php/tasks/configure.yml
@@ -0,0 +1,6 @@
+---
+- stat: path=/etc/php5/cli/php.ini
+ register: phpcli
+
+- include: php-cli.yml
+ when: phpcli.stat.exists
diff --git a/ansible/roles/php/tasks/main.yml b/ansible/roles/php/tasks/main.yml
new file mode 100755
index 0000000..38f2f78
--- /dev/null
+++ b/ansible/roles/php/tasks/main.yml
@@ -0,0 +1,20 @@
+---
+- name: Add ppa Repository
+ sudo: yes
+ apt_repository: repo=ppa:ondrej/{{ php.ppa }}
+
+- name: Update apt
+ sudo: yes
+ apt: update_cache=yes
+
+- name: Install php5
+ sudo: yes
+ apt: pkg=php5 state=latest
+
+- name: Install PHP Packages
+ sudo: yes
+ apt: pkg={{ item }} state=latest
+ with_items: php.packages
+ when: php.packages is defined
+
+- include: configure.yml
diff --git a/ansible/roles/php/tasks/php-cli.yml b/ansible/roles/php/tasks/php-cli.yml
new file mode 100755
index 0000000..e1cfffa
--- /dev/null
+++ b/ansible/roles/php/tasks/php-cli.yml
@@ -0,0 +1,10 @@
+---
+- name: ensure timezone is set in cli php.ini
+ lineinfile: dest=/etc/php5/cli/php.ini
+ regexp='date.timezone ='
+ line='date.timezone = {{ server.timezone }}'
+
+- name: enabling opcache cli
+ lineinfile: dest=/etc/php5/cli/php.ini
+ regexp=';opcache.enable_cli=0'
+ line='opcache.enable_cli=1'
diff --git a/ansible/roles/server/tasks/main.yml b/ansible/roles/server/tasks/main.yml
new file mode 100755
index 0000000..f1ffc08
--- /dev/null
+++ b/ansible/roles/server/tasks/main.yml
@@ -0,0 +1,31 @@
+---
+- name: Update apt
+ sudo: yes
+ apt: update_cache=yes
+
+- name: Install System Packages
+ sudo: yes
+ apt: pkg={{ item }} state=latest
+ with_items:
+ - curl
+ - wget
+ - python-software-properties
+
+- name: Install Extra Packages
+ sudo: yes
+ apt: pkg={{ item }} state=latest
+ with_items: server.packages
+ when: server.packages is defined
+
+- name: Configure the timezone
+ sudo: yes
+ template: src=timezone.tpl dest=/etc/timezone
+
+- name: More Configure the timezone
+ sudo: yes
+ file: src=/usr/share/zoneinfo/{{server.timezone}} dest=/etc/localtime state=link force=yes backup=yes
+
+- name: Set default system language pack
+ shell: locale-gen {{server.locale}}
+ sudo: yes
+
diff --git a/ansible/roles/server/templates/timezone.tpl b/ansible/roles/server/templates/timezone.tpl
new file mode 100755
index 0000000..cca2365
--- /dev/null
+++ b/ansible/roles/server/templates/timezone.tpl
@@ -0,0 +1 @@
+{{server.timezone}}
diff --git a/ansible/roles/vagrant_local/tasks/main.yml b/ansible/roles/vagrant_local/tasks/main.yml
new file mode 100755
index 0000000..cd53609
--- /dev/null
+++ b/ansible/roles/vagrant_local/tasks/main.yml
@@ -0,0 +1,11 @@
+---
+- name: Set the hostname in /etc/hostname
+ shell: echo {{ vagrant_local.vm.hostname }} > /etc/hostname
+ when: vagrant_local.vm.hostname is defined
+
+- name: Set the hostname
+ shell: hostname {{ vagrant_local.vm.hostname }}
+ when: vagrant_local.vm.hostname is defined
+
+- name: Update /etc/hosts
+ lineinfile: dest=/etc/hosts regexp='^127\.0\.0\.1' line='127.0.0.1 localhost {{ vagrant_local.vm.hostname }}' owner=root group=root mode=0644
diff --git a/ansible/roles/xdebug/defaults/main.yml b/ansible/roles/xdebug/defaults/main.yml
new file mode 100755
index 0000000..f2d917e
--- /dev/null
+++ b/ansible/roles/xdebug/defaults/main.yml
@@ -0,0 +1,7 @@
+---
+xdebug:
+ settings:
+ - xdebug.remote_enable=1
+ - xdebug.idekey=PHPSTORM
+ - xdebug.remote_connect_back=1
+ - xdebug.remote_port=9000
diff --git a/ansible/roles/xdebug/tasks/main.yml b/ansible/roles/xdebug/tasks/main.yml
new file mode 100755
index 0000000..e38815d
--- /dev/null
+++ b/ansible/roles/xdebug/tasks/main.yml
@@ -0,0 +1,4 @@
+---
+- name: Install xDebug
+ sudo: yes
+ apt: pkg=php5-xdebug state=latest
diff --git a/ansible/vars/all.yml b/ansible/vars/all.yml
new file mode 100755
index 0000000..b5559e6
--- /dev/null
+++ b/ansible/vars/all.yml
@@ -0,0 +1,15 @@
+---
+server:
+ install: '1'
+ packages: [vim, htop, iotop, bwm-ng]
+ timezone: UTC
+ locale: en_US.UTF-8
+vagrant_local:
+ install: '1'
+ vm: { base_box: trusty64, hostname: design-patterns, ip: 192.168.11.2, sharedfolder: ./, enableWindows: '1', useVagrantCloud: '1', syncType: nfs }
+php:
+ install: '1'
+ ppa: php5-5.6
+ packages: [php5-cli, php5-intl, php5-mcrypt, php5-mysql, php5-curl, php5-json]
+xdebug:
+ install: '1'
diff --git a/ansible/windows.sh b/ansible/windows.sh
new file mode 100755
index 0000000..eab5d9a
--- /dev/null
+++ b/ansible/windows.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+# Update Repositories
+sudo apt-get update
+
+# Determine Ubuntu Version
+. /etc/lsb-release
+
+# Decide on package to install for `add-apt-repository` command
+#
+# USE_COMMON=1 when using a distribution over 12.04
+# USE_COMMON=0 when using a distribution at 12.04 or older
+USE_COMMON=$(echo "$DISTRIB_RELEASE > 12.04" | bc)
+
+if [ "$USE_COMMON" -eq "1" ];
+then
+ sudo apt-get install -y software-properties-common
+else
+ sudo apt-get install -y python-software-properties
+fi
+
+# Add Ansible Repository & Install Ansible
+sudo add-apt-repository -y ppa:ansible/ansible
+sudo apt-get update
+sudo apt-get install -y ansible
+
+# Setup Ansible for Local Use and Run
+cp /vagrant/ansible/inventories/dev /etc/ansible/hosts -f
+chmod 666 /etc/ansible/hosts
+cat /vagrant/ansible/files/authorized_keys >> /home/vagrant/.ssh/authorized_keys
+sudo ansible-playbook /vagrant/ansible/playbook.yml -e hostname=$1 --connection=local
\ No newline at end of file
diff --git a/composer.json b/composer.json
index a857431..71610e4 100644
--- a/composer.json
+++ b/composer.json
@@ -9,7 +9,7 @@
],
"minimum-stability": "stable",
"require-dev": {
- "phpunit/phpunit": "3.7.*",
+ "phpunit/phpunit": "^4.6",
"squizlabs/php_codesniffer": "1.5.*"
},
"autoload": {
diff --git a/composer.lock b/composer.lock
index 3d44d0c..202b73e 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1,55 +1,219 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
- "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
- ],
- "hash": "5fb4edd1df6d1229395f973b68675bfe",
- "packages": [
-
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "This file is @generated automatically"
],
+ "hash": "ccc9bc820717ca4dc310248ad4a69f21",
+ "content-hash": "f9ca7d34db86fa55e8dc649f84d8b4c7",
+ "packages": [],
"packages-dev": [
{
- "name": "phpunit/php-code-coverage",
- "version": "1.2.13",
+ "name": "doctrine/instantiator",
+ "version": "1.0.5",
"source": {
"type": "git",
- "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94"
+ "url": "https://github.com/doctrine/instantiator.git",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/466e7cd2554b4e264c9e3f31216d25ac0e5f3d94",
- "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
"shasum": ""
},
"require": {
- "php": ">=5.3.3",
- "phpunit/php-file-iterator": ">=1.3.0@stable",
- "phpunit/php-text-template": ">=1.1.1@stable",
- "phpunit/php-token-stream": ">=1.1.3@stable"
+ "php": ">=5.3,<8.0-DEV"
},
"require-dev": {
- "phpunit/phpunit": "3.7.*@dev"
- },
- "suggest": {
- "ext-dom": "*",
- "ext-xdebug": ">=2.0.5"
+ "athletic/athletic": "~0.1.8",
+ "ext-pdo": "*",
+ "ext-phar": "*",
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.2.x-dev"
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "homepage": "http://ocramius.github.com/"
+ }
+ ],
+ "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
+ "homepage": "https://github.com/doctrine/instantiator",
+ "keywords": [
+ "constructor",
+ "instantiate"
+ ],
+ "time": "2015-06-14 21:17:01"
+ },
+ {
+ "name": "phpdocumentor/reflection-docblock",
+ "version": "2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
+ "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "suggest": {
+ "dflydev/markdown": "~1.0",
+ "erusev/parsedown": "~1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "phpDocumentor": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "mike.vanriel@naenius.com"
+ }
+ ],
+ "time": "2015-02-03 12:10:50"
+ },
+ {
+ "name": "phpspec/prophecy",
+ "version": "v1.5.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpspec/prophecy.git",
+ "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7",
+ "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "phpdocumentor/reflection-docblock": "~2.0",
+ "sebastian/comparator": "~1.1"
+ },
+ "require-dev": {
+ "phpspec/phpspec": "~2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Prophecy\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Konstantin Kudryashov",
+ "email": "ever.zet@gmail.com",
+ "homepage": "http://everzet.com"
+ },
+ {
+ "name": "Marcello Duarte",
+ "email": "marcello.duarte@gmail.com"
+ }
+ ],
+ "description": "Highly opinionated mocking framework for PHP 5.3+",
+ "homepage": "https://github.com/phpspec/prophecy",
+ "keywords": [
+ "Double",
+ "Dummy",
+ "fake",
+ "mock",
+ "spy",
+ "stub"
+ ],
+ "time": "2015-08-13 10:07:40"
+ },
+ {
+ "name": "phpunit/php-code-coverage",
+ "version": "2.2.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+ "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
+ "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "phpunit/php-file-iterator": "~1.3",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-token-stream": "~1.3",
+ "sebastian/environment": "^1.3.2",
+ "sebastian/version": "~1.0"
+ },
+ "require-dev": {
+ "ext-xdebug": ">=2.1.4",
+ "phpunit/phpunit": "~4"
+ },
+ "suggest": {
+ "ext-dom": "*",
+ "ext-xdebug": ">=2.2.1",
+ "ext-xmlwriter": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.2.x-dev"
}
},
"autoload": {
"classmap": [
- "PHP/"
+ "src/"
]
},
"notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
"license": [
"BSD-3-Clause"
],
@@ -67,35 +231,37 @@
"testing",
"xunit"
],
- "time": "2013-09-10 08:14:32"
+ "time": "2015-10-06 15:47:00"
},
{
"name": "phpunit/php-file-iterator",
- "version": "1.3.4",
+ "version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
- "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
+ "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
- "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
+ "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
"autoload": {
"classmap": [
- "File/"
+ "src/"
]
},
"notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
"license": [
"BSD-3-Clause"
],
@@ -112,20 +278,20 @@
"filesystem",
"iterator"
],
- "time": "2013-10-10 15:34:57"
+ "time": "2015-06-21 13:08:43"
},
{
"name": "phpunit/php-text-template",
- "version": "1.1.4",
+ "version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
- "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23"
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5180896f51c5b3648ac946b05f9ec02be78a0b23",
- "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"shasum": ""
},
"require": {
@@ -134,20 +300,17 @@
"type": "library",
"autoload": {
"classmap": [
- "Text/"
+ "src/"
]
},
"notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
+ "email": "sebastian@phpunit.de",
"role": "lead"
}
],
@@ -156,20 +319,20 @@
"keywords": [
"template"
],
- "time": "2012-10-31 18:15:28"
+ "time": "2015-06-21 13:50:34"
},
{
"name": "phpunit/php-timer",
- "version": "1.0.5",
+ "version": "1.0.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
- "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
+ "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
- "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
+ "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
"shasum": ""
},
"require": {
@@ -178,13 +341,10 @@
"type": "library",
"autoload": {
"classmap": [
- "PHP/"
+ "src/"
]
},
"notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
"license": [
"BSD-3-Clause"
],
@@ -200,49 +360,48 @@
"keywords": [
"timer"
],
- "time": "2013-08-02 07:42:54"
+ "time": "2015-06-21 08:01:12"
},
{
"name": "phpunit/php-token-stream",
- "version": "1.2.1",
+ "version": "1.4.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
- "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e"
+ "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5220af2a7929aa35cf663d97c89ad3d50cf5fa3e",
- "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
+ "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.2-dev"
+ "dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
- "PHP/"
+ "src/"
]
},
"notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
+ "email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
@@ -250,63 +409,61 @@
"keywords": [
"tokenizer"
],
- "time": "2013-09-13 04:58:23"
+ "time": "2015-09-15 10:49:45"
},
{
"name": "phpunit/phpunit",
- "version": "3.7.28",
+ "version": "4.8.18",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d"
+ "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d",
- "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa33d4ad96481b91df343d83e8c8aabed6b1dfd3",
+ "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3",
"shasum": ""
},
"require": {
"ext-dom": "*",
+ "ext-json": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
- "phpunit/php-code-coverage": "~1.2.1",
- "phpunit/php-file-iterator": ">=1.3.1",
- "phpunit/php-text-template": ">=1.1.1",
- "phpunit/php-timer": ">=1.0.4",
- "phpunit/phpunit-mock-objects": "~1.2.0",
- "symfony/yaml": "~2.0"
- },
- "require-dev": {
- "pear-pear/pear": "1.9.4"
+ "phpspec/prophecy": "^1.3.1",
+ "phpunit/php-code-coverage": "~2.1",
+ "phpunit/php-file-iterator": "~1.4",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-timer": ">=1.0.6",
+ "phpunit/phpunit-mock-objects": "~2.3",
+ "sebastian/comparator": "~1.1",
+ "sebastian/diff": "~1.2",
+ "sebastian/environment": "~1.3",
+ "sebastian/exporter": "~1.2",
+ "sebastian/global-state": "~1.0",
+ "sebastian/version": "~1.0",
+ "symfony/yaml": "~2.1|~3.0"
},
"suggest": {
- "ext-json": "*",
- "ext-simplexml": "*",
- "ext-tokenizer": "*",
- "phpunit/php-invoker": ">=1.1.0,<1.2.0"
+ "phpunit/php-invoker": "~1.1"
},
"bin": [
- "composer/bin/phpunit"
+ "phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.7.x-dev"
+ "dev-master": "4.8.x-dev"
}
},
"autoload": {
"classmap": [
- "PHPUnit/"
+ "src/"
]
},
"notification-url": "https://packagist.org/downloads/",
- "include-path": [
- "",
- "../../symfony/yaml/"
- ],
"license": [
"BSD-3-Clause"
],
@@ -318,45 +475,52 @@
}
],
"description": "The PHP Unit Testing framework.",
- "homepage": "http://www.phpunit.de/",
+ "homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
- "time": "2013-10-17 07:27:40"
+ "time": "2015-11-11 11:32:49"
},
{
"name": "phpunit/phpunit-mock-objects",
- "version": "1.2.3",
+ "version": "2.3.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
- "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875"
+ "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875",
- "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
+ "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
"shasum": ""
},
"require": {
+ "doctrine/instantiator": "^1.0.2",
"php": ">=5.3.3",
- "phpunit/php-text-template": ">=1.1.1@stable"
+ "phpunit/php-text-template": "~1.2",
+ "sebastian/exporter": "~1.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3.x-dev"
+ }
+ },
"autoload": {
"classmap": [
- "PHPUnit/"
+ "src/"
]
},
"notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
"license": [
"BSD-3-Clause"
],
@@ -373,20 +537,391 @@
"mock",
"xunit"
],
- "time": "2013-01-13 10:24:48"
+ "time": "2015-10-02 06:51:40"
},
{
- "name": "squizlabs/php_codesniffer",
- "version": "1.5.1",
+ "name": "sebastian/comparator",
+ "version": "1.2.0",
"source": {
"type": "git",
- "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
- "reference": "bd1e50b8c252c914881dba1dcef089219e430dbd"
+ "url": "https://github.com/sebastianbergmann/comparator.git",
+ "reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/bd1e50b8c252c914881dba1dcef089219e430dbd",
- "reference": "bd1e50b8c252c914881dba1dcef089219e430dbd",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
+ "reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/diff": "~1.2",
+ "sebastian/exporter": "~1.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides the functionality to compare PHP values for equality",
+ "homepage": "http://www.github.com/sebastianbergmann/comparator",
+ "keywords": [
+ "comparator",
+ "compare",
+ "equality"
+ ],
+ "time": "2015-07-26 15:48:44"
+ },
+ {
+ "name": "sebastian/diff",
+ "version": "1.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/diff.git",
+ "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3",
+ "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Kore Nordmann",
+ "email": "mail@kore-nordmann.de"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Diff implementation",
+ "homepage": "http://www.github.com/sebastianbergmann/diff",
+ "keywords": [
+ "diff"
+ ],
+ "time": "2015-02-22 15:13:53"
+ },
+ {
+ "name": "sebastian/environment",
+ "version": "1.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/environment.git",
+ "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44",
+ "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides functionality to handle HHVM/PHP environments",
+ "homepage": "http://www.github.com/sebastianbergmann/environment",
+ "keywords": [
+ "Xdebug",
+ "environment",
+ "hhvm"
+ ],
+ "time": "2015-08-03 06:14:51"
+ },
+ {
+ "name": "sebastian/exporter",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/exporter.git",
+ "reference": "7ae5513327cb536431847bcc0c10edba2701064e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e",
+ "reference": "7ae5513327cb536431847bcc0c10edba2701064e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/recursion-context": "~1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides the functionality to export PHP variables for visualization",
+ "homepage": "http://www.github.com/sebastianbergmann/exporter",
+ "keywords": [
+ "export",
+ "exporter"
+ ],
+ "time": "2015-06-21 07:55:53"
+ },
+ {
+ "name": "sebastian/global-state",
+ "version": "1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/global-state.git",
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "suggest": {
+ "ext-uopz": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Snapshotting of global state",
+ "homepage": "http://www.github.com/sebastianbergmann/global-state",
+ "keywords": [
+ "global state"
+ ],
+ "time": "2015-10-12 03:26:01"
+ },
+ {
+ "name": "sebastian/recursion-context",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
+ "reference": "994d4a811bafe801fb06dccbee797863ba2792ba"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba",
+ "reference": "994d4a811bafe801fb06dccbee797863ba2792ba",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides functionality to recursively process PHP variables",
+ "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+ "time": "2015-06-21 08:04:50"
+ },
+ {
+ "name": "sebastian/version",
+ "version": "1.0.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/version.git",
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
+ "homepage": "https://github.com/sebastianbergmann/version",
+ "time": "2015-06-21 13:59:46"
+ },
+ {
+ "name": "squizlabs/php_codesniffer",
+ "version": "1.5.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
+ "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6f3e42d311b882b25b4d409d23a289f4d3b803d5",
+ "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5",
"shasum": ""
},
"require": {
@@ -400,6 +935,11 @@
"scripts/phpcs"
],
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-phpcs-fixer": "2.0.x-dev"
+ }
+ },
"autoload": {
"classmap": [
"CodeSniffer.php",
@@ -443,34 +983,33 @@
"phpcs",
"standards"
],
- "time": "2013-12-12 03:08:49"
+ "time": "2014-12-04 22:32:15"
},
{
"name": "symfony/yaml",
- "version": "v2.4.1",
- "target-dir": "Symfony/Component/Yaml",
+ "version": "v2.7.6",
"source": {
"type": "git",
- "url": "https://github.com/symfony/Yaml.git",
- "reference": "4e1a237fc48145fae114b96458d799746ad89aa0"
+ "url": "https://github.com/symfony/yaml.git",
+ "reference": "eca9019c88fbe250164affd107bc8057771f3f4d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Yaml/zipball/4e1a237fc48145fae114b96458d799746ad89aa0",
- "reference": "4e1a237fc48145fae114b96458d799746ad89aa0",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d",
+ "reference": "eca9019c88fbe250164affd107bc8057771f3f4d",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=5.3.9"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.4-dev"
+ "dev-master": "2.7-dev"
}
},
"autoload": {
- "psr-0": {
+ "psr-4": {
"Symfony\\Component\\Yaml\\": ""
}
},
@@ -485,25 +1024,19 @@
},
{
"name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
+ "homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
- "homepage": "http://symfony.com",
- "time": "2013-12-28 08:12:03"
+ "homepage": "https://symfony.com",
+ "time": "2015-10-11 09:39:48"
}
],
- "aliases": [
-
- ],
+ "aliases": [],
"minimum-stability": "stable",
- "stability-flags": [
-
- ],
- "platform": [
-
- ],
- "platform-dev": [
-
- ]
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": []
}
diff --git a/composer.phar b/composer.phar
deleted file mode 100755
index 49b5aa9..0000000
Binary files a/composer.phar and /dev/null differ
diff --git a/conf.py b/conf.py
new file mode 100644
index 0000000..10ce0b0
--- /dev/null
+++ b/conf.py
@@ -0,0 +1,288 @@
+# -*- coding: utf-8 -*-
+#
+# DesignPatternsPHP documentation build configuration file, created by
+# sphinx-quickstart on Thu Apr 2 00:05:03 2015.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys
+import os
+import shlex
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = []
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+# source_suffix = ['.rst', '.md']
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'README'
+
+# General information about the project.
+project = u'DesignPatternsPHP'
+copyright = u'2015, Dominik Liebler and contributors'
+author = u'Dominik Liebler and contributors'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '1.0'
+# The full version, including alpha/beta/rc tags.
+release = '1.0'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+#keep_warnings = False
+
+# If true, `todo` and `todoList` produce output, else they produce nothing.
+todo_include_todos = False
+
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'sphinx_rtd_theme'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# " v documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#html_extra_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Language to be used for generating the HTML full-text search index.
+# Sphinx supports the following languages:
+# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
+# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
+#html_search_language = 'en'
+
+# A dictionary with options for the search language support, empty by default.
+# Now only 'ja' uses this config value
+#html_search_options = {'type': 'default'}
+
+# The name of a javascript file (relative to the configuration directory) that
+# implements a search results scorer. If empty, the default will be used.
+#html_search_scorer = 'scorer.js'
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'DesignPatternsPHPdoc'
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+'preamble': '\setcounter{tocdepth}{2}',
+
+# Latex figure (float) alignment
+#'figure_align': 'htbp',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ (master_doc, 'DesignPatternsPHP.tex', u'DesignPatternsPHP Documentation',
+ u'Dominik Liebler and contributors', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ (master_doc, 'designpatternsphp', u'DesignPatternsPHP Documentation',
+ [author], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, 'DesignPatternsPHP', u'DesignPatternsPHP Documentation',
+ author, 'DesignPatternsPHP', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#texinfo_no_detailmenu = False
+
+# -- Options for Translation -------------------------------------------
+locale_dirs = ['locale/']
+gettext_compact = False
diff --git a/locale/ca/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po b/locale/ca/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po
new file mode 100644
index 0000000..b5277a5
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po
@@ -0,0 +1,90 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:2
+msgid "`Chain Of Responsibilities`__"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:5
+msgid "Purpose:"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:7
+msgid ""
+"To build a chain of objects to handle a call in sequential order. If one "
+"object cannot handle a call, it delegates the call to the next in the chain "
+"and so forth."
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:12
+msgid "Examples:"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:14
+msgid ""
+"logging framework, where each chain element decides autonomously what to do "
+"with a log message"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:16
+msgid "a Spam filter"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:17
+msgid ""
+"Caching: first object is an instance of e.g. a Memcached Interface, if that "
+"\"misses\" it delegates the call to the database interface"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:19
+msgid ""
+"Yii Framework: CFilterChain is a chain of controller action filters. the "
+"executing point is passed from one filter to the next along the chain, and "
+"only if all filters say \"yes\", the action can be invoked at last."
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:36
+msgid "Request.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:42
+msgid "Handler.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:48
+msgid "Responsible/SlowStorage.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:54
+msgid "Responsible/FastStorage.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:61
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:63
+msgid "Tests/ChainTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/Command/README.po b/locale/ca/LC_MESSAGES/Behavioral/Command/README.po
new file mode 100644
index 0000000..29319a3
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/Command/README.po
@@ -0,0 +1,99 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Command/README.rst:2
+msgid "`Command`__"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:7
+msgid "To encapsulate invocation and decoupling."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:9
+msgid ""
+"We have an Invoker and a Receiver. This pattern uses a \"Command\" to "
+"delegate the method call against the Receiver and presents the same method "
+"\"execute\". Therefore, the Invoker just knows to call \"execute\" to "
+"process the Command of the client. The Receiver is decoupled from the "
+"Invoker."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:15
+msgid ""
+"The second aspect of this pattern is the undo(), which undoes the method "
+"execute(). Command can also be aggregated to combine more complex commands "
+"with minimum copy-paste and relying on composition over inheritance."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:21
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:23
+msgid ""
+"A text editor : all events are Command which can be undone, stacked and "
+"saved."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:25
+msgid ""
+"Symfony2: SF2 Commands that can be run from the CLI are built with just the "
+"Command pattern in mind"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:27
+msgid ""
+"big CLI tools use subcommands to distribute various tasks and pack them in "
+"\"modules\", each of these can be implemented with the Command pattern (e.g."
+" vagrant)"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:32
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:39
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:41
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:43
+msgid "CommandInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:49
+msgid "HelloCommand.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:55
+msgid "Receiver.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:61
+msgid "Invoker.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:68
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:70
+msgid "Tests/CommandTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/Iterator/README.po b/locale/ca/LC_MESSAGES/Behavioral/Iterator/README.po
new file mode 100644
index 0000000..3000658
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/Iterator/README.po
@@ -0,0 +1,83 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Iterator/README.rst:2
+msgid "`Iterator`__"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:7
+msgid ""
+"To make an object iterable and to make it appear like a collection of "
+"objects."
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:11
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:13
+msgid ""
+"to process a file line by line by just running over all lines (which have an"
+" object representation) for a file (which of course is an object, too)"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:18
+msgid "Note"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:20
+msgid ""
+"Standard PHP Library (SPL) defines an interface Iterator which is best "
+"suited for this! Often you would want to implement the Countable interface "
+"too, to allow ``count($object)`` on your iterable object"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:36
+msgid "Book.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:42
+msgid "BookList.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:48
+msgid "BookListIterator.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:54
+msgid "BookListReverseIterator.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:61
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:63
+msgid "Tests/IteratorTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/Mediator/README.po b/locale/ca/LC_MESSAGES/Behavioral/Mediator/README.po
new file mode 100644
index 0000000..9c6694b
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/Mediator/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Mediator/README.rst:2
+msgid "`Mediator`__"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:7
+msgid ""
+"This pattern provides an easy to decouple many components working together. "
+"It is a good alternative over Observer IF you have a \"central "
+"intelligence\", like a controller (but not in the sense of the MVC)."
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:11
+msgid ""
+"All components (called Colleague) are only coupled to the MediatorInterface "
+"and it is a good thing because in OOP, one good friend is better than many. "
+"This is the key-feature of this pattern."
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:16
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:23
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:25
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:27
+msgid "MediatorInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:33
+msgid "Mediator.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:39
+msgid "Colleague.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:45
+msgid "Subsystem/Client.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:51
+msgid "Subsystem/Database.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:57
+msgid "Subsystem/Server.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:64
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:66
+msgid "Tests/MediatorTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/Memento/README.po b/locale/ca/LC_MESSAGES/Behavioral/Memento/README.po
new file mode 100644
index 0000000..913069a
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/Memento/README.po
@@ -0,0 +1,85 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Memento/README.rst:2
+msgid "`Memento`__"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:7
+msgid ""
+"Provide the ability to restore an object to its previous state (undo via "
+"rollback)."
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:10
+msgid ""
+"The memento pattern is implemented with three objects: the originator, a "
+"caretaker and a memento. The originator is some object that has an internal "
+"state. The caretaker is going to do something to the originator, but wants "
+"to be able to undo the change. The caretaker first asks the originator for a"
+" memento object. Then it does whatever operation (or sequence of operations)"
+" it was going to do. To roll back to the state before the operations, it "
+"returns the memento object to the originator. The memento object itself is "
+"an opaque object (one which the caretaker cannot, or should not, change). "
+"When using this pattern, care should be taken if the originator may change "
+"other objects or resources - the memento pattern operates on a single "
+"object."
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:23
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:25
+msgid "The seed of a pseudorandom number generator"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:26
+msgid "The state in a finite state machine"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:29
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:36
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:38
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:40
+msgid "Memento.php"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:46
+msgid "Originator.php"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:52
+msgid "Caretaker.php"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:59
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:61
+msgid "Tests/MementoTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/NullObject/README.po b/locale/ca/LC_MESSAGES/Behavioral/NullObject/README.po
new file mode 100644
index 0000000..35b77f6
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/NullObject/README.po
@@ -0,0 +1,103 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/NullObject/README.rst:2
+msgid "`Null Object`__"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:7
+msgid ""
+"NullObject is not a GoF design pattern but a schema which appears frequently"
+" enough to be considered a pattern. It has the following benefits:"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:11
+msgid "Client code is simplified"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:12
+msgid "Reduces the chance of null pointer exceptions"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:13
+msgid "Fewer conditionals require less test cases"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:15
+msgid ""
+"Methods that return an object or null should instead return an object or "
+"``NullObject``. ``NullObject``\\ s simplify boilerplate code such as ``if "
+"(!is_null($obj)) { $obj->callSomething(); }`` to just "
+"``$obj->callSomething();`` by eliminating the conditional check in client "
+"code."
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:22
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:24
+msgid "Symfony2: null logger of profiler"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:25
+msgid "Symfony2: null output in Symfony/Console"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:26
+msgid "null handler in a Chain of Responsibilities pattern"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:27
+msgid "null command in a Command pattern"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:30
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:37
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:39
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:41
+msgid "Service.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:47
+msgid "LoggerInterface.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:53
+msgid "PrintLogger.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:59
+msgid "NullLogger.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:66
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:68
+msgid "Tests/LoggerTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/Observer/README.po b/locale/ca/LC_MESSAGES/Behavioral/Observer/README.po
new file mode 100644
index 0000000..6aea8e9
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/Observer/README.po
@@ -0,0 +1,75 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Observer/README.rst:2
+msgid "`Observer`__"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:7
+msgid ""
+"To implement a publish/subscribe behaviour to an object, whenever a "
+"\"Subject\" object changes it's state, the attached \"Observers\" will be "
+"notified. It is used to shorten the amount of coupled objects and uses loose"
+" coupling instead."
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:13
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:15
+msgid ""
+"a message queue system is observed to show the progress of a job in a GUI"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:19
+msgid "Note"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:21
+msgid ""
+"PHP already defines two interfaces that can help to implement this pattern: "
+"SplObserver and SplSubject."
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:36
+msgid "User.php"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:42
+msgid "UserObserver.php"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:49
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:51
+msgid "Tests/ObserverTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/README.po b/locale/ca/LC_MESSAGES/Behavioral/README.po
new file mode 100644
index 0000000..93ebd7c
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/README.po
@@ -0,0 +1,24 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/README.rst:2
+msgid "`Behavioral`__"
+msgstr ""
+
+#: ../../Behavioral/README.rst:4
+msgid ""
+"In software engineering, behavioral design patterns are design patterns that"
+" identify common communication patterns between objects and realize these "
+"patterns. By doing so, these patterns increase flexibility in carrying out "
+"this communication."
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/Specification/README.po b/locale/ca/LC_MESSAGES/Behavioral/Specification/README.po
new file mode 100644
index 0000000..54e3b64
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/Specification/README.po
@@ -0,0 +1,84 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Specification/README.rst:2
+msgid "`Specification`__"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:7
+msgid ""
+"Builds a clear specification of business rules, where objects can be checked"
+" against. The composite specification class has one method called "
+"``isSatisfiedBy`` that returns either true or false depending on whether the"
+" given object satisfies the specification."
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:13
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:15
+msgid "`RulerZ `__"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:18
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:25
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:27
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:29
+msgid "Item.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:35
+msgid "SpecificationInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:41
+msgid "AbstractSpecification.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:47
+msgid "Either.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:53
+msgid "PriceSpecification.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:59
+msgid "Plus.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:65
+msgid "Not.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:72
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:74
+msgid "Tests/SpecificationTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/State/README.po b/locale/ca/LC_MESSAGES/Behavioral/State/README.po
new file mode 100644
index 0000000..f71fbfa
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/State/README.po
@@ -0,0 +1,63 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/State/README.rst:2
+msgid "`State`__"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:7
+msgid ""
+"Encapsulate varying behavior for the same routine based on an object's "
+"state. This can be a cleaner way for an object to change its behavior at "
+"runtime without resorting to large monolithic conditional statements."
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:12
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:19
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:21
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:23
+msgid "OrderController.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:29
+msgid "OrderFactory.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:35
+msgid "OrderInterface.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:41
+msgid "ShippingOrder.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:47
+msgid "CreateOrder.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:54
+msgid "Test"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/Strategy/README.po b/locale/ca/LC_MESSAGES/Behavioral/Strategy/README.po
new file mode 100644
index 0000000..dd5797e
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/Strategy/README.po
@@ -0,0 +1,92 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Strategy/README.rst:2
+msgid "`Strategy`__"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:5
+msgid "Terminology:"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:7
+msgid "Context"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:8
+msgid "Strategy"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:9
+msgid "Concrete Strategy"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:12
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:14
+msgid ""
+"To separate strategies and to enable fast switching between them. Also this "
+"pattern is a good alternative to inheritance (instead of having an abstract "
+"class that is extended)."
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:19
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:21
+msgid "sorting a list of objects, one strategy by date, the other by id"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:22
+msgid ""
+"simplify unit testing: e.g. switching between file and in-memory storage"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:26
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:33
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:35
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:37
+msgid "ObjectCollection.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:43
+msgid "ComparatorInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:49
+msgid "DateComparator.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:55
+msgid "IdComparator.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:62
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:64
+msgid "Tests/StrategyTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/TemplateMethod/README.po b/locale/ca/LC_MESSAGES/Behavioral/TemplateMethod/README.po
new file mode 100644
index 0000000..4f6fa81
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/TemplateMethod/README.po
@@ -0,0 +1,83 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/TemplateMethod/README.rst:2
+msgid "`Template Method`__"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:7
+msgid "Template Method is a behavioral design pattern."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:9
+msgid ""
+"Perhaps you have encountered it many times already. The idea is to let "
+"subclasses of this abstract template \"finish\" the behavior of an "
+"algorithm."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:13
+msgid ""
+"A.k.a the \"Hollywood principle\": \"Don't call us, we call you.\" This "
+"class is not called by subclasses but the inverse. How? With abstraction of "
+"course."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:17
+msgid ""
+"In other words, this is a skeleton of algorithm, well-suited for framework "
+"libraries. The user has just to implement one method and the superclass do "
+"the job."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:21
+msgid ""
+"It is an easy way to decouple concrete classes and reduce copy-paste, that's"
+" why you'll find it everywhere."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:36
+msgid "Journey.php"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:42
+msgid "BeachJourney.php"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:48
+msgid "CityJourney.php"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:55
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:57
+msgid "Tests/JourneyTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Behavioral/Visitor/README.po b/locale/ca/LC_MESSAGES/Behavioral/Visitor/README.po
new file mode 100644
index 0000000..cab0ea9
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Behavioral/Visitor/README.po
@@ -0,0 +1,75 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Visitor/README.rst:2
+msgid "`Visitor`__"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:7
+msgid ""
+"The Visitor Pattern lets you outsource operations on objects to other "
+"objects. The main reason to do this is to keep a separation of concerns. But"
+" classes have to define a contract to allow visitors (the ``Role::accept`` "
+"method in the example)."
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:12
+msgid ""
+"The contract is an abstract class but you can have also a clean interface. "
+"In that case, each Visitor has to choose itself which method to invoke on "
+"the visitor."
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:28
+msgid "RoleVisitorInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:34
+msgid "RolePrintVisitor.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:40
+msgid "Role.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:46
+msgid "User.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:52
+msgid "Group.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:59
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:61
+msgid "Tests/VisitorTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/ca/LC_MESSAGES/Creational/AbstractFactory/README.po
new file mode 100644
index 0000000..04a383e
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Creational/AbstractFactory/README.po
@@ -0,0 +1,88 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/AbstractFactory/README.rst:2
+msgid "`Abstract Factory`__"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:7
+msgid ""
+"To create series of related or dependent objects without specifying their "
+"concrete classes. Usually the created classes all implement the same "
+"interface. The client of the abstract factory does not care about how these "
+"objects are created, he just knows how they go together."
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:13
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:20
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:22
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:24
+msgid "AbstractFactory.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:30
+msgid "JsonFactory.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:36
+msgid "HtmlFactory.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:42
+msgid "MediaInterface.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:48
+msgid "Picture.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:54
+msgid "Text.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:60
+msgid "Json/Picture.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:66
+msgid "Json/Text.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:72
+msgid "Html/Picture.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:78
+msgid "Html/Text.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:85
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:87
+msgid "Tests/AbstractFactoryTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Creational/Builder/README.po b/locale/ca/LC_MESSAGES/Creational/Builder/README.po
new file mode 100644
index 0000000..79d4fe3
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Creational/Builder/README.po
@@ -0,0 +1,110 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/Builder/README.rst:2
+msgid "`Builder`__"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:7
+msgid "Builder is an interface that build parts of a complex object."
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:9
+msgid ""
+"Sometimes, if the builder has a better knowledge of what it builds, this "
+"interface could be an abstract class with default methods (aka adapter)."
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:12
+msgid ""
+"If you have a complex inheritance tree for objects, it is logical to have a "
+"complex inheritance tree for builders too."
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:15
+msgid ""
+"Note: Builders have often a fluent interface, see the mock builder of "
+"PHPUnit for example."
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:19
+msgid "Examples"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:21
+msgid "PHPUnit: Mock Builder"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:24
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:31
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:33
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:35
+msgid "Director.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:41
+msgid "BuilderInterface.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:47
+msgid "BikeBuilder.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:53
+msgid "CarBuilder.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:59
+msgid "Parts/Vehicle.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:65
+msgid "Parts/Bike.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:71
+msgid "Parts/Car.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:77
+msgid "Parts/Engine.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:83
+msgid "Parts/Wheel.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:89
+msgid "Parts/Door.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:96
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:98
+msgid "Tests/DirectorTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/ca/LC_MESSAGES/Creational/FactoryMethod/README.po
new file mode 100644
index 0000000..b65c56b
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Creational/FactoryMethod/README.po
@@ -0,0 +1,90 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/FactoryMethod/README.rst:2
+msgid "`Factory Method`__"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:7
+msgid ""
+"The good point over the SimpleFactory is you can subclass it to implement "
+"different ways to create objects"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:10
+msgid "For simple case, this abstract class could be just an interface"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:12
+msgid ""
+"This pattern is a \"real\" Design Pattern because it achieves the "
+"\"Dependency Inversion Principle\" a.k.a the \"D\" in S.O.L.I.D principles."
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:15
+msgid ""
+"It means the FactoryMethod class depends on abstractions, not concrete "
+"classes. This is the real trick compared to SimpleFactory or StaticFactory."
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:31
+msgid "FactoryMethod.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:37
+msgid "ItalianFactory.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:43
+msgid "GermanFactory.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:49
+msgid "VehicleInterface.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:55
+msgid "Porsche.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:61
+msgid "Bicycle.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:67
+msgid "Ferrari.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:74
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:76
+msgid "Tests/FactoryMethodTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Creational/Multiton/README.po b/locale/ca/LC_MESSAGES/Creational/Multiton/README.po
new file mode 100644
index 0000000..702271d
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Creational/Multiton/README.po
@@ -0,0 +1,64 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/Multiton/README.rst:2
+msgid "Multiton"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:4
+msgid ""
+"**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND "
+"MAINTAINABILITY USE DEPENDENCY INJECTION!**"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:8
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:10
+msgid ""
+"To have only a list of named instances that are used, like a singleton but "
+"with n instances."
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:14
+msgid "Examples"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:16
+msgid "2 DB Connectors, e.g. one for MySQL, the other for SQLite"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:17
+msgid "multiple Loggers (one for debug messages, one for errors)"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:31
+msgid "Multiton.php"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:38
+msgid "Test"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Creational/Pool/README.po b/locale/ca/LC_MESSAGES/Creational/Pool/README.po
new file mode 100644
index 0000000..8defedd
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Creational/Pool/README.po
@@ -0,0 +1,81 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/Pool/README.rst:2
+msgid "`Pool`__"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:4
+msgid ""
+"The **object pool pattern** is a software creational design pattern that "
+"uses a set of initialized objects kept ready to use – a \"pool\" – rather "
+"than allocating and destroying them on demand. A client of the pool will "
+"request an object from the pool and perform operations on the returned "
+"object. When the client has finished, it returns the object, which is a "
+"specific type of factory object, to the pool rather than destroying it."
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:11
+msgid ""
+"Object pooling can offer a significant performance boost in situations where"
+" the cost of initializing a class instance is high, the rate of "
+"instantiation of a class is high, and the number of instances in use at any "
+"one time is low. The pooled object is obtained in predictable time when "
+"creation of the new objects (especially over network) may take variable "
+"time."
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:18
+msgid ""
+"However these benefits are mostly true for objects that are expensive with "
+"respect to time, such as database connections, socket connections, threads "
+"and large graphic objects like fonts or bitmaps. In certain situations, "
+"simple object pooling (that hold no external resources, but only occupy "
+"memory) may not be efficient and could decrease performance."
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:36
+msgid "Pool.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:42
+msgid "Processor.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:48
+msgid "Worker.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:55
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:57
+msgid "Tests/PoolTest.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:63
+msgid "Tests/TestWorker.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Creational/Prototype/README.po b/locale/ca/LC_MESSAGES/Creational/Prototype/README.po
new file mode 100644
index 0000000..fac09ef
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Creational/Prototype/README.po
@@ -0,0 +1,68 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/Prototype/README.rst:2
+msgid "`Prototype`__"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:7
+msgid ""
+"To avoid the cost of creating objects the standard way (new Foo()) and "
+"instead create a prototype and clone it."
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:11
+msgid "Examples"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:13
+msgid ""
+"Large amounts of data (e.g. create 1,000,000 rows in a database at once via "
+"a ORM)."
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:28
+msgid "index.php"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:34
+msgid "BookPrototype.php"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:40
+msgid "BarBookPrototype.php"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:46
+msgid "FooBookPrototype.php"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:53
+msgid "Test"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Creational/README.po b/locale/ca/LC_MESSAGES/Creational/README.po
new file mode 100644
index 0000000..72f543b
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Creational/README.po
@@ -0,0 +1,25 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/README.rst:2
+msgid "`Creational`__"
+msgstr ""
+
+#: ../../Creational/README.rst:4
+msgid ""
+"In software engineering, creational design patterns are design patterns that"
+" deal with object creation mechanisms, trying to create objects in a manner "
+"suitable to the situation. The basic form of object creation could result in"
+" design problems or added complexity to the design. Creational design "
+"patterns solve this problem by somehow controlling this object creation."
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po
new file mode 100644
index 0000000..74e85d4
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po
@@ -0,0 +1,72 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/SimpleFactory/README.rst:2
+msgid "Simple Factory"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:7
+msgid "SimpleFactory is a simple factory pattern."
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:9
+msgid ""
+"It differs from the static factory because it is NOT static and as you know:"
+" static => global => evil!"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:12
+msgid ""
+"Therefore, you can have multiple factories, differently parametrized, you "
+"can subclass it and you can mock-up it."
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:16
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:23
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:25
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:27
+msgid "SimpleFactory.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:33
+msgid "VehicleInterface.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:39
+msgid "Bicycle.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:45
+msgid "Scooter.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:52
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:54
+msgid "Tests/SimpleFactoryTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Creational/Singleton/README.po b/locale/ca/LC_MESSAGES/Creational/Singleton/README.po
new file mode 100644
index 0000000..5d108ca
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Creational/Singleton/README.po
@@ -0,0 +1,75 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/Singleton/README.rst:2
+msgid "`Singleton`__"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:4
+msgid ""
+"**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND "
+"MAINTAINABILITY USE DEPENDENCY INJECTION!**"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:8
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:10
+msgid ""
+"To have only one instance of this object in the application that will handle"
+" all calls."
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:14
+msgid "Examples"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:16
+msgid "DB Connector"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:17
+msgid ""
+"Logger (may also be a Multiton if there are many log files for several "
+"purposes)"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:19
+msgid ""
+"Lock file for the application (there is only one in the filesystem ...)"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:23
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:30
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:32
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:34
+msgid "Singleton.php"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:41
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:43
+msgid "Tests/SingletonTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Creational/StaticFactory/README.po b/locale/ca/LC_MESSAGES/Creational/StaticFactory/README.po
new file mode 100644
index 0000000..4a6f64e
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Creational/StaticFactory/README.po
@@ -0,0 +1,75 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/StaticFactory/README.rst:2
+msgid "Static Factory"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:7
+msgid ""
+"Similar to the AbstractFactory, this pattern is used to create series of "
+"related or dependent objects. The difference between this and the abstract "
+"factory pattern is that the static factory pattern uses just one static "
+"method to create all types of objects it can create. It is usually named "
+"``factory`` or ``build``."
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:14
+msgid "Examples"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:16
+msgid ""
+"Zend Framework: ``Zend_Cache_Backend`` or ``_Frontend`` use a factory method"
+" create cache backends or frontends"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:31
+msgid "StaticFactory.php"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:37
+msgid "FormatterInterface.php"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:43
+msgid "FormatString.php"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:49
+msgid "FormatNumber.php"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:56
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:58
+msgid "Tests/StaticFactoryTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/More/Delegation/README.po b/locale/ca/LC_MESSAGES/More/Delegation/README.po
new file mode 100644
index 0000000..169e8fd
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/More/Delegation/README.po
@@ -0,0 +1,60 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/Delegation/README.rst:2
+msgid "`Delegation`__"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:7 ../../More/Delegation/README.rst:12
+msgid "..."
+msgstr ""
+
+#: ../../More/Delegation/README.rst:10
+msgid "Examples"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:15
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:22
+msgid "Code"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:24
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:26
+msgid "Usage.php"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:32
+msgid "TeamLead.php"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:38
+msgid "JuniorDeveloper.php"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:45
+msgid "Test"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:47
+msgid "Tests/DelegationTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/More/README.po b/locale/ca/LC_MESSAGES/More/README.po
new file mode 100644
index 0000000..c3585d8
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/More/README.po
@@ -0,0 +1,16 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/README.rst:2
+msgid "More"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/More/Repository/README.po b/locale/ca/LC_MESSAGES/More/Repository/README.po
new file mode 100644
index 0000000..d9ecc90
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/More/Repository/README.po
@@ -0,0 +1,76 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/Repository/README.rst:2
+msgid "Repository"
+msgstr ""
+
+#: ../../More/Repository/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../More/Repository/README.rst:7
+msgid ""
+"Mediates between the domain and data mapping layers using a collection-like "
+"interface for accessing domain objects. Repository encapsulates the set of "
+"objects persisted in a data store and the operations performed over them, "
+"providing a more object-oriented view of the persistence layer. Repository "
+"also supports the objective of achieving a clean separation and one-way "
+"dependency between the domain and data mapping layers."
+msgstr ""
+
+#: ../../More/Repository/README.rst:16
+msgid "Examples"
+msgstr ""
+
+#: ../../More/Repository/README.rst:18
+msgid ""
+"Doctrine 2 ORM: there is Repository that mediates between Entity and DBAL "
+"and contains methods to retrieve objects"
+msgstr ""
+
+#: ../../More/Repository/README.rst:20
+msgid "Laravel Framework"
+msgstr ""
+
+#: ../../More/Repository/README.rst:23
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../More/Repository/README.rst:30
+msgid "Code"
+msgstr ""
+
+#: ../../More/Repository/README.rst:32
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../More/Repository/README.rst:34
+msgid "Post.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:40
+msgid "PostRepository.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:46
+msgid "Storage.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:52
+msgid "MemoryStorage.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:59
+msgid "Test"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/More/ServiceLocator/README.po b/locale/ca/LC_MESSAGES/More/ServiceLocator/README.po
new file mode 100644
index 0000000..9808a92
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/More/ServiceLocator/README.po
@@ -0,0 +1,94 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/ServiceLocator/README.rst:2
+msgid "`Service Locator`__"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:7
+msgid ""
+"To implement a loosely coupled architecture in order to get better testable,"
+" maintainable and extendable code. DI pattern and Service Locator pattern "
+"are an implementation of the Inverse of Control pattern."
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:12
+msgid "Usage"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:14
+msgid ""
+"With ``ServiceLocator`` you can register a service for a given interface. By"
+" using the interface you can retrieve the service and use it in the classes "
+"of the application without knowing its implementation. You can configure and"
+" inject the Service Locator object on bootstrap."
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:20
+msgid "Examples"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:22
+msgid ""
+"Zend Framework 2 uses Service Locator to create and share services used in "
+"the framework(i.e. EventManager, ModuleManager, all custom user services "
+"provided by modules, etc...)"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:27
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:34
+msgid "Code"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:36
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:38
+msgid "ServiceLocatorInterface.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:44
+msgid "ServiceLocator.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:50
+msgid "LogServiceInterface.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:56
+msgid "LogService.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:62
+msgid "DatabaseServiceInterface.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:68
+msgid "DatabaseService.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:75
+msgid "Test"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:77
+msgid "Tests/ServiceLocatorTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/README.po b/locale/ca/LC_MESSAGES/README.po
new file mode 100644
index 0000000..3a26db2
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/README.po
@@ -0,0 +1,93 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../README.rst:5
+msgid "DesignPatternsPHP"
+msgstr ""
+
+#: ../../README.rst:11
+msgid ""
+"This is a collection of known `design patterns`_ and some sample code how to"
+" implement them in PHP. Every pattern has a small list of examples (most of "
+"them from Zend Framework, Symfony2 or Doctrine2 as I'm most familiar with "
+"this software)."
+msgstr ""
+
+#: ../../README.rst:16
+msgid ""
+"I think the problem with patterns is that often people do know them but "
+"don't know when to apply which."
+msgstr ""
+
+#: ../../README.rst:20
+msgid "Patterns"
+msgstr ""
+
+#: ../../README.rst:22
+msgid ""
+"The patterns can be structured in roughly three different categories. Please"
+" click on **the title of every pattern's page** for a full explanation of "
+"the pattern on Wikipedia."
+msgstr ""
+
+#: ../../README.rst:35
+msgid "Contribute"
+msgstr ""
+
+#: ../../README.rst:37
+msgid ""
+"Please feel free to fork and extend existing or add your own examples and "
+"send a pull request with your changes! To establish a consistent code "
+"quality, please check your code using `PHP CodeSniffer`_ against `PSR2 "
+"standard`_ using ``./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor "
+".``."
+msgstr ""
+
+#: ../../README.rst:44
+msgid "License"
+msgstr ""
+
+#: ../../README.rst:46
+msgid "(The MIT License)"
+msgstr ""
+
+#: ../../README.rst:48
+msgid "Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_"
+msgstr ""
+
+#: ../../README.rst:50
+msgid ""
+"Permission is hereby granted, free of charge, to any person obtaining a copy"
+" of this software and associated documentation files (the 'Software'), to "
+"deal in the Software without restriction, including without limitation the "
+"rights to use, copy, modify, merge, publish, distribute, sublicense, and/or "
+"sell copies of the Software, and to permit persons to whom the Software is "
+"furnished to do so, subject to the following conditions:"
+msgstr ""
+
+#: ../../README.rst:58
+msgid ""
+"The above copyright notice and this permission notice shall be included in "
+"all copies or substantial portions of the Software."
+msgstr ""
+
+#: ../../README.rst:61
+msgid ""
+"THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR "
+"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, "
+"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE "
+"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER "
+"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING "
+"FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS"
+" IN THE SOFTWARE."
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Structural/Adapter/README.po b/locale/ca/LC_MESSAGES/Structural/Adapter/README.po
new file mode 100644
index 0000000..b351fc9
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Structural/Adapter/README.po
@@ -0,0 +1,82 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Adapter/README.rst:2
+msgid "`Adapter / Wrapper`__"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:7
+msgid ""
+"To translate one interface for a class into a compatible interface. An "
+"adapter allows classes to work together that normally could not because of "
+"incompatible interfaces by providing it's interface to clients while using "
+"the original interface."
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:13
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:15
+msgid "DB Client libraries adapter"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:16
+msgid ""
+"using multiple different webservices and adapters normalize data so that the"
+" outcome is the same for all"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:31
+msgid "PaperBookInterface.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:37
+msgid "Book.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:43
+msgid "EBookAdapter.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:49
+msgid "EBookInterface.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:55
+msgid "Kindle.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:62
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:64
+msgid "Tests/AdapterTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Structural/Bridge/README.po b/locale/ca/LC_MESSAGES/Structural/Bridge/README.po
new file mode 100644
index 0000000..a27619b
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Structural/Bridge/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Bridge/README.rst:2
+msgid "`Bridge`__"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:7
+msgid ""
+"Decouple an abstraction from its implementation so that the two can vary "
+"independently."
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:11
+msgid "Sample:"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:13
+msgid "`Symfony DoctrineBridge `__"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:28
+msgid "Workshop.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:34
+msgid "Assemble.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:40
+msgid "Produce.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:46
+msgid "Vehicle.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:52
+msgid "Motorcycle.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:58
+msgid "Car.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:65
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:67
+msgid "Tests/BridgeTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Structural/Composite/README.po b/locale/ca/LC_MESSAGES/Structural/Composite/README.po
new file mode 100644
index 0000000..90ddd21
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Structural/Composite/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Composite/README.rst:2
+msgid "`Composite`__"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:7
+msgid ""
+"To treat a group of objects the same way as a single instance of the object."
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:11
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:13
+msgid ""
+"a form class instance handles all its form elements like a single instance "
+"of the form, when ``render()`` is called, it subsequently runs through all "
+"its child elements and calls ``render()`` on them"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:16
+msgid ""
+"``Zend_Config``: a tree of configuration options, each one is a "
+"``Zend_Config`` object itself"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:31
+msgid "FormElement.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:37
+msgid "Form.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:43
+msgid "InputElement.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:49
+msgid "TextElement.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:56
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:58
+msgid "Tests/CompositeTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Structural/DataMapper/README.po b/locale/ca/LC_MESSAGES/Structural/DataMapper/README.po
new file mode 100644
index 0000000..5ccd9a3
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Structural/DataMapper/README.po
@@ -0,0 +1,77 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/DataMapper/README.rst:2
+msgid "`Data Mapper`__"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:7
+msgid ""
+"A Data Mapper, is a Data Access Layer that performs bidirectional transfer "
+"of data between a persistent data store (often a relational database) and an"
+" in memory data representation (the domain layer). The goal of the pattern "
+"is to keep the in memory representation and the persistent data store "
+"independent of each other and the data mapper itself. The layer is composed "
+"of one or more mappers (or Data Access Objects), performing the data "
+"transfer. Mapper implementations vary in scope. Generic mappers will handle "
+"many different domain entity types, dedicated mappers will handle one or a "
+"few."
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:17
+msgid ""
+"The key point of this pattern is, unlike Active Record pattern, the data "
+"model follows Single Responsibility Principle."
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:21
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:23
+msgid ""
+"DB Object Relational Mapper (ORM) : Doctrine2 uses DAO named as "
+"\"EntityRepository\""
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:27
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:34
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:36
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:38
+msgid "User.php"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:44
+msgid "UserMapper.php"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:51
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:53
+msgid "Tests/DataMapperTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Structural/Decorator/README.po b/locale/ca/LC_MESSAGES/Structural/Decorator/README.po
new file mode 100644
index 0000000..0ecf351
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Structural/Decorator/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Decorator/README.rst:2
+msgid "`Decorator`__"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:7
+msgid "To dynamically add new functionality to class instances."
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:10
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:12
+msgid "Zend Framework: decorators for ``Zend_Form_Element`` instances"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:13
+msgid ""
+"Web Service Layer: Decorators JSON and XML for a REST service (in this case,"
+" only one of these should be allowed of course)"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:28
+msgid "RendererInterface.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:34
+msgid "Webservice.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:40
+msgid "Decorator.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:46
+msgid "RenderInXml.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:52
+msgid "RenderInJson.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:59
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:61
+msgid "Tests/DecoratorTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Structural/DependencyInjection/README.po b/locale/ca/LC_MESSAGES/Structural/DependencyInjection/README.po
new file mode 100644
index 0000000..0834846
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Structural/DependencyInjection/README.po
@@ -0,0 +1,107 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/DependencyInjection/README.rst:2
+msgid "`Dependency Injection`__"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:7
+msgid ""
+"To implement a loosely coupled architecture in order to get better testable,"
+" maintainable and extendable code."
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:11
+msgid "Usage"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:13
+msgid ""
+"Configuration gets injected and ``Connection`` will get all that it needs "
+"from ``$config``. Without DI, the configuration would be created directly in"
+" ``Connection``, which is not very good for testing and extending "
+"``Connection``."
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:18
+msgid ""
+"Notice we are following Inversion of control principle in ``Connection`` by "
+"asking ``$config`` to implement ``Parameters`` interface. This decouples our"
+" components. We don't care where the source of information comes from, we "
+"only care that ``$config`` has certain methods to retrieve that information."
+" Read more about Inversion of control `here "
+"`__."
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:26
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:28
+msgid ""
+"The Doctrine2 ORM uses dependency injection e.g. for configuration that is "
+"injected into a ``Connection`` object. For testing purposes, one can easily "
+"create a mock object of the configuration and inject that into the "
+"``Connection`` object"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:32
+msgid ""
+"Symfony and Zend Framework 2 already have containers for DI that create "
+"objects via a configuration array and inject them where needed (i.e. in "
+"Controllers)"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:37
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:44
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:46
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:48
+msgid "AbstractConfig.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:54
+msgid "Parameters.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:60
+msgid "ArrayConfig.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:66
+msgid "Connection.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:73
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:75
+msgid "Tests/DependencyInjectionTest.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:81
+msgid "Tests/config.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Structural/Facade/README.po b/locale/ca/LC_MESSAGES/Structural/Facade/README.po
new file mode 100644
index 0000000..1d78bf4
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Structural/Facade/README.po
@@ -0,0 +1,87 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Facade/README.rst:2
+msgid "`Facade`__"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:7
+msgid ""
+"The primary goal of a Facade Pattern is not to avoid you to read the manual "
+"of a complex API. It's only a side-effect. The first goal is to reduce "
+"coupling and follow the Law of Demeter."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:11
+msgid ""
+"A Facade is meant to decouple a client and a sub-system by embedding many "
+"(but sometimes just one) interface, and of course to reduce complexity."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:15
+msgid "A facade does not forbid you the access to the sub-system"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:16
+msgid "You can (you should) have multiple facades for one sub-system"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:18
+msgid ""
+"That's why a good facade has no ``new`` in it. If there are multiple "
+"creations for each method, it is not a Facade, it's a Builder or a "
+"[Abstract\\|Static\\|Simple] Factory [Method]."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:22
+msgid ""
+"The best facade has no ``new`` and a constructor with interface-type-hinted "
+"parameters. If you need creation of new instances, use a Factory as "
+"argument."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:27
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:34
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:36
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:38
+msgid "Facade.php"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:44
+msgid "OsInterface.php"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:50
+msgid "BiosInterface.php"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:57
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:59
+msgid "Tests/FacadeTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Structural/FluentInterface/README.po b/locale/ca/LC_MESSAGES/Structural/FluentInterface/README.po
new file mode 100644
index 0000000..0e58551
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Structural/FluentInterface/README.po
@@ -0,0 +1,66 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/FluentInterface/README.rst:2
+msgid "`Fluent Interface`__"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:7
+msgid ""
+"To write code that is easy readable just like sentences in a natural "
+"language (like English)."
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:11
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:13
+msgid "Doctrine2's QueryBuilder works something like that example class below"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:15
+msgid "PHPUnit uses fluent interfaces to build mock objects"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:16
+msgid "Yii Framework: CDbCommand and CActiveRecord use this pattern, too"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:19
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:26
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:28
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:30
+msgid "Sql.php"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:37
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:39
+msgid "Tests/FluentInterfaceTest.php"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Structural/Proxy/README.po b/locale/ca/LC_MESSAGES/Structural/Proxy/README.po
new file mode 100644
index 0000000..290eacc
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Structural/Proxy/README.po
@@ -0,0 +1,59 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Proxy/README.rst:2
+msgid "`Proxy`__"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:7
+msgid "To interface to anything that is expensive or impossible to duplicate."
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:10
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:12
+msgid ""
+"Doctrine2 uses proxies to implement framework magic (e.g. lazy "
+"initialization) in them, while the user still works with his own entity "
+"classes and will never use nor touch the proxies"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:28
+msgid "Record.php"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:34
+msgid "RecordProxy.php"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:41
+msgid "Test"
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Structural/README.po b/locale/ca/LC_MESSAGES/Structural/README.po
new file mode 100644
index 0000000..7957330
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Structural/README.po
@@ -0,0 +1,23 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/README.rst:2
+msgid "`Structural`__"
+msgstr ""
+
+#: ../../Structural/README.rst:4
+msgid ""
+"In Software Engineering, Structural Design Patterns are Design Patterns that"
+" ease the design by identifying a simple way to realize relationships "
+"between entities."
+msgstr ""
diff --git a/locale/ca/LC_MESSAGES/Structural/Registry/README.po b/locale/ca/LC_MESSAGES/Structural/Registry/README.po
new file mode 100644
index 0000000..843138c
--- /dev/null
+++ b/locale/ca/LC_MESSAGES/Structural/Registry/README.po
@@ -0,0 +1,67 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Registry/README.rst:2
+msgid "`Registry`__"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:7
+msgid ""
+"To implement a central storage for objects often used throughout the "
+"application, is typically implemented using an abstract class with only "
+"static methods (or using the Singleton pattern)"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:12
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:14
+msgid ""
+"Zend Framework: ``Zend_Registry`` holds the application's logger object, "
+"front controller etc."
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:16
+msgid ""
+"Yii Framework: ``CWebApplication`` holds all the application components, "
+"such as ``CWebUser``, ``CUrlManager``, etc."
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:31
+msgid "Registry.php"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:38
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:40
+msgid "Tests/RegistryTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po b/locale/es/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po
new file mode 100644
index 0000000..b5277a5
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po
@@ -0,0 +1,90 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:2
+msgid "`Chain Of Responsibilities`__"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:5
+msgid "Purpose:"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:7
+msgid ""
+"To build a chain of objects to handle a call in sequential order. If one "
+"object cannot handle a call, it delegates the call to the next in the chain "
+"and so forth."
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:12
+msgid "Examples:"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:14
+msgid ""
+"logging framework, where each chain element decides autonomously what to do "
+"with a log message"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:16
+msgid "a Spam filter"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:17
+msgid ""
+"Caching: first object is an instance of e.g. a Memcached Interface, if that "
+"\"misses\" it delegates the call to the database interface"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:19
+msgid ""
+"Yii Framework: CFilterChain is a chain of controller action filters. the "
+"executing point is passed from one filter to the next along the chain, and "
+"only if all filters say \"yes\", the action can be invoked at last."
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:36
+msgid "Request.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:42
+msgid "Handler.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:48
+msgid "Responsible/SlowStorage.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:54
+msgid "Responsible/FastStorage.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:61
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:63
+msgid "Tests/ChainTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/Command/README.po b/locale/es/LC_MESSAGES/Behavioral/Command/README.po
new file mode 100644
index 0000000..29319a3
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/Command/README.po
@@ -0,0 +1,99 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Command/README.rst:2
+msgid "`Command`__"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:7
+msgid "To encapsulate invocation and decoupling."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:9
+msgid ""
+"We have an Invoker and a Receiver. This pattern uses a \"Command\" to "
+"delegate the method call against the Receiver and presents the same method "
+"\"execute\". Therefore, the Invoker just knows to call \"execute\" to "
+"process the Command of the client. The Receiver is decoupled from the "
+"Invoker."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:15
+msgid ""
+"The second aspect of this pattern is the undo(), which undoes the method "
+"execute(). Command can also be aggregated to combine more complex commands "
+"with minimum copy-paste and relying on composition over inheritance."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:21
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:23
+msgid ""
+"A text editor : all events are Command which can be undone, stacked and "
+"saved."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:25
+msgid ""
+"Symfony2: SF2 Commands that can be run from the CLI are built with just the "
+"Command pattern in mind"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:27
+msgid ""
+"big CLI tools use subcommands to distribute various tasks and pack them in "
+"\"modules\", each of these can be implemented with the Command pattern (e.g."
+" vagrant)"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:32
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:39
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:41
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:43
+msgid "CommandInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:49
+msgid "HelloCommand.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:55
+msgid "Receiver.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:61
+msgid "Invoker.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:68
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:70
+msgid "Tests/CommandTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/Iterator/README.po b/locale/es/LC_MESSAGES/Behavioral/Iterator/README.po
new file mode 100644
index 0000000..3000658
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/Iterator/README.po
@@ -0,0 +1,83 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Iterator/README.rst:2
+msgid "`Iterator`__"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:7
+msgid ""
+"To make an object iterable and to make it appear like a collection of "
+"objects."
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:11
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:13
+msgid ""
+"to process a file line by line by just running over all lines (which have an"
+" object representation) for a file (which of course is an object, too)"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:18
+msgid "Note"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:20
+msgid ""
+"Standard PHP Library (SPL) defines an interface Iterator which is best "
+"suited for this! Often you would want to implement the Countable interface "
+"too, to allow ``count($object)`` on your iterable object"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:36
+msgid "Book.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:42
+msgid "BookList.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:48
+msgid "BookListIterator.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:54
+msgid "BookListReverseIterator.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:61
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:63
+msgid "Tests/IteratorTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/Mediator/README.po b/locale/es/LC_MESSAGES/Behavioral/Mediator/README.po
new file mode 100644
index 0000000..9c6694b
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/Mediator/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Mediator/README.rst:2
+msgid "`Mediator`__"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:7
+msgid ""
+"This pattern provides an easy to decouple many components working together. "
+"It is a good alternative over Observer IF you have a \"central "
+"intelligence\", like a controller (but not in the sense of the MVC)."
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:11
+msgid ""
+"All components (called Colleague) are only coupled to the MediatorInterface "
+"and it is a good thing because in OOP, one good friend is better than many. "
+"This is the key-feature of this pattern."
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:16
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:23
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:25
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:27
+msgid "MediatorInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:33
+msgid "Mediator.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:39
+msgid "Colleague.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:45
+msgid "Subsystem/Client.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:51
+msgid "Subsystem/Database.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:57
+msgid "Subsystem/Server.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:64
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:66
+msgid "Tests/MediatorTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/Memento/README.po b/locale/es/LC_MESSAGES/Behavioral/Memento/README.po
new file mode 100644
index 0000000..913069a
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/Memento/README.po
@@ -0,0 +1,85 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Memento/README.rst:2
+msgid "`Memento`__"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:7
+msgid ""
+"Provide the ability to restore an object to its previous state (undo via "
+"rollback)."
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:10
+msgid ""
+"The memento pattern is implemented with three objects: the originator, a "
+"caretaker and a memento. The originator is some object that has an internal "
+"state. The caretaker is going to do something to the originator, but wants "
+"to be able to undo the change. The caretaker first asks the originator for a"
+" memento object. Then it does whatever operation (or sequence of operations)"
+" it was going to do. To roll back to the state before the operations, it "
+"returns the memento object to the originator. The memento object itself is "
+"an opaque object (one which the caretaker cannot, or should not, change). "
+"When using this pattern, care should be taken if the originator may change "
+"other objects or resources - the memento pattern operates on a single "
+"object."
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:23
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:25
+msgid "The seed of a pseudorandom number generator"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:26
+msgid "The state in a finite state machine"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:29
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:36
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:38
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:40
+msgid "Memento.php"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:46
+msgid "Originator.php"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:52
+msgid "Caretaker.php"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:59
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:61
+msgid "Tests/MementoTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/NullObject/README.po b/locale/es/LC_MESSAGES/Behavioral/NullObject/README.po
new file mode 100644
index 0000000..35b77f6
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/NullObject/README.po
@@ -0,0 +1,103 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/NullObject/README.rst:2
+msgid "`Null Object`__"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:7
+msgid ""
+"NullObject is not a GoF design pattern but a schema which appears frequently"
+" enough to be considered a pattern. It has the following benefits:"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:11
+msgid "Client code is simplified"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:12
+msgid "Reduces the chance of null pointer exceptions"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:13
+msgid "Fewer conditionals require less test cases"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:15
+msgid ""
+"Methods that return an object or null should instead return an object or "
+"``NullObject``. ``NullObject``\\ s simplify boilerplate code such as ``if "
+"(!is_null($obj)) { $obj->callSomething(); }`` to just "
+"``$obj->callSomething();`` by eliminating the conditional check in client "
+"code."
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:22
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:24
+msgid "Symfony2: null logger of profiler"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:25
+msgid "Symfony2: null output in Symfony/Console"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:26
+msgid "null handler in a Chain of Responsibilities pattern"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:27
+msgid "null command in a Command pattern"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:30
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:37
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:39
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:41
+msgid "Service.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:47
+msgid "LoggerInterface.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:53
+msgid "PrintLogger.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:59
+msgid "NullLogger.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:66
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:68
+msgid "Tests/LoggerTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/Observer/README.po b/locale/es/LC_MESSAGES/Behavioral/Observer/README.po
new file mode 100644
index 0000000..6aea8e9
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/Observer/README.po
@@ -0,0 +1,75 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Observer/README.rst:2
+msgid "`Observer`__"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:7
+msgid ""
+"To implement a publish/subscribe behaviour to an object, whenever a "
+"\"Subject\" object changes it's state, the attached \"Observers\" will be "
+"notified. It is used to shorten the amount of coupled objects and uses loose"
+" coupling instead."
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:13
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:15
+msgid ""
+"a message queue system is observed to show the progress of a job in a GUI"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:19
+msgid "Note"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:21
+msgid ""
+"PHP already defines two interfaces that can help to implement this pattern: "
+"SplObserver and SplSubject."
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:36
+msgid "User.php"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:42
+msgid "UserObserver.php"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:49
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:51
+msgid "Tests/ObserverTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/README.po b/locale/es/LC_MESSAGES/Behavioral/README.po
new file mode 100644
index 0000000..93ebd7c
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/README.po
@@ -0,0 +1,24 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/README.rst:2
+msgid "`Behavioral`__"
+msgstr ""
+
+#: ../../Behavioral/README.rst:4
+msgid ""
+"In software engineering, behavioral design patterns are design patterns that"
+" identify common communication patterns between objects and realize these "
+"patterns. By doing so, these patterns increase flexibility in carrying out "
+"this communication."
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/Specification/README.po b/locale/es/LC_MESSAGES/Behavioral/Specification/README.po
new file mode 100644
index 0000000..54e3b64
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/Specification/README.po
@@ -0,0 +1,84 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Specification/README.rst:2
+msgid "`Specification`__"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:7
+msgid ""
+"Builds a clear specification of business rules, where objects can be checked"
+" against. The composite specification class has one method called "
+"``isSatisfiedBy`` that returns either true or false depending on whether the"
+" given object satisfies the specification."
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:13
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:15
+msgid "`RulerZ `__"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:18
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:25
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:27
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:29
+msgid "Item.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:35
+msgid "SpecificationInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:41
+msgid "AbstractSpecification.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:47
+msgid "Either.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:53
+msgid "PriceSpecification.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:59
+msgid "Plus.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:65
+msgid "Not.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:72
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:74
+msgid "Tests/SpecificationTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/State/README.po b/locale/es/LC_MESSAGES/Behavioral/State/README.po
new file mode 100644
index 0000000..f71fbfa
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/State/README.po
@@ -0,0 +1,63 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/State/README.rst:2
+msgid "`State`__"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:7
+msgid ""
+"Encapsulate varying behavior for the same routine based on an object's "
+"state. This can be a cleaner way for an object to change its behavior at "
+"runtime without resorting to large monolithic conditional statements."
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:12
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:19
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:21
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:23
+msgid "OrderController.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:29
+msgid "OrderFactory.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:35
+msgid "OrderInterface.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:41
+msgid "ShippingOrder.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:47
+msgid "CreateOrder.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:54
+msgid "Test"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/Strategy/README.po b/locale/es/LC_MESSAGES/Behavioral/Strategy/README.po
new file mode 100644
index 0000000..dd5797e
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/Strategy/README.po
@@ -0,0 +1,92 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Strategy/README.rst:2
+msgid "`Strategy`__"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:5
+msgid "Terminology:"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:7
+msgid "Context"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:8
+msgid "Strategy"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:9
+msgid "Concrete Strategy"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:12
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:14
+msgid ""
+"To separate strategies and to enable fast switching between them. Also this "
+"pattern is a good alternative to inheritance (instead of having an abstract "
+"class that is extended)."
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:19
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:21
+msgid "sorting a list of objects, one strategy by date, the other by id"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:22
+msgid ""
+"simplify unit testing: e.g. switching between file and in-memory storage"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:26
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:33
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:35
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:37
+msgid "ObjectCollection.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:43
+msgid "ComparatorInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:49
+msgid "DateComparator.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:55
+msgid "IdComparator.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:62
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:64
+msgid "Tests/StrategyTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/TemplateMethod/README.po b/locale/es/LC_MESSAGES/Behavioral/TemplateMethod/README.po
new file mode 100644
index 0000000..4f6fa81
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/TemplateMethod/README.po
@@ -0,0 +1,83 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/TemplateMethod/README.rst:2
+msgid "`Template Method`__"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:7
+msgid "Template Method is a behavioral design pattern."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:9
+msgid ""
+"Perhaps you have encountered it many times already. The idea is to let "
+"subclasses of this abstract template \"finish\" the behavior of an "
+"algorithm."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:13
+msgid ""
+"A.k.a the \"Hollywood principle\": \"Don't call us, we call you.\" This "
+"class is not called by subclasses but the inverse. How? With abstraction of "
+"course."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:17
+msgid ""
+"In other words, this is a skeleton of algorithm, well-suited for framework "
+"libraries. The user has just to implement one method and the superclass do "
+"the job."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:21
+msgid ""
+"It is an easy way to decouple concrete classes and reduce copy-paste, that's"
+" why you'll find it everywhere."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:36
+msgid "Journey.php"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:42
+msgid "BeachJourney.php"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:48
+msgid "CityJourney.php"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:55
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:57
+msgid "Tests/JourneyTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Behavioral/Visitor/README.po b/locale/es/LC_MESSAGES/Behavioral/Visitor/README.po
new file mode 100644
index 0000000..cab0ea9
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Behavioral/Visitor/README.po
@@ -0,0 +1,75 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Visitor/README.rst:2
+msgid "`Visitor`__"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:7
+msgid ""
+"The Visitor Pattern lets you outsource operations on objects to other "
+"objects. The main reason to do this is to keep a separation of concerns. But"
+" classes have to define a contract to allow visitors (the ``Role::accept`` "
+"method in the example)."
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:12
+msgid ""
+"The contract is an abstract class but you can have also a clean interface. "
+"In that case, each Visitor has to choose itself which method to invoke on "
+"the visitor."
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:28
+msgid "RoleVisitorInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:34
+msgid "RolePrintVisitor.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:40
+msgid "Role.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:46
+msgid "User.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:52
+msgid "Group.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:59
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:61
+msgid "Tests/VisitorTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po
new file mode 100644
index 0000000..8c9340b
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po
@@ -0,0 +1,94 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: es\n"
+"Last-Translator: Daniel González \n"
+"Language-Team: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#: ../../Creational/AbstractFactory/README.rst:2
+msgid "`Abstract Factory`__"
+msgstr "`Factoria Abstracta`__"
+
+#: ../../Creational/AbstractFactory/README.rst:5
+msgid "Purpose"
+msgstr "Proposito"
+
+#: ../../Creational/AbstractFactory/README.rst:7
+msgid ""
+"To create series of related or dependent objects without specifying their "
+"concrete classes. Usually the created classes all implement the same "
+"interface. The client of the abstract factory does not care about how these "
+"objects are created, he just knows how they go together."
+msgstr ""
+"Para crear una serie de objetos relacionados o dependientes sin especificar "
+"a que clase concreta pertenecen. Normalmente las clases creadas implementan "
+"las mismas interfaces. El cliente de la factoría abstracta no necesita "
+"preocupase por como estos objetos son creados, el solo sabe que tiene que "
+"hacer con ellos."
+
+#: ../../Creational/AbstractFactory/README.rst:13
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../Creational/AbstractFactory/README.rst:20
+msgid "Code"
+msgstr "Código"
+
+#: ../../Creational/AbstractFactory/README.rst:22
+msgid "You can also find these code on `GitHub`_"
+msgstr "Puedes encontrar el código en `GitHub`_"
+
+#: ../../Creational/AbstractFactory/README.rst:24
+msgid "AbstractFactory.php"
+msgstr "AbstractFactory.php"
+
+#: ../../Creational/AbstractFactory/README.rst:30
+msgid "JsonFactory.php"
+msgstr "JsonFactory.php"
+
+#: ../../Creational/AbstractFactory/README.rst:36
+msgid "HtmlFactory.php"
+msgstr "HtmlFactory.php"
+
+#: ../../Creational/AbstractFactory/README.rst:42
+msgid "MediaInterface.php"
+msgstr "MediaInterface.php"
+
+#: ../../Creational/AbstractFactory/README.rst:48
+msgid "Picture.php"
+msgstr "Picture.php"
+
+#: ../../Creational/AbstractFactory/README.rst:54
+msgid "Text.php"
+msgstr "Text.php"
+
+#: ../../Creational/AbstractFactory/README.rst:60
+msgid "Json/Picture.php"
+msgstr "Json/Picture.php"
+
+#: ../../Creational/AbstractFactory/README.rst:66
+msgid "Json/Text.php"
+msgstr "Json/Text.php"
+
+#: ../../Creational/AbstractFactory/README.rst:72
+msgid "Html/Picture.php"
+msgstr "Html/Picture.php"
+
+#: ../../Creational/AbstractFactory/README.rst:78
+msgid "Html/Text.php"
+msgstr "Html/Text.php"
+
+#: ../../Creational/AbstractFactory/README.rst:85
+msgid "Test"
+msgstr "Test"
+
+#: ../../Creational/AbstractFactory/README.rst:87
+msgid "Tests/AbstractFactoryTest.php"
+msgstr "Tests/AbstractFactoryTest.php"
diff --git a/locale/es/LC_MESSAGES/Creational/Builder/README.po b/locale/es/LC_MESSAGES/Creational/Builder/README.po
new file mode 100644
index 0000000..0cbdd58
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Creational/Builder/README.po
@@ -0,0 +1,121 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-09-11 11:42+0100\n"
+"Last-Translator: Daniel González \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Language: es\n"
+"Language-Team: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#: ../../Creational/Builder/README.rst:2
+msgid "`Builder`__"
+msgstr "`Constructor`__"
+
+#: ../../Creational/Builder/README.rst:5
+msgid "Purpose"
+msgstr "Propósito"
+
+#: ../../Creational/Builder/README.rst:7
+msgid "Builder is an interface that build parts of a complex object."
+msgstr ""
+"El constructor es una interfaz que construye parte de un objeto complejo."
+
+#: ../../Creational/Builder/README.rst:9
+msgid ""
+"Sometimes, if the builder has a better knowledge of what it builds, this "
+"interface could be an abstract class with default methods (aka adapter)."
+msgstr ""
+"A veces, si el constructor conoce bien lo que está construyendo, esta "
+"interfaz podría ser una clase abstracta con métodos por defecto ( también "
+"conocido como Adaptador )"
+
+#: ../../Creational/Builder/README.rst:12
+msgid ""
+"If you have a complex inheritance tree for objects, it is logical to have a "
+"complex inheritance tree for builders too."
+msgstr ""
+"Si tienes una herencia compleja de tu árbol de objetos, es lógico tener "
+"también una herencia compleja en el árbol de constructores."
+
+#: ../../Creational/Builder/README.rst:15
+msgid ""
+"Note: Builders have often a fluent interface, see the mock builder of "
+"PHPUnit for example."
+msgstr ""
+"Nota: Los constructores suelen tener una interfaz fluida, fíjate en el mock "
+"builder de PHPUnit por ejemplo."
+
+#: ../../Creational/Builder/README.rst:19
+msgid "Examples"
+msgstr "Ejemplos"
+
+#: ../../Creational/Builder/README.rst:21
+msgid "PHPUnit: Mock Builder"
+msgstr "PHPUnit: Mock Builder"
+
+#: ../../Creational/Builder/README.rst:24
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../Creational/Builder/README.rst:31
+msgid "Code"
+msgstr "Código"
+
+#: ../../Creational/Builder/README.rst:33
+msgid "You can also find these code on `GitHub`_"
+msgstr "Puedes encontrar el código en `GitHub`_"
+
+#: ../../Creational/Builder/README.rst:35
+msgid "Director.php"
+msgstr "Director.php"
+
+#: ../../Creational/Builder/README.rst:41
+msgid "BuilderInterface.php"
+msgstr "BuilderInterface.php"
+
+#: ../../Creational/Builder/README.rst:47
+msgid "BikeBuilder.php"
+msgstr "BikeBuilder.php"
+
+#: ../../Creational/Builder/README.rst:53
+msgid "CarBuilder.php"
+msgstr "CarBuilder.php"
+
+#: ../../Creational/Builder/README.rst:59
+msgid "Parts/Vehicle.php"
+msgstr "Parts/Vehicle.php"
+
+#: ../../Creational/Builder/README.rst:65
+msgid "Parts/Bike.php"
+msgstr "Parts/Bike.php"
+
+#: ../../Creational/Builder/README.rst:71
+msgid "Parts/Car.php"
+msgstr "Parts/Car.php"
+
+#: ../../Creational/Builder/README.rst:77
+msgid "Parts/Engine.php"
+msgstr "Parts/Engine.php"
+
+#: ../../Creational/Builder/README.rst:83
+msgid "Parts/Wheel.php"
+msgstr "Parts/Wheel.php"
+
+#: ../../Creational/Builder/README.rst:89
+msgid "Parts/Door.php"
+msgstr "Parts/Door.php"
+
+#: ../../Creational/Builder/README.rst:96
+msgid "Test"
+msgstr "Test"
+
+#: ../../Creational/Builder/README.rst:98
+msgid "Tests/DirectorTest.php"
+msgstr "Tests/DirectorTest.php"
diff --git a/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po
new file mode 100644
index 0000000..550573a
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po
@@ -0,0 +1,97 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-09-15 17:15+0100\n"
+"Last-Translator: Daniel González \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: es\n"
+"Language-Team: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#: ../../Creational/FactoryMethod/README.rst:2
+msgid "`Factory Method`__"
+msgstr "`Factory Method`__"
+
+#: ../../Creational/FactoryMethod/README.rst:5
+msgid "Purpose"
+msgstr "Proposito"
+
+#: ../../Creational/FactoryMethod/README.rst:7
+msgid ""
+"The good point over the SimpleFactory is you can subclass it to implement "
+"different ways to create objects"
+msgstr ""
+"La principal ventaja de SimpleFactory es que puedes extender la clase para "
+"implementar diferentes formas"
+
+#: ../../Creational/FactoryMethod/README.rst:10
+msgid "For simple case, this abstract class could be just an interface"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:12
+msgid ""
+"This pattern is a \"real\" Design Pattern because it achieves the "
+"\"Dependency Inversion Principle\" a.k.a the \"D\" in S.O.L.I.D principles."
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:15
+msgid ""
+"It means the FactoryMethod class depends on abstractions, not concrete "
+"classes. This is the real trick compared to SimpleFactory or StaticFactory."
+msgstr ""
+"Esto significa que la clase FactoryMethod depende de abstraciones, no de "
+"clases concretas. Esto es el truco con respecto a SimpleFactory o "
+"StaticFactory"
+
+#: ../../Creational/FactoryMethod/README.rst:20
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../Creational/FactoryMethod/README.rst:27
+msgid "Code"
+msgstr "Código"
+
+#: ../../Creational/FactoryMethod/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr "Puedes encontrar el código en `GitHub`_"
+
+#: ../../Creational/FactoryMethod/README.rst:31
+msgid "FactoryMethod.php"
+msgstr "FactoryMethod.php"
+
+#: ../../Creational/FactoryMethod/README.rst:37
+msgid "ItalianFactory.php"
+msgstr "ItalianFactory.php"
+
+#: ../../Creational/FactoryMethod/README.rst:43
+msgid "GermanFactory.php"
+msgstr "GermanFactory.php"
+
+#: ../../Creational/FactoryMethod/README.rst:49
+msgid "VehicleInterface.php"
+msgstr "VehicleInterface.php"
+
+#: ../../Creational/FactoryMethod/README.rst:55
+msgid "Porsche.php"
+msgstr "Porsche.php"
+
+#: ../../Creational/FactoryMethod/README.rst:61
+msgid "Bicycle.php"
+msgstr "Bicycle.php"
+
+#: ../../Creational/FactoryMethod/README.rst:67
+msgid "Ferrari.php"
+msgstr "Ferrari.php"
+
+#: ../../Creational/FactoryMethod/README.rst:74
+msgid "Test"
+msgstr "Test"
+
+#: ../../Creational/FactoryMethod/README.rst:76
+msgid "Tests/FactoryMethodTest.php"
+msgstr "Tests/FactoryMethodTest.php"
diff --git a/locale/es/LC_MESSAGES/Creational/Multiton/README.po b/locale/es/LC_MESSAGES/Creational/Multiton/README.po
new file mode 100644
index 0000000..c32fbaa
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Creational/Multiton/README.po
@@ -0,0 +1,71 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-09-11 11:31+0100\n"
+"Last-Translator: Daniel González \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: es\n"
+"Language-Team: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#: ../../Creational/Multiton/README.rst:2
+msgid "Multiton"
+msgstr "Multiton"
+
+#: ../../Creational/Multiton/README.rst:4
+msgid ""
+"**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND "
+"MAINTAINABILITY USE DEPENDENCY INJECTION!**"
+msgstr ""
+"**ESTO ES CONSIDERADO UN ANTI-PATRÓN. PARA MEJOR TESTEABILIDAD Y "
+"MANTENIBILIDAD USA INYECCIÓN DE DEPENDENCIAS**"
+
+#: ../../Creational/Multiton/README.rst:8
+msgid "Purpose"
+msgstr "Propósito"
+
+#: ../../Creational/Multiton/README.rst:10
+msgid ""
+"To have only a list of named instances that are used, like a singleton but "
+"with n instances."
+msgstr ""
+"Tener una única lista de los nombres de las instancias que has usando, como "
+"en el singleton pero con varias instancias."
+
+#: ../../Creational/Multiton/README.rst:14
+msgid "Examples"
+msgstr "Ejemplos"
+
+#: ../../Creational/Multiton/README.rst:16
+msgid "2 DB Connectors, e.g. one for MySQL, the other for SQLite"
+msgstr "2 Conectores de base de datos, Ej. uno para MySQL el otro para SQLite."
+
+#: ../../Creational/Multiton/README.rst:17
+msgid "multiple Loggers (one for debug messages, one for errors)"
+msgstr ""
+"Múltiples sistemas de log ( no para mensajes de debug, uno para errores )."
+
+#: ../../Creational/Multiton/README.rst:20
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../Creational/Multiton/README.rst:27
+msgid "Code"
+msgstr "Código"
+
+#: ../../Creational/Multiton/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr "Puedes encontrar el código en `GitHub`_"
+
+#: ../../Creational/Multiton/README.rst:31
+msgid "Multiton.php"
+msgstr "Multiton.php"
+
+#: ../../Creational/Multiton/README.rst:38
+msgid "Test"
+msgstr "Test"
diff --git a/locale/es/LC_MESSAGES/Creational/Pool/README.po b/locale/es/LC_MESSAGES/Creational/Pool/README.po
new file mode 100644
index 0000000..99fbef8
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Creational/Pool/README.po
@@ -0,0 +1,94 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-09-10 10:03+0100\n"
+"Last-Translator: Daniel González \n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"MIME-Version: 1.0\n"
+"Language: es\n"
+"Language-Team: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#: ../../Creational/Pool/README.rst:2
+msgid "`Pool`__"
+msgstr "`Pila`__"
+
+#: ../../Creational/Pool/README.rst:4
+msgid ""
+"The **object pool pattern** is a software creational design pattern that "
+"uses a set of initialized objects kept ready to use – a \"pool\" – rather "
+"than allocating and destroying them on demand. A client of the pool will "
+"request an object from the pool and perform operations on the returned "
+"object. When the client has finished, it returns the object, which is a "
+"specific type of factory object, to the pool rather than destroying it."
+msgstr ""
+"El **Patrón Pila** es un patrón de diseño creacional que utiliza un conjunto "
+"de objetos inicializados y los mantiene listos para usar el la \"pila\" en "
+"lugar de crearlos y destruirlos bajo demanda. Un cliente puede pedirle a la "
+"pila un objeto, realizar las operaciones necesarias sobre el. Cuando el "
+"cliente ha terminado devuelve el objeto a la pila en lugar de destruirlo."
+
+#: ../../Creational/Pool/README.rst:11
+msgid ""
+"Object pooling can offer a significant performance boost in situations where "
+"the cost of initializing a class instance is high, the rate of instantiation "
+"of a class is high, and the number of instances in use at any one time is "
+"low. The pooled object is obtained in predictable time when creation of the "
+"new objects (especially over network) may take variable time."
+msgstr ""
+"Mantener los objetos en una pila puede ofrecer mejoras significativas de "
+"rendimiento en aquellas situaciones donde el coste de inicializar las "
+"instancias es alto, el volumen de veces que se instancia la clase es alto y "
+"el número de instancias que se mantienen en uso a la vez es bajo. El objeto "
+"puede recuperase de la pila en una cantidad de tiempo predecible, cuando la "
+"creación de nuevos objetos ( especialmente cuando se realiza a través de una "
+"red ) puede variar."
+
+#: ../../Creational/Pool/README.rst:18
+msgid ""
+"However these benefits are mostly true for objects that are expensive with "
+"respect to time, such as database connections, socket connections, threads "
+"and large graphic objects like fonts or bitmaps. In certain situations, "
+"simple object pooling (that hold no external resources, but only occupy "
+"memory) may not be efficient and could decrease performance."
+msgstr "Sin embargo estos beneficios "
+
+#: ../../Creational/Pool/README.rst:25
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../Creational/Pool/README.rst:32
+msgid "Code"
+msgstr "Código"
+
+#: ../../Creational/Pool/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr "Puedes encontrar el código en `GitHub`_"
+
+#: ../../Creational/Pool/README.rst:36
+msgid "Pool.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:42
+msgid "Processor.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:48
+msgid "Worker.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:55
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:57
+msgid "Tests/PoolTest.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:63
+msgid "Tests/TestWorker.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Creational/Prototype/README.po b/locale/es/LC_MESSAGES/Creational/Prototype/README.po
new file mode 100644
index 0000000..dfd8b5e
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Creational/Prototype/README.po
@@ -0,0 +1,74 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-09-09 16:26+0100\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: es\n"
+"Last-Translator: Daniel González \n"
+"Language-Team: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#: ../../Creational/Prototype/README.rst:2
+msgid "`Prototype`__"
+msgstr "`Prototype`__"
+
+#: ../../Creational/Prototype/README.rst:5
+msgid "Purpose"
+msgstr "Proposito"
+
+#: ../../Creational/Prototype/README.rst:7
+msgid ""
+"To avoid the cost of creating objects the standard way (new Foo()) and "
+"instead create a prototype and clone it."
+msgstr ""
+"Evitar el cote de crear objetos de la forma estandar (new Foo()). En su "
+"lugar crear una instancia y clonarla."
+
+#: ../../Creational/Prototype/README.rst:11
+msgid "Examples"
+msgstr "Ejemplos"
+
+#: ../../Creational/Prototype/README.rst:13
+msgid ""
+"Large amounts of data (e.g. create 1,000,000 rows in a database at once via "
+"a ORM)."
+msgstr ""
+"Grandes cantidades de datos ( ej. crear 1.000.000 de registros en la base de "
+"datos a través del ORM )."
+
+#: ../../Creational/Prototype/README.rst:17
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../Creational/Prototype/README.rst:24
+msgid "Code"
+msgstr "Código"
+
+#: ../../Creational/Prototype/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr "Puedes encontrar el código en `GitHub`_"
+
+#: ../../Creational/Prototype/README.rst:28
+msgid "index.php"
+msgstr "index.php"
+
+#: ../../Creational/Prototype/README.rst:34
+msgid "BookPrototype.php"
+msgstr "BookPrototype.php"
+
+#: ../../Creational/Prototype/README.rst:40
+msgid "BarBookPrototype.php"
+msgstr "BarBookPrototype.php"
+
+#: ../../Creational/Prototype/README.rst:46
+msgid "FooBookPrototype.php"
+msgstr "FooBookPrototype.php"
+
+#: ../../Creational/Prototype/README.rst:53
+msgid "Test"
+msgstr "Test"
diff --git a/locale/es/LC_MESSAGES/Creational/README.po b/locale/es/LC_MESSAGES/Creational/README.po
new file mode 100644
index 0000000..7a5db3c
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Creational/README.po
@@ -0,0 +1,32 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-09-08 17:17+0100\n"
+"Last-Translator: Daniel González \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.4\n"
+"Language: es\n"
+
+#: ../../Creational/README.rst:2
+msgid "`Creational`__"
+msgstr "`Creacionales`__"
+
+#: ../../Creational/README.rst:4
+msgid ""
+"In software engineering, creational design patterns are design patterns that "
+"deal with object creation mechanisms, trying to create objects in a manner "
+"suitable to the situation. The basic form of object creation could result in "
+"design problems or added complexity to the design. Creational design "
+"patterns solve this problem by somehow controlling this object creation."
+msgstr ""
+"En ingeniería del software, los patrones de diseño creacionales son patrones "
+"que se encargan del los mecanismos de creación de los objetos, intentando "
+"crear objetos de una manera adecuada a cada situación. La forma básica de "
+"creación de objetos podría generar un problemas de diseño o añadir "
+"complejidad al diseño. Los patrones de diseño creacionales resuelven este "
+"problema controlando de alguna forma la creación de objetos."
diff --git a/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po
new file mode 100644
index 0000000..0b517cd
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po
@@ -0,0 +1,72 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: es\n"
+
+#: ../../Creational/SimpleFactory/README.rst:2
+msgid "Simple Factory"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:7
+msgid "SimpleFactory is a simple factory pattern."
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:9
+msgid ""
+"It differs from the static factory because it is NOT static and as you know:"
+" static => global => evil!"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:12
+msgid ""
+"Therefore, you can have multiple factories, differently parametrized, you "
+"can subclass it and you can mock-up it."
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:16
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:23
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:25
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:27
+msgid "SimpleFactory.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:33
+msgid "VehicleInterface.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:39
+msgid "Bicycle.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:45
+msgid "Scooter.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:52
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:54
+msgid "Tests/SimpleFactoryTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Creational/Singleton/README.po b/locale/es/LC_MESSAGES/Creational/Singleton/README.po
new file mode 100644
index 0000000..0bb78f3
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Creational/Singleton/README.po
@@ -0,0 +1,84 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-09-08 17:34+0100\n"
+"Last-Translator: Daniel González \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.4\n"
+"Language: es\n"
+"Language-Team: \n"
+
+#: ../../Creational/Singleton/README.rst:2
+msgid "`Singleton`__"
+msgstr "`Singleton`__"
+
+#: ../../Creational/Singleton/README.rst:4
+msgid ""
+"**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND "
+"MAINTAINABILITY USE DEPENDENCY INJECTION!**"
+msgstr ""
+"**ESTO ES CONSIDERADO UN ANTI-PATRÓN. PARA MEJOR TESTEABILIDAD Y "
+"MANTENIBILIDAD USA INYECCIÓN DE DEPENDENCIAS**"
+
+#: ../../Creational/Singleton/README.rst:8
+msgid "Purpose"
+msgstr "Proposito"
+
+#: ../../Creational/Singleton/README.rst:10
+msgid ""
+"To have only one instance of this object in the application that will handle "
+"all calls."
+msgstr ""
+"Tener una única instancia de este objeto en la aplicación que pueda "
+"encargarse de todas las llamadas."
+
+#: ../../Creational/Singleton/README.rst:14
+msgid "Examples"
+msgstr "Ejemplos"
+
+#: ../../Creational/Singleton/README.rst:16
+msgid "DB Connector"
+msgstr "Conexión a la base de datos"
+
+#: ../../Creational/Singleton/README.rst:17
+msgid ""
+"Logger (may also be a Multiton if there are many log files for several "
+"purposes)"
+msgstr ""
+"Logger ( también podría ser un Multiton si hay varios ficheros de log para "
+"diferentes propósitos )"
+
+#: ../../Creational/Singleton/README.rst:19
+msgid "Lock file for the application (there is only one in the filesystem ...)"
+msgstr ""
+"Bloqueo de ficheros para la aplicación ( Solo hay uno en el sistema de "
+"ficheros )"
+
+#: ../../Creational/Singleton/README.rst:23
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../Creational/Singleton/README.rst:30
+msgid "Code"
+msgstr "Código"
+
+#: ../../Creational/Singleton/README.rst:32
+msgid "You can also find these code on `GitHub`_"
+msgstr "Puedes ver este código en `GitHub`_"
+
+#: ../../Creational/Singleton/README.rst:34
+msgid "Singleton.php"
+msgstr "Singleton.php"
+
+#: ../../Creational/Singleton/README.rst:41
+msgid "Test"
+msgstr "Test"
+
+#: ../../Creational/Singleton/README.rst:43
+msgid "Tests/SingletonTest.php"
+msgstr "Tests/SingletonTest.php"
diff --git a/locale/es/LC_MESSAGES/Creational/StaticFactory/README.po b/locale/es/LC_MESSAGES/Creational/StaticFactory/README.po
new file mode 100644
index 0000000..7005abb
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Creational/StaticFactory/README.po
@@ -0,0 +1,84 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-09-08 17:47+0100\n"
+"Last-Translator: Daniel González \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: es\n"
+"Language-Team: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#: ../../Creational/StaticFactory/README.rst:2
+msgid "Static Factory"
+msgstr "Static Factory"
+
+#: ../../Creational/StaticFactory/README.rst:5
+msgid "Purpose"
+msgstr "Proposito"
+
+#: ../../Creational/StaticFactory/README.rst:7
+msgid ""
+"Similar to the AbstractFactory, this pattern is used to create series of "
+"related or dependent objects. The difference between this and the abstract "
+"factory pattern is that the static factory pattern uses just one static "
+"method to create all types of objects it can create. It is usually named "
+"``factory`` or ``build``."
+msgstr ""
+"Parecido a AbstractFactory, este patrón es usado para crear conjuntos de "
+"objetos relacionados o dependientes. La diferencia entre este y la factoría "
+"abstracta es que el patrón factoría estática usa un sólo método estático "
+"para crear todos los tipos de objetos que puede crear. Este método "
+"normalmente se llama ``factory`` or ``build``."
+
+#: ../../Creational/StaticFactory/README.rst:14
+msgid "Examples"
+msgstr "Ejemplos"
+
+#: ../../Creational/StaticFactory/README.rst:16
+msgid ""
+"Zend Framework: ``Zend_Cache_Backend`` or ``_Frontend`` use a factory method "
+"create cache backends or frontends"
+msgstr ""
+"Zend Framework: ``Zend_Cache_Backend`` or ``_Frontend`` usa un método "
+"factoría para crear la cache de las aplicaciones."
+
+#: ../../Creational/StaticFactory/README.rst:20
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../Creational/StaticFactory/README.rst:27
+msgid "Code"
+msgstr "Código"
+
+#: ../../Creational/StaticFactory/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr "Puedes encontrar el código en `GitHub`_"
+
+#: ../../Creational/StaticFactory/README.rst:31
+msgid "StaticFactory.php"
+msgstr "StaticFactory.php"
+
+#: ../../Creational/StaticFactory/README.rst:37
+msgid "FormatterInterface.php"
+msgstr "FormatterInterface.php"
+
+#: ../../Creational/StaticFactory/README.rst:43
+msgid "FormatString.php"
+msgstr "FormatString.php"
+
+#: ../../Creational/StaticFactory/README.rst:49
+msgid "FormatNumber.php"
+msgstr "FormatNumber.php"
+
+#: ../../Creational/StaticFactory/README.rst:56
+msgid "Test"
+msgstr "Test"
+
+#: ../../Creational/StaticFactory/README.rst:58
+msgid "Tests/StaticFactoryTest.php"
+msgstr "Tests/StaticFactoryTest.php"
diff --git a/locale/es/LC_MESSAGES/More/Delegation/README.po b/locale/es/LC_MESSAGES/More/Delegation/README.po
new file mode 100644
index 0000000..169e8fd
--- /dev/null
+++ b/locale/es/LC_MESSAGES/More/Delegation/README.po
@@ -0,0 +1,60 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/Delegation/README.rst:2
+msgid "`Delegation`__"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:7 ../../More/Delegation/README.rst:12
+msgid "..."
+msgstr ""
+
+#: ../../More/Delegation/README.rst:10
+msgid "Examples"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:15
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:22
+msgid "Code"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:24
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:26
+msgid "Usage.php"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:32
+msgid "TeamLead.php"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:38
+msgid "JuniorDeveloper.php"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:45
+msgid "Test"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:47
+msgid "Tests/DelegationTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/More/README.po b/locale/es/LC_MESSAGES/More/README.po
new file mode 100644
index 0000000..c3585d8
--- /dev/null
+++ b/locale/es/LC_MESSAGES/More/README.po
@@ -0,0 +1,16 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/README.rst:2
+msgid "More"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/More/Repository/README.po b/locale/es/LC_MESSAGES/More/Repository/README.po
new file mode 100644
index 0000000..d9ecc90
--- /dev/null
+++ b/locale/es/LC_MESSAGES/More/Repository/README.po
@@ -0,0 +1,76 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/Repository/README.rst:2
+msgid "Repository"
+msgstr ""
+
+#: ../../More/Repository/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../More/Repository/README.rst:7
+msgid ""
+"Mediates between the domain and data mapping layers using a collection-like "
+"interface for accessing domain objects. Repository encapsulates the set of "
+"objects persisted in a data store and the operations performed over them, "
+"providing a more object-oriented view of the persistence layer. Repository "
+"also supports the objective of achieving a clean separation and one-way "
+"dependency between the domain and data mapping layers."
+msgstr ""
+
+#: ../../More/Repository/README.rst:16
+msgid "Examples"
+msgstr ""
+
+#: ../../More/Repository/README.rst:18
+msgid ""
+"Doctrine 2 ORM: there is Repository that mediates between Entity and DBAL "
+"and contains methods to retrieve objects"
+msgstr ""
+
+#: ../../More/Repository/README.rst:20
+msgid "Laravel Framework"
+msgstr ""
+
+#: ../../More/Repository/README.rst:23
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../More/Repository/README.rst:30
+msgid "Code"
+msgstr ""
+
+#: ../../More/Repository/README.rst:32
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../More/Repository/README.rst:34
+msgid "Post.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:40
+msgid "PostRepository.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:46
+msgid "Storage.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:52
+msgid "MemoryStorage.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:59
+msgid "Test"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/More/ServiceLocator/README.po b/locale/es/LC_MESSAGES/More/ServiceLocator/README.po
new file mode 100644
index 0000000..9808a92
--- /dev/null
+++ b/locale/es/LC_MESSAGES/More/ServiceLocator/README.po
@@ -0,0 +1,94 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/ServiceLocator/README.rst:2
+msgid "`Service Locator`__"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:7
+msgid ""
+"To implement a loosely coupled architecture in order to get better testable,"
+" maintainable and extendable code. DI pattern and Service Locator pattern "
+"are an implementation of the Inverse of Control pattern."
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:12
+msgid "Usage"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:14
+msgid ""
+"With ``ServiceLocator`` you can register a service for a given interface. By"
+" using the interface you can retrieve the service and use it in the classes "
+"of the application without knowing its implementation. You can configure and"
+" inject the Service Locator object on bootstrap."
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:20
+msgid "Examples"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:22
+msgid ""
+"Zend Framework 2 uses Service Locator to create and share services used in "
+"the framework(i.e. EventManager, ModuleManager, all custom user services "
+"provided by modules, etc...)"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:27
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:34
+msgid "Code"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:36
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:38
+msgid "ServiceLocatorInterface.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:44
+msgid "ServiceLocator.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:50
+msgid "LogServiceInterface.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:56
+msgid "LogService.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:62
+msgid "DatabaseServiceInterface.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:68
+msgid "DatabaseService.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:75
+msgid "Test"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:77
+msgid "Tests/ServiceLocatorTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/README.po b/locale/es/LC_MESSAGES/README.po
new file mode 100644
index 0000000..ddebaed
--- /dev/null
+++ b/locale/es/LC_MESSAGES/README.po
@@ -0,0 +1,123 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-09-08 17:14+0100\n"
+"Last-Translator: Daniel González \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.4\n"
+"Language: es\n"
+"Language-Team: \n"
+
+#: ../../README.rst:5
+msgid "DesignPatternsPHP"
+msgstr ""
+
+#: ../../README.rst:11
+msgid ""
+"This is a collection of known `design patterns`_ and some sample code how to "
+"implement them in PHP. Every pattern has a small list of examples (most of "
+"them from Zend Framework, Symfony2 or Doctrine2 as I'm most familiar with "
+"this software)."
+msgstr ""
+"Esto es un recopilatorio de los conocidos como `patrones de diseño`_ junto "
+"con algunos ejemplos de código sobre como implementarlos en PHP. Cada patrón "
+"tiene una pequeña lista de ejemplos ( la mayoría de ellos de Zend "
+"Framework, Symfony2 o Doctrine2 ya que estoy más familiarizado con ellos )."
+
+#: ../../README.rst:16
+msgid ""
+"I think the problem with patterns is that often people do know them but "
+"don't know when to apply which."
+msgstr ""
+"El problema con los patrones es que la mayoría de la gente los conoce, pero "
+"no saben cuando aplicarlos."
+
+#: ../../README.rst:20
+msgid "Patterns"
+msgstr "Patrones"
+
+#: ../../README.rst:22
+msgid ""
+"The patterns can be structured in roughly three different categories. Please "
+"click on **the title of every pattern's page** for a full explanation of the "
+"pattern on Wikipedia."
+msgstr ""
+"Los patrones pueden clasificarse en tres categorías diferentes. Por favor "
+"pincha en **el título de cada pagina de patrón** para ver la explicación "
+"completa del patrón en la Wikipedia."
+
+#: ../../README.rst:35
+msgid "Contribute"
+msgstr "Contribuir"
+
+#: ../../README.rst:37
+msgid ""
+"Please feel free to fork and extend existing or add your own examples and "
+"send a pull request with your changes! To establish a consistent code "
+"quality, please check your code using `PHP CodeSniffer`_ against `PSR2 "
+"standard`_ using ``./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor .``."
+msgstr ""
+"Por favor tomate la libertad de copiar, extender y añadir tus propios "
+"ejemplos y enviar una solicitud para añadir tus cambios al repositorio "
+"principal. Para establecer una calidad de código consistente revisa que tu "
+"código usa `PHP CodeSniffer` con el `PSR2 standard`_ utilizando ``./vendor/"
+"bin/phpcs -p --standard=PSR2 --ignore=vendor "
+
+#: ../../README.rst:44
+msgid "License"
+msgstr "Licencia"
+
+#: ../../README.rst:46
+msgid "(The MIT License)"
+msgstr "(La licencia MIT)"
+
+#: ../../README.rst:48
+msgid "Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_"
+msgstr "Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_"
+
+#: ../../README.rst:50
+msgid ""
+"Permission is hereby granted, free of charge, to any person obtaining a copy "
+"of this software and associated documentation files (the 'Software'), to "
+"deal in the Software without restriction, including without limitation the "
+"rights to use, copy, modify, merge, publish, distribute, sublicense, and/or "
+"sell copies of the Software, and to permit persons to whom the Software is "
+"furnished to do so, subject to the following conditions:"
+msgstr ""
+"Permission is hereby granted, free of charge, to any person obtaining a copy "
+"of this software and associated documentation files (the 'Software'), to "
+"deal in the Software without restriction, including without limitation the "
+"rights to use, copy, modify, merge, publish, distribute, sublicense, and/or "
+"sell copies of the Software, and to permit persons to whom the Software is "
+"furnished to do so, subject to the following conditions:"
+
+#: ../../README.rst:58
+msgid ""
+"The above copyright notice and this permission notice shall be included in "
+"all copies or substantial portions of the Software."
+msgstr ""
+"The above copyright notice and this permission notice shall be included in "
+"all copies or substantial portions of the Software."
+
+#: ../../README.rst:61
+msgid ""
+"THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR "
+"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, "
+"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE "
+"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER "
+"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING "
+"FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS "
+"IN THE SOFTWARE."
+msgstr ""
+"THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR "
+"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, "
+"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE "
+"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER "
+"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING "
+"FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS "
+"IN THE SOFTWARE."
diff --git a/locale/es/LC_MESSAGES/Structural/Adapter/README.po b/locale/es/LC_MESSAGES/Structural/Adapter/README.po
new file mode 100644
index 0000000..b351fc9
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Structural/Adapter/README.po
@@ -0,0 +1,82 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Adapter/README.rst:2
+msgid "`Adapter / Wrapper`__"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:7
+msgid ""
+"To translate one interface for a class into a compatible interface. An "
+"adapter allows classes to work together that normally could not because of "
+"incompatible interfaces by providing it's interface to clients while using "
+"the original interface."
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:13
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:15
+msgid "DB Client libraries adapter"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:16
+msgid ""
+"using multiple different webservices and adapters normalize data so that the"
+" outcome is the same for all"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:31
+msgid "PaperBookInterface.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:37
+msgid "Book.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:43
+msgid "EBookAdapter.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:49
+msgid "EBookInterface.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:55
+msgid "Kindle.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:62
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:64
+msgid "Tests/AdapterTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Structural/Bridge/README.po b/locale/es/LC_MESSAGES/Structural/Bridge/README.po
new file mode 100644
index 0000000..a27619b
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Structural/Bridge/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Bridge/README.rst:2
+msgid "`Bridge`__"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:7
+msgid ""
+"Decouple an abstraction from its implementation so that the two can vary "
+"independently."
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:11
+msgid "Sample:"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:13
+msgid "`Symfony DoctrineBridge `__"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:28
+msgid "Workshop.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:34
+msgid "Assemble.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:40
+msgid "Produce.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:46
+msgid "Vehicle.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:52
+msgid "Motorcycle.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:58
+msgid "Car.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:65
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:67
+msgid "Tests/BridgeTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Structural/Composite/README.po b/locale/es/LC_MESSAGES/Structural/Composite/README.po
new file mode 100644
index 0000000..90ddd21
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Structural/Composite/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Composite/README.rst:2
+msgid "`Composite`__"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:7
+msgid ""
+"To treat a group of objects the same way as a single instance of the object."
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:11
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:13
+msgid ""
+"a form class instance handles all its form elements like a single instance "
+"of the form, when ``render()`` is called, it subsequently runs through all "
+"its child elements and calls ``render()`` on them"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:16
+msgid ""
+"``Zend_Config``: a tree of configuration options, each one is a "
+"``Zend_Config`` object itself"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:31
+msgid "FormElement.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:37
+msgid "Form.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:43
+msgid "InputElement.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:49
+msgid "TextElement.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:56
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:58
+msgid "Tests/CompositeTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Structural/DataMapper/README.po b/locale/es/LC_MESSAGES/Structural/DataMapper/README.po
new file mode 100644
index 0000000..5ccd9a3
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Structural/DataMapper/README.po
@@ -0,0 +1,77 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/DataMapper/README.rst:2
+msgid "`Data Mapper`__"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:7
+msgid ""
+"A Data Mapper, is a Data Access Layer that performs bidirectional transfer "
+"of data between a persistent data store (often a relational database) and an"
+" in memory data representation (the domain layer). The goal of the pattern "
+"is to keep the in memory representation and the persistent data store "
+"independent of each other and the data mapper itself. The layer is composed "
+"of one or more mappers (or Data Access Objects), performing the data "
+"transfer. Mapper implementations vary in scope. Generic mappers will handle "
+"many different domain entity types, dedicated mappers will handle one or a "
+"few."
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:17
+msgid ""
+"The key point of this pattern is, unlike Active Record pattern, the data "
+"model follows Single Responsibility Principle."
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:21
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:23
+msgid ""
+"DB Object Relational Mapper (ORM) : Doctrine2 uses DAO named as "
+"\"EntityRepository\""
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:27
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:34
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:36
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:38
+msgid "User.php"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:44
+msgid "UserMapper.php"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:51
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:53
+msgid "Tests/DataMapperTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Structural/Decorator/README.po b/locale/es/LC_MESSAGES/Structural/Decorator/README.po
new file mode 100644
index 0000000..0ecf351
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Structural/Decorator/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Decorator/README.rst:2
+msgid "`Decorator`__"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:7
+msgid "To dynamically add new functionality to class instances."
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:10
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:12
+msgid "Zend Framework: decorators for ``Zend_Form_Element`` instances"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:13
+msgid ""
+"Web Service Layer: Decorators JSON and XML for a REST service (in this case,"
+" only one of these should be allowed of course)"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:28
+msgid "RendererInterface.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:34
+msgid "Webservice.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:40
+msgid "Decorator.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:46
+msgid "RenderInXml.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:52
+msgid "RenderInJson.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:59
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:61
+msgid "Tests/DecoratorTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Structural/DependencyInjection/README.po b/locale/es/LC_MESSAGES/Structural/DependencyInjection/README.po
new file mode 100644
index 0000000..0834846
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Structural/DependencyInjection/README.po
@@ -0,0 +1,107 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/DependencyInjection/README.rst:2
+msgid "`Dependency Injection`__"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:7
+msgid ""
+"To implement a loosely coupled architecture in order to get better testable,"
+" maintainable and extendable code."
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:11
+msgid "Usage"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:13
+msgid ""
+"Configuration gets injected and ``Connection`` will get all that it needs "
+"from ``$config``. Without DI, the configuration would be created directly in"
+" ``Connection``, which is not very good for testing and extending "
+"``Connection``."
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:18
+msgid ""
+"Notice we are following Inversion of control principle in ``Connection`` by "
+"asking ``$config`` to implement ``Parameters`` interface. This decouples our"
+" components. We don't care where the source of information comes from, we "
+"only care that ``$config`` has certain methods to retrieve that information."
+" Read more about Inversion of control `here "
+"`__."
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:26
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:28
+msgid ""
+"The Doctrine2 ORM uses dependency injection e.g. for configuration that is "
+"injected into a ``Connection`` object. For testing purposes, one can easily "
+"create a mock object of the configuration and inject that into the "
+"``Connection`` object"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:32
+msgid ""
+"Symfony and Zend Framework 2 already have containers for DI that create "
+"objects via a configuration array and inject them where needed (i.e. in "
+"Controllers)"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:37
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:44
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:46
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:48
+msgid "AbstractConfig.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:54
+msgid "Parameters.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:60
+msgid "ArrayConfig.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:66
+msgid "Connection.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:73
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:75
+msgid "Tests/DependencyInjectionTest.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:81
+msgid "Tests/config.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Structural/Facade/README.po b/locale/es/LC_MESSAGES/Structural/Facade/README.po
new file mode 100644
index 0000000..1d78bf4
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Structural/Facade/README.po
@@ -0,0 +1,87 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Facade/README.rst:2
+msgid "`Facade`__"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:7
+msgid ""
+"The primary goal of a Facade Pattern is not to avoid you to read the manual "
+"of a complex API. It's only a side-effect. The first goal is to reduce "
+"coupling and follow the Law of Demeter."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:11
+msgid ""
+"A Facade is meant to decouple a client and a sub-system by embedding many "
+"(but sometimes just one) interface, and of course to reduce complexity."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:15
+msgid "A facade does not forbid you the access to the sub-system"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:16
+msgid "You can (you should) have multiple facades for one sub-system"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:18
+msgid ""
+"That's why a good facade has no ``new`` in it. If there are multiple "
+"creations for each method, it is not a Facade, it's a Builder or a "
+"[Abstract\\|Static\\|Simple] Factory [Method]."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:22
+msgid ""
+"The best facade has no ``new`` and a constructor with interface-type-hinted "
+"parameters. If you need creation of new instances, use a Factory as "
+"argument."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:27
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:34
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:36
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:38
+msgid "Facade.php"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:44
+msgid "OsInterface.php"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:50
+msgid "BiosInterface.php"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:57
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:59
+msgid "Tests/FacadeTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Structural/FluentInterface/README.po b/locale/es/LC_MESSAGES/Structural/FluentInterface/README.po
new file mode 100644
index 0000000..0e58551
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Structural/FluentInterface/README.po
@@ -0,0 +1,66 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/FluentInterface/README.rst:2
+msgid "`Fluent Interface`__"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:7
+msgid ""
+"To write code that is easy readable just like sentences in a natural "
+"language (like English)."
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:11
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:13
+msgid "Doctrine2's QueryBuilder works something like that example class below"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:15
+msgid "PHPUnit uses fluent interfaces to build mock objects"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:16
+msgid "Yii Framework: CDbCommand and CActiveRecord use this pattern, too"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:19
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:26
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:28
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:30
+msgid "Sql.php"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:37
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:39
+msgid "Tests/FluentInterfaceTest.php"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Structural/Proxy/README.po b/locale/es/LC_MESSAGES/Structural/Proxy/README.po
new file mode 100644
index 0000000..290eacc
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Structural/Proxy/README.po
@@ -0,0 +1,59 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Proxy/README.rst:2
+msgid "`Proxy`__"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:7
+msgid "To interface to anything that is expensive or impossible to duplicate."
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:10
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:12
+msgid ""
+"Doctrine2 uses proxies to implement framework magic (e.g. lazy "
+"initialization) in them, while the user still works with his own entity "
+"classes and will never use nor touch the proxies"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:28
+msgid "Record.php"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:34
+msgid "RecordProxy.php"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:41
+msgid "Test"
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Structural/README.po b/locale/es/LC_MESSAGES/Structural/README.po
new file mode 100644
index 0000000..7957330
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Structural/README.po
@@ -0,0 +1,23 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/README.rst:2
+msgid "`Structural`__"
+msgstr ""
+
+#: ../../Structural/README.rst:4
+msgid ""
+"In Software Engineering, Structural Design Patterns are Design Patterns that"
+" ease the design by identifying a simple way to realize relationships "
+"between entities."
+msgstr ""
diff --git a/locale/es/LC_MESSAGES/Structural/Registry/README.po b/locale/es/LC_MESSAGES/Structural/Registry/README.po
new file mode 100644
index 0000000..843138c
--- /dev/null
+++ b/locale/es/LC_MESSAGES/Structural/Registry/README.po
@@ -0,0 +1,67 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Registry/README.rst:2
+msgid "`Registry`__"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:7
+msgid ""
+"To implement a central storage for objects often used throughout the "
+"application, is typically implemented using an abstract class with only "
+"static methods (or using the Singleton pattern)"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:12
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:14
+msgid ""
+"Zend Framework: ``Zend_Registry`` holds the application's logger object, "
+"front controller etc."
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:16
+msgid ""
+"Yii Framework: ``CWebApplication`` holds all the application components, "
+"such as ``CWebUser``, ``CUrlManager``, etc."
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:31
+msgid "Registry.php"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:38
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:40
+msgid "Tests/RegistryTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po
new file mode 100644
index 0000000..b5277a5
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po
@@ -0,0 +1,90 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:2
+msgid "`Chain Of Responsibilities`__"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:5
+msgid "Purpose:"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:7
+msgid ""
+"To build a chain of objects to handle a call in sequential order. If one "
+"object cannot handle a call, it delegates the call to the next in the chain "
+"and so forth."
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:12
+msgid "Examples:"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:14
+msgid ""
+"logging framework, where each chain element decides autonomously what to do "
+"with a log message"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:16
+msgid "a Spam filter"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:17
+msgid ""
+"Caching: first object is an instance of e.g. a Memcached Interface, if that "
+"\"misses\" it delegates the call to the database interface"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:19
+msgid ""
+"Yii Framework: CFilterChain is a chain of controller action filters. the "
+"executing point is passed from one filter to the next along the chain, and "
+"only if all filters say \"yes\", the action can be invoked at last."
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:36
+msgid "Request.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:42
+msgid "Handler.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:48
+msgid "Responsible/SlowStorage.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:54
+msgid "Responsible/FastStorage.php"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:61
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:63
+msgid "Tests/ChainTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Command/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Command/README.po
new file mode 100644
index 0000000..29319a3
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Command/README.po
@@ -0,0 +1,99 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Command/README.rst:2
+msgid "`Command`__"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:7
+msgid "To encapsulate invocation and decoupling."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:9
+msgid ""
+"We have an Invoker and a Receiver. This pattern uses a \"Command\" to "
+"delegate the method call against the Receiver and presents the same method "
+"\"execute\". Therefore, the Invoker just knows to call \"execute\" to "
+"process the Command of the client. The Receiver is decoupled from the "
+"Invoker."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:15
+msgid ""
+"The second aspect of this pattern is the undo(), which undoes the method "
+"execute(). Command can also be aggregated to combine more complex commands "
+"with minimum copy-paste and relying on composition over inheritance."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:21
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:23
+msgid ""
+"A text editor : all events are Command which can be undone, stacked and "
+"saved."
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:25
+msgid ""
+"Symfony2: SF2 Commands that can be run from the CLI are built with just the "
+"Command pattern in mind"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:27
+msgid ""
+"big CLI tools use subcommands to distribute various tasks and pack them in "
+"\"modules\", each of these can be implemented with the Command pattern (e.g."
+" vagrant)"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:32
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:39
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:41
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:43
+msgid "CommandInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:49
+msgid "HelloCommand.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:55
+msgid "Receiver.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:61
+msgid "Invoker.php"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:68
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Command/README.rst:70
+msgid "Tests/CommandTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Iterator/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Iterator/README.po
new file mode 100644
index 0000000..3000658
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Iterator/README.po
@@ -0,0 +1,83 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Iterator/README.rst:2
+msgid "`Iterator`__"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:7
+msgid ""
+"To make an object iterable and to make it appear like a collection of "
+"objects."
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:11
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:13
+msgid ""
+"to process a file line by line by just running over all lines (which have an"
+" object representation) for a file (which of course is an object, too)"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:18
+msgid "Note"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:20
+msgid ""
+"Standard PHP Library (SPL) defines an interface Iterator which is best "
+"suited for this! Often you would want to implement the Countable interface "
+"too, to allow ``count($object)`` on your iterable object"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:36
+msgid "Book.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:42
+msgid "BookList.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:48
+msgid "BookListIterator.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:54
+msgid "BookListReverseIterator.php"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:61
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Iterator/README.rst:63
+msgid "Tests/IteratorTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Mediator/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Mediator/README.po
new file mode 100644
index 0000000..9c6694b
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Mediator/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Mediator/README.rst:2
+msgid "`Mediator`__"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:7
+msgid ""
+"This pattern provides an easy to decouple many components working together. "
+"It is a good alternative over Observer IF you have a \"central "
+"intelligence\", like a controller (but not in the sense of the MVC)."
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:11
+msgid ""
+"All components (called Colleague) are only coupled to the MediatorInterface "
+"and it is a good thing because in OOP, one good friend is better than many. "
+"This is the key-feature of this pattern."
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:16
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:23
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:25
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:27
+msgid "MediatorInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:33
+msgid "Mediator.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:39
+msgid "Colleague.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:45
+msgid "Subsystem/Client.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:51
+msgid "Subsystem/Database.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:57
+msgid "Subsystem/Server.php"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:64
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Mediator/README.rst:66
+msgid "Tests/MediatorTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Memento/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Memento/README.po
new file mode 100644
index 0000000..913069a
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Memento/README.po
@@ -0,0 +1,85 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Memento/README.rst:2
+msgid "`Memento`__"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:7
+msgid ""
+"Provide the ability to restore an object to its previous state (undo via "
+"rollback)."
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:10
+msgid ""
+"The memento pattern is implemented with three objects: the originator, a "
+"caretaker and a memento. The originator is some object that has an internal "
+"state. The caretaker is going to do something to the originator, but wants "
+"to be able to undo the change. The caretaker first asks the originator for a"
+" memento object. Then it does whatever operation (or sequence of operations)"
+" it was going to do. To roll back to the state before the operations, it "
+"returns the memento object to the originator. The memento object itself is "
+"an opaque object (one which the caretaker cannot, or should not, change). "
+"When using this pattern, care should be taken if the originator may change "
+"other objects or resources - the memento pattern operates on a single "
+"object."
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:23
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:25
+msgid "The seed of a pseudorandom number generator"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:26
+msgid "The state in a finite state machine"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:29
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:36
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:38
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:40
+msgid "Memento.php"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:46
+msgid "Originator.php"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:52
+msgid "Caretaker.php"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:59
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Memento/README.rst:61
+msgid "Tests/MementoTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/NullObject/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/NullObject/README.po
new file mode 100644
index 0000000..35b77f6
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/NullObject/README.po
@@ -0,0 +1,103 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/NullObject/README.rst:2
+msgid "`Null Object`__"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:7
+msgid ""
+"NullObject is not a GoF design pattern but a schema which appears frequently"
+" enough to be considered a pattern. It has the following benefits:"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:11
+msgid "Client code is simplified"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:12
+msgid "Reduces the chance of null pointer exceptions"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:13
+msgid "Fewer conditionals require less test cases"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:15
+msgid ""
+"Methods that return an object or null should instead return an object or "
+"``NullObject``. ``NullObject``\\ s simplify boilerplate code such as ``if "
+"(!is_null($obj)) { $obj->callSomething(); }`` to just "
+"``$obj->callSomething();`` by eliminating the conditional check in client "
+"code."
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:22
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:24
+msgid "Symfony2: null logger of profiler"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:25
+msgid "Symfony2: null output in Symfony/Console"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:26
+msgid "null handler in a Chain of Responsibilities pattern"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:27
+msgid "null command in a Command pattern"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:30
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:37
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:39
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:41
+msgid "Service.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:47
+msgid "LoggerInterface.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:53
+msgid "PrintLogger.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:59
+msgid "NullLogger.php"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:66
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/NullObject/README.rst:68
+msgid "Tests/LoggerTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Observer/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Observer/README.po
new file mode 100644
index 0000000..6aea8e9
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Observer/README.po
@@ -0,0 +1,75 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Observer/README.rst:2
+msgid "`Observer`__"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:7
+msgid ""
+"To implement a publish/subscribe behaviour to an object, whenever a "
+"\"Subject\" object changes it's state, the attached \"Observers\" will be "
+"notified. It is used to shorten the amount of coupled objects and uses loose"
+" coupling instead."
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:13
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:15
+msgid ""
+"a message queue system is observed to show the progress of a job in a GUI"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:19
+msgid "Note"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:21
+msgid ""
+"PHP already defines two interfaces that can help to implement this pattern: "
+"SplObserver and SplSubject."
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:36
+msgid "User.php"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:42
+msgid "UserObserver.php"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:49
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Observer/README.rst:51
+msgid "Tests/ObserverTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/README.po
new file mode 100644
index 0000000..93ebd7c
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/README.po
@@ -0,0 +1,24 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/README.rst:2
+msgid "`Behavioral`__"
+msgstr ""
+
+#: ../../Behavioral/README.rst:4
+msgid ""
+"In software engineering, behavioral design patterns are design patterns that"
+" identify common communication patterns between objects and realize these "
+"patterns. By doing so, these patterns increase flexibility in carrying out "
+"this communication."
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Specification/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Specification/README.po
new file mode 100644
index 0000000..54e3b64
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Specification/README.po
@@ -0,0 +1,84 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Specification/README.rst:2
+msgid "`Specification`__"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:7
+msgid ""
+"Builds a clear specification of business rules, where objects can be checked"
+" against. The composite specification class has one method called "
+"``isSatisfiedBy`` that returns either true or false depending on whether the"
+" given object satisfies the specification."
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:13
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:15
+msgid "`RulerZ `__"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:18
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:25
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:27
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:29
+msgid "Item.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:35
+msgid "SpecificationInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:41
+msgid "AbstractSpecification.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:47
+msgid "Either.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:53
+msgid "PriceSpecification.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:59
+msgid "Plus.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:65
+msgid "Not.php"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:72
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Specification/README.rst:74
+msgid "Tests/SpecificationTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/State/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/State/README.po
new file mode 100644
index 0000000..f71fbfa
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/State/README.po
@@ -0,0 +1,63 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/State/README.rst:2
+msgid "`State`__"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:7
+msgid ""
+"Encapsulate varying behavior for the same routine based on an object's "
+"state. This can be a cleaner way for an object to change its behavior at "
+"runtime without resorting to large monolithic conditional statements."
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:12
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:19
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:21
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:23
+msgid "OrderController.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:29
+msgid "OrderFactory.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:35
+msgid "OrderInterface.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:41
+msgid "ShippingOrder.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:47
+msgid "CreateOrder.php"
+msgstr ""
+
+#: ../../Behavioral/State/README.rst:54
+msgid "Test"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Strategy/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Strategy/README.po
new file mode 100644
index 0000000..dd5797e
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Strategy/README.po
@@ -0,0 +1,92 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Strategy/README.rst:2
+msgid "`Strategy`__"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:5
+msgid "Terminology:"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:7
+msgid "Context"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:8
+msgid "Strategy"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:9
+msgid "Concrete Strategy"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:12
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:14
+msgid ""
+"To separate strategies and to enable fast switching between them. Also this "
+"pattern is a good alternative to inheritance (instead of having an abstract "
+"class that is extended)."
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:19
+msgid "Examples"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:21
+msgid "sorting a list of objects, one strategy by date, the other by id"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:22
+msgid ""
+"simplify unit testing: e.g. switching between file and in-memory storage"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:26
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:33
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:35
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:37
+msgid "ObjectCollection.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:43
+msgid "ComparatorInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:49
+msgid "DateComparator.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:55
+msgid "IdComparator.php"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:62
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Strategy/README.rst:64
+msgid "Tests/StrategyTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/TemplateMethod/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/TemplateMethod/README.po
new file mode 100644
index 0000000..4f6fa81
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/TemplateMethod/README.po
@@ -0,0 +1,83 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/TemplateMethod/README.rst:2
+msgid "`Template Method`__"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:7
+msgid "Template Method is a behavioral design pattern."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:9
+msgid ""
+"Perhaps you have encountered it many times already. The idea is to let "
+"subclasses of this abstract template \"finish\" the behavior of an "
+"algorithm."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:13
+msgid ""
+"A.k.a the \"Hollywood principle\": \"Don't call us, we call you.\" This "
+"class is not called by subclasses but the inverse. How? With abstraction of "
+"course."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:17
+msgid ""
+"In other words, this is a skeleton of algorithm, well-suited for framework "
+"libraries. The user has just to implement one method and the superclass do "
+"the job."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:21
+msgid ""
+"It is an easy way to decouple concrete classes and reduce copy-paste, that's"
+" why you'll find it everywhere."
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:36
+msgid "Journey.php"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:42
+msgid "BeachJourney.php"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:48
+msgid "CityJourney.php"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:55
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/TemplateMethod/README.rst:57
+msgid "Tests/JourneyTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Visitor/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Visitor/README.po
new file mode 100644
index 0000000..cab0ea9
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Visitor/README.po
@@ -0,0 +1,75 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Behavioral/Visitor/README.rst:2
+msgid "`Visitor`__"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:7
+msgid ""
+"The Visitor Pattern lets you outsource operations on objects to other "
+"objects. The main reason to do this is to keep a separation of concerns. But"
+" classes have to define a contract to allow visitors (the ``Role::accept`` "
+"method in the example)."
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:12
+msgid ""
+"The contract is an abstract class but you can have also a clean interface. "
+"In that case, each Visitor has to choose itself which method to invoke on "
+"the visitor."
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:28
+msgid "RoleVisitorInterface.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:34
+msgid "RolePrintVisitor.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:40
+msgid "Role.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:46
+msgid "User.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:52
+msgid "Group.php"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:59
+msgid "Test"
+msgstr ""
+
+#: ../../Behavioral/Visitor/README.rst:61
+msgid "Tests/VisitorTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/pt_BR/LC_MESSAGES/Creational/AbstractFactory/README.po
new file mode 100644
index 0000000..fd6e4dd
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Creational/AbstractFactory/README.po
@@ -0,0 +1,92 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-06-20 12:00-0300\n"
+"Last-Translator: Leonam Pereira Dias \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: pt_BR\n"
+
+#: ../../Creational/AbstractFactory/README.rst:2
+msgid "`Abstract Factory`__"
+msgstr ""
+"Fábrica de abstração_ (`Abstract Factory`__)"
+
+#: ../../Creational/AbstractFactory/README.rst:5
+msgid "Purpose"
+msgstr "Objetivo"
+
+#: ../../Creational/AbstractFactory/README.rst:7
+msgid ""
+"To create series of related or dependent objects without specifying their "
+"concrete classes. Usually the created classes all implement the same "
+"interface. The client of the abstract factory does not care about how these "
+"objects are created, he just knows how they go together."
+msgstr ""
+"Para a criação de conjunto de objetos relacionados ou dependentes sem especificar suas "
+"classes concretas. O cliente da fábrica de abstração não precisa se preocupar como estes "
+"objetos são criados, ele só sabe obtê-los."
+
+#: ../../Creational/AbstractFactory/README.rst:13
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../Creational/AbstractFactory/README.rst:20
+msgid "Code"
+msgstr "Código"
+
+#: ../../Creational/AbstractFactory/README.rst:22
+msgid "You can also find these code on `GitHub`_"
+msgstr "Você pode encontrar o código no `Github`_"
+
+#: ../../Creational/AbstractFactory/README.rst:24
+msgid "AbstractFactory.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:30
+msgid "JsonFactory.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:36
+msgid "HtmlFactory.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:42
+msgid "MediaInterface.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:48
+msgid "Picture.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:54
+msgid "Text.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:60
+msgid "Json/Picture.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:66
+msgid "Json/Text.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:72
+msgid "Html/Picture.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:78
+msgid "Html/Text.php"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:85
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/AbstractFactory/README.rst:87
+msgid "Tests/AbstractFactoryTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Creational/Builder/README.po b/locale/pt_BR/LC_MESSAGES/Creational/Builder/README.po
new file mode 100644
index 0000000..4dcdf66
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Creational/Builder/README.po
@@ -0,0 +1,115 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-05-21 10:54-0300\n"
+"Last-Translator: Leonam Pereira Dias \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: pt_BR\n"
+
+#: ../../Creational/Builder/README.rst:2
+msgid "`Builder`__"
+msgstr "Construtor (`Builder`__)"
+
+#: ../../Creational/Builder/README.rst:5
+msgid "Purpose"
+msgstr "Objetivo"
+
+#: ../../Creational/Builder/README.rst:7
+msgid "Builder is an interface that build parts of a complex object."
+msgstr "Contrutor é uma interface que constrói partes de objetos complexos."
+
+#: ../../Creational/Builder/README.rst:9
+msgid ""
+"Sometimes, if the builder has a better knowledge of what it builds, this "
+"interface could be an abstract class with default methods (aka adapter)."
+msgstr ""
+"As vezes, se o construtor tem melhor conhecimento do que ele cria, essa "
+"interface pode ser uma classe abstrata com métodos padrão (como o padrão adaptador)."
+
+#: ../../Creational/Builder/README.rst:12
+msgid ""
+"If you have a complex inheritance tree for objects, it is logical to have a "
+"complex inheritance tree for builders too."
+msgstr ""
+"Se você tem uma árvore de herança entre objetos complexa, é lógico que se tenha uma "
+"árvore de herança complexa para os construtores também"
+
+#: ../../Creational/Builder/README.rst:15
+msgid ""
+"Note: Builders have often a fluent interface, see the mock builder of "
+"PHPUnit for example."
+msgstr ""
+"Nota: Construtores têm frequentemente, uma interface fluente. Veja o construtor mock do PHPUnit, por exemplo."
+
+#: ../../Creational/Builder/README.rst:19
+msgid "Examples"
+msgstr "Exemplos"
+
+#: ../../Creational/Builder/README.rst:21
+msgid "PHPUnit: Mock Builder"
+msgstr "PHPUnit: Contrutor Mock"
+
+#: ../../Creational/Builder/README.rst:24
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../Creational/Builder/README.rst:31
+msgid "Code"
+msgstr "Código"
+
+#: ../../Creational/Builder/README.rst:33
+msgid "You can also find these code on `GitHub`_"
+msgstr "Você pode encontrar esse código no `Github`_"
+
+#: ../../Creational/Builder/README.rst:35
+msgid "Director.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:41
+msgid "BuilderInterface.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:47
+msgid "BikeBuilder.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:53
+msgid "CarBuilder.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:59
+msgid "Parts/Vehicle.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:65
+msgid "Parts/Bike.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:71
+msgid "Parts/Car.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:77
+msgid "Parts/Engine.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:83
+msgid "Parts/Wheel.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:89
+msgid "Parts/Door.php"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:96
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/Builder/README.rst:98
+msgid "Tests/DirectorTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/pt_BR/LC_MESSAGES/Creational/FactoryMethod/README.po
new file mode 100644
index 0000000..ddbfdd7
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Creational/FactoryMethod/README.po
@@ -0,0 +1,97 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-06-21 11:09-0300\n"
+"Last-Translator: Leonam Pereira Dias \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: pt_BR\n"
+
+#: ../../Creational/FactoryMethod/README.rst:2
+msgid "`Factory Method`__"
+msgstr "Fábrica de Métodos (`Factory Method`__)"
+
+#: ../../Creational/FactoryMethod/README.rst:5
+msgid "Purpose"
+msgstr "Objetivo"
+
+#: ../../Creational/FactoryMethod/README.rst:7
+msgid ""
+"The good point over the SimpleFactory is you can subclass it to implement "
+"different ways to create objects"
+msgstr ""
+"O ponto positivo em relação ao SimpleFactory é que pode-se extender sua implementação "
+"de diferentes maneiras para a criação de objetos."
+
+#: ../../Creational/FactoryMethod/README.rst:10
+msgid "For simple case, this abstract class could be just an interface"
+msgstr ""
+"Para um caso simples, esta classe abstrata pode ser apenas uma interface"
+
+#: ../../Creational/FactoryMethod/README.rst:12
+msgid ""
+"This pattern is a \"real\" Design Pattern because it achieves the "
+"\"Dependency Inversion Principle\" a.k.a the \"D\" in S.O.L.I.D principles."
+msgstr ""
+"Este padrão é um padrão de projetos de software \"real\" já que "
+"trata o \"Princípio da inversão de dependências\" o \"D\" nos princípios S.O.L.I.D"
+
+#: ../../Creational/FactoryMethod/README.rst:15
+msgid ""
+"It means the FactoryMethod class depends on abstractions, not concrete "
+"classes. This is the real trick compared to SimpleFactory or StaticFactory."
+msgstr ""
+"Significa que a Fábrica de Método depende de abstrações, não implementação. "
+"Este é uma vantagem comparado ao SimpleFactory ou StaticFactory."
+
+#: ../../Creational/FactoryMethod/README.rst:20
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../Creational/FactoryMethod/README.rst:27
+msgid "Code"
+msgstr "Código"
+
+#: ../../Creational/FactoryMethod/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr "Você pode encontrar este código no `Github`_"
+
+#: ../../Creational/FactoryMethod/README.rst:31
+msgid "FactoryMethod.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:37
+msgid "ItalianFactory.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:43
+msgid "GermanFactory.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:49
+msgid "VehicleInterface.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:55
+msgid "Porsche.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:61
+msgid "Bicycle.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:67
+msgid "Ferrari.php"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:74
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/FactoryMethod/README.rst:76
+msgid "Tests/FactoryMethodTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Creational/Multiton/README.po b/locale/pt_BR/LC_MESSAGES/Creational/Multiton/README.po
new file mode 100644
index 0000000..702271d
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Creational/Multiton/README.po
@@ -0,0 +1,64 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/Multiton/README.rst:2
+msgid "Multiton"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:4
+msgid ""
+"**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND "
+"MAINTAINABILITY USE DEPENDENCY INJECTION!**"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:8
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:10
+msgid ""
+"To have only a list of named instances that are used, like a singleton but "
+"with n instances."
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:14
+msgid "Examples"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:16
+msgid "2 DB Connectors, e.g. one for MySQL, the other for SQLite"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:17
+msgid "multiple Loggers (one for debug messages, one for errors)"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:31
+msgid "Multiton.php"
+msgstr ""
+
+#: ../../Creational/Multiton/README.rst:38
+msgid "Test"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Creational/Pool/README.po b/locale/pt_BR/LC_MESSAGES/Creational/Pool/README.po
new file mode 100644
index 0000000..8defedd
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Creational/Pool/README.po
@@ -0,0 +1,81 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/Pool/README.rst:2
+msgid "`Pool`__"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:4
+msgid ""
+"The **object pool pattern** is a software creational design pattern that "
+"uses a set of initialized objects kept ready to use – a \"pool\" – rather "
+"than allocating and destroying them on demand. A client of the pool will "
+"request an object from the pool and perform operations on the returned "
+"object. When the client has finished, it returns the object, which is a "
+"specific type of factory object, to the pool rather than destroying it."
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:11
+msgid ""
+"Object pooling can offer a significant performance boost in situations where"
+" the cost of initializing a class instance is high, the rate of "
+"instantiation of a class is high, and the number of instances in use at any "
+"one time is low. The pooled object is obtained in predictable time when "
+"creation of the new objects (especially over network) may take variable "
+"time."
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:18
+msgid ""
+"However these benefits are mostly true for objects that are expensive with "
+"respect to time, such as database connections, socket connections, threads "
+"and large graphic objects like fonts or bitmaps. In certain situations, "
+"simple object pooling (that hold no external resources, but only occupy "
+"memory) may not be efficient and could decrease performance."
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:25
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:32
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:36
+msgid "Pool.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:42
+msgid "Processor.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:48
+msgid "Worker.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:55
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:57
+msgid "Tests/PoolTest.php"
+msgstr ""
+
+#: ../../Creational/Pool/README.rst:63
+msgid "Tests/TestWorker.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Creational/Prototype/README.po b/locale/pt_BR/LC_MESSAGES/Creational/Prototype/README.po
new file mode 100644
index 0000000..fac09ef
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Creational/Prototype/README.po
@@ -0,0 +1,68 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/Prototype/README.rst:2
+msgid "`Prototype`__"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:7
+msgid ""
+"To avoid the cost of creating objects the standard way (new Foo()) and "
+"instead create a prototype and clone it."
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:11
+msgid "Examples"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:13
+msgid ""
+"Large amounts of data (e.g. create 1,000,000 rows in a database at once via "
+"a ORM)."
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:28
+msgid "index.php"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:34
+msgid "BookPrototype.php"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:40
+msgid "BarBookPrototype.php"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:46
+msgid "FooBookPrototype.php"
+msgstr ""
+
+#: ../../Creational/Prototype/README.rst:53
+msgid "Test"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Creational/README.po b/locale/pt_BR/LC_MESSAGES/Creational/README.po
new file mode 100644
index 0000000..4873bcd
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Creational/README.po
@@ -0,0 +1,30 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/README.rst:2
+msgid "`Creational`__"
+msgstr "`Criacional`__"
+
+#: ../../Creational/README.rst:4
+msgid ""
+"In software engineering, creational design patterns are design patterns that"
+" deal with object creation mechanisms, trying to create objects in a manner "
+"suitable to the situation. The basic form of object creation could result in"
+" design problems or added complexity to the design. Creational design "
+"patterns solve this problem by somehow controlling this object creation."
+msgstr ""
+"Em engenharia de software, padrões de projeto do tipo criacional são padrões que"
+" trabalham com mecanismos de criação de objetos, criando objetos de maneira "
+"adequada às situações. A forma básica para criação de objetos pode resultar em"
+" problemas de design ou adicionar complexidade ao mesmo. Padrões de Criação "
+"resolvem este problema mantendo a criação do objeto sob controle."
diff --git a/locale/pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po
new file mode 100644
index 0000000..74e85d4
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po
@@ -0,0 +1,72 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/SimpleFactory/README.rst:2
+msgid "Simple Factory"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:7
+msgid "SimpleFactory is a simple factory pattern."
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:9
+msgid ""
+"It differs from the static factory because it is NOT static and as you know:"
+" static => global => evil!"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:12
+msgid ""
+"Therefore, you can have multiple factories, differently parametrized, you "
+"can subclass it and you can mock-up it."
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:16
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:23
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:25
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:27
+msgid "SimpleFactory.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:33
+msgid "VehicleInterface.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:39
+msgid "Bicycle.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:45
+msgid "Scooter.php"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:52
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/SimpleFactory/README.rst:54
+msgid "Tests/SimpleFactoryTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Creational/Singleton/README.po b/locale/pt_BR/LC_MESSAGES/Creational/Singleton/README.po
new file mode 100644
index 0000000..5d108ca
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Creational/Singleton/README.po
@@ -0,0 +1,75 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/Singleton/README.rst:2
+msgid "`Singleton`__"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:4
+msgid ""
+"**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND "
+"MAINTAINABILITY USE DEPENDENCY INJECTION!**"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:8
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:10
+msgid ""
+"To have only one instance of this object in the application that will handle"
+" all calls."
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:14
+msgid "Examples"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:16
+msgid "DB Connector"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:17
+msgid ""
+"Logger (may also be a Multiton if there are many log files for several "
+"purposes)"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:19
+msgid ""
+"Lock file for the application (there is only one in the filesystem ...)"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:23
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:30
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:32
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:34
+msgid "Singleton.php"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:41
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/Singleton/README.rst:43
+msgid "Tests/SingletonTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Creational/StaticFactory/README.po b/locale/pt_BR/LC_MESSAGES/Creational/StaticFactory/README.po
new file mode 100644
index 0000000..4a6f64e
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Creational/StaticFactory/README.po
@@ -0,0 +1,75 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Creational/StaticFactory/README.rst:2
+msgid "Static Factory"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:7
+msgid ""
+"Similar to the AbstractFactory, this pattern is used to create series of "
+"related or dependent objects. The difference between this and the abstract "
+"factory pattern is that the static factory pattern uses just one static "
+"method to create all types of objects it can create. It is usually named "
+"``factory`` or ``build``."
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:14
+msgid "Examples"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:16
+msgid ""
+"Zend Framework: ``Zend_Cache_Backend`` or ``_Frontend`` use a factory method"
+" create cache backends or frontends"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:31
+msgid "StaticFactory.php"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:37
+msgid "FormatterInterface.php"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:43
+msgid "FormatString.php"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:49
+msgid "FormatNumber.php"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:56
+msgid "Test"
+msgstr ""
+
+#: ../../Creational/StaticFactory/README.rst:58
+msgid "Tests/StaticFactoryTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/More/Delegation/README.po b/locale/pt_BR/LC_MESSAGES/More/Delegation/README.po
new file mode 100644
index 0000000..21a201b
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/More/Delegation/README.po
@@ -0,0 +1,60 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/Delegation/README.rst:2
+msgid "`Delegation`__"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:7 ../../More/Delegation/README.rst:12
+msgid "..."
+msgstr ""
+
+#: ../../More/Delegation/README.rst:10
+msgid "Examples"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:15
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../More/Delegation/README.rst:22
+msgid "Code"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:24
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:26
+msgid "Usage.php"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:32
+msgid "TeamLead.php"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:38
+msgid "JuniorDeveloper.php"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:45
+msgid "Test"
+msgstr ""
+
+#: ../../More/Delegation/README.rst:47
+msgid "Tests/DelegationTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/More/README.po b/locale/pt_BR/LC_MESSAGES/More/README.po
new file mode 100644
index 0000000..454e09c
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/More/README.po
@@ -0,0 +1,16 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/README.rst:2
+msgid "More"
+msgstr "Outros"
diff --git a/locale/pt_BR/LC_MESSAGES/More/Repository/README.po b/locale/pt_BR/LC_MESSAGES/More/Repository/README.po
new file mode 100644
index 0000000..7439b93
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/More/Repository/README.po
@@ -0,0 +1,82 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/Repository/README.rst:2
+msgid "Repository"
+msgstr ""
+
+#: ../../More/Repository/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../More/Repository/README.rst:7
+msgid ""
+"Mediates between the domain and data mapping layers using a collection-like "
+"interface for accessing domain objects. Repository encapsulates the set of "
+"objects persisted in a data store and the operations performed over them, "
+"providing a more object-oriented view of the persistence layer. Repository "
+"also supports the objective of achieving a clean separation and one-way "
+"dependency between the domain and data mapping layers."
+msgstr ""
+"Faz a mediação entre o domínio e as camadas de mapeamento de dados usando uma coleção de "
+"interfaces para acessar os objetos de domínio. Repositóros encapsulam um conjunto de "
+"objetos persistidos em um data store e as operações feitas sobre eles, "
+"provendo uma visão mais orientada a objetos da camada de persistência. Repositorio "
+"também apóia o objetivo de alcançar uma separação limpa e uma dependencia unidirecional "
+"entre o domínio e as camadas de mapeamento de dados."
+
+#: ../../More/Repository/README.rst:16
+msgid "Examples"
+msgstr "Exemplos"
+
+#: ../../More/Repository/README.rst:18
+msgid ""
+"Doctrine 2 ORM: there is Repository that mediates between Entity and DBAL "
+"and contains methods to retrieve objects"
+msgstr ""
+
+#: ../../More/Repository/README.rst:20
+msgid "Laravel Framework"
+msgstr "Framework Laravel"
+
+#: ../../More/Repository/README.rst:23
+msgid "UML Diagram"
+msgstr "Diagrama UML"
+
+#: ../../More/Repository/README.rst:30
+msgid "Code"
+msgstr "Código"
+
+#: ../../More/Repository/README.rst:32
+msgid "You can also find these code on `GitHub`_"
+msgstr "Você também pode encontrar esse código no `GitHub`_"
+
+#: ../../More/Repository/README.rst:34
+msgid "Post.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:40
+msgid "PostRepository.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:46
+msgid "Storage.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:52
+msgid "MemoryStorage.php"
+msgstr ""
+
+#: ../../More/Repository/README.rst:59
+msgid "Test"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/More/ServiceLocator/README.po b/locale/pt_BR/LC_MESSAGES/More/ServiceLocator/README.po
new file mode 100644
index 0000000..9808a92
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/More/ServiceLocator/README.po
@@ -0,0 +1,94 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../More/ServiceLocator/README.rst:2
+msgid "`Service Locator`__"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:7
+msgid ""
+"To implement a loosely coupled architecture in order to get better testable,"
+" maintainable and extendable code. DI pattern and Service Locator pattern "
+"are an implementation of the Inverse of Control pattern."
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:12
+msgid "Usage"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:14
+msgid ""
+"With ``ServiceLocator`` you can register a service for a given interface. By"
+" using the interface you can retrieve the service and use it in the classes "
+"of the application without knowing its implementation. You can configure and"
+" inject the Service Locator object on bootstrap."
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:20
+msgid "Examples"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:22
+msgid ""
+"Zend Framework 2 uses Service Locator to create and share services used in "
+"the framework(i.e. EventManager, ModuleManager, all custom user services "
+"provided by modules, etc...)"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:27
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:34
+msgid "Code"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:36
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:38
+msgid "ServiceLocatorInterface.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:44
+msgid "ServiceLocator.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:50
+msgid "LogServiceInterface.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:56
+msgid "LogService.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:62
+msgid "DatabaseServiceInterface.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:68
+msgid "DatabaseService.php"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:75
+msgid "Test"
+msgstr ""
+
+#: ../../More/ServiceLocator/README.rst:77
+msgid "Tests/ServiceLocatorTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/README.po b/locale/pt_BR/LC_MESSAGES/README.po
new file mode 100644
index 0000000..a10ea0b
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/README.po
@@ -0,0 +1,122 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-06-18 12:00-0300\n"
+"Last-Translator: Leonam Pereira Dias \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: pt_BR\n"
+
+#: ../../README.rst:5
+msgid "DesignPatternsPHP"
+msgstr ""
+
+#: ../../README.rst:11
+msgid ""
+"This is a collection of known `design patterns`_ and some sample code how to"
+" implement them in PHP. Every pattern has a small list of examples (most of "
+"them from Zend Framework, Symfony2 or Doctrine2 as I'm most familiar with "
+"this software)."
+msgstr ""
+"Esta é uma coleção de padrões de projetos conhecidos e alguns códigos de exemplo de como "
+"implementá-los em PHP. Todo padrão tem uma pequena lista de exemplos (muitos deles "
+"vindos do Zend Framework, Symfony2 ou Doctrine2 já que tenho mais familiaridade com "
+"eles"
+
+#: ../../README.rst:16
+msgid ""
+"I think the problem with patterns is that often people do know them but "
+"don't know when to apply which."
+msgstr ""
+"Eu acredito que o problema com os padrões é que muitas pessoas os conhecem mas "
+"não sabem quando aplicá-los"
+
+#: ../../README.rst:20
+msgid "Patterns"
+msgstr ""
+"Padrões"
+
+#: ../../README.rst:22
+msgid ""
+"The patterns can be structured in roughly three different categories. Please"
+" click on **the title of every pattern's page** for a full explanation of "
+"the pattern on Wikipedia."
+msgstr ""
+"Os padrões podem ser estruturados grosseiramente em tres categorias diferentes. Por favor "
+"clique no **no título da página de cada padrão** para uma explicação completa do "
+"padrão na Wikipedia."
+
+#: ../../README.rst:35
+msgid "Contribute"
+msgstr ""
+"Contribua"
+
+#: ../../README.rst:37
+msgid ""
+"Please feel free to fork and extend existing or add your own examples and "
+"send a pull request with your changes! To establish a consistent code "
+"quality, please check your code using `PHP CodeSniffer`_ against `PSR2 "
+"standard`_ using ``./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor "
+".``."
+msgstr ""
+"Por favor, sinta-se a vontade para criar um fork e extender os exemplos existentes ou para criar os seus e "
+"envie um pull request com suas alterações! Para manter o código consistente "
+"e com qualidade, por favor, valide seu código usando o `PHP CodeSniffer`_ baseado na `PSR2`_ "
+"usando ``./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor``"
+
+#: ../../README.rst:44
+msgid "License"
+msgstr ""
+"Licença"
+
+#: ../../README.rst:46
+msgid "(The MIT License)"
+msgstr "(The MIT License)"
+
+#: ../../README.rst:48
+msgid "Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_"
+msgstr "Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_"
+
+#: ../../README.rst:50
+msgid ""
+"Permission is hereby granted, free of charge, to any person obtaining a copy"
+" of this software and associated documentation files (the 'Software'), to "
+"deal in the Software without restriction, including without limitation the "
+"rights to use, copy, modify, merge, publish, distribute, sublicense, and/or "
+"sell copies of the Software, and to permit persons to whom the Software is "
+"furnished to do so, subject to the following conditions:"
+msgstr ""
+"Permissão é dada, sem qualquer cobrança, àquele que obter uma cópia"
+" deste software sem restrição, inclusive sem restrições de uso, cópia, modificação, mescla, publicação, distribuição, sublicense, e/ou "
+"venda de cópias deste Software, e permitir a quem o Software é "
+"fornecido o façam, nas seguintes condições:"
+
+#: ../../README.rst:58
+msgid ""
+"The above copyright notice and this permission notice shall be included in "
+"all copies or substantial portions of the Software."
+msgstr ""
+"O aviso de copyright acima e o aviso de permissão devem ser incluidos em "
+"todas as cópias ou porções substanciais deste Software."
+
+#: ../../README.rst:61
+msgid ""
+"THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR "
+"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, "
+"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE "
+"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER "
+"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING "
+"FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS"
+" IN THE SOFTWARE."
+msgstr ""
+"THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR "
+"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, "
+"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE "
+"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER "
+"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING "
+"FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS"
+" IN THE SOFTWARE."
diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Adapter/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Adapter/README.po
new file mode 100644
index 0000000..b351fc9
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Structural/Adapter/README.po
@@ -0,0 +1,82 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Adapter/README.rst:2
+msgid "`Adapter / Wrapper`__"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:7
+msgid ""
+"To translate one interface for a class into a compatible interface. An "
+"adapter allows classes to work together that normally could not because of "
+"incompatible interfaces by providing it's interface to clients while using "
+"the original interface."
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:13
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:15
+msgid "DB Client libraries adapter"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:16
+msgid ""
+"using multiple different webservices and adapters normalize data so that the"
+" outcome is the same for all"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:31
+msgid "PaperBookInterface.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:37
+msgid "Book.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:43
+msgid "EBookAdapter.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:49
+msgid "EBookInterface.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:55
+msgid "Kindle.php"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:62
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Adapter/README.rst:64
+msgid "Tests/AdapterTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Bridge/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Bridge/README.po
new file mode 100644
index 0000000..a27619b
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Structural/Bridge/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Bridge/README.rst:2
+msgid "`Bridge`__"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:7
+msgid ""
+"Decouple an abstraction from its implementation so that the two can vary "
+"independently."
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:11
+msgid "Sample:"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:13
+msgid "`Symfony DoctrineBridge `__"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:28
+msgid "Workshop.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:34
+msgid "Assemble.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:40
+msgid "Produce.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:46
+msgid "Vehicle.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:52
+msgid "Motorcycle.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:58
+msgid "Car.php"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:65
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Bridge/README.rst:67
+msgid "Tests/BridgeTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Composite/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Composite/README.po
new file mode 100644
index 0000000..90ddd21
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Structural/Composite/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Composite/README.rst:2
+msgid "`Composite`__"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:7
+msgid ""
+"To treat a group of objects the same way as a single instance of the object."
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:11
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:13
+msgid ""
+"a form class instance handles all its form elements like a single instance "
+"of the form, when ``render()`` is called, it subsequently runs through all "
+"its child elements and calls ``render()`` on them"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:16
+msgid ""
+"``Zend_Config``: a tree of configuration options, each one is a "
+"``Zend_Config`` object itself"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:31
+msgid "FormElement.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:37
+msgid "Form.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:43
+msgid "InputElement.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:49
+msgid "TextElement.php"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:56
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Composite/README.rst:58
+msgid "Tests/CompositeTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Structural/DataMapper/README.po b/locale/pt_BR/LC_MESSAGES/Structural/DataMapper/README.po
new file mode 100644
index 0000000..5ccd9a3
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Structural/DataMapper/README.po
@@ -0,0 +1,77 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/DataMapper/README.rst:2
+msgid "`Data Mapper`__"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:7
+msgid ""
+"A Data Mapper, is a Data Access Layer that performs bidirectional transfer "
+"of data between a persistent data store (often a relational database) and an"
+" in memory data representation (the domain layer). The goal of the pattern "
+"is to keep the in memory representation and the persistent data store "
+"independent of each other and the data mapper itself. The layer is composed "
+"of one or more mappers (or Data Access Objects), performing the data "
+"transfer. Mapper implementations vary in scope. Generic mappers will handle "
+"many different domain entity types, dedicated mappers will handle one or a "
+"few."
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:17
+msgid ""
+"The key point of this pattern is, unlike Active Record pattern, the data "
+"model follows Single Responsibility Principle."
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:21
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:23
+msgid ""
+"DB Object Relational Mapper (ORM) : Doctrine2 uses DAO named as "
+"\"EntityRepository\""
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:27
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:34
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:36
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:38
+msgid "User.php"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:44
+msgid "UserMapper.php"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:51
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/DataMapper/README.rst:53
+msgid "Tests/DataMapperTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Decorator/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Decorator/README.po
new file mode 100644
index 0000000..0ecf351
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Structural/Decorator/README.po
@@ -0,0 +1,78 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Decorator/README.rst:2
+msgid "`Decorator`__"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:7
+msgid "To dynamically add new functionality to class instances."
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:10
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:12
+msgid "Zend Framework: decorators for ``Zend_Form_Element`` instances"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:13
+msgid ""
+"Web Service Layer: Decorators JSON and XML for a REST service (in this case,"
+" only one of these should be allowed of course)"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:28
+msgid "RendererInterface.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:34
+msgid "Webservice.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:40
+msgid "Decorator.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:46
+msgid "RenderInXml.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:52
+msgid "RenderInJson.php"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:59
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Decorator/README.rst:61
+msgid "Tests/DecoratorTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Structural/DependencyInjection/README.po b/locale/pt_BR/LC_MESSAGES/Structural/DependencyInjection/README.po
new file mode 100644
index 0000000..0834846
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Structural/DependencyInjection/README.po
@@ -0,0 +1,107 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/DependencyInjection/README.rst:2
+msgid "`Dependency Injection`__"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:7
+msgid ""
+"To implement a loosely coupled architecture in order to get better testable,"
+" maintainable and extendable code."
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:11
+msgid "Usage"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:13
+msgid ""
+"Configuration gets injected and ``Connection`` will get all that it needs "
+"from ``$config``. Without DI, the configuration would be created directly in"
+" ``Connection``, which is not very good for testing and extending "
+"``Connection``."
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:18
+msgid ""
+"Notice we are following Inversion of control principle in ``Connection`` by "
+"asking ``$config`` to implement ``Parameters`` interface. This decouples our"
+" components. We don't care where the source of information comes from, we "
+"only care that ``$config`` has certain methods to retrieve that information."
+" Read more about Inversion of control `here "
+"`__."
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:26
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:28
+msgid ""
+"The Doctrine2 ORM uses dependency injection e.g. for configuration that is "
+"injected into a ``Connection`` object. For testing purposes, one can easily "
+"create a mock object of the configuration and inject that into the "
+"``Connection`` object"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:32
+msgid ""
+"Symfony and Zend Framework 2 already have containers for DI that create "
+"objects via a configuration array and inject them where needed (i.e. in "
+"Controllers)"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:37
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:44
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:46
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:48
+msgid "AbstractConfig.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:54
+msgid "Parameters.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:60
+msgid "ArrayConfig.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:66
+msgid "Connection.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:73
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:75
+msgid "Tests/DependencyInjectionTest.php"
+msgstr ""
+
+#: ../../Structural/DependencyInjection/README.rst:81
+msgid "Tests/config.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Facade/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Facade/README.po
new file mode 100644
index 0000000..1d78bf4
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Structural/Facade/README.po
@@ -0,0 +1,87 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Facade/README.rst:2
+msgid "`Facade`__"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:7
+msgid ""
+"The primary goal of a Facade Pattern is not to avoid you to read the manual "
+"of a complex API. It's only a side-effect. The first goal is to reduce "
+"coupling and follow the Law of Demeter."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:11
+msgid ""
+"A Facade is meant to decouple a client and a sub-system by embedding many "
+"(but sometimes just one) interface, and of course to reduce complexity."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:15
+msgid "A facade does not forbid you the access to the sub-system"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:16
+msgid "You can (you should) have multiple facades for one sub-system"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:18
+msgid ""
+"That's why a good facade has no ``new`` in it. If there are multiple "
+"creations for each method, it is not a Facade, it's a Builder or a "
+"[Abstract\\|Static\\|Simple] Factory [Method]."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:22
+msgid ""
+"The best facade has no ``new`` and a constructor with interface-type-hinted "
+"parameters. If you need creation of new instances, use a Factory as "
+"argument."
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:27
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:34
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:36
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:38
+msgid "Facade.php"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:44
+msgid "OsInterface.php"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:50
+msgid "BiosInterface.php"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:57
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Facade/README.rst:59
+msgid "Tests/FacadeTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Structural/FluentInterface/README.po b/locale/pt_BR/LC_MESSAGES/Structural/FluentInterface/README.po
new file mode 100644
index 0000000..0e58551
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Structural/FluentInterface/README.po
@@ -0,0 +1,66 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/FluentInterface/README.rst:2
+msgid "`Fluent Interface`__"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:7
+msgid ""
+"To write code that is easy readable just like sentences in a natural "
+"language (like English)."
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:11
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:13
+msgid "Doctrine2's QueryBuilder works something like that example class below"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:15
+msgid "PHPUnit uses fluent interfaces to build mock objects"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:16
+msgid "Yii Framework: CDbCommand and CActiveRecord use this pattern, too"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:19
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:26
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:28
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:30
+msgid "Sql.php"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:37
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/FluentInterface/README.rst:39
+msgid "Tests/FluentInterfaceTest.php"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Proxy/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Proxy/README.po
new file mode 100644
index 0000000..290eacc
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Structural/Proxy/README.po
@@ -0,0 +1,59 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Proxy/README.rst:2
+msgid "`Proxy`__"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:7
+msgid "To interface to anything that is expensive or impossible to duplicate."
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:10
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:12
+msgid ""
+"Doctrine2 uses proxies to implement framework magic (e.g. lazy "
+"initialization) in them, while the user still works with his own entity "
+"classes and will never use nor touch the proxies"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:17
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:24
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:26
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:28
+msgid "Record.php"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:34
+msgid "RecordProxy.php"
+msgstr ""
+
+#: ../../Structural/Proxy/README.rst:41
+msgid "Test"
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Structural/README.po b/locale/pt_BR/LC_MESSAGES/Structural/README.po
new file mode 100644
index 0000000..7957330
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Structural/README.po
@@ -0,0 +1,23 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/README.rst:2
+msgid "`Structural`__"
+msgstr ""
+
+#: ../../Structural/README.rst:4
+msgid ""
+"In Software Engineering, Structural Design Patterns are Design Patterns that"
+" ease the design by identifying a simple way to realize relationships "
+"between entities."
+msgstr ""
diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Registry/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Registry/README.po
new file mode 100644
index 0000000..843138c
--- /dev/null
+++ b/locale/pt_BR/LC_MESSAGES/Structural/Registry/README.po
@@ -0,0 +1,67 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../../Structural/Registry/README.rst:2
+msgid "`Registry`__"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:5
+msgid "Purpose"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:7
+msgid ""
+"To implement a central storage for objects often used throughout the "
+"application, is typically implemented using an abstract class with only "
+"static methods (or using the Singleton pattern)"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:12
+msgid "Examples"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:14
+msgid ""
+"Zend Framework: ``Zend_Registry`` holds the application's logger object, "
+"front controller etc."
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:16
+msgid ""
+"Yii Framework: ``CWebApplication`` holds all the application components, "
+"such as ``CWebUser``, ``CUrlManager``, etc."
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:20
+msgid "UML Diagram"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:27
+msgid "Code"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:29
+msgid "You can also find these code on `GitHub`_"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:31
+msgid "Registry.php"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:38
+msgid "Test"
+msgstr ""
+
+#: ../../Structural/Registry/README.rst:40
+msgid "Tests/RegistryTest.php"
+msgstr ""
diff --git a/locale/ru/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po b/locale/ru/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po
new file mode 100644
index 0000000..d0dcfac
--- /dev/null
+++ b/locale/ru/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po
@@ -0,0 +1,101 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-05-29 21:17+0300\n"
+"Last-Translator: Eugene Glotov \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: ru\n"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:2
+msgid "`Chain Of Responsibilities`__"
+msgstr "`Цепочка Обязанностей `_ (`Chain Of Responsibilities`__)"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:5
+msgid "Purpose:"
+msgstr "Назначение:"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:7
+msgid ""
+"To build a chain of objects to handle a call in sequential order. If one "
+"object cannot handle a call, it delegates the call to the next in the chain "
+"and so forth."
+msgstr ""
+"Построить цепочку объектов для обработки вызова в последовательном порядке. "
+"Если один объект не может справиться с вызовом, он делегирует вызов для "
+"следующего в цепи и так далее."
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:12
+msgid "Examples:"
+msgstr "Примеры:"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:14
+msgid ""
+"logging framework, where each chain element decides autonomously what to do "
+"with a log message"
+msgstr ""
+"фреймворк для записи журналов, где каждый элемент цепи самостоятельно "
+"принимает решение, что делать с сообщением для логгирования."
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:16
+msgid "a Spam filter"
+msgstr "фильтр спама"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:17
+msgid ""
+"Caching: first object is an instance of e.g. a Memcached Interface, if that "
+"\"misses\" it delegates the call to the database interface"
+msgstr ""
+"кеширование: первый объект является экземпляром, к примеру, интерфейса "
+"Memcached. Если запись в кеше отсутствует, вызов делегируется интерфейсу "
+"базы данных."
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:19
+msgid ""
+"Yii Framework: CFilterChain is a chain of controller action filters. the "
+"executing point is passed from one filter to the next along the chain, and "
+"only if all filters say \"yes\", the action can be invoked at last."
+msgstr ""
+"Yii Framework: CFilterChain — это цепочка фильтров действий контроллера. "
+"Точка вызова передаётся от фильтра к фильтру по цепочке и только если все "
+"фильтры скажут “да”, действие в итоге может быть вызвано."
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:25
+msgid "UML Diagram"
+msgstr "UML Диаграмма"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:32
+msgid "Code"
+msgstr "Код"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr "Вы можете найти этот код на `GitHub`_"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:36
+msgid "Request.php"
+msgstr "Request.php"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:42
+msgid "Handler.php"
+msgstr "Handler.php"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:48
+msgid "Responsible/SlowStorage.php"
+msgstr "Responsible/SlowStorage.php"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:54
+msgid "Responsible/FastStorage.php"
+msgstr "Responsible/FastStorage.php"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:61
+msgid "Test"
+msgstr "Тест"
+
+#: ../../Behavioral/ChainOfResponsibilities/README.rst:63
+msgid "Tests/ChainTest.php"
+msgstr "Tests/ChainTest.php"
diff --git a/locale/ru/LC_MESSAGES/Behavioral/Command/README.po b/locale/ru/LC_MESSAGES/Behavioral/Command/README.po
new file mode 100644
index 0000000..4780baa
--- /dev/null
+++ b/locale/ru/LC_MESSAGES/Behavioral/Command/README.po
@@ -0,0 +1,116 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-05-29 21:16+0300\n"
+"Last-Translator: Eugene Glotov \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: ru\n"
+
+#: ../../Behavioral/Command/README.rst:2
+msgid "`Command`__"
+msgstr "`Команда `_ (`Command`__)"
+
+#: ../../Behavioral/Command/README.rst:5
+msgid "Purpose"
+msgstr "Назначение"
+
+#: ../../Behavioral/Command/README.rst:7
+msgid "To encapsulate invocation and decoupling."
+msgstr "Инкапсулировать действие и его параметры"
+
+#: ../../Behavioral/Command/README.rst:9
+msgid ""
+"We have an Invoker and a Receiver. This pattern uses a \"Command\" to "
+"delegate the method call against the Receiver and presents the same method "
+"\"execute\". Therefore, the Invoker just knows to call \"execute\" to "
+"process the Command of the client. The Receiver is decoupled from the "
+"Invoker."
+msgstr ""
+"Допустим, у нас есть объекты Invoker (Командир) и Receiver (Исполнитель). "
+"Этот паттерн использует реализацию интерфейса «Команда», чтобы вызвать "
+"некий метод Исполнителя используя для этого известный Командиру метод "
+"«execute()». Командир просто знает, что нужно вызвать метод “execute()”, "
+"для обработки команды клиента, не разбираясь в деталях реализации "
+"Исполнителя. Исполнитель отделен от Командира."
+
+#: ../../Behavioral/Command/README.rst:15
+msgid ""
+"The second aspect of this pattern is the undo(), which undoes the method "
+"execute(). Command can also be aggregated to combine more complex commands "
+"with minimum copy-paste and relying on composition over inheritance."
+msgstr ""
+"Вторым аспектом этого паттерна является метод undo(), который отменяет "
+"действие, выполняемое методом execute(). Команды также могут быть "
+"объединены в более общие команды с минимальным копированием-вставкой и "
+"полагаясь на композицию поверх наследования."
+
+#: ../../Behavioral/Command/README.rst:21
+msgid "Examples"
+msgstr "Примеры"
+
+#: ../../Behavioral/Command/README.rst:23
+msgid ""
+"A text editor : all events are Command which can be undone, stacked and "
+"saved."
+msgstr ""
+"текстовый редактор: все события являются Командами, которые могут быть "
+"отменены, выстроены в определённую последовательность и сохранены."
+
+#: ../../Behavioral/Command/README.rst:25
+msgid ""
+"Symfony2: SF2 Commands that can be run from the CLI are built with just the "
+"Command pattern in mind"
+msgstr ""
+"Symfony2: SF2 Commands, это команды, которые построены согласно данному "
+"паттерну и могут выполняться из командной строки."
+
+#: ../../Behavioral/Command/README.rst:27
+msgid ""
+"big CLI tools use subcommands to distribute various tasks and pack them in "
+"\"modules\", each of these can be implemented with the Command pattern (e.g."
+" vagrant)"
+msgstr ""
+"большие утилиты для командной строки (например, Vagrant) используют "
+"вложенные команды для разделения различных задач и упаковки их в «модули», "
+"каждый из которых может быть реализован с помощью паттерна «Команда»."
+
+#: ../../Behavioral/Command/README.rst:32
+msgid "UML Diagram"
+msgstr "UML Диаграмма"
+
+#: ../../Behavioral/Command/README.rst:39
+msgid "Code"
+msgstr "Код"
+
+#: ../../Behavioral/Command/README.rst:41
+msgid "You can also find these code on `GitHub`_"
+msgstr "Вы также можете найти этот код на `GitHub`_"
+
+#: ../../Behavioral/Command/README.rst:43
+msgid "CommandInterface.php"
+msgstr "CommandInterface.php"
+
+#: ../../Behavioral/Command/README.rst:49
+msgid "HelloCommand.php"
+msgstr "HelloCommand.php"
+
+#: ../../Behavioral/Command/README.rst:55
+msgid "Receiver.php"
+msgstr "Receiver.php"
+
+#: ../../Behavioral/Command/README.rst:61
+msgid "Invoker.php"
+msgstr "Invoker.php"
+
+#: ../../Behavioral/Command/README.rst:68
+msgid "Test"
+msgstr "Тест"
+
+#: ../../Behavioral/Command/README.rst:70
+msgid "Tests/CommandTest.php"
+msgstr "Tests/CommandTest.php"
diff --git a/locale/ru/LC_MESSAGES/Behavioral/Iterator/README.po b/locale/ru/LC_MESSAGES/Behavioral/Iterator/README.po
new file mode 100644
index 0000000..1d5061d
--- /dev/null
+++ b/locale/ru/LC_MESSAGES/Behavioral/Iterator/README.po
@@ -0,0 +1,93 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-05-29 21:47+0300\n"
+"Last-Translator: Eugene Glotov \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: ru\n"
+
+#: ../../Behavioral/Iterator/README.rst:2
+msgid "`Iterator`__"
+msgstr "`Итератор `_ (`Iterator`__)"
+
+#: ../../Behavioral/Iterator/README.rst:5
+msgid "Purpose"
+msgstr "Назначение"
+
+#: ../../Behavioral/Iterator/README.rst:7
+msgid ""
+"To make an object iterable and to make it appear like a collection of "
+"objects."
+msgstr ""
+"Добавить коллекции объектов функционал последовательного доступа к "
+"содержащимся в ней экземплярам объектов без реализации этого функционала в "
+"самой коллекции."
+
+#: ../../Behavioral/Iterator/README.rst:11
+msgid "Examples"
+msgstr "Примеры"
+
+#: ../../Behavioral/Iterator/README.rst:13
+msgid ""
+"to process a file line by line by just running over all lines (which have an"
+" object representation) for a file (which of course is an object, too)"
+msgstr ""
+"построчный перебор файла, который представлен в виде объекта, содержащего "
+"строки, тоже являющиеся объектами. Обработчик будет запущен поверх всех "
+"объектов."
+
+#: ../../Behavioral/Iterator/README.rst:18
+msgid "Note"
+msgstr "Примечание"
+
+#: ../../Behavioral/Iterator/README.rst:20
+msgid ""
+"Standard PHP Library (SPL) defines an interface Iterator which is best "
+"suited for this! Often you would want to implement the Countable interface "
+"too, to allow ``count($object)`` on your iterable object"
+msgstr ""
+"Стандартная библиотека PHP SPL определяет интерфейс Iterator, который "
+"хорошо подходит для данных целей. Также вам может понадобиться реализовать "
+"интерфейс Countable, чтобы разрешить вызывать ``count($object)`` в вашем "
+"листаемом объекте."
+
+#: ../../Behavioral/Iterator/README.rst:25
+msgid "UML Diagram"
+msgstr "UML Диаграмма"
+
+#: ../../Behavioral/Iterator/README.rst:32
+msgid "Code"
+msgstr "Код"
+
+#: ../../Behavioral/Iterator/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr "Также вы можете найти этот код на `GitHub`_"
+
+#: ../../Behavioral/Iterator/README.rst:36
+msgid "Book.php"
+msgstr "Book.php"
+
+#: ../../Behavioral/Iterator/README.rst:42
+msgid "BookList.php"
+msgstr "BookList.php"
+
+#: ../../Behavioral/Iterator/README.rst:48
+msgid "BookListIterator.php"
+msgstr "BookListIterator.php"
+
+#: ../../Behavioral/Iterator/README.rst:54
+msgid "BookListReverseIterator.php"
+msgstr "BookListReverseIterator.php"
+
+#: ../../Behavioral/Iterator/README.rst:61
+msgid "Test"
+msgstr "Тест"
+
+#: ../../Behavioral/Iterator/README.rst:63
+msgid "Tests/IteratorTest.php"
+msgstr "Tests/IteratorTest.php"
diff --git a/locale/ru/LC_MESSAGES/Behavioral/Mediator/README.po b/locale/ru/LC_MESSAGES/Behavioral/Mediator/README.po
new file mode 100644
index 0000000..13b8089
--- /dev/null
+++ b/locale/ru/LC_MESSAGES/Behavioral/Mediator/README.po
@@ -0,0 +1,87 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-05-29 22:18+0300\n"
+"Last-Translator: Eugene Glotov \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: ru\n"
+"Language-Team: \n"
+"X-Generator: Poedit 1.8.1\n"
+
+#: ../../Behavioral/Mediator/README.rst:2
+msgid "`Mediator`__"
+msgstr "`Посредник `_ (`Mediator`__)"
+
+#: ../../Behavioral/Mediator/README.rst:5
+msgid "Purpose"
+msgstr "Назначение"
+
+#: ../../Behavioral/Mediator/README.rst:7
+msgid ""
+"This pattern provides an easy to decouple many components working together. "
+"It is a good alternative over Observer IF you have a \"central intelligence"
+"\", like a controller (but not in the sense of the MVC)."
+msgstr ""
+"Этот паттерн позволяет снизить связность множества компонентов, работающих "
+"совместно. Объектам больше нет нужды вызывать друг друга напрямую. Это "
+"хорошая альтернатива Наблюдателю, если у вас есть “центр интеллекта” вроде "
+"контроллера (но не в смысле MVC)"
+
+#: ../../Behavioral/Mediator/README.rst:11
+msgid ""
+"All components (called Colleague) are only coupled to the MediatorInterface "
+"and it is a good thing because in OOP, one good friend is better than many. "
+"This is the key-feature of this pattern."
+msgstr ""
+"Все компоненты (называемые «Коллеги») объединяются в интерфейс "
+"MediatorInterface и это хорошо, потому что в рамках ООП, «старый друг лучше "
+"новых двух»."
+
+#: ../../Behavioral/Mediator/README.rst:16
+msgid "UML Diagram"
+msgstr "UML Диаграмма"
+
+#: ../../Behavioral/Mediator/README.rst:23
+msgid "Code"
+msgstr "Код"
+
+#: ../../Behavioral/Mediator/README.rst:25
+msgid "You can also find these code on `GitHub`_"
+msgstr "Вы можете найти этот код на `GitHub`_"
+
+#: ../../Behavioral/Mediator/README.rst:27
+msgid "MediatorInterface.php"
+msgstr "MediatorInterface.php"
+
+#: ../../Behavioral/Mediator/README.rst:33
+msgid "Mediator.php"
+msgstr "Mediator.php"
+
+#: ../../Behavioral/Mediator/README.rst:39
+msgid "Colleague.php"
+msgstr "Colleague.php"
+
+#: ../../Behavioral/Mediator/README.rst:45
+msgid "Subsystem/Client.php"
+msgstr "Subsystem/Client.php"
+
+#: ../../Behavioral/Mediator/README.rst:51
+msgid "Subsystem/Database.php"
+msgstr "Subsystem/Database.php"
+
+#: ../../Behavioral/Mediator/README.rst:57
+msgid "Subsystem/Server.php"
+msgstr "Subsystem/Server.php"
+
+#: ../../Behavioral/Mediator/README.rst:64
+msgid "Test"
+msgstr "Тест"
+
+#: ../../Behavioral/Mediator/README.rst:66
+msgid "Tests/MediatorTest.php"
+msgstr "Tests/MediatorTest.php"
diff --git a/locale/ru/LC_MESSAGES/Behavioral/Memento/README.po b/locale/ru/LC_MESSAGES/Behavioral/Memento/README.po
new file mode 100644
index 0000000..146f4f5
--- /dev/null
+++ b/locale/ru/LC_MESSAGES/Behavioral/Memento/README.po
@@ -0,0 +1,115 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-05-30 01:42+0300\n"
+"Last-Translator: Eugene Glotov \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: ru\n"
+
+#: ../../Behavioral/Memento/README.rst:2
+msgid "`Memento`__"
+msgstr "`Хранитель`__"
+
+#: ../../Behavioral/Memento/README.rst:5
+msgid "Purpose"
+msgstr "Назначение"
+
+#: ../../Behavioral/Memento/README.rst:7
+msgid ""
+"Provide the ability to restore an object to its previous state (undo via "
+"rollback)."
+msgstr ""
+"Предоставляет возможность восстановить объект в его предыдущем состоянии или "
+"получить доступ к состоянию объекта, не раскрывая его реализацию (т.е. сам "
+"объект не обязан иметь функционал возврата текущего состояния)."
+
+#: ../../Behavioral/Memento/README.rst:10
+msgid ""
+"The memento pattern is implemented with three objects: the originator, a "
+"caretaker and a memento. The originator is some object that has an internal "
+"state. The caretaker is going to do something to the originator, but wants "
+"to be able to undo the change. The caretaker first asks the originator for a"
+" memento object. Then it does whatever operation (or sequence of operations)"
+" it was going to do. To roll back to the state before the operations, it "
+"returns the memento object to the originator. The memento object itself is "
+"an opaque object (one which the caretaker cannot, or should not, change). "
+"When using this pattern, care should be taken if the originator may change "
+"other objects or resources - the memento pattern operates on a single "
+"object."
+msgstr ""
+"Паттерн «Хранитель» реализуется тремя объектами: Создатель, Опекун и "
+"Хранитель.\n"
+"\n"
+"Хранитель — объект, который *хранит конкретный уникальный слепок состояния* "
+"любого объекта или ресурса: строка, число, массив, экземпляр класса и так "
+"далее. Уникальность в данном случае подразумевает не запрет существования "
+"одинаковых состояний в слепках, а то, что состояние можно извлечь в виде "
+"независимого клона. Это значит, объект, сохраняемый в Хранитель, должен *быть "
+"полной копией исходного объекта а не ссылкой* на исходный объект. Сам объект "
+"Хранитель является «непрозрачным объектом» (тот, который никто не может и не "
+"должен изменять).\n"
+"\n"
+"Создатель — это объект, который *содержит в себе актуальное состояние внешнего "
+"объекта строго заданного типа* и умеет создать уникальную копию этого "
+"состояния, возвращая её обёрнутую в Хранитель. Создатель не знает истории "
+"изменений. Создателю можно принудительно установить конкретное состояние "
+"извне, которое будет считаться актуальным. Создатель должен позаботиться, "
+"чтобы это состояние соответствовало типу объекта, с которым ему разрешено "
+"работать. Создатель может (но не обязан) иметь любые методы, но они *не могут "
+"менять сохранённое состояние объекта*.\n"
+"\n"
+"Опекун *управляет историей слепков состояний*. Он может вносить изменения в "
+"объект, принимать решение о сохранении состояния внешнего объекта в Создателе, "
+"требовать от Создателя слепок текущего состояния, или привести состояние "
+"Создателя в соответствие состоянию какого-то слепка из истории."
+
+#: ../../Behavioral/Memento/README.rst:23
+msgid "Examples"
+msgstr "Примеры"
+
+#: ../../Behavioral/Memento/README.rst:25
+msgid "The seed of a pseudorandom number generator"
+msgstr ""
+"`Семя `_ псевдослучайного генератора "
+"чисел."
+
+#: ../../Behavioral/Memento/README.rst:26
+msgid "The state in a finite state machine"
+msgstr "Состояние конечного автомата"
+
+#: ../../Behavioral/Memento/README.rst:29
+msgid "UML Diagram"
+msgstr "UML Диаграмма"
+
+#: ../../Behavioral/Memento/README.rst:36
+msgid "Code"
+msgstr "Код"
+
+#: ../../Behavioral/Memento/README.rst:38
+msgid "You can also find these code on `GitHub`_"
+msgstr "Вы можете найти этот код на `GitHub`_"
+
+#: ../../Behavioral/Memento/README.rst:40
+msgid "Memento.php"
+msgstr "Memento.php"
+
+#: ../../Behavioral/Memento/README.rst:46
+msgid "Originator.php"
+msgstr "Originator.php"
+
+#: ../../Behavioral/Memento/README.rst:52
+msgid "Caretaker.php"
+msgstr "Caretaker.php"
+
+#: ../../Behavioral/Memento/README.rst:59
+msgid "Test"
+msgstr "Тест"
+
+#: ../../Behavioral/Memento/README.rst:61
+msgid "Tests/MementoTest.php"
+msgstr "Tests/MementoTest.php"
diff --git a/locale/ru/LC_MESSAGES/Behavioral/NullObject/README.po b/locale/ru/LC_MESSAGES/Behavioral/NullObject/README.po
new file mode 100644
index 0000000..7560c18
--- /dev/null
+++ b/locale/ru/LC_MESSAGES/Behavioral/NullObject/README.po
@@ -0,0 +1,112 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-05-30 14:24+0300\n"
+"Last-Translator: Eugene Glotov \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: ru\n"
+
+#: ../../Behavioral/NullObject/README.rst:2
+msgid "`Null Object`__"
+msgstr "`Объект Null `_ (`Null Object`__)"
+
+#: ../../Behavioral/NullObject/README.rst:5
+msgid "Purpose"
+msgstr "Назначение"
+
+#: ../../Behavioral/NullObject/README.rst:7
+msgid ""
+"NullObject is not a GoF design pattern but a schema which appears "
+"frequently enough to be considered a pattern. It has the following benefits:"
+msgstr ""
+"NullObject не шаблон из книги Банды Четырёх, но схема, которая появляется "
+"достаточно часто, чтобы считаться паттерном. Она имеет следующие "
+"преимущества:"
+
+#: ../../Behavioral/NullObject/README.rst:11
+msgid "Client code is simplified"
+msgstr "Клиентский код упрощается"
+
+#: ../../Behavioral/NullObject/README.rst:12
+msgid "Reduces the chance of null pointer exceptions"
+msgstr ""
+"Уменьшает шанс исключений из-за нулевых указателей (и ошибок PHP различного "
+"уровня)"
+
+#: ../../Behavioral/NullObject/README.rst:13
+msgid "Fewer conditionals require less test cases"
+msgstr "Меньше дополнительных условий — значит меньше тесткейсов"
+
+#: ../../Behavioral/NullObject/README.rst:15
+msgid ""
+"Methods that return an object or null should instead return an object or "
+"``NullObject``. ``NullObject``\\ s simplify boilerplate code such as ``if "
+"(!is_null($obj)) { $obj->callSomething(); }`` to just "
+"``$obj->callSomething();`` by eliminating the conditional check in client "
+"code."
+msgstr ""
+"Методы, которые возвращают объект или Null, вместо этого должны вернуть "
+"объект ``NullObject``. Это упрощённый формальный код, устраняющий "
+"необходимость проверки ``if (!is_null($obj)) { $obj->callSomething(); }``, "
+"заменяя её на обычный вызов ``$obj->callSomething();``."
+
+#: ../../Behavioral/NullObject/README.rst:22
+msgid "Examples"
+msgstr "Примеры"
+
+#: ../../Behavioral/NullObject/README.rst:24
+msgid "Symfony2: null logger of profiler"
+msgstr "Symfony2: null logger of profiler"
+
+#: ../../Behavioral/NullObject/README.rst:25
+msgid "Symfony2: null output in Symfony/Console"
+msgstr "Symfony2: null output in Symfony/Console"
+
+#: ../../Behavioral/NullObject/README.rst:26
+msgid "null handler in a Chain of Responsibilities pattern"
+msgstr "null handler in a Chain of Responsibilities pattern"
+
+#: ../../Behavioral/NullObject/README.rst:27
+msgid "null command in a Command pattern"
+msgstr "null command in a Command pattern"
+
+#: ../../Behavioral/NullObject/README.rst:30
+msgid "UML Diagram"
+msgstr "UML Диаграмма"
+
+#: ../../Behavioral/NullObject/README.rst:37
+msgid "Code"
+msgstr "Код"
+
+#: ../../Behavioral/NullObject/README.rst:39
+msgid "You can also find these code on `GitHub`_"
+msgstr "Вы можете найти этот код на `GitHub`_"
+
+#: ../../Behavioral/NullObject/README.rst:41
+msgid "Service.php"
+msgstr "Service.php"
+
+#: ../../Behavioral/NullObject/README.rst:47
+msgid "LoggerInterface.php"
+msgstr "LoggerInterface.php"
+
+#: ../../Behavioral/NullObject/README.rst:53
+msgid "PrintLogger.php"
+msgstr "PrintLogger.php"
+
+#: ../../Behavioral/NullObject/README.rst:59
+msgid "NullLogger.php"
+msgstr "NullLogger.php"
+
+#: ../../Behavioral/NullObject/README.rst:66
+msgid "Test"
+msgstr "Тест"
+
+#: ../../Behavioral/NullObject/README.rst:68
+msgid "Tests/LoggerTest.php"
+msgstr "Tests/LoggerTest.php"
diff --git a/locale/ru/LC_MESSAGES/Behavioral/Observer/README.po b/locale/ru/LC_MESSAGES/Behavioral/Observer/README.po
new file mode 100644
index 0000000..fbd4f45
--- /dev/null
+++ b/locale/ru/LC_MESSAGES/Behavioral/Observer/README.po
@@ -0,0 +1,84 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-05-30 05:20+0300\n"
+"Last-Translator: Eugene Glotov \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: ru\n"
+
+#: ../../Behavioral/Observer/README.rst:2
+msgid "`Observer`__"
+msgstr "`Наблюдатель `_ (`Observer`__)"
+
+#: ../../Behavioral/Observer/README.rst:5
+msgid "Purpose"
+msgstr "Назначение"
+
+#: ../../Behavioral/Observer/README.rst:7
+msgid ""
+"To implement a publish/subscribe behaviour to an object, whenever a "
+"\"Subject\" object changes it's state, the attached \"Observers\" will be "
+"notified. It is used to shorten the amount of coupled objects and uses loose"
+" coupling instead."
+msgstr ""
+"Для реализации публикации/подписки на поведение объекта, всякий раз, когда "
+"объект «Subject» меняет свое состояние, прикрепленные объекты «Observers» "
+"будут уведомлены. Паттерн используется, чтобы сократить количество "
+"связанных напрямую объектов и вместо этого использует слабую связь (loose "
+"coupling)."
+
+#: ../../Behavioral/Observer/README.rst:13
+msgid "Examples"
+msgstr "Примеры"
+
+#: ../../Behavioral/Observer/README.rst:15
+msgid ""
+"a message queue system is observed to show the progress of a job in a GUI"
+msgstr ""
+"Система очереди сообщений наблюдает за очередями, чтобы отображать прогресс "
+"в GUI"
+
+#: ../../Behavioral/Observer/README.rst:19
+msgid "Note"
+msgstr "Примечание"
+
+#: ../../Behavioral/Observer/README.rst:21
+msgid ""
+"PHP already defines two interfaces that can help to implement this pattern: "
+"SplObserver and SplSubject."
+msgstr ""
+"PHP предоставляет два стандартных интерфейса, которые могут помочь "
+"реализовать этот шаблон: SplObserver и SplSubject."
+
+#: ../../Behavioral/Observer/README.rst:25
+msgid "UML Diagram"
+msgstr "UML Диаграмма"
+
+#: ../../Behavioral/Observer/README.rst:32
+msgid "Code"
+msgstr "Код"
+
+#: ../../Behavioral/Observer/README.rst:34
+msgid "You can also find these code on `GitHub`_"
+msgstr "Вы можете найти этот код на `GitHub`_"
+
+#: ../../Behavioral/Observer/README.rst:36
+msgid "User.php"
+msgstr "User.php"
+
+#: ../../Behavioral/Observer/README.rst:42
+msgid "UserObserver.php"
+msgstr "UserObserver.php"
+
+#: ../../Behavioral/Observer/README.rst:49
+msgid "Test"
+msgstr "Тест"
+
+#: ../../Behavioral/Observer/README.rst:51
+msgid "Tests/ObserverTest.php"
+msgstr "Tests/ObserverTest.php"
diff --git a/locale/ru/LC_MESSAGES/Behavioral/README.po b/locale/ru/LC_MESSAGES/Behavioral/README.po
new file mode 100644
index 0000000..38ef9ce
--- /dev/null
+++ b/locale/ru/LC_MESSAGES/Behavioral/README.po
@@ -0,0 +1,28 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-05-29 21:22+0300\n"
+"Last-Translator: Eugene Glotov \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: ru\n"
+
+#: ../../Behavioral/README.rst:2
+msgid "`Behavioral`__"
+msgstr "`Поведенческие шаблоны проектирования `_ (`Behavioral`__)"
+
+#: ../../Behavioral/README.rst:4
+msgid ""
+"In software engineering, behavioral design patterns are design patterns that"
+" identify common communication patterns between objects and realize these "
+"patterns. By doing so, these patterns increase flexibility in carrying out "
+"this communication."
+msgstr ""
+"Поведенческие шаблоны проектирования определяют общие закономерности связей "
+"между объектами, реализующими данные паттерны. Следование этим шаблонам "
+"уменьшает связность системы и облегчает коммуникацию между объектами, что "
+"улучшает гибкость программного продукта."
diff --git a/locale/ru/LC_MESSAGES/Behavioral/Specification/README.po b/locale/ru/LC_MESSAGES/Behavioral/Specification/README.po
new file mode 100644
index 0000000..5c318ca
--- /dev/null
+++ b/locale/ru/LC_MESSAGES/Behavioral/Specification/README.po
@@ -0,0 +1,88 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: DesignPatternsPHP 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-05-29 12:18+0200\n"
+"PO-Revision-Date: 2015-05-30 04:28+0300\n"
+"Last-Translator: Eugene Glotov \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: ru\n"
+
+#: ../../Behavioral/Specification/README.rst:2
+msgid "`Specification`__"
+msgstr "`Спецификация