diff --git a/.travis.yml b/.travis.yml index 9f379f8..cb88b17 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,17 +3,10 @@ language: php sudo: false php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - 7.0 - - hhvm + - 7.1 matrix: - allow_failures: - - php: hhvm - - php: 7.0 fast_finish: true cache: diff --git a/Behavioral/ChainOfResponsibilities/Handler.php b/Behavioral/ChainOfResponsibilities/Handler.php index 679734e..fe4e18b 100644 --- a/Behavioral/ChainOfResponsibilities/Handler.php +++ b/Behavioral/ChainOfResponsibilities/Handler.php @@ -2,77 +2,42 @@ namespace DesignPatterns\Behavioral\ChainOfResponsibilities; -/** - * 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 - * situations. Usually, a CoR is meant to be changed everytime and evolves, that's - * why we slice the workflow in little bits of code. - */ +use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; + abstract class Handler { /** - * @var Handler + * @var Handler|null */ private $successor = null; - /** - * Append a responsibility to the end of chain. - * - * A prepend method could be done with the same spirit - * - * You could also send the successor in the constructor but in PHP that is a - * bad idea because you have to remove the type-hint of the parameter because - * the last handler has a null successor. - * - * And if you override the constructor, that Handler can no longer have a - * successor. One solution is to provide a NullObject (see pattern). - * It is more preferable to keep the constructor "free" to inject services - * you need with the DiC of symfony2 for example. - * - * @param Handler $handler - */ - final public function append(Handler $handler) + public function __construct(Handler $handler = null) { - if (is_null($this->successor)) { - $this->successor = $handler; - } else { - $this->successor->append($handler); - } + $this->successor = $handler; } /** - * Handle the request. - * * This approach by using a template method pattern ensures you that - * each subclass will not forget to call the successor. Besides, the returned - * boolean value indicates you if the request have been processed or not. + * each subclass will not forget to call the successor * - * @param Request $req + * @param RequestInterface $request * - * @return bool + * @return string|null */ - final public function handle(Request $req) + final public function handle(RequestInterface $request) { - $req->forDebugOnly = get_called_class(); - $processed = $this->processing($req); - if (!$processed) { + $processed = $this->processing($request); + + if ($processed === null) { // the request has not been processed by this handler => see the next - if (!is_null($this->successor)) { - $processed = $this->successor->handle($req); + if ($this->successor !== null) { + $processed = $this->successor->handle($request); } } return $processed; } - /** - * Each concrete handler has to implement the processing of the request. - * - * @param Request $req - * - * @return bool true if the request has been processed - */ - abstract protected function processing(Request $req); + abstract protected function processing(RequestInterface $request); } diff --git a/Behavioral/ChainOfResponsibilities/README.rst b/Behavioral/ChainOfResponsibilities/README.rst index b3f47b9..45a7755 100644 --- a/Behavioral/ChainOfResponsibilities/README.rst +++ b/Behavioral/ChainOfResponsibilities/README.rst @@ -31,13 +31,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ - -Request.php - -.. literalinclude:: Request.php - :language: php - :linenos: +You can also find this code on `GitHub`_ Handler.php diff --git a/Behavioral/ChainOfResponsibilities/Request.php b/Behavioral/ChainOfResponsibilities/Request.php deleted file mode 100644 index 68bf24e..0000000 --- a/Behavioral/ChainOfResponsibilities/Request.php +++ /dev/null @@ -1,19 +0,0 @@ -data = $data; - } - - protected function processing(Request $req) - { - if ('get' === $req->verb) { - if (array_key_exists($req->key, $this->data)) { - // the handler IS responsible and then processes the request - $req->response = $this->data[$req->key]; - // instead of returning true, I could return the value but it proves - // to be a bad idea. What if the value IS "false" ? - return true; - } - } - - return false; - } -} diff --git a/Behavioral/ChainOfResponsibilities/Responsible/HttpInMemoryCacheHandler.php b/Behavioral/ChainOfResponsibilities/Responsible/HttpInMemoryCacheHandler.php new file mode 100644 index 0000000..9391ceb --- /dev/null +++ b/Behavioral/ChainOfResponsibilities/Responsible/HttpInMemoryCacheHandler.php @@ -0,0 +1,45 @@ +data = $data; + } + + /** + * @param RequestInterface $request + * + * @return string|null + */ + protected function processing(RequestInterface $request) + { + $key = sprintf( + '%s?%s', + $request->getUri()->getPath(), + $request->getUri()->getQuery() + ); + + if ($request->getMethod() == 'GET' && isset($this->data[$key])) { + return $this->data[$key]; + } + + return null; + } +} diff --git a/Behavioral/ChainOfResponsibilities/Responsible/SlowDatabaseHandler.php b/Behavioral/ChainOfResponsibilities/Responsible/SlowDatabaseHandler.php new file mode 100644 index 0000000..975ed42 --- /dev/null +++ b/Behavioral/ChainOfResponsibilities/Responsible/SlowDatabaseHandler.php @@ -0,0 +1,21 @@ +data = $data; - } - - protected function processing(Request $req) - { - if ('get' === $req->verb) { - if (array_key_exists($req->key, $this->data)) { - $req->response = $this->data[$req->key]; - - return true; - } - } - - return false; - } -} diff --git a/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php b/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php index 62d1172..c61f1fb 100644 --- a/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php +++ b/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php @@ -2,80 +2,51 @@ 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\Handler; +use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\HttpInMemoryCacheHandler; +use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowDatabaseHandler; +use PHPUnit\Framework\TestCase; -/** - * ChainTest tests the CoR. - */ -class ChainTest extends \PHPUnit_Framework_TestCase +class ChainTest extends TestCase { /** - * @var FastStorage + * @var Handler */ - protected $chain; + private $chain; protected function setUp() { - $this->chain = new FastStorage(array('bar' => 'baz')); - $this->chain->append(new SlowStorage(array('bar' => 'baz', 'foo' => 'bar'))); - } - - public function makeRequest() - { - $request = new Request(); - $request->verb = 'get'; - - return array( - array($request), + $this->chain = new HttpInMemoryCacheHandler( + ['/foo/bar?index=1' => 'Hello In Memory!'], + new SlowDatabaseHandler() ); } - /** - * @dataProvider makeRequest - */ - public function testFastStorage($request) + public function testCanRequestKeyInFastStorage() { - $request->key = 'bar'; - $ret = $this->chain->handle($request); + $uri = $this->createMock('Psr\Http\Message\UriInterface'); + $uri->method('getPath')->willReturn('/foo/bar'); + $uri->method('getQuery')->willReturn('index=1'); - $this->assertTrue($ret); - $this->assertObjectHasAttribute('response', $request); - $this->assertEquals('baz', $request->response); - // despite both handle owns the 'bar' key, the FastStorage is responding first - $className = 'DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\FastStorage'; - $this->assertEquals($className, $request->forDebugOnly); + $request = $this->createMock('Psr\Http\Message\RequestInterface'); + $request->method('getMethod') + ->willReturn('GET'); + $request->method('getUri')->willReturn($uri); + + $this->assertEquals('Hello In Memory!', $this->chain->handle($request)); } - /** - * @dataProvider makeRequest - */ - public function testSlowStorage($request) + public function testCanRequestKeyInSlowStorage() { - $request->key = 'foo'; - $ret = $this->chain->handle($request); + $uri = $this->createMock('Psr\Http\Message\UriInterface'); + $uri->method('getPath')->willReturn('/foo/baz'); + $uri->method('getQuery')->willReturn(''); - $this->assertTrue($ret); - $this->assertObjectHasAttribute('response', $request); - $this->assertEquals('bar', $request->response); - // FastStorage has no 'foo' key, the SlowStorage is responding - $className = 'DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage'; - $this->assertEquals($className, $request->forDebugOnly); - } + $request = $this->createMock('Psr\Http\Message\RequestInterface'); + $request->method('getMethod') + ->willReturn('GET'); + $request->method('getUri')->willReturn($uri); - /** - * @dataProvider makeRequest - */ - public function testFailure($request) - { - $request->key = 'kurukuku'; - $ret = $this->chain->handle($request); - - $this->assertFalse($ret); - // the last responsible : - $className = 'DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage'; - $this->assertEquals($className, $request->forDebugOnly); + $this->assertEquals('Hello World!', $this->chain->handle($request)); } } diff --git a/Behavioral/Command/AddMessageDateCommand.php b/Behavioral/Command/AddMessageDateCommand.php index 11bb9af..fcaeb4f 100644 --- a/Behavioral/Command/AddMessageDateCommand.php +++ b/Behavioral/Command/AddMessageDateCommand.php @@ -4,14 +4,14 @@ namespace DesignPatterns\Behavioral\Command; /** * This concrete command tweaks receiver to add current date to messages - * invoker just knows that it can call "execute". + * invoker just knows that it can call "execute" */ class AddMessageDateCommand implements UndoableCommandInterface { /** * @var Receiver */ - protected $output; + private $output; /** * Each concrete command is built with different receivers. diff --git a/Behavioral/Command/CommandInterface.php b/Behavioral/Command/CommandInterface.php index cd9d9c6..265e862 100644 --- a/Behavioral/Command/CommandInterface.php +++ b/Behavioral/Command/CommandInterface.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Behavioral\Command; -/** - * class CommandInterface. - */ interface CommandInterface { /** diff --git a/Behavioral/Command/HelloCommand.php b/Behavioral/Command/HelloCommand.php index 94d4723..1dbfaf5 100644 --- a/Behavioral/Command/HelloCommand.php +++ b/Behavioral/Command/HelloCommand.php @@ -4,18 +4,18 @@ namespace DesignPatterns\Behavioral\Command; /** * This concrete command calls "print" on the Receiver, but an external - * invoker just knows that it can call "execute". + * invoker just knows that it can call "execute" */ class HelloCommand implements CommandInterface { /** * @var Receiver */ - protected $output; + private $output; /** * 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. + * There can be one, many or completely no receivers, but there can be other commands in the parameters * * @param Receiver $console */ @@ -29,8 +29,7 @@ class HelloCommand implements CommandInterface */ public function execute() { - // sometimes, there is no receiver and this is the command which - // does all the work + // sometimes, there is no receiver and this is the command which does all the work $this->output->write('Hello World'); } } diff --git a/Behavioral/Command/Invoker.php b/Behavioral/Command/Invoker.php index 7942adb..c6e7f93 100644 --- a/Behavioral/Command/Invoker.php +++ b/Behavioral/Command/Invoker.php @@ -11,11 +11,11 @@ class Invoker /** * @var CommandInterface */ - protected $command; + private $command; /** - * In the invoker we find this kind of method for subscribing the command. - * There can be also a stack, a list, a fixed set... + * in the invoker we find this kind of method for subscribing the command + * There can be also a stack, a list, a fixed set ... * * @param CommandInterface $cmd */ @@ -25,12 +25,10 @@ class Invoker } /** - * executes the command. + * executes the command; the invoker is the same whatever is the command */ public function run() { - // here is a key feature of the invoker - // the invoker is the same whatever is the command $this->command->execute(); } } diff --git a/Behavioral/Command/README.rst b/Behavioral/Command/README.rst index ddd2164..55b3287 100644 --- a/Behavioral/Command/README.rst +++ b/Behavioral/Command/README.rst @@ -38,7 +38,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ CommandInterface.php diff --git a/Behavioral/Command/Receiver.php b/Behavioral/Command/Receiver.php index 956ce74..7ca6343 100644 --- a/Behavioral/Command/Receiver.php +++ b/Behavioral/Command/Receiver.php @@ -7,14 +7,20 @@ namespace DesignPatterns\Behavioral\Command; */ class Receiver { + /** + * @var bool + */ private $enableDate = false; - private $output = array(); + /** + * @var string[] + */ + private $output = []; /** * @param string $str */ - public function write($str) + public function write(string $str) { if ($this->enableDate) { $str .= ' ['.date('Y-m-d').']'; @@ -23,13 +29,13 @@ class Receiver $this->output[] = $str; } - public function getOutput() + public function getOutput(): string { - return implode("\n", $this->output); + return join("\n", $this->output); } /** - * Enable receiver to display message date. + * Enable receiver to display message date */ public function enableDate() { @@ -37,7 +43,7 @@ class Receiver } /** - * Disable receiver to display message date. + * Disable receiver to display message date */ public function disableDate() { diff --git a/Behavioral/Command/Tests/CommandTest.php b/Behavioral/Command/Tests/CommandTest.php index 3852495..2479321 100644 --- a/Behavioral/Command/Tests/CommandTest.php +++ b/Behavioral/Command/Tests/CommandTest.php @@ -5,32 +5,17 @@ namespace DesignPatterns\Behavioral\Command\Tests; use DesignPatterns\Behavioral\Command\HelloCommand; use DesignPatterns\Behavioral\Command\Invoker; use DesignPatterns\Behavioral\Command\Receiver; +use PHPUnit\Framework\TestCase; -/** - * CommandTest has the role of the Client in the Command Pattern. - */ -class CommandTest extends \PHPUnit_Framework_TestCase +class CommandTest extends TestCase { - /** - * @var Invoker - */ - protected $invoker; - - /** - * @var Receiver - */ - protected $receiver; - - protected function setUp() - { - $this->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'); + $invoker = new Invoker(); + $receiver = new Receiver(); + + $invoker->setCommand(new HelloCommand($receiver)); + $invoker->run(); + $this->assertEquals('Hello World', $receiver->getOutput()); } } diff --git a/Behavioral/Command/Tests/UndoableCommandTest.php b/Behavioral/Command/Tests/UndoableCommandTest.php index 5302a7b..9569cb1 100644 --- a/Behavioral/Command/Tests/UndoableCommandTest.php +++ b/Behavioral/Command/Tests/UndoableCommandTest.php @@ -6,44 +6,28 @@ use DesignPatterns\Behavioral\Command\AddMessageDateCommand; use DesignPatterns\Behavioral\Command\HelloCommand; use DesignPatterns\Behavioral\Command\Invoker; use DesignPatterns\Behavioral\Command\Receiver; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; -/** - * UndoableCommandTest has the role of the Client in the Command Pattern. - */ -class UndoableCommandTest extends PHPUnit_Framework_TestCase +class UndoableCommandTest extends TestCase { - /** - * @var Invoker - */ - protected $invoker; - - /** - * @var Receiver - */ - protected $receiver; - - protected function setUp() - { - $this->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'); + $invoker = new Invoker(); + $receiver = new Receiver(); - $messageDateCommand = new AddMessageDateCommand($this->receiver); + $invoker->setCommand(new HelloCommand($receiver)); + $invoker->run(); + $this->assertEquals('Hello World', $receiver->getOutput()); + + $messageDateCommand = new AddMessageDateCommand($receiver); $messageDateCommand->execute(); - $this->invoker->run(); - $this->assertEquals($this->receiver->getOutput(), "Hello World\nHello World [".date('Y-m-d').']'); + $invoker->run(); + $this->assertEquals("Hello World\nHello World [".date('Y-m-d').']', $receiver->getOutput()); $messageDateCommand->undo(); - $this->invoker->run(); - $this->assertEquals($this->receiver->getOutput(), "Hello World\nHello World [".date('Y-m-d')."]\nHello World"); + $invoker->run(); + $this->assertEquals("Hello World\nHello World [".date('Y-m-d')."]\nHello World", $receiver->getOutput()); } } diff --git a/Behavioral/Command/UndoableCommandInterface.php b/Behavioral/Command/UndoableCommandInterface.php index f9234ab..52b02e9 100644 --- a/Behavioral/Command/UndoableCommandInterface.php +++ b/Behavioral/Command/UndoableCommandInterface.php @@ -2,14 +2,10 @@ namespace DesignPatterns\Behavioral\Command; -/** - * Interface UndoableCommandInterface. - */ interface UndoableCommandInterface extends CommandInterface { /** * This method is used to undo change made by command execution - * The Receiver goes in the constructor. */ public function undo(); } diff --git a/Behavioral/Iterator/Book.php b/Behavioral/Iterator/Book.php index b1adf7f..bb9abeb 100644 --- a/Behavioral/Iterator/Book.php +++ b/Behavioral/Iterator/Book.php @@ -4,27 +4,33 @@ namespace DesignPatterns\Behavioral\Iterator; class Book { + /** + * @var string + */ private $author; + /** + * @var string + */ private $title; - public function __construct($title, $author) + public function __construct(string $title, string $author) { $this->author = $author; $this->title = $title; } - public function getAuthor() + public function getAuthor(): string { return $this->author; } - public function getTitle() + public function getTitle(): string { return $this->title; } - public function getAuthorAndTitle() + public function getAuthorAndTitle(): string { return $this->getTitle().' by '.$this->getAuthor(); } diff --git a/Behavioral/Iterator/BookList.php b/Behavioral/Iterator/BookList.php index 6cc5e5e..f8d0c87 100644 --- a/Behavioral/Iterator/BookList.php +++ b/Behavioral/Iterator/BookList.php @@ -2,18 +2,17 @@ namespace DesignPatterns\Behavioral\Iterator; -class BookList implements \Countable +class BookList implements \Countable, \Iterator { - private $books; + /** + * @var Book[] + */ + private $books = []; - public function getBook($bookNumberToGet) - { - if (isset($this->books[$bookNumberToGet])) { - return $this->books[$bookNumberToGet]; - } - - return; - } + /** + * @var int + */ + private $currentIndex = 0; public function addBook(Book $book) { @@ -23,15 +22,41 @@ class BookList implements \Countable public function removeBook(Book $bookToRemove) { foreach ($this->books as $key => $book) { - /** @var Book $book */ if ($book->getAuthorAndTitle() === $bookToRemove->getAuthorAndTitle()) { unset($this->books[$key]); } } + + $this->books = array_values($this->books); } - public function count() + public function count(): int { return count($this->books); } + + public function current(): Book + { + return $this->books[$this->currentIndex]; + } + + public function key(): int + { + return $this->currentIndex; + } + + public function next() + { + $this->currentIndex++; + } + + public function rewind() + { + $this->currentIndex = 0; + } + + public function valid(): bool + { + return isset($this->books[$this->currentIndex]); + } } diff --git a/Behavioral/Iterator/BookListIterator.php b/Behavioral/Iterator/BookListIterator.php deleted file mode 100644 index ecedba6..0000000 --- a/Behavioral/Iterator/BookListIterator.php +++ /dev/null @@ -1,86 +0,0 @@ -bookList = $bookList; - } - - /** - * 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 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 = 0; - } -} diff --git a/Behavioral/Iterator/BookListReverseIterator.php b/Behavioral/Iterator/BookListReverseIterator.php deleted file mode 100644 index 94f34d9..0000000 --- a/Behavioral/Iterator/BookListReverseIterator.php +++ /dev/null @@ -1,87 +0,0 @@ -bookList = $bookList; - $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 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.rst b/Behavioral/Iterator/README.rst index 9398350..d0b0714 100644 --- a/Behavioral/Iterator/README.rst +++ b/Behavioral/Iterator/README.rst @@ -4,8 +4,7 @@ Purpose ------- -To make an object iterable and to make it appear like a collection of -objects. +To make an object iterable and to make it appear like a collection of objects. Examples -------- @@ -31,7 +30,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Book.php @@ -45,18 +44,6 @@ BookList.php :language: php :linenos: -BookListIterator.php - -.. literalinclude:: BookListIterator.php - :language: php - :linenos: - -BookListReverseIterator.php - -.. literalinclude:: BookListReverseIterator.php - :language: php - :linenos: - Test ---- @@ -67,4 +54,4 @@ Tests/IteratorTest.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 +.. __: http://en.wikipedia.org/wiki/Iterator_pattern diff --git a/Behavioral/Iterator/Tests/IteratorTest.php b/Behavioral/Iterator/Tests/IteratorTest.php index db386f0..5a63078 100644 --- a/Behavioral/Iterator/Tests/IteratorTest.php +++ b/Behavioral/Iterator/Tests/IteratorTest.php @@ -6,69 +6,72 @@ use DesignPatterns\Behavioral\Iterator\Book; use DesignPatterns\Behavioral\Iterator\BookList; use DesignPatterns\Behavioral\Iterator\BookListIterator; use DesignPatterns\Behavioral\Iterator\BookListReverseIterator; +use PHPUnit\Framework\TestCase; -class IteratorTest extends \PHPUnit_Framework_TestCase +class IteratorTest extends TestCase { - /** - * @var BookList - */ - protected $bookList; - - protected function setUp() + public function testCanIterateOverBookList() { - $this->bookList = new BookList(); - $this->bookList->addBook(new Book('Learning PHP Design Patterns', 'William Sanders')); - $this->bookList->addBook(new Book('Professional Php Design Patterns', 'Aaron Saray')); - $this->bookList->addBook(new Book('Clean Code', 'Robert C. Martin')); - } + $bookList = new BookList(); + $bookList->addBook(new Book('Learning PHP Design Patterns', 'William Sanders')); + $bookList->addBook(new Book('Professional Php Design Patterns', 'Aaron Saray')); + $bookList->addBook(new Book('Clean Code', 'Robert C. Martin')); - public function expectedAuthors() - { - return array( - array( - array( - 'Learning PHP Design Patterns by William Sanders', - 'Professional Php Design Patterns by Aaron Saray', - 'Clean Code by Robert C. Martin', - ), - ), + $books = []; + + foreach ($bookList as $book) { + $books[] = $book->getAuthorAndTitle(); + } + + $this->assertEquals( + [ + 'Learning PHP Design Patterns by William Sanders', + 'Professional Php Design Patterns by Aaron Saray', + 'Clean Code by Robert C. Martin', + ], + $books ); } - /** - * @dataProvider expectedAuthors - */ - public function testUseAIteratorAndValidateAuthors($expected) + public function testCanIterateOverBookListAfterRemovingBook() { - $iterator = new BookListIterator($this->bookList); + $book = new Book('Clean Code', 'Robert C. Martin'); + $book2 = new Book('Professional Php Design Patterns', 'Aaron Saray'); - while ($iterator->valid()) { - $expectedBook = array_shift($expected); - $this->assertEquals($expectedBook, $iterator->current()->getAuthorAndTitle()); - $iterator->next(); + $bookList = new BookList(); + $bookList->addBook($book); + $bookList->addBook($book2); + $bookList->removeBook($book); + + $books = []; + foreach ($bookList as $book) { + $books[] = $book->getAuthorAndTitle(); } + + $this->assertEquals( + ['Professional Php Design Patterns by Aaron Saray'], + $books + ); } - /** - * @dataProvider expectedAuthors - */ - public function testUseAReverseIteratorAndValidateAuthors($expected) + public function testCanAddBookToList() { - $iterator = new BookListReverseIterator($this->bookList); + $book = new Book('Clean Code', 'Robert C. Martin'); - while ($iterator->valid()) { - $expectedBook = array_pop($expected); - $this->assertEquals($expectedBook, $iterator->current()->getAuthorAndTitle()); - $iterator->next(); - } + $bookList = new BookList(); + $bookList->addBook($book); + + $this->assertCount(1, $bookList); } - /** - * Test BookList Remove. - */ - public function testBookRemove() + public function testCanRemoveBookFromList() { - $this->bookList->removeBook($this->bookList->getBook(0)); - $this->assertEquals($this->bookList->count(), 2); + $book = new Book('Clean Code', 'Robert C. Martin'); + + $bookList = new BookList(); + $bookList->addBook($book); + $bookList->removeBook($book); + + $this->assertCount(0, $bookList); } } diff --git a/Behavioral/Mediator/Colleague.php b/Behavioral/Mediator/Colleague.php index c74dee5..3a83742 100644 --- a/Behavioral/Mediator/Colleague.php +++ b/Behavioral/Mediator/Colleague.php @@ -4,7 +4,7 @@ namespace DesignPatterns\Behavioral\Mediator; /** * Colleague is an abstract colleague who works together but he only knows - * the Mediator, not other colleague. + * the Mediator, not other colleagues */ abstract class Colleague { @@ -13,21 +13,13 @@ abstract class Colleague * * @var MediatorInterface */ - private $mediator; + protected $mediator; /** - * @param MediatorInterface $medium + * @param MediatorInterface $mediator */ - public function __construct(MediatorInterface $medium) + public function setMediator(MediatorInterface $mediator) { - // in this way, we are sure the concrete colleague knows the mediator - $this->mediator = $medium; - } - - // for subclasses - - protected function getMediator() - { - return $this->mediator; + $this->mediator = $mediator; } } diff --git a/Behavioral/Mediator/Mediator.php b/Behavioral/Mediator/Mediator.php index 98a7890..08e1b71 100644 --- a/Behavioral/Mediator/Mediator.php +++ b/Behavioral/Mediator/Mediator.php @@ -3,59 +3,54 @@ namespace DesignPatterns\Behavioral\Mediator; /** - * Mediator is the concrete Mediator for this design pattern. - * In this example, I have made a "Hello World" with the Mediator Pattern. + * 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 */ - protected $server; + private $server; /** * @var Subsystem\Database */ - protected $database; + private $database; /** * @var Subsystem\Client */ - protected $client; + private $client; /** - * @param Subsystem\Database $db - * @param Subsystem\Client $cl - * @param Subsystem\Server $srv + * @param Subsystem\Database $database + * @param Subsystem\Client $client + * @param Subsystem\Server $server */ - public function setColleague(Subsystem\Database $db, Subsystem\Client $cl, Subsystem\Server $srv) + public function __construct(Subsystem\Database $database, Subsystem\Client $client, Subsystem\Server $server) { - $this->database = $db; - $this->server = $srv; - $this->client = $cl; + $this->database = $database; + $this->server = $server; + $this->client = $client; + + $this->database->setMediator($this); + $this->server->setMediator($this); + $this->client->setMediator($this); } - /** - * make request. - */ public function makeRequest() { $this->server->process(); } - /** - * query db. - * - * @return mixed - */ - public function queryDb() + public function queryDb(): string { return $this->database->getData(); } /** - * send response. - * * @param string $content */ public function sendResponse($content) diff --git a/Behavioral/Mediator/MediatorInterface.php b/Behavioral/Mediator/MediatorInterface.php index dbdd489..5ec717a 100644 --- a/Behavioral/Mediator/MediatorInterface.php +++ b/Behavioral/Mediator/MediatorInterface.php @@ -4,7 +4,7 @@ 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 Liskov substitution principle concerns. */ interface MediatorInterface { @@ -16,12 +16,12 @@ interface MediatorInterface 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.rst b/Behavioral/Mediator/README.rst index bc9485a..b789ec6 100644 --- a/Behavioral/Mediator/README.rst +++ b/Behavioral/Mediator/README.rst @@ -22,7 +22,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ MediatorInterface.php diff --git a/Behavioral/Mediator/Subsystem/Client.php b/Behavioral/Mediator/Subsystem/Client.php index f7a21c9..79a472d 100644 --- a/Behavioral/Mediator/Subsystem/Client.php +++ b/Behavioral/Mediator/Subsystem/Client.php @@ -5,24 +5,16 @@ 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 makes requests and gets the response. */ class Client extends Colleague { - /** - * request. - */ public function request() { - $this->getMediator()->makeRequest(); + $this->mediator->makeRequest(); } - /** - * output content. - * - * @param string $content - */ - public function output($content) + public function output(string $content) { echo $content; } diff --git a/Behavioral/Mediator/Subsystem/Database.php b/Behavioral/Mediator/Subsystem/Database.php index 69ad6cf..9255f22 100644 --- a/Behavioral/Mediator/Subsystem/Database.php +++ b/Behavioral/Mediator/Subsystem/Database.php @@ -4,15 +4,9 @@ namespace DesignPatterns\Behavioral\Mediator\Subsystem; use DesignPatterns\Behavioral\Mediator\Colleague; -/** - * Database is a database service. - */ class Database extends Colleague { - /** - * @return string - */ - public function getData() + public function getData(): string { return 'World'; } diff --git a/Behavioral/Mediator/Subsystem/Server.php b/Behavioral/Mediator/Subsystem/Server.php index 1602bcb..c05be5e 100644 --- a/Behavioral/Mediator/Subsystem/Server.php +++ b/Behavioral/Mediator/Subsystem/Server.php @@ -4,17 +4,11 @@ namespace DesignPatterns\Behavioral\Mediator\Subsystem; use DesignPatterns\Behavioral\Mediator\Colleague; -/** - * Server serves responses. - */ class Server extends Colleague { - /** - * process on server. - */ public function process() { - $data = $this->getMediator()->queryDb(); - $this->getMediator()->sendResponse("Hello $data"); + $data = $this->mediator->queryDb(); + $this->mediator->sendResponse(sprintf("Hello %s", $data)); } } diff --git a/Behavioral/Mediator/Tests/MediatorTest.php b/Behavioral/Mediator/Tests/MediatorTest.php index 2bce947..31a4b77 100644 --- a/Behavioral/Mediator/Tests/MediatorTest.php +++ b/Behavioral/Mediator/Tests/MediatorTest.php @@ -6,28 +6,16 @@ use DesignPatterns\Behavioral\Mediator\Mediator; use DesignPatterns\Behavioral\Mediator\Subsystem\Client; use DesignPatterns\Behavioral\Mediator\Subsystem\Database; use DesignPatterns\Behavioral\Mediator\Subsystem\Server; +use PHPUnit\Framework\TestCase; -/** - * MediatorTest tests hello world. - */ -class MediatorTest extends \PHPUnit_Framework_TestCase +class MediatorTest extends TestCase { - protected $client; - - protected function setUp() - { - $media = new Mediator(); - $this->client = new Client($media); - $media->setColleague(new Database($media), $this->client, new Server($media)); - } - public function testOutputHelloWorld() { - // testing if Hello World is output : + $client = new Client(); + new Mediator(new Database(), $client, new Server()); + $this->expectOutputString('Hello World'); - // as you see, the 3 components Client, Server and Database are totally decoupled - $this->client->request(); - // Anyway, it remains complexity in the Mediator that's why the pattern - // Observer is preferable in mnay situations. + $client->request(); } } diff --git a/Behavioral/Memento/Caretaker.php b/Behavioral/Memento/Caretaker.php deleted file mode 100644 index d80454a..0000000 --- a/Behavioral/Memento/Caretaker.php +++ /dev/null @@ -1,49 +0,0 @@ -history[$id]; - } - - /** - * @param Memento $state - */ - public function saveToHistory(Memento $state) - { - $this->history[] = $state; - } - - public function runCustomLogic() - { - $originator = new Originator(); - - //Setting state to State1 - $originator->setState('State1'); - //Setting state to State2 - $originator->setState('State2'); - //Saving State2 to Memento - $this->saveToHistory($originator->getStateAsMemento()); - //Setting state to State3 - $originator->setState('State3'); - - // We can request multiple mementos, and choose which one to roll back to. - // Saving State3 to Memento - $this->saveToHistory($originator->getStateAsMemento()); - //Setting state to State4 - $originator->setState('State4'); - - $originator->restoreFromMemento($this->getFromHistory(1)); - //State after restoring from Memento: State3 - - return $originator->getStateAsMemento()->getState(); - } -} diff --git a/Behavioral/Memento/Memento.php b/Behavioral/Memento/Memento.php index 4dd2fc8..f75fcc9 100644 --- a/Behavioral/Memento/Memento.php +++ b/Behavioral/Memento/Memento.php @@ -4,19 +4,21 @@ namespace DesignPatterns\Behavioral\Memento; class Memento { - /* @var mixed */ + /** + * @var State + */ private $state; /** - * @param mixed $stateToSave + * @param State $stateToSave */ - public function __construct($stateToSave) + public function __construct(State $stateToSave) { $this->state = $stateToSave; } /** - * @return mixed + * @return State */ public function getState() { diff --git a/Behavioral/Memento/Originator.php b/Behavioral/Memento/Originator.php deleted file mode 100644 index 3acb0c1..0000000 --- a/Behavioral/Memento/Originator.php +++ /dev/null @@ -1,38 +0,0 @@ -state = $state; - } - - /** - * @return Memento - */ - 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); - } - - public function restoreFromMemento(Memento $memento) - { - $this->state = $memento->getState(); - } -} diff --git a/Behavioral/Memento/README.rst b/Behavioral/Memento/README.rst index 911e30e..249445b 100644 --- a/Behavioral/Memento/README.rst +++ b/Behavioral/Memento/README.rst @@ -6,8 +6,8 @@ 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). +it's implementation (i.e., the object is not required to have a function +to return the current state). The memento pattern is implemented with three objects: the Originator, a Caretaker and a Memento. @@ -52,7 +52,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Memento.php @@ -60,15 +60,15 @@ Memento.php :language: php :linenos: -Originator.php +State.php -.. literalinclude:: Originator.php +.. literalinclude:: State.php :language: php :linenos: -Caretaker.php +Ticket.php -.. literalinclude:: Caretaker.php +.. literalinclude:: Ticket.php :language: php :linenos: @@ -82,4 +82,4 @@ Tests/MementoTest.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 +.. __: http://en.wikipedia.org/wiki/Memento_pattern diff --git a/Behavioral/Memento/State.php b/Behavioral/Memento/State.php new file mode 100644 index 0000000..6cb5dd1 --- /dev/null +++ b/Behavioral/Memento/State.php @@ -0,0 +1,48 @@ +state = $state; + } + + private static function ensureIsValidState(string $state) + { + if (!in_array($state, self::$validStates)) { + throw new \InvalidArgumentException('Invalid state given'); + } + } + + public function __toString(): string + { + return $this->state; + } +} diff --git a/Behavioral/Memento/Tests/MementoTest.php b/Behavioral/Memento/Tests/MementoTest.php index 722dbfa..656a58c 100644 --- a/Behavioral/Memento/Tests/MementoTest.php +++ b/Behavioral/Memento/Tests/MementoTest.php @@ -2,161 +2,31 @@ namespace DesignPatterns\Behavioral\Memento\Tests; -use DesignPatterns\Behavioral\Memento\Caretaker; -use DesignPatterns\Behavioral\Memento\Memento; -use DesignPatterns\Behavioral\Memento\Originator; +use DesignPatterns\Behavioral\Memento\State; +use DesignPatterns\Behavioral\Memento\Ticket; +use PHPUnit\Framework\TestCase; -/** - * MementoTest tests the memento pattern. - */ -class MementoTest extends \PHPUnit_Framework_TestCase +class MementoTest extends TestCase { - public function testUsageExample() + public function testOpenTicketAssignAndSetBackToOpen() { - $originator = new Originator(); - $caretaker = new Caretaker(); + $ticket = new Ticket(); - $character = new \stdClass(); - // new object - $character->name = 'Gandalf'; - // connect Originator to character object - $originator->setState($character); + // open the ticket + $ticket->open(); + $openedState = $ticket->getState(); + $this->assertEquals(State::STATE_OPENED, (string) $ticket->getState()); - // 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); + $memento = $ticket->saveToMemento(); - // change something - $character->name = 'Sauron'; - // and again - $character->race = 'Ainur'; - // state inside the Originator was equally changed - $this->assertAttributeEquals($character, 'state', $originator); + // assign the ticket + $ticket->assign(); + $this->assertEquals(State::STATE_ASSIGNED, (string) $ticket->getState()); - // time to save another state - $snapshot = $originator->getStateAsMemento(); - // put state to log - $caretaker->saveToHistory($snapshot); + // now restore to the opened state, but verify that the state object has been cloned for the memento + $ticket->restoreFromMemento($memento); - $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'); - - $this->assertAttributeEquals('State1', 'state', $originator); - - $originator->setState('State2'); - $this->assertAttributeEquals('State2', 'state', $originator); - - $snapshot = $originator->getStateAsMemento(); - $this->assertAttributeEquals('State2', 'state', $snapshot); - - $originator->setState('State3'); - $this->assertAttributeEquals('State3', 'state', $originator); - - $originator->restoreFromMemento($snapshot); - $this->assertAttributeEquals('State2', 'state', $originator); - } - - 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(); - - $first = new \stdClass(); - $first->data = 'foo'; - - $originator->setState($first); - $this->assertAttributeEquals($first, 'state', $originator); - - $first_snapshot = $originator->getStateAsMemento(); - $this->assertAttributeEquals($first, 'state', $first_snapshot); - - $second = new \stdClass(); - $second->data = 'bar'; - $originator->setState($second); - $this->assertAttributeEquals($second, 'state', $originator); - - $originator->restoreFromMemento($first_snapshot); - $this->assertAttributeEquals($first, 'state', $originator); - } - - 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)); - } - - public function testCaretakerCustomLogic() - { - $caretaker = new Caretaker(); - $result = $caretaker->runCustomLogic(); - $this->assertEquals('State3', $result); + $this->assertEquals(State::STATE_OPENED, (string) $ticket->getState()); + $this->assertNotSame($openedState, $ticket->getState()); } } diff --git a/Behavioral/Memento/Ticket.php b/Behavioral/Memento/Ticket.php new file mode 100644 index 0000000..13f75e7 --- /dev/null +++ b/Behavioral/Memento/Ticket.php @@ -0,0 +1,49 @@ +currentState = new State(State::STATE_CREATED); + } + + public function open() + { + $this->currentState = new State(State::STATE_OPENED); + } + + public function assign() + { + $this->currentState = new State(State::STATE_ASSIGNED); + } + + public function close() + { + $this->currentState = new State(State::STATE_CLOSED); + } + + public function saveToMemento(): Memento + { + return new Memento(clone $this->currentState); + } + + public function restoreFromMemento(Memento $memento) + { + $this->currentState = $memento->getState(); + } + + public function getState(): State + { + return $this->currentState; + } +} diff --git a/Behavioral/Memento/uml/Memento.uml b/Behavioral/Memento/uml/Memento.uml new file mode 100644 index 0000000..194187a --- /dev/null +++ b/Behavioral/Memento/uml/Memento.uml @@ -0,0 +1,21 @@ + + + PHP + \DesignPatterns\Behavioral\Memento\Memento + + \DesignPatterns\Behavioral\Memento\State + \DesignPatterns\Behavioral\Memento\Memento + \DesignPatterns\Behavioral\Memento\Ticket + + + + + + + Fields + Constants + Methods + + private + + diff --git a/Behavioral/Memento/uml/Momento.uml b/Behavioral/Memento/uml/Momento.uml deleted file mode 100644 index c72667e..0000000 --- a/Behavioral/Memento/uml/Momento.uml +++ /dev/null @@ -1,22 +0,0 @@ - - - PHP - \DesignPatterns\Behavioral\Memento\Caretaker - - \DesignPatterns\Behavioral\Memento\Caretaker - \DesignPatterns\Behavioral\Memento\Originator - \DesignPatterns\Behavioral\Memento\Memento - - - - - - - Fields - Constants - Constructors - Methods - - private - - diff --git a/Behavioral/Memento/uml/uml.png b/Behavioral/Memento/uml/uml.png index 0fde074..417b293 100644 Binary files a/Behavioral/Memento/uml/uml.png and b/Behavioral/Memento/uml/uml.png differ diff --git a/Behavioral/Memento/uml/uml.svg b/Behavioral/Memento/uml/uml.svg index 2cc47a8..aeb665a 100644 --- a/Behavioral/Memento/uml/uml.svg +++ b/Behavioral/Memento/uml/uml.svg @@ -1,310 +1,952 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - state - - - - - - - - - - - - setState(state) - - - - - - - - - saveToMemento() - - - - - - - - - restoreFromMemento(memento) - - - - - - - - - - - - - Originator - - - Originator - - - - - - - - - - - - - - - - - - run() - - - - - - - - - - - - - Caretaker - - - Caretaker - - - - - - - - - - - - - - - - - - - state - - - - - - - - - - - - __construct(stateToSave) - - - - - - - - - - - - getState() - - - - - - - - - - - - - Memento - - - Memento - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + validStates + + + + + + + + + + + + + + + + state + + + + + + + + + + + + + + + + + + + STATE_CREATED + + + + + + + + + + + + + + + + STATE_OPENED + + + + + + + + + + + + + + + + STATE_ASSIGNED + + + + + + + + + + + + + + + + STATE_CLOSED + + + + + + + + + + + + + + + + ensureIsValidState(state) + + + + + + + + + + + + + __toString() + + + + + + + + + + + + + State + + + State + + + + + + + + + + + + + + + + + + + + + + + + + validStates + + + + + + + + + + + + + + + + state + + + + + + + + + + + + + + + + + + + STATE_CREATED + + + + + + + + + + + + + + + + STATE_OPENED + + + + + + + + + + + + + + + + STATE_ASSIGNED + + + + + + + + + + + + + + + + STATE_CLOSED + + + + + + + + + + + + + + + + + + + + + + ensureIsValidState(state) + + + + + + + + + + + + + + + + __toString() + + + + + + + + + + + + + State + + + State + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + state + + + + + + + + + + + + + + + + getState() + + + + + + + + + + + + + Memento + + + Memento + + + + + + + + + + + + + + + + + + + + + + state + + + + + + + + + + + + + + + + + + + getState() + + + + + + + + + + + + + Memento + + + Memento + + + + + + + + + + + + + + + + + + + + + + + + + currentState + + + + + + + + + + + + + + + + open() + + + + + + + + + + + + + assign() + + + + + + + + + + + + + close() + + + + + + + + + + + + + saveToMemento() + + + + + + + + + + + + + restoreFromMemento(memento) + + + + + + + + + + + + + getState() + + + + + + + + + + + + + Ticket + + + Ticket + + + + + + + + + + + + + + + + + + + + + + currentState + + + + + + + + + + + + + + + + + + + open() + + + + + + + + + + + + + + + + assign() + + + + + + + + + + + + + + + + close() + + + + + + + + + + + + + + + + saveToMemento() + + + + + + + + + + + + + + + + restoreFromMemento(memento) + + + + + + + + + + + + + + + + getState() + + + + + + + + + + + + + Ticket + + + Ticket + + + diff --git a/Behavioral/NullObject/LoggerInterface.php b/Behavioral/NullObject/LoggerInterface.php index 99a28c7..7c1ff7d 100644 --- a/Behavioral/NullObject/LoggerInterface.php +++ b/Behavioral/NullObject/LoggerInterface.php @@ -3,16 +3,9 @@ namespace DesignPatterns\Behavioral\NullObject; /** - * LoggerInterface is a contract for logging something. - * - * Key feature: NullLogger MUST inherit from this interface like any other Loggers + * Key feature: NullLogger must inherit from this interface like any other loggers */ interface LoggerInterface { - /** - * @param string $str - * - * @return mixed - */ - public function log($str); + public function log(string $str); } diff --git a/Behavioral/NullObject/NullLogger.php b/Behavioral/NullObject/NullLogger.php index a4bf469..afddbd6 100644 --- a/Behavioral/NullObject/NullLogger.php +++ b/Behavioral/NullObject/NullLogger.php @@ -2,19 +2,9 @@ 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. - */ class NullLogger implements LoggerInterface { - /** - * {@inheritdoc} - */ - public function log($str) + public function log(string $str) { // do nothing } diff --git a/Behavioral/NullObject/PrintLogger.php b/Behavioral/NullObject/PrintLogger.php index 371c1ab..6c1d4ba 100644 --- a/Behavioral/NullObject/PrintLogger.php +++ b/Behavioral/NullObject/PrintLogger.php @@ -2,15 +2,9 @@ namespace DesignPatterns\Behavioral\NullObject; -/** - * PrintLogger is a logger that prints the log entry to standard output. - */ class PrintLogger implements LoggerInterface { - /** - * @param string $str - */ - public function log($str) + public function log(string $str) { echo $str; } diff --git a/Behavioral/NullObject/README.rst b/Behavioral/NullObject/README.rst index ad7719c..67b66ad 100644 --- a/Behavioral/NullObject/README.rst +++ b/Behavioral/NullObject/README.rst @@ -36,7 +36,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Service.php diff --git a/Behavioral/NullObject/Service.php b/Behavioral/NullObject/Service.php index 56a3847..81baf8f 100644 --- a/Behavioral/NullObject/Service.php +++ b/Behavioral/NullObject/Service.php @@ -2,24 +2,19 @@ namespace DesignPatterns\Behavioral\NullObject; -/** - * Service is dummy service that uses a logger. - */ class Service { /** * @var LoggerInterface */ - protected $logger; + private $logger; /** - * we inject the logger in ctor and it is mandatory. - * - * @param LoggerInterface $log + * @param LoggerInterface $logger */ - public function __construct(LoggerInterface $log) + public function __construct(LoggerInterface $logger) { - $this->logger = $log; + $this->logger = $logger; } /** @@ -27,8 +22,7 @@ class Service */ public function doSomething() { - // no more check "if (!is_null($this->logger))..." with the NullObject pattern + // notice here that you don't have to check if the logger is set with eg. is_null(), instead just use it $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 034b577..9b74c35 100644 --- a/Behavioral/NullObject/Tests/LoggerTest.php +++ b/Behavioral/NullObject/Tests/LoggerTest.php @@ -5,18 +5,14 @@ namespace DesignPatterns\Behavioral\NullObject\Tests; use DesignPatterns\Behavioral\NullObject\NullLogger; use DesignPatterns\Behavioral\NullObject\PrintLogger; use DesignPatterns\Behavioral\NullObject\Service; +use PHPUnit\Framework\TestCase; -/** - * LoggerTest tests for different loggers. - */ -class LoggerTest extends \PHPUnit_Framework_TestCase +class LoggerTest extends TestCase { public function testNullObject() { - // one can use a singleton for NullObjet : I don't think it's a good idea - // because the purpose behind null object is to "avoid special case". $service = new Service(new NullLogger()); - $this->expectOutputString(null); // no output + $this->expectOutputString(''); $service->doSomething(); } diff --git a/Behavioral/Observer/README.rst b/Behavioral/Observer/README.rst index 53398c2..84e3b28 100644 --- a/Behavioral/Observer/README.rst +++ b/Behavioral/Observer/README.rst @@ -5,7 +5,7 @@ Purpose ------- To implement a publish/subscribe behaviour to an object, whenever a -"Subject" object changes it's state, the attached "Observers" will be +"Subject" object changes its state, the attached "Observers" will be notified. It is used to shorten the amount of coupled objects and uses loose coupling instead. @@ -31,7 +31,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ User.php @@ -55,4 +55,4 @@ Tests/ObserverTest.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 +.. __: http://en.wikipedia.org/wiki/Observer_pattern diff --git a/Behavioral/Observer/Tests/ObserverTest.php b/Behavioral/Observer/Tests/ObserverTest.php index d9dacec..d7762d8 100644 --- a/Behavioral/Observer/Tests/ObserverTest.php +++ b/Behavioral/Observer/Tests/ObserverTest.php @@ -4,66 +4,18 @@ namespace DesignPatterns\Behavioral\Observer\Tests; use DesignPatterns\Behavioral\Observer\User; use DesignPatterns\Behavioral\Observer\UserObserver; +use PHPUnit\Framework\TestCase; -/** - * ObserverTest tests the Observer pattern. - */ -class ObserverTest extends \PHPUnit_Framework_TestCase +class ObserverTest extends TestCase { - protected $observer; - - protected function setUp() + public function testChangeInUserLeadsToUserObserverBeingNotified() { - $this->observer = new UserObserver(); - } + $observer = new UserObserver(); - /** - * Tests the notification. - */ - public function testNotify() - { - $this->expectOutputString('DesignPatterns\Behavioral\Observer\User has been updated'); - $subject = new User(); + $user = new User(); + $user->attach($observer); - $subject->attach($this->observer); - $subject->property = 123; - } - - /** - * Tests the subscribing. - */ - public function testAttachDetach() - { - $subject = new User(); - $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->assertTrue($observers->contains($this->observer)); - - $subject->detach($this->observer); - $this->assertFalse($observers->contains($this->observer)); - } - - /** - * Tests the update() invocation on a mockup. - */ - public function testUpdateCalling() - { - $subject = new User(); - $observer = $this->getMock('SplObserver'); - $subject->attach($observer); - - $observer->expects($this->once()) - ->method('update') - ->with($subject); - - $subject->notify(); + $user->changeEmail('foo@bar.com'); + $this->assertCount(1, $observer->getChangedUsers()); } } diff --git a/Behavioral/Observer/User.php b/Behavioral/Observer/User.php index 0d2a817..6fd58d4 100644 --- a/Behavioral/Observer/User.php +++ b/Behavioral/Observer/User.php @@ -3,60 +3,42 @@ namespace DesignPatterns\Behavioral\Observer; /** - * Observer pattern : The observed object (the subject). - * - * The subject maintains a list of Observers and sends notifications. + * User implements the observed object (called Subject), it maintains a list of observers and sends notifications to + * them in case changes are made on the User object */ class User implements \SplSubject { /** - * user data. - * - * @var array + * @var string */ - protected $data = array(); + private $email; /** - * observers. - * * @var \SplObjectStorage */ - protected $observers; + private $observers; public function __construct() { $this->observers = new \SplObjectStorage(); } - /** - * attach a new observer. - * - * @param \SplObserver $observer - * - * @return void - */ public function attach(\SplObserver $observer) { $this->observers->attach($observer); } - /** - * detach an observer. - * - * @param \SplObserver $observer - * - * @return void - */ public function detach(\SplObserver $observer) { $this->observers->detach($observer); } - /** - * notify observers. - * - * @return void - */ + public function changeEmail(string $email) + { + $this->email = $email; + $this->notify(); + } + public function notify() { /** @var \SplObserver $observer */ @@ -64,21 +46,4 @@ class User implements \SplSubject $observer->update($this); } } - - /** - * Ideally one would better write setter/getter for all valid attributes and only call notify() - * on attributes that matter when changed. - * - * @param string $name - * @param mixed $value - * - * @return void - */ - public function __set($name, $value) - { - $this->data[$name] = $value; - - // notify the observers, that user has been updated - $this->notify(); - } } diff --git a/Behavioral/Observer/UserObserver.php b/Behavioral/Observer/UserObserver.php index f2673ba..243e740 100644 --- a/Behavioral/Observer/UserObserver.php +++ b/Behavioral/Observer/UserObserver.php @@ -2,19 +2,28 @@ namespace DesignPatterns\Behavioral\Observer; -/** - * 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() ). + * @var User[] + */ + private $changedUsers = []; + + /** + * 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'; + $this->changedUsers[] = clone $subject; + } + + /** + * @return User[] + */ + public function getChangedUsers(): array + { + return $this->changedUsers; } } diff --git a/Behavioral/Observer/uml/Observer.uml b/Behavioral/Observer/uml/Observer.uml index 0e5ddef..b74d770 100644 --- a/Behavioral/Observer/uml/Observer.uml +++ b/Behavioral/Observer/uml/Observer.uml @@ -1,27 +1,26 @@ - - - PHP - \DesignPatterns\Behavioral\Observer\User - - \DesignPatterns\Behavioral\Observer\UserObserver - \DesignPatterns\Behavioral\Observer\User - \SplSubject - - - - - - - - - - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Behavioral\Observer\UserObserver + + \DesignPatterns\Behavioral\Observer\UserObserver + \SplObserver + \DesignPatterns\Behavioral\Observer\User + + + + + + + + + + + + Fields + Constants + Methods + + private + + diff --git a/Behavioral/Observer/uml/uml.png b/Behavioral/Observer/uml/uml.png index 0300bd4..3eff464 100644 Binary files a/Behavioral/Observer/uml/uml.png and b/Behavioral/Observer/uml/uml.png differ diff --git a/Behavioral/Observer/uml/uml.svg b/Behavioral/Observer/uml/uml.svg index 09c79c1..44f3c60 100644 --- a/Behavioral/Observer/uml/uml.svg +++ b/Behavioral/Observer/uml/uml.svg @@ -1,310 +1,649 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - data - - - - - - - - - - observers - - - - - - - - - - - - attach(observer) - - - - - - - - - detach(observer) - - - - - - - - - notify() - - - - - - - - - __set(name, value) - - - - - - - - - - - - - User - - - User - - - - - - - - - - - - - - - - - - update(subject) - - - - - - - - - - - - - UserObserver - - - UserObserver - - - - - - - - - - - - - - - - - - attach(observer) - - - - - - - - - detach(observer) - - - - - - - - - notify() - - - - - - - - - - - - - SplSubject - - - SplSubject - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + changedUsers + + + + + + + + + + + + + + + + update(subject) + + + + + + + + + + + + + getChangedUsers() + + + + + + + + + + + + + UserObserver + + + UserObserver + + + + + + + + + + + + + + + + + + + + + + changedUsers + + + + + + + + + + + + + + + + + + + update(subject) + + + + + + + + + + + + + + + + getChangedUsers() + + + + + + + + + + + + + UserObserver + + + UserObserver + + + + + + + + + + + + + + + + + + + + + + update(subject) + + + + + + + + + + + + + SplObserver + + + SplObserver + + + + + + + + + + + + + + + + + + + + + + update(subject) + + + + + + + + + + + + + SplObserver + + + SplObserver + + + + + + + + + + + + + + + + + + + + + + + + + email + + + + + + + + + + + + + + + + observers + + + + + + + + + + + + + + + + attach(observer) + + + + + + + + + + + + + detach(observer) + + + + + + + + + + + + + changeEmail(email) + + + + + + + + + + + + + notify() + + + + + + + + + + + + + User + + + User + + + + + + + + + + + + + + + + + + + + + + email + + + + + + + + + + + + + + + + observers + + + + + + + + + + + + + + + + + + + attach(observer) + + + + + + + + + + + + + + + + detach(observer) + + + + + + + + + + + + + + + + changeEmail(email) + + + + + + + + + + + + + + + + notify() + + + + + + + + + + + + + User + + + User + + + + + + + + + diff --git a/Behavioral/Specification/AbstractSpecification.php b/Behavioral/Specification/AbstractSpecification.php deleted file mode 100644 index 66d61b8..0000000 --- a/Behavioral/Specification/AbstractSpecification.php +++ /dev/null @@ -1,52 +0,0 @@ -specifications = $specifications; + } + + /** + * if at least one specification is false, return false, else return true. + */ + public function isSatisfiedBy(Item $item): bool + { + foreach ($this->specifications as $specification) { + if (!$specification->isSatisfiedBy($item)) { + return false; + } + } + + return true; + } +} diff --git a/Behavioral/Specification/Either.php b/Behavioral/Specification/Either.php deleted file mode 100644 index a30372a..0000000 --- a/Behavioral/Specification/Either.php +++ /dev/null @@ -1,36 +0,0 @@ -left = $left; - $this->right = $right; - } - - /** - * Returns the evaluation of both wrapped specifications as a logical OR. - * - * @param Item $item - * - * @return bool - */ - public function isSatisfiedBy(Item $item) - { - return $this->left->isSatisfiedBy($item) || $this->right->isSatisfiedBy($item); - } -} diff --git a/Behavioral/Specification/Item.php b/Behavioral/Specification/Item.php index 8d639e0..a167f0a 100644 --- a/Behavioral/Specification/Item.php +++ b/Behavioral/Specification/Item.php @@ -2,29 +2,19 @@ namespace DesignPatterns\Behavioral\Specification; -/** - * An trivial item. - */ class Item { - protected $price; - /** - * An item must have a price. - * - * @param int $price + * @var float */ - public function __construct($price) + private $price; + + public function __construct(float $price) { $this->price = $price; } - /** - * Get the items price. - * - * @return int - */ - public function getPrice() + public function getPrice(): float { return $this->price; } diff --git a/Behavioral/Specification/Not.php b/Behavioral/Specification/Not.php deleted file mode 100644 index e99a6cc..0000000 --- a/Behavioral/Specification/Not.php +++ /dev/null @@ -1,33 +0,0 @@ -spec = $spec; - } - - /** - * Returns the negated result of the wrapped specification. - * - * @param Item $item - * - * @return bool - */ - public function isSatisfiedBy(Item $item) - { - return !$this->spec->isSatisfiedBy($item); - } -} diff --git a/Behavioral/Specification/NotSpecification.php b/Behavioral/Specification/NotSpecification.php new file mode 100644 index 0000000..db47b51 --- /dev/null +++ b/Behavioral/Specification/NotSpecification.php @@ -0,0 +1,21 @@ +specification = $specification; + } + + public function isSatisfiedBy(Item $item): bool + { + return !$this->specification->isSatisfiedBy($item); + } +} diff --git a/Behavioral/Specification/OrSpecification.php b/Behavioral/Specification/OrSpecification.php new file mode 100644 index 0000000..47faaaa --- /dev/null +++ b/Behavioral/Specification/OrSpecification.php @@ -0,0 +1,32 @@ +specifications = $specifications; + } + + /** + * if at least one specification is true, return true, else return false + */ + public function isSatisfiedBy(Item $item): bool + { + foreach ($this->specifications as $specification) { + if ($specification->isSatisfiedBy($item)) { + return true; + } + } + return false; + } +} diff --git a/Behavioral/Specification/Plus.php b/Behavioral/Specification/Plus.php deleted file mode 100644 index 26bd585..0000000 --- a/Behavioral/Specification/Plus.php +++ /dev/null @@ -1,36 +0,0 @@ -left = $left; - $this->right = $right; - } - - /** - * Checks if the composite AND of specifications passes. - * - * @param Item $item - * - * @return bool - */ - public function isSatisfiedBy(Item $item) - { - return $this->left->isSatisfiedBy($item) && $this->right->isSatisfiedBy($item); - } -} diff --git a/Behavioral/Specification/PriceSpecification.php b/Behavioral/Specification/PriceSpecification.php index 2019ad2..3b54586 100644 --- a/Behavioral/Specification/PriceSpecification.php +++ b/Behavioral/Specification/PriceSpecification.php @@ -2,47 +2,35 @@ namespace DesignPatterns\Behavioral\Specification; -/** - * A specification to check an Item is priced between min and max. - */ -class PriceSpecification extends AbstractSpecification +class PriceSpecification implements SpecificationInterface { - protected $maxPrice; - protected $minPrice; + /** + * @var float|null + */ + private $maxPrice; /** - * Sets the optional maximum price. - * - * @param int $maxPrice + * @var float|null */ - public function setMaxPrice($maxPrice) + private $minPrice; + + /** + * @param float $minPrice + * @param float $maxPrice + */ + public function __construct($minPrice, $maxPrice) { + $this->minPrice = $minPrice; $this->maxPrice = $maxPrice; } - /** - * Sets the optional minimum price. - * - * @param int $minPrice - */ - public function setMinPrice($minPrice) + public function isSatisfiedBy(Item $item): bool { - $this->minPrice = $minPrice; - } - - /** - * Checks if Item price falls between bounds. - * - * @param Item $item - * - * @return bool - */ - public function isSatisfiedBy(Item $item) - { - if (!empty($this->maxPrice) && $item->getPrice() > $this->maxPrice) { + if ($this->maxPrice !== null && $item->getPrice() > $this->maxPrice) { return false; } - if (!empty($this->minPrice) && $item->getPrice() < $this->minPrice) { + + if ($this->minPrice !== null && $item->getPrice() < $this->minPrice) { return false; } diff --git a/Behavioral/Specification/README.rst b/Behavioral/Specification/README.rst index b6957e0..69cebbc 100644 --- a/Behavioral/Specification/README.rst +++ b/Behavioral/Specification/README.rst @@ -24,7 +24,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Item.php @@ -38,15 +38,9 @@ SpecificationInterface.php :language: php :linenos: -AbstractSpecification.php +OrSpecification.php -.. literalinclude:: AbstractSpecification.php - :language: php - :linenos: - -Either.php - -.. literalinclude:: Either.php +.. literalinclude:: OrSpecification.php :language: php :linenos: @@ -56,15 +50,15 @@ PriceSpecification.php :language: php :linenos: -Plus.php +AndSpecification.php -.. literalinclude:: Plus.php +.. literalinclude:: AndSpecification.php :language: php :linenos: -Not.php +NotSpecification.php -.. literalinclude:: Not.php +.. literalinclude:: NotSpecification.php :language: php :linenos: diff --git a/Behavioral/Specification/SpecificationInterface.php b/Behavioral/Specification/SpecificationInterface.php index 796af9f..7387700 100644 --- a/Behavioral/Specification/SpecificationInterface.php +++ b/Behavioral/Specification/SpecificationInterface.php @@ -2,36 +2,7 @@ namespace DesignPatterns\Behavioral\Specification; -/** - * An interface for a specification. - */ interface SpecificationInterface { - /** - * A boolean evaluation indicating if the object meets the specification. - * - * @param Item $item - * - * @return bool - */ - public function isSatisfiedBy(Item $item); - - /** - * Creates a logical AND specification. - * - * @param SpecificationInterface $spec - */ - public function plus(SpecificationInterface $spec); - - /** - * Creates a logical OR specification. - * - * @param SpecificationInterface $spec - */ - public function either(SpecificationInterface $spec); - - /** - * Creates a logical not specification. - */ - public function not(); + public function isSatisfiedBy(Item $item): bool; } diff --git a/Behavioral/Specification/Tests/SpecificationTest.php b/Behavioral/Specification/Tests/SpecificationTest.php index 5abc82a..34e4db4 100644 --- a/Behavioral/Specification/Tests/SpecificationTest.php +++ b/Behavioral/Specification/Tests/SpecificationTest.php @@ -3,101 +3,45 @@ namespace DesignPatterns\Behavioral\Specification\Tests; use DesignPatterns\Behavioral\Specification\Item; +use DesignPatterns\Behavioral\Specification\NotSpecification; +use DesignPatterns\Behavioral\Specification\OrSpecification; +use DesignPatterns\Behavioral\Specification\AndSpecification; use DesignPatterns\Behavioral\Specification\PriceSpecification; +use PHPUnit\Framework\TestCase; -/** - * SpecificationTest tests the specification pattern. - */ -class SpecificationTest extends \PHPUnit_Framework_TestCase +class SpecificationTest extends TestCase { - public function testSimpleSpecification() + public function testCanOr() { - $item = new Item(100); - $spec = new PriceSpecification(); + $spec1 = new PriceSpecification(50, 99); + $spec2 = new PriceSpecification(101, 200); - $this->assertTrue($spec->isSatisfiedBy($item)); + $orSpec = new OrSpecification($spec1, $spec2); - $spec->setMaxPrice(50); - $this->assertFalse($spec->isSatisfiedBy($item)); - - $spec->setMaxPrice(150); - $this->assertTrue($spec->isSatisfiedBy($item)); - - $spec->setMinPrice(101); - $this->assertFalse($spec->isSatisfiedBy($item)); - - $spec->setMinPrice(100); - $this->assertTrue($spec->isSatisfiedBy($item)); + $this->assertFalse($orSpec->isSatisfiedBy(new Item(100))); + $this->assertTrue($orSpec->isSatisfiedBy(new Item(51))); + $this->assertTrue($orSpec->isSatisfiedBy(new Item(150))); } - public function testNotSpecification() + public function testCanAnd() { - $item = new Item(100); - $spec = new PriceSpecification(); - $not = $spec->not(); + $spec1 = new PriceSpecification(50, 100); + $spec2 = new PriceSpecification(80, 200); - $this->assertFalse($not->isSatisfiedBy($item)); + $andSpec = new AndSpecification($spec1, $spec2); - $spec->setMaxPrice(50); - $this->assertTrue($not->isSatisfiedBy($item)); - - $spec->setMaxPrice(150); - $this->assertFalse($not->isSatisfiedBy($item)); - - $spec->setMinPrice(101); - $this->assertTrue($not->isSatisfiedBy($item)); - - $spec->setMinPrice(100); - $this->assertFalse($not->isSatisfiedBy($item)); + $this->assertFalse($andSpec->isSatisfiedBy(new Item(150))); + $this->assertFalse($andSpec->isSatisfiedBy(new Item(1))); + $this->assertFalse($andSpec->isSatisfiedBy(new Item(51))); + $this->assertTrue($andSpec->isSatisfiedBy(new Item(100))); } - public function testPlusSpecification() + public function testCanNot() { - $spec1 = new PriceSpecification(); - $spec2 = new PriceSpecification(); - $plus = $spec1->plus($spec2); + $spec1 = new PriceSpecification(50, 100); + $notSpec = new NotSpecification($spec1); - $item = new Item(100); - - $this->assertTrue($plus->isSatisfiedBy($item)); - - $spec1->setMaxPrice(150); - $spec2->setMinPrice(50); - $this->assertTrue($plus->isSatisfiedBy($item)); - - $spec1->setMaxPrice(150); - $spec2->setMinPrice(101); - $this->assertFalse($plus->isSatisfiedBy($item)); - - $spec1->setMaxPrice(99); - $spec2->setMinPrice(50); - $this->assertFalse($plus->isSatisfiedBy($item)); - } - - public function testEitherSpecification() - { - $spec1 = new PriceSpecification(); - $spec2 = new PriceSpecification(); - $either = $spec1->either($spec2); - - $item = new Item(100); - - $this->assertTrue($either->isSatisfiedBy($item)); - - $spec1->setMaxPrice(150); - $spec2->setMaxPrice(150); - $this->assertTrue($either->isSatisfiedBy($item)); - - $spec1->setMaxPrice(150); - $spec2->setMaxPrice(0); - $this->assertTrue($either->isSatisfiedBy($item)); - - $spec1->setMaxPrice(0); - $spec2->setMaxPrice(150); - $this->assertTrue($either->isSatisfiedBy($item)); - - $spec1->setMaxPrice(99); - $spec2->setMaxPrice(99); - $this->assertFalse($either->isSatisfiedBy($item)); + $this->assertTrue($notSpec->isSatisfiedBy(new Item(150))); + $this->assertFalse($notSpec->isSatisfiedBy(new Item(50))); } } diff --git a/Behavioral/State/ContextOrder.php b/Behavioral/State/ContextOrder.php new file mode 100644 index 0000000..b05537d --- /dev/null +++ b/Behavioral/State/ContextOrder.php @@ -0,0 +1,26 @@ +done(); + } + + public function getStatus(): string + { + return static::$state->getStatus(); + } +} diff --git a/Behavioral/State/CreateOrder.php b/Behavioral/State/CreateOrder.php index 7ac48d4..9c95b61 100644 --- a/Behavioral/State/CreateOrder.php +++ b/Behavioral/State/CreateOrder.php @@ -2,49 +2,15 @@ namespace DesignPatterns\Behavioral\State; -/** - * Class CreateOrder. - */ -class CreateOrder implements OrderInterface +class CreateOrder extends StateOrder { - /** - * @var array - */ - private $order; - - /** - * @param array $order - * - * @throws \Exception - */ - public function __construct(array $order) + public function __construct() { - if (empty($order)) { - throw new \Exception('Order can not be empty!'); - } - $this->order = $order; + $this->setStatus('created'); } - /** - * @return mixed - */ - public function shipOrder() + protected function done() { - $this->order['status'] = 'shipping'; - $this->order['updatedTime'] = time(); - - // Setting the new order status into database; - return $this->updateOrder($this->order); - } - - /** - * @throws \Exception - * - * @return mixed|void - */ - public function completeOrder() - { - //Can not complete the order which status is created, throw exception; - throw new \Exception('Can not complete the order which status is created!'); + static::$state = new ShippingOrder(); } } diff --git a/Behavioral/State/OrderController.php b/Behavioral/State/OrderController.php deleted file mode 100644 index 93ac542..0000000 --- a/Behavioral/State/OrderController.php +++ /dev/null @@ -1,37 +0,0 @@ -shipOrder(); - } catch (Exception $e) { - //handle error! - } - // response to browser - } - - /** - * @param int $id - */ - public function completeAction($id) - { - $order = OrderFactory::getOrder($id); - try { - $order->completeOrder(); - } catch (Exception $e) { - //handle error! - } - // response to browser - } -} diff --git a/Behavioral/State/OrderFactory.php b/Behavioral/State/OrderFactory.php deleted file mode 100644 index 205d505..0000000 --- a/Behavioral/State/OrderFactory.php +++ /dev/null @@ -1,36 +0,0 @@ -order = $order; + $this->setStatus('shipping'); } - /** - * @throws \Exception - * - * @return mixed|void - */ - public function shipOrder() + protected function done() { - //Can not ship the order which status is shipping, throw exception; - throw new \Exception('Can not ship the order which status is shipping!'); - } - - /** - * @return mixed - */ - public function completeOrder() - { - $this->order['status'] = 'completed'; - $this->order['updatedTime'] = time(); - - // Setting the new order status into database; - return $this->updateOrder($this->order); + $this->setStatus('completed'); } } diff --git a/Behavioral/State/StateOrder.php b/Behavioral/State/StateOrder.php new file mode 100644 index 0000000..b003cb7 --- /dev/null +++ b/Behavioral/State/StateOrder.php @@ -0,0 +1,32 @@ +details['status'] = $status; + $this->details['updatedTime'] = time(); + } + + protected function getStatus(): string + { + return $this->details['status']; + } +} diff --git a/Behavioral/State/Tests/StateTest.php b/Behavioral/State/Tests/StateTest.php new file mode 100644 index 0000000..834c02c --- /dev/null +++ b/Behavioral/State/Tests/StateTest.php @@ -0,0 +1,31 @@ +setState($order); + $contextOrder->done(); + + $this->assertEquals('shipping', $contextOrder->getStatus()); + } + + public function testCanCompleteShippedOrder() + { + $order = new CreateOrder(); + $contextOrder = new ContextOrder(); + $contextOrder->setState($order); + $contextOrder->done(); + $contextOrder->done(); + + $this->assertEquals('completed', $contextOrder->getStatus()); + } +} diff --git a/Behavioral/State/uml/uml.png b/Behavioral/State/uml/uml.png index 847a4e4..e95b39a 100644 Binary files a/Behavioral/State/uml/uml.png and b/Behavioral/State/uml/uml.png differ diff --git a/Behavioral/State/uml/uml.svg b/Behavioral/State/uml/uml.svg index 2b97e07..7cffe9c 100644 --- a/Behavioral/State/uml/uml.svg +++ b/Behavioral/State/uml/uml.svg @@ -1,460 +1,665 @@ - + - + - + - + - + - + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - + - - + + - + - - + + - - + + - - + + - - + + - - - - - - order + + + + + + __construct() - - + + - - + + - - - - - __construct(order) + + + + + + done() - - + + - - + + + - - - - - shipOrder() + + - - + + ShippingOrder - - - - - completeOrder() + + ShippingOrder - - + + - - - + + - - + + - - CreateOrder + + + + + + __construct() - - CreateOrder + + - - + + - - + + + + + + done() - - + + - - + + + - - - - - __construct() + + - - + + ShippingOrder - - + + ShippingOrder - - - - - getOrder(id) + + - - + + - - - + + - - + + - - OrderFactory + + + + + + __construct() - - OrderFactory + + - - + + - - + + + + + + done() - - + + - - + + + - - - - - shipAction(id) + + - - + + CreateOrder - - - - - completeAction(id) + + CreateOrder - - + + - - - + + - - + + - - OrderController + + + + + + __construct() - - OrderController + + - - + + - - + + + + + + done() - - + + - - + + + - - - - - shipOrder() + + - - + + CreateOrder - - - - - completeOrder() + + CreateOrder - - + + - - - + + - - + + - - OrderInterface + + - - OrderInterface + + + + + + details - - + + - - + + + + + + + state + + + + + + + + + + + + + done() + + + - - + + + + + + setStatus(status) + + + + + + + + + + getStatus() + + + + + + + - - + + + + + StateOrder + + + StateOrder + + + + + + + + + + + + + + + + details + + + + + + + + + + + state + + + + + + + + + + + + + done() + + + + + + + + + + setStatus(status) - - - - - - order + + + + + + + + + getStatus() + + + + + + + + + + + + + StateOrder + + + StateOrder + + + + + + + + + + + + + + + + + + + getState() + + + + + + + + + + setState(state) + + + + + + + + + + done() + + + + + + + + + + getStatus() + + + + + + + + + + + + + ContextOrder + + + ContextOrder + + + + + + + + + - - + + + + + + getState() + + + - - + + + + + + setState(state) - - - - - __construct(order) + + - - - - - - - - - - - shipOrder() - - - - - - - - - completeOrder() - - - - - - - - - - - - - ShippingOrder - - - ShippingOrder - - - - - - - - + + + + + + done() + + + + + + + + + + getStatus() + + + + + + + + + + + + + ContextOrder + + + ContextOrder + + + + + + + + + + diff --git a/Behavioral/Strategy/ComparatorInterface.php b/Behavioral/Strategy/ComparatorInterface.php index f472fd9..4c5dcb2 100644 --- a/Behavioral/Strategy/ComparatorInterface.php +++ b/Behavioral/Strategy/ComparatorInterface.php @@ -2,16 +2,13 @@ namespace DesignPatterns\Behavioral\Strategy; -/** - * Class ComparatorInterface. - */ interface ComparatorInterface { /** * @param mixed $a * @param mixed $b * - * @return bool + * @return int */ - public function compare($a, $b); + public function compare($a, $b): int; } diff --git a/Behavioral/Strategy/DateComparator.php b/Behavioral/Strategy/DateComparator.php index fb3c408..3f59667 100644 --- a/Behavioral/Strategy/DateComparator.php +++ b/Behavioral/Strategy/DateComparator.php @@ -2,23 +2,19 @@ namespace DesignPatterns\Behavioral\Strategy; -/** - * Class DateComparator. - */ class DateComparator implements ComparatorInterface { /** - * {@inheritdoc} + * @param mixed $a + * @param mixed $b + * + * @return int */ - public function compare($a, $b) + public function compare($a, $b): int { $aDate = new \DateTime($a['date']); $bDate = new \DateTime($b['date']); - if ($aDate == $bDate) { - return 0; - } else { - return $aDate < $bDate ? -1 : 1; - } + return $aDate <=> $bDate; } } diff --git a/Behavioral/Strategy/IdComparator.php b/Behavioral/Strategy/IdComparator.php index f829195..80c43cc 100644 --- a/Behavioral/Strategy/IdComparator.php +++ b/Behavioral/Strategy/IdComparator.php @@ -2,20 +2,16 @@ namespace DesignPatterns\Behavioral\Strategy; -/** - * Class IdComparator. - */ class IdComparator implements ComparatorInterface { /** - * {@inheritdoc} + * @param mixed $a + * @param mixed $b + * + * @return int */ - public function compare($a, $b) + public function compare($a, $b): int { - if ($a['id'] == $b['id']) { - return 0; - } else { - return $a['id'] < $b['id'] ? -1 : 1; - } + return $a['id'] <=> $b['id']; } } diff --git a/Behavioral/Strategy/ObjectCollection.php b/Behavioral/Strategy/ObjectCollection.php index b5c1bd2..ca8165b 100644 --- a/Behavioral/Strategy/ObjectCollection.php +++ b/Behavioral/Strategy/ObjectCollection.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Behavioral\Strategy; -/** - * Class ObjectCollection. - */ class ObjectCollection { /** @@ -20,30 +17,24 @@ class ObjectCollection /** * @param array $elements */ - public function __construct(array $elements = array()) + public function __construct(array $elements = []) { $this->elements = $elements; } - /** - * @return array - */ - public function sort() + public function sort(): array { if (!$this->comparator) { throw new \LogicException('Comparator is not set'); } - $callback = array($this->comparator, 'compare'); - uasort($this->elements, $callback); + uasort($this->elements, [$this->comparator, 'compare']); return $this->elements; } /** * @param ComparatorInterface $comparator - * - * @return void */ public function setComparator(ComparatorInterface $comparator) { diff --git a/Behavioral/Strategy/README.rst b/Behavioral/Strategy/README.rst index c3ced8f..4613d2c 100644 --- a/Behavioral/Strategy/README.rst +++ b/Behavioral/Strategy/README.rst @@ -32,7 +32,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ ObjectCollection.php diff --git a/Behavioral/Strategy/Tests/StrategyTest.php b/Behavioral/Strategy/Tests/StrategyTest.php index 1911ba4..cf1f7f3 100644 --- a/Behavioral/Strategy/Tests/StrategyTest.php +++ b/Behavioral/Strategy/Tests/StrategyTest.php @@ -5,43 +5,43 @@ namespace DesignPatterns\Behavioral\Strategy\Tests; use DesignPatterns\Behavioral\Strategy\DateComparator; use DesignPatterns\Behavioral\Strategy\IdComparator; use DesignPatterns\Behavioral\Strategy\ObjectCollection; -use DesignPatterns\Behavioral\Strategy\Strategy; +use PHPUnit\Framework\TestCase; -/** - * Tests for Strategy pattern. - */ -class StrategyTest extends \PHPUnit_Framework_TestCase +class StrategyTest extends TestCase { - public function getIdCollection() + public function provideIntegers() { - return array( - array( - array(array('id' => 2), array('id' => 1), array('id' => 3)), - array('id' => 1), - ), - array( - array(array('id' => 3), array('id' => 2), array('id' => 1)), - array('id' => 1), - ), - ); + return [ + [ + [['id' => 2], ['id' => 1], ['id' => 3]], + ['id' => 1], + ], + [ + [['id' => 3], ['id' => 2], ['id' => 1]], + ['id' => 1], + ], + ]; } - public function getDateCollection() + public function provideDates() { - 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( - array(array('date' => '2014-02-03'), array('date' => '2013-02-01'), array('date' => '2015-02-02')), - array('date' => '2013-02-01'), - ), - ); + return [ + [ + [['date' => '2014-03-03'], ['date' => '2015-03-02'], ['date' => '2013-03-01']], + ['date' => '2013-03-01'], + ], + [ + [['date' => '2014-02-03'], ['date' => '2013-02-01'], ['date' => '2015-02-02']], + ['date' => '2013-02-01'], + ], + ]; } /** - * @dataProvider getIdCollection + * @dataProvider provideIntegers + * + * @param array $collection + * @param array $expected */ public function testIdComparator($collection, $expected) { @@ -54,7 +54,10 @@ class StrategyTest extends \PHPUnit_Framework_TestCase } /** - * @dataProvider getDateCollection + * @dataProvider provideDates + * + * @param array $collection + * @param array $expected */ public function testDateComparator($collection, $expected) { diff --git a/Behavioral/TemplateMethod/BeachJourney.php b/Behavioral/TemplateMethod/BeachJourney.php index d19845c..5007054 100644 --- a/Behavioral/TemplateMethod/BeachJourney.php +++ b/Behavioral/TemplateMethod/BeachJourney.php @@ -2,16 +2,10 @@ namespace DesignPatterns\Behavioral\TemplateMethod; -/** - * BeachJourney is vacation at the beach. - */ class BeachJourney extends Journey { - /** - * prints what to do to enjoy your vacation. - */ - protected function enjoyVacation() + protected function enjoyVacation(): string { - echo "Swimming and sun-bathing\n"; + return "Swimming and sun-bathing"; } } diff --git a/Behavioral/TemplateMethod/CityJourney.php b/Behavioral/TemplateMethod/CityJourney.php index 3f36b61..f1f9335 100644 --- a/Behavioral/TemplateMethod/CityJourney.php +++ b/Behavioral/TemplateMethod/CityJourney.php @@ -2,16 +2,15 @@ namespace DesignPatterns\Behavioral\TemplateMethod; -/** - * CityJourney is a journey in a city. - */ class CityJourney extends Journey { - /** - * prints what to do in your journey to enjoy vacation. - */ - protected function enjoyVacation() + protected function enjoyVacation(): string { - echo "Eat, drink, take photos and sleep\n"; + return "Eat, drink, take photos and sleep"; + } + + protected function buyGift(): string + { + return "Buy a gift"; } } diff --git a/Behavioral/TemplateMethod/Journey.php b/Behavioral/TemplateMethod/Journey.php index 6309e7f..0a1407c 100644 --- a/Behavioral/TemplateMethod/Journey.php +++ b/Behavioral/TemplateMethod/Journey.php @@ -2,11 +2,13 @@ namespace DesignPatterns\Behavioral\TemplateMethod; -/** - * - */ abstract class Journey { + /** + * @var string[] + */ + private $thingsToDo = []; + /** * This is the public service provided by this class and its subclasses. * Notice it is final to "freeze" the global behavior of algorithm. @@ -15,46 +17,49 @@ abstract class Journey */ final public function takeATrip() { - $this->buyAFlight(); - $this->takePlane(); - $this->enjoyVacation(); - $this->buyGift(); - $this->takePlane(); + $this->thingsToDo[] = $this->buyAFlight(); + $this->thingsToDo[] = $this->takePlane(); + $this->thingsToDo[] = $this->enjoyVacation(); + $buyGift = $this->buyGift(); + + if ($buyGift !== null) { + $this->thingsToDo[] = $buyGift; + } + + $this->thingsToDo[] = $this->takePlane(); } /** * This method must be implemented, this is the key-feature of this pattern. */ - abstract protected function enjoyVacation(); + abstract protected function enjoyVacation(): string; /** * This method is also part of the algorithm but it is optional. - * This is an "adapter" (do not confuse with the Adapter pattern, not related) - * You can override it only if you need to. + * You can override it only if you need to + * + * @return null|string */ protected function buyGift() { + return null; + } + + private function buyAFlight(): string + { + return 'Buy a flight ticket'; + } + + private function takePlane(): string + { + return 'Taking the plane'; } /** - * This method will be unknown by subclasses (better). + * @return string[] */ - private function buyAFlight() + public function getThingsToDo(): array { - echo "Buying a flight\n"; + return $this->thingsToDo; } - - /** - * Subclasses will get access to this method but cannot override it and - * compromise this algorithm (warning : cause of cyclic dependencies). - */ - final protected function takePlane() - { - echo "Taking the plane\n"; - } - - // A note regarding the keyword "final" : don't use it when you start coding : - // add it after you narrow and know exactly what change and what remain unchanged - // in this algorithm. - // [abstract] x [3 access] x [final] = 12 combinations, it can be hard ! } diff --git a/Behavioral/TemplateMethod/README.rst b/Behavioral/TemplateMethod/README.rst index 559cd36..a3f1e7b 100644 --- a/Behavioral/TemplateMethod/README.rst +++ b/Behavioral/TemplateMethod/README.rst @@ -31,7 +31,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Journey.php diff --git a/Behavioral/TemplateMethod/Tests/JourneyTest.php b/Behavioral/TemplateMethod/Tests/JourneyTest.php index 82acef3..25bdd51 100644 --- a/Behavioral/TemplateMethod/Tests/JourneyTest.php +++ b/Behavioral/TemplateMethod/Tests/JourneyTest.php @@ -3,41 +3,35 @@ namespace DesignPatterns\Behavioral\TemplateMethod\Tests; use DesignPatterns\Behavioral\TemplateMethod; +use PHPUnit\Framework\TestCase; -/** - * JourneyTest tests all journeys. - */ -class JourneyTest extends \PHPUnit_Framework_TestCase +class JourneyTest extends TestCase { - public function testBeach() + public function testCanGetOnVacationOnTheBeach() { - $journey = new TemplateMethod\BeachJourney(); - $this->expectOutputRegex('#sun-bathing#'); - $journey->takeATrip(); + $beachJourney = new TemplateMethod\BeachJourney(); + $beachJourney->takeATrip(); + + $this->assertEquals( + ['Buy a flight ticket', 'Taking the plane', 'Swimming and sun-bathing', 'Taking the plane'], + $beachJourney->getThingsToDo() + ); } - public function testCity() + public function testCanGetOnAJourneyToACity() { - $journey = new TemplateMethod\CityJourney(); - $this->expectOutputRegex('#drink#'); - $journey->takeATrip(); - } + $beachJourney = new TemplateMethod\CityJourney(); + $beachJourney->takeATrip(); - /** - * How to test an abstract template method with PHPUnit. - */ - public function testLasVegas() - { - $journey = $this->getMockForAbstractClass('DesignPatterns\Behavioral\TemplateMethod\Journey'); - $journey->expects($this->once()) - ->method('enjoyVacation') - ->will($this->returnCallback(array($this, 'mockUpVacation'))); - $this->expectOutputRegex('#Las Vegas#'); - $journey->takeATrip(); - } - - public function mockUpVacation() - { - echo "Fear and loathing in Las Vegas\n"; + $this->assertEquals( + [ + 'Buy a flight ticket', + 'Taking the plane', + 'Eat, drink, take photos and sleep', + 'Buy a gift', + 'Taking the plane' + ], + $beachJourney->getThingsToDo() + ); } } diff --git a/Behavioral/TemplateMethod/uml/TemplateMethod.uml b/Behavioral/TemplateMethod/uml/TemplateMethod.uml index 063b022..29d6c04 100644 --- a/Behavioral/TemplateMethod/uml/TemplateMethod.uml +++ b/Behavioral/TemplateMethod/uml/TemplateMethod.uml @@ -1,35 +1,35 @@ - - - PHP - \DesignPatterns\Behavioral\TemplateMethod\BeachJourney - - \DesignPatterns\Behavioral\TemplateMethod\CityJourney - \DesignPatterns\Behavioral\TemplateMethod\Journey - \DesignPatterns\Behavioral\TemplateMethod\BeachJourney - - - - - - - - - - - - - - - - - - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Behavioral\TemplateMethod\BeachJourney + + \DesignPatterns\Behavioral\TemplateMethod\BeachJourney + \DesignPatterns\Behavioral\TemplateMethod\Journey + \DesignPatterns\Behavioral\TemplateMethod\CityJourney + + + + + + + + + + + + + + + + + + + + Fields + Constants + Constructors + Methods + + private + + diff --git a/Behavioral/TemplateMethod/uml/uml.png b/Behavioral/TemplateMethod/uml/uml.png index c557e8f..d8e9f69 100644 Binary files a/Behavioral/TemplateMethod/uml/uml.png and b/Behavioral/TemplateMethod/uml/uml.png differ diff --git a/Behavioral/TemplateMethod/uml/uml.svg b/Behavioral/TemplateMethod/uml/uml.svg index d06adcb..6f7f555 100644 --- a/Behavioral/TemplateMethod/uml/uml.svg +++ b/Behavioral/TemplateMethod/uml/uml.svg @@ -1,256 +1,636 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enjoyVacation() - - - - - - - - - - - - - CityJourney - - - CityJourney - - - - - - - - - - - - - - - - - - takeATrip() - - - - - - - - - enjoyVacation() - - - - - - - - - buyGift() - - - - - - - - - buyAFlight() - - - - - - - - - takePlane() - - - - - - - - - - - - - Journey - - - Journey - - - - - - - - - - - - - - - - - - enjoyVacation() - - - - - - - - - - - - - BeachJourney - - - BeachJourney - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enjoyVacation() + + + + + + + + + + + + + BeachJourney + + + BeachJourney + + + + + + + + + + + + + + + + + + + + + + enjoyVacation() + + + + + + + + + + + + + BeachJourney + + + BeachJourney + + + + + + + + + + + + + + + + + + + + + + + + + thingsToDo + + + + + + + + + + + + + + + + takeATrip() + + + + + + + + + + + + + enjoyVacation() + + + + + + + + + + + + + buyGift() + + + + + + + + + + + + + buyAFlight() + + + + + + + + + + + + + takePlane() + + + + + + + + + + + + + getThingsToDo() + + + + + + + + + + + + + Journey + + + Journey + + + + + + + + + + + + + + + + + + + + + + thingsToDo + + + + + + + + + + + + + + + + + + + + + + takeATrip() + + + + + + + + + + + + + + + + enjoyVacation() + + + + + + + + + + + + + + + + buyGift() + + + + + + + + + + + + + + + + buyAFlight() + + + + + + + + + + + + + + + + takePlane() + + + + + + + + + + + + + + + + getThingsToDo() + + + + + + + + + + + + + Journey + + + Journey + + + + + + + + + + + + + + + + + + + + + + enjoyVacation() + + + + + + + + + + + + + buyGift() + + + + + + + + + + + + + CityJourney + + + CityJourney + + + + + + + + + + + + + + + + + + + + + + enjoyVacation() + + + + + + + + + + + + + + + + buyGift() + + + + + + + + + + + + + CityJourney + + + CityJourney + + + + + + + + + + + diff --git a/Behavioral/Visitor/Group.php b/Behavioral/Visitor/Group.php index b2c9d90..e4a9a65 100644 --- a/Behavioral/Visitor/Group.php +++ b/Behavioral/Visitor/Group.php @@ -2,29 +2,25 @@ namespace DesignPatterns\Behavioral\Visitor; -/** - * An example of a Visitor: Group. - */ -class Group extends Role +class Group implements Role { /** * @var string */ - protected $name; + private $name; - /** - * @param string $name - */ - public function __construct($name) + public function __construct(string $name) { - $this->name = (string) $name; + $this->name = $name; } - /** - * @return string - */ - public function getName() + public function getName(): string { - return 'Group: '.$this->name; + return sprintf('Group: %s', $this->name); + } + + public function accept(RoleVisitorInterface $visitor) + { + $visitor->visitGroup($this); } } diff --git a/Behavioral/Visitor/README.rst b/Behavioral/Visitor/README.rst index ba256b9..e2be9e3 100644 --- a/Behavioral/Visitor/README.rst +++ b/Behavioral/Visitor/README.rst @@ -23,7 +23,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ RoleVisitorInterface.php @@ -31,9 +31,9 @@ RoleVisitorInterface.php :language: php :linenos: -RolePrintVisitor.php +RoleVisitor.php -.. literalinclude:: RolePrintVisitor.php +.. literalinclude:: RoleVisitor.php :language: php :linenos: diff --git a/Behavioral/Visitor/Role.php b/Behavioral/Visitor/Role.php index 011a0fb..1a55c74 100644 --- a/Behavioral/Visitor/Role.php +++ b/Behavioral/Visitor/Role.php @@ -2,32 +2,7 @@ namespace DesignPatterns\Behavioral\Visitor; -/** - * class Role. - */ -abstract class Role +interface Role { - /** - * 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 - * - * @param \DesignPatterns\Behavioral\Visitor\RoleVisitorInterface $visitor - * - * @throws \InvalidArgumentException - */ - public function accept(RoleVisitorInterface $visitor) - { - // this trick to simulate double-dispatch based on type-hinting - $klass = get_called_class(); - preg_match('#([^\\\\]+)$#', $klass, $extract); - $visitingMethod = 'visit'.$extract[1]; - - // this ensures strong typing with visitor interface, not some visitor objects - if (!method_exists(__NAMESPACE__.'\RoleVisitorInterface', $visitingMethod)) { - throw new \InvalidArgumentException("The visitor you provide cannot visit a $klass instance"); - } - - call_user_func(array($visitor, $visitingMethod), $this); - } + public function accept(RoleVisitorInterface $visitor); } diff --git a/Behavioral/Visitor/RolePrintVisitor.php b/Behavioral/Visitor/RolePrintVisitor.php deleted file mode 100644 index 49777cf..0000000 --- a/Behavioral/Visitor/RolePrintVisitor.php +++ /dev/null @@ -1,27 +0,0 @@ -getName(); - } - - /** - * {@inheritdoc} - */ - public function visitUser(User $role) - { - echo 'Role: '.$role->getName(); - } -} diff --git a/Behavioral/Visitor/RoleVisitor.php b/Behavioral/Visitor/RoleVisitor.php new file mode 100644 index 0000000..fc368b2 --- /dev/null +++ b/Behavioral/Visitor/RoleVisitor.php @@ -0,0 +1,29 @@ +visited[] = $role; + } + + public function visitUser(User $role) + { + $this->visited[] = $role; + } + + /** + * @return Role[] + */ + public function getVisited(): array + { + return $this->visited; + } +} diff --git a/Behavioral/Visitor/RoleVisitorInterface.php b/Behavioral/Visitor/RoleVisitorInterface.php index e8ba0ec..b2aff5e 100644 --- a/Behavioral/Visitor/RoleVisitorInterface.php +++ b/Behavioral/Visitor/RoleVisitorInterface.php @@ -3,29 +3,12 @@ namespace DesignPatterns\Behavioral\Visitor; /** - * Visitor Pattern. - * - * The contract for the visitor. - * - * 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. + * Note: the visitor must not choose itself which method to + * invoke, it is the Visitee that make this decision */ interface RoleVisitorInterface { - /** - * Visit a User object. - * - * @param \DesignPatterns\Behavioral\Visitor\User $role - */ public function visitUser(User $role); - /** - * 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 f3b5bc7..e09cd2c 100644 --- a/Behavioral/Visitor/Tests/VisitorTest.php +++ b/Behavioral/Visitor/Tests/VisitorTest.php @@ -3,43 +3,36 @@ namespace DesignPatterns\Tests\Visitor\Tests; use DesignPatterns\Behavioral\Visitor; +use PHPUnit\Framework\TestCase; -/** - * VisitorTest tests the visitor pattern. - */ -class VisitorTest extends \PHPUnit_Framework_TestCase +class VisitorTest extends TestCase { - protected $visitor; + /** + * @var Visitor\RoleVisitor + */ + private $visitor; protected function setUp() { - $this->visitor = new Visitor\RolePrintVisitor(); + $this->visitor = new Visitor\RoleVisitor(); } - public function getRole() + public function provideRoles() { - return array( - array(new Visitor\User('Dominik'), 'Role: User Dominik'), - array(new Visitor\Group('Administrators'), 'Role: Group: Administrators'), - ); + return [ + [new Visitor\User('Dominik')], + [new Visitor\Group('Administrators')], + ]; } /** - * @dataProvider getRole + * @dataProvider provideRoles + * + * @param Visitor\Role $role */ - public function testVisitSomeRole(Visitor\Role $role, $expect) + public function testVisitSomeRole(Visitor\Role $role) { - $this->expectOutputString($expect); $role->accept($this->visitor); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Mock - */ - public function testUnknownObject() - { - $mock = $this->getMockForAbstractClass('DesignPatterns\Behavioral\Visitor\Role'); - $mock->accept($this->visitor); + $this->assertSame($role, $this->visitor->getVisited()[0]); } } diff --git a/Behavioral/Visitor/User.php b/Behavioral/Visitor/User.php index 5a95fbe..f3d9ad3 100644 --- a/Behavioral/Visitor/User.php +++ b/Behavioral/Visitor/User.php @@ -2,31 +2,25 @@ namespace DesignPatterns\Behavioral\Visitor; -/** - * Visitor Pattern. - * - * One example for a visitee. Each visitee has to extends Role - */ -class User extends Role +class User implements Role { /** * @var string */ - protected $name; + private $name; - /** - * @param string $name - */ - public function __construct($name) + public function __construct(string $name) { - $this->name = (string) $name; + $this->name = $name; } - /** - * @return string - */ - public function getName() + public function getName(): string { - return 'User '.$this->name; + return sprintf('User %s', $this->name); + } + + public function accept(RoleVisitorInterface $visitor) + { + $visitor->visitUser($this); } } diff --git a/Creational/AbstractFactory/AbstractFactory.php b/Creational/AbstractFactory/AbstractFactory.php index 6529ff6..85bd878 100644 --- a/Creational/AbstractFactory/AbstractFactory.php +++ b/Creational/AbstractFactory/AbstractFactory.php @@ -3,38 +3,10 @@ namespace DesignPatterns\Creational\AbstractFactory; /** - * class AbstractFactory. - * - * Sometimes also known as "Kit" in a GUI libraries. - * - * This design pattern implements the Dependency Inversion Principle since - * 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 - * 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) + * for the web. There are two ways of rendering text: HTML and JSON */ abstract class AbstractFactory { - /** - * Creates a text component. - * - * @param string $content - * - * @return Text - */ - abstract public function createText($content); - - /** - * Creates a picture component. - * - * @param string $path - * @param string $name - * - * @return Picture - */ - abstract public function createPicture($path, $name = ''); + abstract public function createText(string $content): Text; } diff --git a/Creational/AbstractFactory/Html/Picture.php b/Creational/AbstractFactory/Html/Picture.php deleted file mode 100644 index 3abacb4..0000000 --- a/Creational/AbstractFactory/Html/Picture.php +++ /dev/null @@ -1,23 +0,0 @@ -', $this->path, $this->name); - } -} diff --git a/Creational/AbstractFactory/Html/Text.php b/Creational/AbstractFactory/Html/Text.php deleted file mode 100644 index 8c33da6..0000000 --- a/Creational/AbstractFactory/Html/Text.php +++ /dev/null @@ -1,23 +0,0 @@ -'.htmlspecialchars($this->text).''; - } -} diff --git a/Creational/AbstractFactory/HtmlFactory.php b/Creational/AbstractFactory/HtmlFactory.php index 5c22859..ba44216 100644 --- a/Creational/AbstractFactory/HtmlFactory.php +++ b/Creational/AbstractFactory/HtmlFactory.php @@ -2,35 +2,10 @@ namespace DesignPatterns\Creational\AbstractFactory; -/** - * Class HtmlFactory. - * - * HtmlFactory is a concrete factory for HTML component - */ class HtmlFactory extends AbstractFactory { - /** - * Creates a picture component. - * - * @param string $path - * @param string $name - * - * @return Html\Picture|Picture - */ - public function createPicture($path, $name = '') + public function createText(string $content): Text { - return new Html\Picture($path, $name); - } - - /** - * Creates a text component. - * - * @param string $content - * - * @return Html\Text|Text - */ - public function createText($content) - { - return new Html\Text($content); + return new HtmlText($content); } } diff --git a/Creational/AbstractFactory/HtmlText.php b/Creational/AbstractFactory/HtmlText.php new file mode 100644 index 0000000..a3764da --- /dev/null +++ b/Creational/AbstractFactory/HtmlText.php @@ -0,0 +1,8 @@ + $this->name, 'path' => $this->path)); - } -} diff --git a/Creational/AbstractFactory/Json/Text.php b/Creational/AbstractFactory/Json/Text.php deleted file mode 100644 index 4c51785..0000000 --- a/Creational/AbstractFactory/Json/Text.php +++ /dev/null @@ -1,23 +0,0 @@ - $this->text)); - } -} diff --git a/Creational/AbstractFactory/JsonFactory.php b/Creational/AbstractFactory/JsonFactory.php index 63a9979..a767f7e 100644 --- a/Creational/AbstractFactory/JsonFactory.php +++ b/Creational/AbstractFactory/JsonFactory.php @@ -2,36 +2,10 @@ namespace DesignPatterns\Creational\AbstractFactory; -/** - * Class JsonFactory. - * - * JsonFactory is a factory for creating a family of JSON component - * (example for ajax) - */ class JsonFactory extends AbstractFactory { - /** - * Creates a picture component. - * - * @param string $path - * @param string $name - * - * @return Json\Picture|Picture - */ - public function createPicture($path, $name = '') + public function createText(string $content): Text { - return new Json\Picture($path, $name); - } - - /** - * Creates a text component. - * - * @param string $content - * - * @return Json\Text|Text - */ - public function createText($content) - { - return new Json\Text($content); + return new JsonText($content); } } diff --git a/Creational/AbstractFactory/JsonText.php b/Creational/AbstractFactory/JsonText.php new file mode 100644 index 0000000..a0386a0 --- /dev/null +++ b/Creational/AbstractFactory/JsonText.php @@ -0,0 +1,8 @@ +name = (string) $name; - $this->path = (string) $path; - } -} diff --git a/Creational/AbstractFactory/README.rst b/Creational/AbstractFactory/README.rst index 69980eb..0c340ab 100644 --- a/Creational/AbstractFactory/README.rst +++ b/Creational/AbstractFactory/README.rst @@ -19,7 +19,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ AbstractFactory.php @@ -39,45 +39,21 @@ 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 +JsonText.php -.. literalinclude:: Json/Picture.php +.. literalinclude:: JsonText.php :language: php :linenos: -Json/Text.php +HtmlText.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 +.. literalinclude:: HtmlText.php :language: php :linenos: diff --git a/Creational/AbstractFactory/Tests/AbstractFactoryTest.php b/Creational/AbstractFactory/Tests/AbstractFactoryTest.php index 97f4417..35b83ad 100644 --- a/Creational/AbstractFactory/Tests/AbstractFactoryTest.php +++ b/Creational/AbstractFactory/Tests/AbstractFactoryTest.php @@ -2,43 +2,27 @@ namespace DesignPatterns\Creational\AbstractFactory\Tests; -use DesignPatterns\Creational\AbstractFactory\AbstractFactory; use DesignPatterns\Creational\AbstractFactory\HtmlFactory; +use DesignPatterns\Creational\AbstractFactory\HtmlText; use DesignPatterns\Creational\AbstractFactory\JsonFactory; +use DesignPatterns\Creational\AbstractFactory\JsonText; +use PHPUnit\Framework\TestCase; -/** - * AbstractFactoryTest tests concrete factories. - */ -class AbstractFactoryTest extends \PHPUnit_Framework_TestCase +class AbstractFactoryTest extends TestCase { - public function getFactories() + public function testCanCreateHtmlText() { - return array( - array(new JsonFactory()), - array(new HtmlFactory()), - ); + $factory = new HtmlFactory(); + $text = $factory->createText('foobar'); + + $this->assertInstanceOf(HtmlText::class, $text); } - /** - * 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 - * wants and render how he wants. - * - * @dataProvider getFactories - */ - public function testComponentCreation(AbstractFactory $factory) + public function testCanCreateJsonText() { - $article = array( - $factory->createText('Lorem Ipsum'), - $factory->createPicture('/image.jpg', 'caption'), - $factory->createText('footnotes'), - ); + $factory = new JsonFactory(); + $text = $factory->createText('foobar'); - $this->assertContainsOnly('DesignPatterns\Creational\AbstractFactory\MediaInterface', $article); - - /* this is the time to look at the Builder pattern. This pattern - * helps you to create complex object like that article above with - * a given Abstract Factory - */ + $this->assertInstanceOf(JsonText::class, $text); } } diff --git a/Creational/AbstractFactory/Text.php b/Creational/AbstractFactory/Text.php index 30984f3..60846bb 100644 --- a/Creational/AbstractFactory/Text.php +++ b/Creational/AbstractFactory/Text.php @@ -2,21 +2,15 @@ namespace DesignPatterns\Creational\AbstractFactory; -/** - * Class Text. - */ -abstract class Text implements MediaInterface +abstract class Text { /** * @var string */ - protected $text; + private $text; - /** - * @param string $text - */ - public function __construct($text) + public function __construct(string $text) { - $this->text = (string) $text; + $this->text = $text; } } diff --git a/Creational/AbstractFactory/uml/AbstractFactory.uml b/Creational/AbstractFactory/uml/AbstractFactory.uml index a44e64c..224cc06 100644 --- a/Creational/AbstractFactory/uml/AbstractFactory.uml +++ b/Creational/AbstractFactory/uml/AbstractFactory.uml @@ -1,38 +1,51 @@ - - - PHP - \DesignPatterns\Creational\AbstractFactory\AbstractFactory - - \DesignPatterns\Creational\AbstractFactory\Html\Text - \DesignPatterns\Creational\AbstractFactory\Html\Picture - \DesignPatterns\Creational\AbstractFactory\HtmlFactory - \DesignPatterns\Creational\AbstractFactory\JsonFactory - \DesignPatterns\Creational\AbstractFactory\AbstractFactory - \DesignPatterns\Creational\AbstractFactory\MediaInterface - - - - - - - - - - - - - - - - - - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Creational\AbstractFactory\AbstractFactory + + \DesignPatterns\Creational\AbstractFactory\JsonFactory + \DesignPatterns\Creational\AbstractFactory\AbstractFactory + \DesignPatterns\Creational\AbstractFactory\HtmlFactory + \DesignPatterns\Creational\AbstractFactory\JsonText + \DesignPatterns\Creational\AbstractFactory\HtmlText + \DesignPatterns\Creational\AbstractFactory\Text + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \DesignPatterns\Creational\AbstractFactory\AbstractFactory + + + Methods + Constants + Fields + + private + + diff --git a/Creational/AbstractFactory/uml/uml.png b/Creational/AbstractFactory/uml/uml.png index 6de2767..68d3a8b 100644 Binary files a/Creational/AbstractFactory/uml/uml.png and b/Creational/AbstractFactory/uml/uml.png differ diff --git a/Creational/AbstractFactory/uml/uml.svg b/Creational/AbstractFactory/uml/uml.svg index 17b4b70..e7eff24 100644 --- a/Creational/AbstractFactory/uml/uml.svg +++ b/Creational/AbstractFactory/uml/uml.svg @@ -1,379 +1,560 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - createPicture(path, name) - - - - - - - - - createText(content) - - - - - - - - - - - - - HtmlFactory - - - HtmlFactory - - - - - - - - - - - - - - - - - - render() - - - - - - - - - - - - - Picture - - - Picture - - - - - - - - - - - - - - - - - - render() - - - - - - - - - - - - - Text - - - Text - - - - - - - - - - - - - - - - - - createPicture(path, name) - - - - - - - - - createText(content) - - - - - - - - - - - - - JsonFactory - - - JsonFactory - - - - - - - - - - - - - - - - - - createText(content) - - - - - - - - - createPicture(path, name) - - - - - - - - - - - - - AbstractFactory - - - AbstractFactory - - - - - - - - - - - - - - - - - - render() - - - - - - - - - - - - - MediaInterface - - - MediaInterface - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + createText(content) + + + + + + + + + + + + + JsonFactory + + + JsonFactory + + + + + + + + + + + + + + + + + + + + + + createText(content) + + + + + + + + + + + + + JsonFactory + + + JsonFactory + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + createText(content) + + + + + + + + + + + + + AbstractFactory + + + AbstractFactory + + + + + + + + + + + + + + + + + + + + + + createText(content) + + + + + + + + + + + + + AbstractFactory + + + AbstractFactory + + + + + + + + + + + + + + + + + + + + + + createText(content) + + + + + + + + + + + + + HtmlFactory + + + HtmlFactory + + + + + + + + + + + + + + + + + + + + + + createText(content) + + + + + + + + + + + + + HtmlFactory + + + HtmlFactory + + + + + + + + + + + + + + + + JsonText + + + JsonText + + + + + + + + + + + + + JsonText + + + JsonText + + + + + + + + + + + + + + + + HtmlText + + + HtmlText + + + + + + + + + + + + + HtmlText + + + HtmlText + + + + + + + + + + + + + + + + + + + + + + + + + text + + + + + + + + + + + + + Text + + + Text + + + + + + + + + + + + + + + + + + + + + + text + + + + + + + + + + + + + Text + + + Text + + + + + + + + + + + + + + + diff --git a/Creational/Builder/BikeBuilder.php b/Creational/Builder/BikeBuilder.php deleted file mode 100644 index f83c5db..0000000 --- a/Creational/Builder/BikeBuilder.php +++ /dev/null @@ -1,54 +0,0 @@ -bike->setPart('engine', new Parts\Engine()); - } - - /** - * {@inheritdoc} - */ - public function addWheel() - { - $this->bike->setPart('forwardWheel', new Parts\Wheel()); - $this->bike->setPart('rearWheel', new Parts\Wheel()); - } - - /** - * {@inheritdoc} - */ - public function createVehicle() - { - $this->bike = new Parts\Bike(); - } - - /** - * {@inheritdoc} - */ - public function getVehicle() - { - return $this->bike; - } -} diff --git a/Creational/Builder/BuilderInterface.php b/Creational/Builder/BuilderInterface.php index f682656..3bcf961 100644 --- a/Creational/Builder/BuilderInterface.php +++ b/Creational/Builder/BuilderInterface.php @@ -2,33 +2,17 @@ namespace DesignPatterns\Creational\Builder; -/** - * - */ +use DesignPatterns\Creational\Builder\Parts\Vehicle; + interface BuilderInterface { - /** - * @return mixed - */ public function createVehicle(); - /** - * @return mixed - */ public function addWheel(); - /** - * @return mixed - */ public function addEngine(); - /** - * @return mixed - */ public function addDoors(); - /** - * @return mixed - */ - public function getVehicle(); + public function getVehicle(): Vehicle; } diff --git a/Creational/Builder/CarBuilder.php b/Creational/Builder/CarBuilder.php index a0693d0..fb20822 100644 --- a/Creational/Builder/CarBuilder.php +++ b/Creational/Builder/CarBuilder.php @@ -2,36 +2,27 @@ namespace DesignPatterns\Creational\Builder; -/** - * CarBuilder builds car. - */ +use DesignPatterns\Creational\Builder\Parts\Vehicle; + class CarBuilder implements BuilderInterface { /** * @var Parts\Car */ - protected $car; + private $car; - /** - * @return void - */ public function addDoors() { - $this->car->setPart('rightdoor', new Parts\Door()); + $this->car->setPart('rightDoor', new Parts\Door()); $this->car->setPart('leftDoor', new Parts\Door()); + $this->car->setPart('trunkLid', new Parts\Door()); } - /** - * @return void - */ public function addEngine() { $this->car->setPart('engine', new Parts\Engine()); } - /** - * @return void - */ public function addWheel() { $this->car->setPart('wheelLF', new Parts\Wheel()); @@ -40,18 +31,12 @@ class CarBuilder implements BuilderInterface $this->car->setPart('wheelRR', new Parts\Wheel()); } - /** - * @return void - */ public function createVehicle() { $this->car = new Parts\Car(); } - /** - * @return Parts\Car - */ - public function getVehicle() + public function getVehicle(): Vehicle { return $this->car; } diff --git a/Creational/Builder/Director.php b/Creational/Builder/Director.php index 642cd1b..9925d5a 100644 --- a/Creational/Builder/Director.php +++ b/Creational/Builder/Director.php @@ -2,22 +2,17 @@ namespace DesignPatterns\Creational\Builder; +use DesignPatterns\Creational\Builder\Parts\Vehicle; + /** * 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 about concrete part. - * - * @param BuilderInterface $builder - * - * @return Parts\Vehicle - */ - public function build(BuilderInterface $builder) + public function build(BuilderInterface $builder): Vehicle { $builder->createVehicle(); $builder->addDoors(); diff --git a/Creational/Builder/Parts/Car.php b/Creational/Builder/Parts/Car.php index e345ea9..53eb0d4 100644 --- a/Creational/Builder/Parts/Car.php +++ b/Creational/Builder/Parts/Car.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Creational\Builder\Parts; -/** - * Car is a car. - */ class Car extends Vehicle { } diff --git a/Creational/Builder/Parts/Door.php b/Creational/Builder/Parts/Door.php index fc12608..f2732fe 100644 --- a/Creational/Builder/Parts/Door.php +++ b/Creational/Builder/Parts/Door.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Creational\Builder\Parts; -/** - * Class Door. - */ class Door { } diff --git a/Creational/Builder/Parts/Engine.php b/Creational/Builder/Parts/Engine.php index 5232ab3..48046b8 100644 --- a/Creational/Builder/Parts/Engine.php +++ b/Creational/Builder/Parts/Engine.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Creational\Builder\Parts; -/** - * Class Engine. - */ class Engine { } diff --git a/Creational/Builder/Parts/Bike.php b/Creational/Builder/Parts/Truck.php similarity index 53% rename from Creational/Builder/Parts/Bike.php rename to Creational/Builder/Parts/Truck.php index e5adbba..23c137c 100644 --- a/Creational/Builder/Parts/Bike.php +++ b/Creational/Builder/Parts/Truck.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Creational\Builder\Parts; -/** - * Bike is a bike. - */ -class Bike extends Vehicle +class Truck extends Vehicle { } diff --git a/Creational/Builder/Parts/Vehicle.php b/Creational/Builder/Parts/Vehicle.php index 18c47ba..c7e3c15 100644 --- a/Creational/Builder/Parts/Vehicle.php +++ b/Creational/Builder/Parts/Vehicle.php @@ -2,19 +2,16 @@ namespace DesignPatterns\Creational\Builder\Parts; -/** - * Vehicle class is an abstraction for a vehicle. - */ abstract class Vehicle { /** - * @var array + * @var object[] */ - protected $data; + private $data = []; /** * @param string $key - * @param mixed $value + * @param object $value */ public function setPart($key, $value) { diff --git a/Creational/Builder/Parts/Wheel.php b/Creational/Builder/Parts/Wheel.php index 0a1afbd..4e677e3 100644 --- a/Creational/Builder/Parts/Wheel.php +++ b/Creational/Builder/Parts/Wheel.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Creational\Builder\Parts; -/** - * Class Wheel. - */ class Wheel { } diff --git a/Creational/Builder/README.rst b/Creational/Builder/README.rst index de8971b..94744e3 100644 --- a/Creational/Builder/README.rst +++ b/Creational/Builder/README.rst @@ -30,7 +30,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Director.php @@ -44,9 +44,9 @@ BuilderInterface.php :language: php :linenos: -BikeBuilder.php +TruckBuilder.php -.. literalinclude:: BikeBuilder.php +.. literalinclude:: TruckBuilder.php :language: php :linenos: @@ -62,9 +62,9 @@ Parts/Vehicle.php :language: php :linenos: -Parts/Bike.php +Parts/Truck.php -.. literalinclude:: Parts/Bike.php +.. literalinclude:: Parts/Truck.php :language: php :linenos: diff --git a/Creational/Builder/Tests/DirectorTest.php b/Creational/Builder/Tests/DirectorTest.php index 9f07b83..353758b 100644 --- a/Creational/Builder/Tests/DirectorTest.php +++ b/Creational/Builder/Tests/DirectorTest.php @@ -2,40 +2,28 @@ namespace DesignPatterns\Creational\Builder\Tests; -use DesignPatterns\Creational\Builder\BikeBuilder; -use DesignPatterns\Creational\Builder\BuilderInterface; +use DesignPatterns\Creational\Builder\Parts\Car; +use DesignPatterns\Creational\Builder\Parts\Truck; +use DesignPatterns\Creational\Builder\TruckBuilder; use DesignPatterns\Creational\Builder\CarBuilder; use DesignPatterns\Creational\Builder\Director; +use PHPUnit\Framework\TestCase; -/** - * DirectorTest tests the builder pattern. - */ -class DirectorTest extends \PHPUnit_Framework_TestCase +class DirectorTest extends TestCase { - protected $director; - - protected function setUp() + public function testCanBuildTruck() { - $this->director = new Director(); + $truckBuilder = new TruckBuilder(); + $newVehicle = (new Director())->build($truckBuilder); + + $this->assertInstanceOf(Truck::class, $newVehicle); } - public function getBuilder() + public function testCanBuildCar() { - return array( - array(new CarBuilder()), - array(new BikeBuilder()), - ); - } + $carBuilder = new CarBuilder(); + $newVehicle = (new Director())->build($carBuilder); - /** - * Here we test the build process. Notice that the client don't know - * anything about the concrete builder. - * - * @dataProvider getBuilder - */ - public function testBuild(BuilderInterface $builder) - { - $newVehicle = $this->director->build($builder); - $this->assertInstanceOf('DesignPatterns\Creational\Builder\Parts\Vehicle', $newVehicle); + $this->assertInstanceOf(Car::class, $newVehicle); } } diff --git a/Creational/Builder/TruckBuilder.php b/Creational/Builder/TruckBuilder.php new file mode 100644 index 0000000..e686eac --- /dev/null +++ b/Creational/Builder/TruckBuilder.php @@ -0,0 +1,44 @@ +truck->setPart('rightDoor', new Parts\Door()); + $this->truck->setPart('leftDoor', new Parts\Door()); + } + + public function addEngine() + { + $this->truck->setPart('truckEngine', new Parts\Engine()); + } + + public function addWheel() + { + $this->truck->setPart('wheel1', new Parts\Wheel()); + $this->truck->setPart('wheel2', new Parts\Wheel()); + $this->truck->setPart('wheel3', new Parts\Wheel()); + $this->truck->setPart('wheel4', new Parts\Wheel()); + $this->truck->setPart('wheel5', new Parts\Wheel()); + $this->truck->setPart('wheel6', new Parts\Wheel()); + } + + public function createVehicle() + { + $this->truck = new Parts\Truck(); + } + + public function getVehicle(): Vehicle + { + return $this->truck; + } +} diff --git a/Creational/FactoryMethod/Bicycle.php b/Creational/FactoryMethod/Bicycle.php index 8e41f88..95aacbf 100644 --- a/Creational/FactoryMethod/Bicycle.php +++ b/Creational/FactoryMethod/Bicycle.php @@ -2,22 +2,14 @@ namespace DesignPatterns\Creational\FactoryMethod; -/** - * Bicycle is a bicycle. - */ class Bicycle implements VehicleInterface { /** * @var string */ - protected $color; + private $color; - /** - * sets the color of the bicycle. - * - * @param string $rgb - */ - public function setColor($rgb) + public function setColor(string $rgb) { $this->color = $rgb; } diff --git a/Creational/FactoryMethod/CarFerrari.php b/Creational/FactoryMethod/CarFerrari.php new file mode 100644 index 0000000..dfb9eca --- /dev/null +++ b/Creational/FactoryMethod/CarFerrari.php @@ -0,0 +1,16 @@ +color = $rgb; + } +} diff --git a/Creational/FactoryMethod/CarMercedes.php b/Creational/FactoryMethod/CarMercedes.php new file mode 100644 index 0000000..bc6e337 --- /dev/null +++ b/Creational/FactoryMethod/CarMercedes.php @@ -0,0 +1,21 @@ +color = $rgb; + } + + public function addAMGTuning() + { + // do additional tuning here + } +} diff --git a/Creational/FactoryMethod/FactoryMethod.php b/Creational/FactoryMethod/FactoryMethod.php index fa3d4a3..d999f7b 100644 --- a/Creational/FactoryMethod/FactoryMethod.php +++ b/Creational/FactoryMethod/FactoryMethod.php @@ -2,36 +2,17 @@ namespace DesignPatterns\Creational\FactoryMethod; -/** - * class FactoryMethod. - */ abstract class FactoryMethod { - const CHEAP = 1; - const FAST = 2; + const CHEAP = 'cheap'; + const FAST = 'fast'; - /** - * 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); + abstract protected function createVehicle(string $type): VehicleInterface; - /** - * Creates a new vehicle. - * - * @param int $type - * - * @return VehicleInterface a new vehicle - */ - public function create($type) + public function create(string $type): VehicleInterface { $obj = $this->createVehicle($type); - $obj->setColor('#f00'); + $obj->setColor('black'); return $obj; } diff --git a/Creational/FactoryMethod/Ferrari.php b/Creational/FactoryMethod/Ferrari.php deleted file mode 100644 index 9434e3d..0000000 --- a/Creational/FactoryMethod/Ferrari.php +++ /dev/null @@ -1,22 +0,0 @@ -color = $rgb; - } -} diff --git a/Creational/FactoryMethod/GermanFactory.php b/Creational/FactoryMethod/GermanFactory.php index 1f65eb4..7abb750 100644 --- a/Creational/FactoryMethod/GermanFactory.php +++ b/Creational/FactoryMethod/GermanFactory.php @@ -2,28 +2,19 @@ namespace DesignPatterns\Creational\FactoryMethod; -/** - * GermanFactory is a vehicle factory in Germany. - */ class GermanFactory extends FactoryMethod { - /** - * {@inheritdoc} - */ - protected function createVehicle($type) + protected function createVehicle(string $type): VehicleInterface { switch ($type) { case parent::CHEAP: return new Bicycle(); - break; case parent::FAST: - $obj = new Porsche(); - // we can specialize the way we want some concrete Vehicle since - // we know the class - $obj->addTuningAMG(); + $carMercedes = new CarMercedes(); + // we can specialize the way we want some concrete Vehicle since we know the class + $carMercedes->addAMGTuning(); - return $obj; - break; + return $carMercedes; default: throw new \InvalidArgumentException("$type is not a valid vehicle"); } diff --git a/Creational/FactoryMethod/ItalianFactory.php b/Creational/FactoryMethod/ItalianFactory.php index 25eeaf1..58a54f4 100644 --- a/Creational/FactoryMethod/ItalianFactory.php +++ b/Creational/FactoryMethod/ItalianFactory.php @@ -2,23 +2,15 @@ namespace DesignPatterns\Creational\FactoryMethod; -/** - * ItalianFactory is vehicle factory in Italy. - */ class ItalianFactory extends FactoryMethod { - /** - * {@inheritdoc} - */ - protected function createVehicle($type) + protected function createVehicle(string $type): VehicleInterface { switch ($type) { case parent::CHEAP: return new Bicycle(); - break; case parent::FAST: - return new Ferrari(); - break; + return new CarFerrari(); default: throw new \InvalidArgumentException("$type is not a valid vehicle"); } diff --git a/Creational/FactoryMethod/Porsche.php b/Creational/FactoryMethod/Porsche.php deleted file mode 100644 index bdabb87..0000000 --- a/Creational/FactoryMethod/Porsche.php +++ /dev/null @@ -1,30 +0,0 @@ -color = $rgb; - } - - /** - * although tuning by AMG is only offered for Mercedes Cars, - * this is a valid coding example ... - */ - public function addTuningAMG() - { - } -} diff --git a/Creational/FactoryMethod/README.rst b/Creational/FactoryMethod/README.rst index 7e69a8d..6a73793 100644 --- a/Creational/FactoryMethod/README.rst +++ b/Creational/FactoryMethod/README.rst @@ -26,7 +26,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ FactoryMethod.php @@ -52,9 +52,15 @@ VehicleInterface.php :language: php :linenos: -Porsche.php +CarMercedes.php -.. literalinclude:: Porsche.php +.. literalinclude:: CarMercedes.php + :language: php + :linenos: + +CarFerrari.php + +.. literalinclude:: CarFerrari.php :language: php :linenos: @@ -64,12 +70,6 @@ Bicycle.php :language: php :linenos: -Ferrari.php - -.. literalinclude:: Ferrari.php - :language: php - :linenos: - Test ---- diff --git a/Creational/FactoryMethod/Tests/FactoryMethodTest.php b/Creational/FactoryMethod/Tests/FactoryMethodTest.php index 6b1c4d2..6bd0509 100644 --- a/Creational/FactoryMethod/Tests/FactoryMethodTest.php +++ b/Creational/FactoryMethod/Tests/FactoryMethodTest.php @@ -2,48 +2,54 @@ namespace DesignPatterns\Creational\FactoryMethod\Tests; +use DesignPatterns\Creational\FactoryMethod\Bicycle; +use DesignPatterns\Creational\FactoryMethod\CarFerrari; +use DesignPatterns\Creational\FactoryMethod\CarMercedes; use DesignPatterns\Creational\FactoryMethod\FactoryMethod; use DesignPatterns\Creational\FactoryMethod\GermanFactory; use DesignPatterns\Creational\FactoryMethod\ItalianFactory; +use PHPUnit\Framework\TestCase; -/** - * FactoryMethodTest tests the factory method pattern. - */ -class FactoryMethodTest extends \PHPUnit_Framework_TestCase +class FactoryMethodTest extends TestCase { - protected $type = array( - FactoryMethod::CHEAP, - FactoryMethod::FAST, - ); - - public function getShop() + public function testCanCreateCheapVehicleInGermany() { - return array( - array(new GermanFactory()), - array(new ItalianFactory()), - ); + $factory = new GermanFactory(); + $result = $factory->create(FactoryMethod::CHEAP); + + $this->assertInstanceOf(Bicycle::class, $result); + } + + public function testCanCreateFastVehicleInGermany() + { + $factory = new GermanFactory(); + $result = $factory->create(FactoryMethod::FAST); + + $this->assertInstanceOf(CarMercedes::class, $result); + } + + public function testCanCreateCheapVehicleInItaly() + { + $factory = new ItalianFactory(); + $result = $factory->create(FactoryMethod::CHEAP); + + $this->assertInstanceOf(Bicycle::class, $result); + } + + public function testCanCreateFastVehicleInItaly() + { + $factory = new ItalianFactory(); + $result = $factory->create(FactoryMethod::FAST); + + $this->assertInstanceOf(CarFerrari::class, $result); } /** - * @dataProvider getShop - */ - public function testCreation(FactoryMethod $shop) - { - // this test method acts as a client for the factory. We don't care - // about the factory, all we know is it can produce vehicle - foreach ($this->type as $oneType) { - $vehicle = $shop->create($oneType); - $this->assertInstanceOf('DesignPatterns\Creational\FactoryMethod\VehicleInterface', $vehicle); - } - } - - /** - * @dataProvider getShop * @expectedException \InvalidArgumentException * @expectedExceptionMessage spaceship is not a valid vehicle */ - public function testUnknownType(FactoryMethod $shop) + public function testUnknownType() { - $shop->create('spaceship'); + (new ItalianFactory())->create('spaceship'); } } diff --git a/Creational/FactoryMethod/VehicleInterface.php b/Creational/FactoryMethod/VehicleInterface.php index ccb05ee..9f5fb15 100644 --- a/Creational/FactoryMethod/VehicleInterface.php +++ b/Creational/FactoryMethod/VehicleInterface.php @@ -2,15 +2,7 @@ namespace DesignPatterns\Creational\FactoryMethod; -/** - * VehicleInterface is a contract for a vehicle. - */ interface VehicleInterface { - /** - * sets the color of the vehicle. - * - * @param string $rgb - */ - public function setColor($rgb); + public function setColor(string $rgb); } diff --git a/Creational/FactoryMethod/uml/FactoryMethod.uml b/Creational/FactoryMethod/uml/FactoryMethod.uml index ec4249c..bb6d3b4 100644 --- a/Creational/FactoryMethod/uml/FactoryMethod.uml +++ b/Creational/FactoryMethod/uml/FactoryMethod.uml @@ -1,55 +1,54 @@ - - - PHP - \DesignPatterns\Creational\FactoryMethod\Bicycle - - \DesignPatterns\Creational\FactoryMethod\FactoryMethod - \DesignPatterns\Creational\FactoryMethod\Bicycle - \DesignPatterns\Creational\FactoryMethod\GermanFactory - \DesignPatterns\Creational\FactoryMethod\VehicleInterface - \DesignPatterns\Creational\FactoryMethod\ItalianFactory - \DesignPatterns\Creational\FactoryMethod\Ferrari - \DesignPatterns\Creational\FactoryMethod\Porsche - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Creational\FactoryMethod\GermanFactory + + \DesignPatterns\Creational\FactoryMethod\FactoryMethod + \DesignPatterns\Creational\FactoryMethod\Bicycle + \DesignPatterns\Creational\FactoryMethod\CarFerrari + \DesignPatterns\Creational\FactoryMethod\ItalianFactory + \DesignPatterns\Creational\FactoryMethod\CarMercedes + \DesignPatterns\Creational\FactoryMethod\GermanFactory + \DesignPatterns\Creational\FactoryMethod\VehicleInterface + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fields + Constructors + Methods + + private + + diff --git a/Creational/FactoryMethod/uml/uml.png b/Creational/FactoryMethod/uml/uml.png index 0687038..b705b22 100644 Binary files a/Creational/FactoryMethod/uml/uml.png and b/Creational/FactoryMethod/uml/uml.png differ diff --git a/Creational/FactoryMethod/uml/uml.svg b/Creational/FactoryMethod/uml/uml.svg index 62b8cc6..6ddd586 100644 --- a/Creational/FactoryMethod/uml/uml.svg +++ b/Creational/FactoryMethod/uml/uml.svg @@ -1,623 +1,974 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CHEAP - - - - - - - - - - FAST - - - - - - - - - - - - createVehicle(type) - - - - - - - - - create(type) - - - - - - - - - - - - - FactoryMethod - - - FactoryMethod - - - - - - - - - - - - - - - - - - - color - - - - - - - - - - - - setColor(rgb) - - - - - - - - - - - - - Bicycle - - - Bicycle - - - - - - - - - - - - - - - - - - createVehicle(type) - - - - - - - - - - - - - GermanFactory - - - GermanFactory - - - - - - - - - - - - - - - - - - - - - setColor(rgb) - - - - - - - - - - - - - VehicleInterface - - - VehicleInterface - - - - - - - - - - - - - - - - - - - - - - - - createVehicle(type) - - - - - - - - - - - - - ItalianFactory - - - ItalianFactory - - - - - - - - - - - - - - - - - - - color - - - - - - - - - - - - setColor(rgb) - - - - - - - - - - - - - Ferrari - - - Ferrari - - - - - - - - - - - - - - - - - - - - - - - - - color - - - - - - - - - - - - setColor(rgb) - - - - - - - - - addTuningAMG() - - - - - - - - - - - - - Porsche - - - Porsche - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + createVehicle(type) + + + + + + + + + + + + + create(type) + + + + + + + + + + + + + FactoryMethod + + + FactoryMethod + + + + + + + + + + + + + + + + + + + + + + createVehicle(type) + + + + + + + + + + + + + + + + create(type) + + + + + + + + + + + + + FactoryMethod + + + FactoryMethod + + + + + + + + + + + + + + + + + + + + + + + + + color + + + + + + + + + + + + + + + + setColor(rgb) + + + + + + + + + + + + + Bicycle + + + Bicycle + + + + + + + + + + + + + + + + + + + + + + color + + + + + + + + + + + + + + + + + + + setColor(rgb) + + + + + + + + + + + + + Bicycle + + + Bicycle + + + + + + + + + + + + + + + + + + + + + + + + + color + + + + + + + + + + + + + + + + setColor(rgb) + + + + + + + + + + + + + CarFerrari + + + CarFerrari + + + + + + + + + + + + + + + + + + + + + + color + + + + + + + + + + + + + + + + + + + setColor(rgb) + + + + + + + + + + + + + CarFerrari + + + CarFerrari + + + + + + + + + + + + + + + + + + + + + + createVehicle(type) + + + + + + + + + + + + + ItalianFactory + + + ItalianFactory + + + + + + + + + + + + + + + + + + + + + + createVehicle(type) + + + + + + + + + + + + + ItalianFactory + + + ItalianFactory + + + + + + + + + + + + + + + + + + + + + + + + + color + + + + + + + + + + + + + + + + setColor(rgb) + + + + + + + + + + + + + addAMGTuning() + + + + + + + + + + + + + CarMercedes + + + CarMercedes + + + + + + + + + + + + + + + + + + + + + + color + + + + + + + + + + + + + + + + + + + setColor(rgb) + + + + + + + + + + + + + + + + addAMGTuning() + + + + + + + + + + + + + CarMercedes + + + CarMercedes + + + + + + + + + + + + + + + + + + + + + + createVehicle(type) + + + + + + + + + + + + + GermanFactory + + + GermanFactory + + + + + + + + + + + + + + + + + + + + + + createVehicle(type) + + + + + + + + + + + + + GermanFactory + + + GermanFactory + + + + + + + + + + + + + + + + + + + + + + setColor(rgb) + + + + + + + + + + + + + VehicleInterface + + + VehicleInterface + + + + + + + + + + + + + + + + + + + + + + setColor(rgb) + + + + + + + + + + + + + VehicleInterface + + + VehicleInterface + + + + + + + + + + + + + + + + + diff --git a/Creational/Multiton/Multiton.php b/Creational/Multiton/Multiton.php index 5338e62..d662f24 100644 --- a/Creational/Multiton/Multiton.php +++ b/Creational/Multiton/Multiton.php @@ -2,46 +2,26 @@ namespace DesignPatterns\Creational\Multiton; -/** - * class Multiton. - */ -class Multiton +final class Multiton { - /** - * the first instance. - */ const INSTANCE_1 = '1'; - - /** - * the second instance. - */ const INSTANCE_2 = '2'; /** - * holds the named instances. - * - * @var array + * @var Multiton[] */ - private static $instances = array(); + private static $instances = []; /** - * should not be called from outside: private! + * this is private to prevent from creating arbitrary instances */ private function __construct() { } - /** - * gets the instance with the given name, e.g. Multiton::INSTANCE_1 - * uses lazy initialization. - * - * @param string $instanceName - * - * @return Multiton - */ - public static function getInstance($instanceName) + public static function getInstance(string $instanceName): Multiton { - if (!array_key_exists($instanceName, self::$instances)) { + if (!isset(self::$instances[$instanceName])) { self::$instances[$instanceName] = new self(); } @@ -49,18 +29,14 @@ class Multiton } /** - * prevent instance from being cloned. - * - * @return void + * prevent instance from being cloned */ private function __clone() { } /** - * prevent instance from being unserialized. - * - * @return void + * prevent instance from being unserialized */ private function __wakeup() { diff --git a/Creational/Multiton/README.rst b/Creational/Multiton/README.rst index 3f5167e..54d881a 100644 --- a/Creational/Multiton/README.rst +++ b/Creational/Multiton/README.rst @@ -26,7 +26,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Multiton.php diff --git a/Creational/Multiton/Tests/MultitonTest.php b/Creational/Multiton/Tests/MultitonTest.php new file mode 100644 index 0000000..bbe4f2a --- /dev/null +++ b/Creational/Multiton/Tests/MultitonTest.php @@ -0,0 +1,28 @@ +assertInstanceOf(Multiton::class, $firstCall); + $this->assertSame($firstCall, $secondCall); + } + + public function testUniquenessForEveryInstance() + { + $firstCall = Multiton::getInstance(Multiton::INSTANCE_1); + $secondCall = Multiton::getInstance(Multiton::INSTANCE_2); + + $this->assertInstanceOf(Multiton::class, $firstCall); + $this->assertInstanceOf(Multiton::class, $secondCall); + $this->assertNotSame($firstCall, $secondCall); + } +} diff --git a/Creational/Pool/Pool.php b/Creational/Pool/Pool.php deleted file mode 100644 index 7dcc6e3..0000000 --- a/Creational/Pool/Pool.php +++ /dev/null @@ -1,28 +0,0 @@ -class = $class; - } - - public function get() - { - if (count($this->instances) > 0) { - return array_pop($this->instances); - } - - return new $this->class(); - } - - public function dispose($instance) - { - $this->instances[] = $instance; - } -} diff --git a/Creational/Pool/Processor.php b/Creational/Pool/Processor.php deleted file mode 100644 index 89179b9..0000000 --- a/Creational/Pool/Processor.php +++ /dev/null @@ -1,51 +0,0 @@ -pool = $pool; - } - - public function process($image) - { - if ($this->processing++ < $this->maxProcesses) { - $this->createWorker($image); - } else { - $this->pushToWaitingQueue($image); - } - } - - private function createWorker($image) - { - $worker = $this->pool->get(); - $worker->run($image, array($this, 'processDone')); - } - - public function processDone($worker) - { - $this->processing--; - $this->pool->dispose($worker); - - if (count($this->waitingQueue) > 0) { - $this->createWorker($this->popFromWaitingQueue()); - } - } - - private function pushToWaitingQueue($image) - { - $this->waitingQueue[] = $image; - } - - private function popFromWaitingQueue() - { - return array_pop($this->waitingQueue); - } -} diff --git a/Creational/Pool/README.rst b/Creational/Pool/README.rst index 7b97b9b..7a85d80 100644 --- a/Creational/Pool/README.rst +++ b/Creational/Pool/README.rst @@ -1,6 +1,9 @@ `Pool`__ ======== +Purpose +------- + 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 @@ -31,23 +34,17 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ -Pool.php +WorkerPool.php -.. literalinclude:: Pool.php +.. literalinclude:: WorkerPool.php :language: php :linenos: -Processor.php +StringReverseWorker.php -.. literalinclude:: Processor.php - :language: php - :linenos: - -Worker.php - -.. literalinclude:: Worker.php +.. literalinclude:: StringReverseWorker.php :language: php :linenos: @@ -60,11 +57,5 @@ 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/StringReverseWorker.php b/Creational/Pool/StringReverseWorker.php new file mode 100644 index 0000000..92c2ce5 --- /dev/null +++ b/Creational/Pool/StringReverseWorker.php @@ -0,0 +1,21 @@ +createdAt = new \DateTime(); + } + + public function run(string $text) + { + return strrev($text); + } +} diff --git a/Creational/Pool/Tests/PoolTest.php b/Creational/Pool/Tests/PoolTest.php index 7ff546a..b115d39 100644 --- a/Creational/Pool/Tests/PoolTest.php +++ b/Creational/Pool/Tests/PoolTest.php @@ -2,21 +2,29 @@ namespace DesignPatterns\Creational\Pool\Tests; -use DesignPatterns\Creational\Pool\Pool; +use DesignPatterns\Creational\Pool\WorkerPool; +use PHPUnit\Framework\TestCase; -class PoolTest extends \PHPUnit_Framework_TestCase +class PoolTest extends TestCase { - public function testPool() + public function testCanGetNewInstancesWithGet() { - $pool = new Pool('DesignPatterns\Creational\Pool\Tests\TestWorker'); - $worker = $pool->get(); + $pool = new WorkerPool(); + $worker1 = $pool->get(); + $worker2 = $pool->get(); - $this->assertEquals(1, $worker->id); + $this->assertCount(2, $pool); + $this->assertNotSame($worker1, $worker2); + } - $worker->id = 5; - $pool->dispose($worker); + public function testCanGetSameInstanceTwiceWhenDisposingItFirst() + { + $pool = new WorkerPool(); + $worker1 = $pool->get(); + $pool->dispose($worker1); + $worker2 = $pool->get(); - $this->assertEquals(5, $pool->get()->id); - $this->assertEquals(1, $pool->get()->id); + $this->assertCount(1, $pool); + $this->assertSame($worker1, $worker2); } } diff --git a/Creational/Pool/Tests/TestWorker.php b/Creational/Pool/Tests/TestWorker.php deleted file mode 100644 index 3cfbef5..0000000 --- a/Creational/Pool/Tests/TestWorker.php +++ /dev/null @@ -1,8 +0,0 @@ -freeWorkers) == 0) { + $worker = new StringReverseWorker(); + } else { + $worker = array_pop($this->freeWorkers); + } + + $this->occupiedWorkers[spl_object_hash($worker)] = $worker; + + return $worker; + } + + public function dispose(StringReverseWorker $worker) + { + $key = spl_object_hash($worker); + + if (isset($this->occupiedWorkers[$key])) { + unset($this->occupiedWorkers[$key]); + $this->freeWorkers[$key] = $worker; + } + } + + public function count(): int + { + return count($this->occupiedWorkers) + count($this->freeWorkers); + } +} diff --git a/Creational/Pool/uml/Pool.uml b/Creational/Pool/uml/Pool.uml index 5a770de..8f3a757 100644 --- a/Creational/Pool/uml/Pool.uml +++ b/Creational/Pool/uml/Pool.uml @@ -1,22 +1,20 @@ - - - PHP - \DesignPatterns\Creational\Pool\Processor - - \DesignPatterns\Creational\Pool\Pool - \DesignPatterns\Creational\Pool\Processor - \DesignPatterns\Creational\Pool\Worker - - - - - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Creational\Pool\StringReverseWorker + + \DesignPatterns\Creational\Pool\StringReverseWorker + \DesignPatterns\Creational\Pool\WorkerPool + + + + + + + Fields + Methods + Constructors + + private + + diff --git a/Creational/Pool/uml/uml.png b/Creational/Pool/uml/uml.png index 4bcb05c..5d32c8b 100644 Binary files a/Creational/Pool/uml/uml.png and b/Creational/Pool/uml/uml.png differ diff --git a/Creational/Pool/uml/uml.svg b/Creational/Pool/uml/uml.svg index 4ddd1b4..508ecf6 100644 --- a/Creational/Pool/uml/uml.svg +++ b/Creational/Pool/uml/uml.svg @@ -1,467 +1,512 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - instances - - - - - - - - - - class - - - - - - - - - - - - __construct(class) - - - - - - - - - - - - get() - - - - - - - - - dispose(instance) - - - - - - - - - - - - - Pool - - - Pool - - - - - - - - - - - - - - - - - - - pool - - - - - - - - - - processing - - - - - - - - - - maxProcesses - - - - - - - - - - waitingQueue - - - - - - - - - - - - __construct(pool) - - - - - - - - - - - - process(image) - - - - - - - - - createWorker(image) - - - - - - - - - processDone(worker) - - - - - - - - - pushToWaitingQueue(image) - - - - - - - - - popFromWaitingQueue() - - - - - - - - - - - - - Processor - - - Processor - - - - - - - - - - - - - - - - - - __construct() - - - - - - - - - - - - run(image, callback) - - - - - - - - - - - - - Worker - - - Worker - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + createdAt + + + + + + + + + + + + + + + + + + + __construct() + + + + + + + + + + + + + + + + + + + run(text) + + + + + + + + + + + + + StringReverseWorker + + + StringReverseWorker + + + + + + + + + + + + + + + + + + + + + + createdAt + + + + + + + + + + + + + + + + + + + __construct() + + + + + + + + + + + + + + + + + + + run(text) + + + + + + + + + + + + + StringReverseWorker + + + StringReverseWorker + + + + + + + + + + + + + + + + + + + + + + + + + occupiedWorkers + + + + + + + + + + + + + + + + freeWorkers + + + + + + + + + + + + + + + + + + + get() + + + + + + + + + + + + + + + + dispose(worker) + + + + + + + + + + + + + + + + count() + + + + + + + + + + + + + WorkerPool + + + WorkerPool + + + + + + + + + + + + + + + + + + + + + + occupiedWorkers + + + + + + + + + + + + + + + + freeWorkers + + + + + + + + + + + + + + + + + + + get() + + + + + + + + + + + + + + + + dispose(worker) + + + + + + + + + + + + + + + + count() + + + + + + + + + + + + + WorkerPool + + + WorkerPool + + + diff --git a/Creational/Prototype/BarBookPrototype.php b/Creational/Prototype/BarBookPrototype.php index 7c9b72b..5afadad 100644 --- a/Creational/Prototype/BarBookPrototype.php +++ b/Creational/Prototype/BarBookPrototype.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Creational\Prototype; -/** - * Class BarBookPrototype. - */ class BarBookPrototype extends BookPrototype { /** @@ -12,9 +9,6 @@ class BarBookPrototype extends BookPrototype */ protected $category = 'Bar'; - /** - * empty clone. - */ public function __clone() { } diff --git a/Creational/Prototype/BookPrototype.php b/Creational/Prototype/BookPrototype.php index e0fafa6..2f4d55f 100644 --- a/Creational/Prototype/BookPrototype.php +++ b/Creational/Prototype/BookPrototype.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Creational\Prototype; -/** - * class BookPrototype. - */ abstract class BookPrototype { /** @@ -17,24 +14,13 @@ abstract class BookPrototype */ protected $category; - /** - * @abstract - * - * @return void - */ abstract public function __clone(); - /** - * @return string - */ - public function getTitle() + public function getTitle(): string { return $this->title; } - /** - * @param string $title - */ public function setTitle($title) { $this->title = $title; diff --git a/Creational/Prototype/FooBookPrototype.php b/Creational/Prototype/FooBookPrototype.php index 95ea9e6..51550f9 100644 --- a/Creational/Prototype/FooBookPrototype.php +++ b/Creational/Prototype/FooBookPrototype.php @@ -2,16 +2,13 @@ namespace DesignPatterns\Creational\Prototype; -/** - * Class FooBookPrototype. - */ class FooBookPrototype extends BookPrototype { + /** + * @var string + */ protected $category = 'Foo'; - /** - * empty clone. - */ public function __clone() { } diff --git a/Creational/Prototype/README.rst b/Creational/Prototype/README.rst index af38f8f..252ece3 100644 --- a/Creational/Prototype/README.rst +++ b/Creational/Prototype/README.rst @@ -23,13 +23,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ - -index.php - -.. literalinclude:: index.php - :language: php - :linenos: +You can also find this code on `GitHub`_ BookPrototype.php @@ -52,5 +46,11 @@ FooBookPrototype.php Test ---- +Tests/PrototypeTest.php + +.. literalinclude:: Tests/PrototypeTest.php + :language: php + :linenos: + .. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Creational/Prototype .. __: http://en.wikipedia.org/wiki/Prototype_pattern diff --git a/Creational/Prototype/Tests/PrototypeTest.php b/Creational/Prototype/Tests/PrototypeTest.php new file mode 100644 index 0000000..06eb280 --- /dev/null +++ b/Creational/Prototype/Tests/PrototypeTest.php @@ -0,0 +1,28 @@ +setTitle('Foo Book No ' . $i); + $this->assertInstanceOf(FooBookPrototype::class, $book); + } + + for ($i = 0; $i < 5; $i++) { + $book = clone $barPrototype; + $book->setTitle('Bar Book No ' . $i); + $this->assertInstanceOf(BarBookPrototype::class, $book); + } + } +} diff --git a/Creational/Prototype/index.php b/Creational/Prototype/index.php deleted file mode 100644 index d0f6e94..0000000 --- a/Creational/Prototype/index.php +++ /dev/null @@ -1,17 +0,0 @@ -setTitle('Foo Book No '.$i); -} - -for ($i = 0; $i < 5000; $i++) { - $book = clone $barPrototype; - $book->setTitle('Bar Book No '.$i); -} diff --git a/Creational/SimpleFactory/Bicycle.php b/Creational/SimpleFactory/Bicycle.php index defa801..552b986 100644 --- a/Creational/SimpleFactory/Bicycle.php +++ b/Creational/SimpleFactory/Bicycle.php @@ -2,17 +2,9 @@ namespace DesignPatterns\Creational\SimpleFactory; -/** - * Bicycle is a bicycle. - */ -class Bicycle implements VehicleInterface +class Bicycle { - /** - * @param mixed $destination - * - * @return mixed|void - */ - public function driveTo($destination) + public function driveTo(string $destination) { } } diff --git a/Creational/SimpleFactory/README.rst b/Creational/SimpleFactory/README.rst index 8f6ce81..3ef9f0e 100644 --- a/Creational/SimpleFactory/README.rst +++ b/Creational/SimpleFactory/README.rst @@ -6,11 +6,9 @@ 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. +It differs from the static factory because it is not static. +Therefore, you can have multiple factories, differently parametrized, you can subclass it and you can mock it. +It always should be preferred over a static factory! UML Diagram ----------- @@ -22,7 +20,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ SimpleFactory.php @@ -30,32 +28,21 @@ 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 +.. code-block:: php + :linenos: - $factory = new SimpleFactory(); - $bicycle = $factory->createVehicle('bicycle'); - $bicycle->driveTo('Paris'); + $factory = new SimpleFactory(); + $bicycle = $factory->createBicycle(); + $bicycle->driveTo('Paris'); Test ---- diff --git a/Creational/SimpleFactory/Scooter.php b/Creational/SimpleFactory/Scooter.php deleted file mode 100644 index e1db734..0000000 --- a/Creational/SimpleFactory/Scooter.php +++ /dev/null @@ -1,16 +0,0 @@ -typeList = array( - 'bicycle' => __NAMESPACE__.'\Bicycle', - 'other' => __NAMESPACE__.'\Scooter', - ); - } - - /** - * Creates a vehicle. - * - * @param string $type a known type key - * - * @throws \InvalidArgumentException - * - * @return VehicleInterface a new instance of VehicleInterface - */ - public function createVehicle($type) - { - if (!array_key_exists($type, $this->typeList)) { - throw new \InvalidArgumentException("$type is not valid vehicle"); - } - $className = $this->typeList[$type]; - - return new $className(); + return new Bicycle(); } } diff --git a/Creational/SimpleFactory/Tests/SimpleFactoryTest.php b/Creational/SimpleFactory/Tests/SimpleFactoryTest.php index c2f5379..0e144a5 100644 --- a/Creational/SimpleFactory/Tests/SimpleFactoryTest.php +++ b/Creational/SimpleFactory/Tests/SimpleFactoryTest.php @@ -2,42 +2,15 @@ namespace DesignPatterns\Creational\SimpleFactory\Tests; +use DesignPatterns\Creational\SimpleFactory\Bicycle; use DesignPatterns\Creational\SimpleFactory\SimpleFactory; +use PHPUnit\Framework\TestCase; -/** - * SimpleFactoryTest tests the Simple Factory pattern. - */ -class SimpleFactoryTest extends \PHPUnit_Framework_TestCase +class SimpleFactoryTest extends TestCase { - protected $factory; - - protected function setUp() + public function testCanCreateBicycle() { - $this->factory = new SimpleFactory(); - } - - public function getType() - { - return array( - array('bicycle'), - array('other'), - ); - } - - /** - * @dataProvider getType - */ - public function testCreation($type) - { - $obj = $this->factory->createVehicle($type); - $this->assertInstanceOf('DesignPatterns\Creational\SimpleFactory\VehicleInterface', $obj); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testBadType() - { - $this->factory->createVehicle('car'); + $bicycle = (new SimpleFactory())->createBicycle(); + $this->assertInstanceOf(Bicycle::class, $bicycle); } } diff --git a/Creational/SimpleFactory/VehicleInterface.php b/Creational/SimpleFactory/VehicleInterface.php deleted file mode 100644 index f2c8d3f..0000000 --- a/Creational/SimpleFactory/VehicleInterface.php +++ /dev/null @@ -1,16 +0,0 @@ - - - PHP - \DesignPatterns\Creational\SimpleFactory\SimpleFactory - - \DesignPatterns\Creational\SimpleFactory\Scooter - \DesignPatterns\Creational\SimpleFactory\SimpleFactory - \DesignPatterns\Creational\SimpleFactory\VehicleInterface - \DesignPatterns\Creational\SimpleFactory\Bicycle - - - - - - - - - - - - - - - - - - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Creational\SimpleFactory\Bicycle + + \DesignPatterns\Creational\SimpleFactory\Bicycle + \DesignPatterns\Creational\SimpleFactory\SimpleFactory + + + + + + + Methods + Constants + Fields + + private + + diff --git a/Creational/SimpleFactory/uml/uml.png b/Creational/SimpleFactory/uml/uml.png index d22c00a..93d2838 100644 Binary files a/Creational/SimpleFactory/uml/uml.png and b/Creational/SimpleFactory/uml/uml.png differ diff --git a/Creational/SimpleFactory/uml/uml.svg b/Creational/SimpleFactory/uml/uml.svg index 7da8077..73d07c1 100644 --- a/Creational/SimpleFactory/uml/uml.svg +++ b/Creational/SimpleFactory/uml/uml.svg @@ -1,286 +1,245 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - driveTo(destination) - - - - - - - - - - - - - Scooter - - - Scooter - - - - - - - - - - - - - - - - - - - typeList - - - - - - - - - - - - __construct() - - - - - - - - - - - - createVehicle(type) - - - - - - - - - - - - - SimpleFactory - - - SimpleFactory - - - - - - - - - - - - - - - - - - driveTo(destination) - - - - - - - - - - - - - VehicleInterface - - - VehicleInterface - - - - - - - - - - - - - - - - - - driveTo(destination) - - - - - - - - - - - - - Bicycle - - - Bicycle - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + driveTo(destination) + + + + + + + + + + + + + Bicycle + + + Bicycle + + + + + + + + + + + + + + + + + + + + + + driveTo(destination) + + + + + + + + + + + + + Bicycle + + + Bicycle + + + + + + + + + + + + + + + + + + + + + + createBicycle() + + + + + + + + + + + + + SimpleFactory + + + SimpleFactory + + + + + + + + + + + + + + + + + + + + + + createBicycle() + + + + + + + + + + + + + SimpleFactory + + + SimpleFactory + + + diff --git a/Creational/Singleton/README.rst b/Creational/Singleton/README.rst index c8aad42..a1c7673 100644 --- a/Creational/Singleton/README.rst +++ b/Creational/Singleton/README.rst @@ -29,7 +29,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Singleton.php diff --git a/Creational/Singleton/Singleton.php b/Creational/Singleton/Singleton.php index 650810e..c7cacc7 100644 --- a/Creational/Singleton/Singleton.php +++ b/Creational/Singleton/Singleton.php @@ -2,22 +2,17 @@ namespace DesignPatterns\Creational\Singleton; -/** - * class Singleton. - */ -class Singleton +final class Singleton { /** - * @var Singleton reference to singleton instance + * @var Singleton */ private static $instance; /** - * gets the instance via lazy initialization (created on first usage). - * - * @return self + * gets the instance via lazy initialization (created on first usage) */ - public static function getInstance() + public static function getInstance(): Singleton { if (null === static::$instance) { static::$instance = new static(); @@ -27,33 +22,24 @@ class Singleton } /** - * is not allowed to call from outside: private! + * is not allowed to call from outside to prevent from creating multiple instances, + * to use the singleton, you have to obtain the instance from Singleton::getInstance() instead */ private function __construct() { } /** - * prevent the instance from being cloned. - * - * @throws SingletonPatternViolationException - * - * @return void + * prevent the instance from being cloned (which would create a second instance of it) */ - final public function __clone() + private function __clone() { - throw new SingletonPatternViolationException('This is a Singleton. Clone is forbidden'); } /** - * prevent from being unserialized. - * - * @throws SingletonPatternViolationException - * - * @return void + * prevent from being unserialized (which would create a second instance of it) */ - final public function __wakeup() + private 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 deleted file mode 100644 index b025b4a..0000000 --- a/Creational/Singleton/SingletonPatternViolationException.php +++ /dev/null @@ -1,7 +0,0 @@ -assertInstanceOf('DesignPatterns\Creational\Singleton\Singleton', $firstCall); $secondCall = Singleton::getInstance(); + + $this->assertInstanceOf(Singleton::class, $firstCall); $this->assertSame($firstCall, $secondCall); } - - public function testNoConstructor() - { - $obj = Singleton::getInstance(); - - $refl = new \ReflectionObject($obj); - $meth = $refl->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 e577ab2..69fd9e1 100644 --- a/Creational/StaticFactory/FormatNumber.php +++ b/Creational/StaticFactory/FormatNumber.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Creational\StaticFactory; -/** - * Class FormatNumber. - */ class FormatNumber implements FormatterInterface { } diff --git a/Creational/StaticFactory/FormatString.php b/Creational/StaticFactory/FormatString.php index 5cb9e28..14c2055 100644 --- a/Creational/StaticFactory/FormatString.php +++ b/Creational/StaticFactory/FormatString.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Creational\StaticFactory; -/** - * Class FormatString. - */ class FormatString implements FormatterInterface { } diff --git a/Creational/StaticFactory/FormatterInterface.php b/Creational/StaticFactory/FormatterInterface.php index 349f8b6..22ea0de 100644 --- a/Creational/StaticFactory/FormatterInterface.php +++ b/Creational/StaticFactory/FormatterInterface.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Creational\StaticFactory; -/** - * Class FormatterInterface. - */ interface FormatterInterface { } diff --git a/Creational/StaticFactory/README.rst b/Creational/StaticFactory/README.rst index 85cacf7..feb62bf 100644 --- a/Creational/StaticFactory/README.rst +++ b/Creational/StaticFactory/README.rst @@ -26,7 +26,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ StaticFactory.php diff --git a/Creational/StaticFactory/StaticFactory.php b/Creational/StaticFactory/StaticFactory.php index e4c4f4b..237ec68 100644 --- a/Creational/StaticFactory/StaticFactory.php +++ b/Creational/StaticFactory/StaticFactory.php @@ -3,30 +3,26 @@ namespace DesignPatterns\Creational\StaticFactory; /** - * Note1: Remember, static => global => evil + * Note1: Remember, static means global state which is evil because it can't be mocked for tests * Note2: Cannot be subclassed or mock-upped or have multiple different instances. */ -class StaticFactory +final class StaticFactory { /** - * the parametrized function to get create an instance. - * * @param string $type * - * @static - * - * @throws \InvalidArgumentException - * * @return FormatterInterface */ - public static function factory($type) + public static function factory(string $type): FormatterInterface { - $className = __NAMESPACE__.'\Format'.ucfirst($type); - - if (!class_exists($className)) { - throw new \InvalidArgumentException('Missing format class.'); + if ($type == 'number') { + return new FormatNumber(); } - return new $className(); + if ($type == 'string') { + return new FormatString(); + } + + throw new \InvalidArgumentException('Unknown format given'); } } diff --git a/Creational/StaticFactory/Tests/StaticFactoryTest.php b/Creational/StaticFactory/Tests/StaticFactoryTest.php index 61f65af..e9f7712 100644 --- a/Creational/StaticFactory/Tests/StaticFactoryTest.php +++ b/Creational/StaticFactory/Tests/StaticFactoryTest.php @@ -3,34 +3,31 @@ namespace DesignPatterns\Creational\StaticFactory\Tests; use DesignPatterns\Creational\StaticFactory\StaticFactory; +use PHPUnit\Framework\TestCase; -/** - * Tests for Static Factory pattern. - */ -class StaticFactoryTest extends \PHPUnit_Framework_TestCase +class StaticFactoryTest extends TestCase { - public function getTypeList() + public function testCanCreateNumberFormatter() { - return array( - array('string'), - array('number'), + $this->assertInstanceOf( + 'DesignPatterns\Creational\StaticFactory\FormatNumber', + StaticFactory::factory('number') + ); + } + + public function testCanCreateStringFormatter() + { + $this->assertInstanceOf( + 'DesignPatterns\Creational\StaticFactory\FormatString', + StaticFactory::factory('string') ); } /** - * @dataProvider getTypeList - */ - public function testCreation($type) - { - $obj = StaticFactory::factory($type); - $this->assertInstanceOf('DesignPatterns\Creational\StaticFactory\FormatterInterface', $obj); - } - - /** - * @expectedException InvalidArgumentException + * @expectedException \InvalidArgumentException */ public function testException() { - StaticFactory::factory(''); + StaticFactory::factory('object'); } } diff --git a/LICENSE b/LICENSE index 5f1ce83..97e323b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2011 Dominik Liebler +Copyright (c) 2011-2016 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: diff --git a/Makefile b/Makefile index 52169e6..c3841a2 100644 --- a/Makefile +++ b/Makefile @@ -190,3 +190,20 @@ pseudoxml: $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml @echo @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." + +composer.phar: + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" + php composer-setup.php + php -r "unlink('composer-setup.php');" + +install: vendor + +vendor: composer.phar + php composer.phar install + +cs: install + ./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor . + +test: install cs + ./vendor/bin/phpunit diff --git a/More/Delegation/JuniorDeveloper.php b/More/Delegation/JuniorDeveloper.php index 0946dad..dbaa30a 100644 --- a/More/Delegation/JuniorDeveloper.php +++ b/More/Delegation/JuniorDeveloper.php @@ -2,12 +2,9 @@ namespace DesignPatterns\More\Delegation; -/** - * Class JuniorDeveloper. - */ class JuniorDeveloper { - public function writeBadCode() + public function writeBadCode(): string { return 'Some junior developer generated code...'; } diff --git a/More/Delegation/README.rst b/More/Delegation/README.rst index 69306ad..65cfa72 100644 --- a/More/Delegation/README.rst +++ b/More/Delegation/README.rst @@ -4,7 +4,11 @@ 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. +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 -------- @@ -21,13 +25,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ - -Usage.php - -.. literalinclude:: Usage.php - :language: php - :linenos: +You can also find this code on `GitHub`_ TeamLead.php diff --git a/More/Delegation/TeamLead.php b/More/Delegation/TeamLead.php index 9b75190..67d9bdf 100644 --- a/More/Delegation/TeamLead.php +++ b/More/Delegation/TeamLead.php @@ -2,31 +2,23 @@ namespace DesignPatterns\More\Delegation; -/** - * Class TeamLead. - */ class TeamLead { - /** @var JuniorDeveloper */ - protected $slave; + /** + * @var JuniorDeveloper + */ + private $junior; /** - * Give junior developer into teamlead submission. - * * @param JuniorDeveloper $junior */ public function __construct(JuniorDeveloper $junior) { - $this->slave = $junior; + $this->junior = $junior; } - /** - * TeamLead drink coffee, junior work. - * - * @return mixed - */ - public function writeCode() + public function writeCode(): string { - return $this->slave->writeBadCode(); + return $this->junior->writeBadCode(); } } diff --git a/More/Delegation/Tests/DelegationTest.php b/More/Delegation/Tests/DelegationTest.php index 7d0a33b..888555a 100644 --- a/More/Delegation/Tests/DelegationTest.php +++ b/More/Delegation/Tests/DelegationTest.php @@ -3,16 +3,15 @@ namespace DesignPatterns\More\Delegation\Tests; use DesignPatterns\More\Delegation; +use PHPUnit\Framework\TestCase; -/** - * DelegationTest tests the delegation pattern. - */ -class DelegationTest extends \PHPUnit_Framework_TestCase +class DelegationTest extends TestCase { public function testHowTeamLeadWriteCode() { $junior = new Delegation\JuniorDeveloper(); $teamLead = new Delegation\TeamLead($junior); + $this->assertEquals($junior->writeBadCode(), $teamLead->writeCode()); } } diff --git a/More/Delegation/Usage.php b/More/Delegation/Usage.php deleted file mode 100644 index a1d9837..0000000 --- a/More/Delegation/Usage.php +++ /dev/null @@ -1,9 +0,0 @@ -writeCode(); diff --git a/More/EAV/Attribute.php b/More/EAV/Attribute.php index 3874360..10ac638 100644 --- a/More/EAV/Attribute.php +++ b/More/EAV/Attribute.php @@ -2,15 +2,10 @@ namespace DesignPatterns\More\EAV; -use SplObjectStorage; - -/** - * Class Attribute. - */ -class Attribute implements ValueAccessInterface +class Attribute { /** - * @var SplObjectStorage + * @var \SplObjectStorage */ private $values; @@ -19,64 +14,27 @@ class Attribute implements ValueAccessInterface */ private $name; - public function __construct() + public function __construct(string $name) { - $this->values = new SplObjectStorage(); + $this->values = new \SplObjectStorage(); + $this->name = $name; + } + + public function addValue(Value $value) + { + $this->values->attach($value); } /** - * @return SplObjectStorage + * @return \SplObjectStorage */ - public function getValues() + public function getValues(): \SplObjectStorage { 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() + public function __toString(): string { 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 index ff26589..96d6583 100644 --- a/More/EAV/Entity.php +++ b/More/EAV/Entity.php @@ -2,15 +2,10 @@ namespace DesignPatterns\More\EAV; -use SplObjectStorage; - -/** - * Class Entity. - */ -class Entity implements ValueAccessInterface +class Entity { /** - * @var SplObjectStorage + * @var \SplObjectStorage */ private $values; @@ -19,64 +14,28 @@ class Entity implements ValueAccessInterface */ private $name; - public function __construct() - { - $this->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 + * @param Value[] $values */ - public function setName($name) + public function __construct(string $name, $values) { + $this->values = new \SplObjectStorage(); $this->name = $name; - return $this; + foreach ($values as $value) { + $this->values->attach($value); + } + } + + public function __toString(): string + { + $text = [$this->name]; + + foreach ($this->values as $value) { + $text[] = (string) $value; + } + + return join(', ', $text); } } diff --git a/More/EAV/README.rst b/More/EAV/README.rst index b8a8fbe..bddc76e 100644 --- a/More/EAV/README.rst +++ b/More/EAV/README.rst @@ -11,81 +11,6 @@ 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 ----------- @@ -96,30 +21,34 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ + +Entity.php + +.. literalinclude:: Entity.php + :language: php + :linenos: + +Attribute.php + +.. literalinclude:: Attribute.php + :language: php + :linenos: + +Value.php + +.. literalinclude:: Value.php + :language: php + :linenos: Test ---- -Tests/EntityTest.php +Tests/EAVTest.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 deleted file mode 100644 index 4affe41..0000000 --- a/More/EAV/Tests/AttributeTest.php +++ /dev/null @@ -1,66 +0,0 @@ -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/EAVTest.php b/More/EAV/Tests/EAVTest.php new file mode 100644 index 0000000..c170a43 --- /dev/null +++ b/More/EAV/Tests/EAVTest.php @@ -0,0 +1,25 @@ +assertEquals('MacBook Pro, color: silver, color: black, memory: 8GB', (string) $entity); + } +} diff --git a/More/EAV/Tests/EntityTest.php b/More/EAV/Tests/EntityTest.php deleted file mode 100644 index ecd6c40..0000000 --- a/More/EAV/Tests/EntityTest.php +++ /dev/null @@ -1,145 +0,0 @@ -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 deleted file mode 100644 index f80f070..0000000 --- a/More/EAV/Tests/ValueTest.php +++ /dev/null @@ -1,46 +0,0 @@ -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 index 2c156a9..f316728 100644 --- a/More/EAV/Value.php +++ b/More/EAV/Value.php @@ -2,10 +2,7 @@ namespace DesignPatterns\More\EAV; -/** - * Class Value. - */ -class Value implements ValueInterface +class Value { /** * @var Attribute @@ -17,54 +14,16 @@ class Value implements ValueInterface */ private $name; - /** - * @param Attribute $attribute - */ - public function __construct(Attribute $attribute) - { - $attribute->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) + public function __construct(Attribute $attribute, string $name) { $this->name = $name; + $this->attribute = $attribute; - return $this; + $attribute->addValue($this); + } + + public function __toString(): string + { + return sprintf('%s: %s', $this->attribute, $this->name); } } diff --git a/More/EAV/ValueAccessInterface.php b/More/EAV/ValueAccessInterface.php deleted file mode 100644 index dde67b2..0000000 --- a/More/EAV/ValueAccessInterface.php +++ /dev/null @@ -1,24 +0,0 @@ -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/README.rst b/More/README.rst index dbab1f6..a2de938 100644 --- a/More/README.rst +++ b/More/README.rst @@ -7,3 +7,4 @@ More Delegation/README ServiceLocator/README Repository/README + EAV/README diff --git a/More/Repository/MemoryStorage.php b/More/Repository/MemoryStorage.php index 44276d5..f0fd69a 100644 --- a/More/Repository/MemoryStorage.php +++ b/More/Repository/MemoryStorage.php @@ -2,50 +2,43 @@ namespace DesignPatterns\More\Repository; -/** - * Class MemoryStorage. - */ -class MemoryStorage implements Storage +class MemoryStorage { - private $data; - private $lastId; - - public function __construct() - { - $this->data = array(); - $this->lastId = 0; - } + /** + * @var array + */ + private $data = []; /** - * {@inheritdoc} + * @var int */ - public function persist($data) + private $lastId = 0; + + public function persist(array $data): int { - $this->data[++$this->lastId] = $data; + $this->lastId++; + + $data['id'] = $this->lastId; + $this->data[$this->lastId] = $data; return $this->lastId; } - /** - * {@inheritdoc} - */ - public function retrieve($id) - { - return isset($this->data[$id]) ? $this->data[$id] : null; - } - - /** - * {@inheritdoc} - */ - public function delete($id) + public function retrieve(int $id): array { if (!isset($this->data[$id])) { - return false; + throw new \OutOfRangeException(sprintf('No data found for ID %d', $id)); } - $this->data[$id] = null; - unset($this->data[$id]); + return $this->data[$id]; + } - return true; + public function delete(int $id) + { + if (!isset($this->data[$id])) { + throw new \OutOfRangeException(sprintf('No data found for ID %d', $id)); + } + + unset($this->data[$id]); } } diff --git a/More/Repository/Post.php b/More/Repository/Post.php index e9990b4..44aaefa 100644 --- a/More/Repository/Post.php +++ b/More/Repository/Post.php @@ -2,15 +2,10 @@ namespace DesignPatterns\More\Repository; -/** - * Post represents entity for some post that user left on the site. - * - * Class Post - */ class Post { /** - * @var int + * @var int|null */ private $id; @@ -24,92 +19,43 @@ class Post */ private $text; - /** - * @var string - */ - private $author; + public static function fromState(array $state): Post + { + return new self( + $state['id'], + $state['title'], + $state['text'] + ); + } /** - * @var \DateTime + * @param int|null $id + * @param string $text + * @param string $title */ - private $created; + public function __construct($id, string $title, string $text) + { + $this->id = $id; + $this->text = $text; + $this->title = $title; + } - /** - * @param int $id - */ - public function setId($id) + public function setId(int $id) { $this->id = $id; } - /** - * @return int - */ - public function getId() + public function getId(): int { return $this->id; } - /** - * @param string $author - */ - public function setAuthor($author) - { - $this->author = $author; - } - - /** - * @return string - */ - public function getAuthor() - { - return $this->author; - } - - /** - * @param \DateTime $created - */ - public function setCreated($created) - { - $this->created = $created; - } - - /** - * @return \DateTime - */ - public function getCreated() - { - return $this->created; - } - - /** - * @param string $text - */ - public function setText($text) - { - $this->text = $text; - } - - /** - * @return string - */ - public function getText() + public function getText(): string { return $this->text; } - /** - * @param string $title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * @return string - */ - public function getTitle() + public function getTitle(): string { return $this->title; } diff --git a/More/Repository/PostRepository.php b/More/Repository/PostRepository.php index e7687f3..417bf52 100644 --- a/More/Repository/PostRepository.php +++ b/More/Repository/PostRepository.php @@ -3,80 +3,44 @@ namespace DesignPatterns\More\Repository; /** - * Repository for class Post - * This class is between Entity layer(class Post) and access object layer(interface Storage). + * This class is situated between Entity layer (class Post) and access object layer (MemoryStorage). * * 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 - * - * Class PostRepository */ class PostRepository { + /** + * @var MemoryStorage + */ private $persistence; - public function __construct(Storage $persistence) + public function __construct(MemoryStorage $persistence) { $this->persistence = $persistence; } - /** - * Returns Post object by specified id. - * - * @param int $id - * - * @return Post|null - */ - public function getById($id) + public function findById(int $id): Post { $arrayData = $this->persistence->retrieve($id); + if (is_null($arrayData)) { - return; + throw new \InvalidArgumentException(sprintf('Post with ID %d does not exist', $id)); } - $post = new Post(); - $post->setId($arrayData['id']); - $post->setAuthor($arrayData['author']); - $post->setCreated($arrayData['created']); - $post->setText($arrayData['text']); - $post->setTitle($arrayData['title']); - - return $post; + return Post::fromState($arrayData); } - /** - * Save post object and populate it with id. - * - * @param Post $post - * - * @return Post - */ public function save(Post $post) { - $id = $this->persistence->persist(array( - 'author' => $post->getAuthor(), - 'created' => $post->getCreated(), + $id = $this->persistence->persist([ 'text' => $post->getText(), 'title' => $post->getTitle(), - )); + ]); $post->setId($id); - - return $post; - } - - /** - * Deletes specified Post object. - * - * @param Post $post - * - * @return bool - */ - public function delete(Post $post) - { - return $this->persistence->delete($post->getId()); } } diff --git a/More/Repository/README.rst b/More/Repository/README.rst index 48ac018..fb27585 100644 --- a/More/Repository/README.rst +++ b/More/Repository/README.rst @@ -29,7 +29,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Post.php @@ -43,12 +43,6 @@ PostRepository.php :language: php :linenos: -Storage.php - -.. literalinclude:: Storage.php - :language: php - :linenos: - MemoryStorage.php .. literalinclude:: MemoryStorage.php @@ -58,4 +52,10 @@ MemoryStorage.php Test ---- +Tests/RepositoryTest.php + +.. literalinclude:: Tests/RepositoryTest.php + :language: php + :linenos: + .. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/More/Repository diff --git a/More/Repository/Storage.php b/More/Repository/Storage.php deleted file mode 100644 index a730f09..0000000 --- a/More/Repository/Storage.php +++ /dev/null @@ -1,42 +0,0 @@ -save($post); + + $this->assertEquals(1, $post->getId()); + $this->assertEquals($post->getId(), $repository->findById(1)->getId()); + } +} diff --git a/More/ServiceLocator/DatabaseService.php b/More/ServiceLocator/DatabaseService.php deleted file mode 100644 index 776ba2d..0000000 --- a/More/ServiceLocator/DatabaseService.php +++ /dev/null @@ -1,7 +0,0 @@ -services = array(); - $this->instantiated = array(); - $this->shared = array(); + $this->services[$class] = $service; + $this->instantiated[$class] = $service; + $this->shared[$class] = $share; } /** - * Registers a service with specific interface. + * instead of supplying a class here, you could also store a service for an interface * - * @param string $interface - * @param string|object $service - * @param bool $share + * @param string $class + * @param array $params + * @param bool $share */ - public function add($interface, $service, $share = true) + public function addClass(string $class, array $params, bool $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. - */ - - if (is_object($service) && $share) { - $this->instantiated[$interface] = $service; - } - $this->services[$interface] = (is_object($service) ? get_class($service) : $service); - $this->shared[$interface] = $share; + $this->services[$class] = $params; + $this->shared[$class] = $share; } - /** - * Checks if a service is registered. - * - * @param string $interface - * - * @return bool - */ - public function has($interface) + public function has(string $interface): bool { return isset($this->services[$interface]) || isset($this->instantiated[$interface]); } /** - * Gets the service registered for the interface. + * @param string $class * - * @param string $interface - * - * @return mixed + * @return object */ - public function get($interface) + public function get(string $class) { - // Retrieves the instance if it exists and it is shared - if (isset($this->instantiated[$interface]) && $this->shared[$interface]) { - return $this->instantiated[$interface]; + if (isset($this->instantiated[$class]) && $this->shared[$class]) { + return $this->instantiated[$class]; } - // otherwise gets the service registered. - $service = $this->services[$interface]; + $args = $this->services[$class]; - // You should check if the service class exists and - // the class is instantiable. + switch (count($args)) { + case 0: + $object = new $class(); + break; + case 1: + $object = new $class($args[0]); + break; + case 2: + $object = new $class($args[0], $args[1]); + break; + case 3: + $object = new $class($args[0], $args[1], $args[2]); + break; + default: + throw new \OutOfRangeException('Too many arguments given'); + } - // This example is a simple implementation, but - // when you create a service, you can decide - // if $service is a factory or a class. - // By registering a factory you can create your services - // using the DependencyInjection pattern. - - // ... - - // Creates the service object - $object = new $service(); - - // and saves it if the service must be shared. - if ($this->shared[$interface]) { - $this->instantiated[$interface] = $object; + if ($this->shared[$class]) { + $this->instantiated[$class] = $object; } return $object; diff --git a/More/ServiceLocator/ServiceLocatorInterface.php b/More/ServiceLocator/ServiceLocatorInterface.php deleted file mode 100644 index 3738624..0000000 --- a/More/ServiceLocator/ServiceLocatorInterface.php +++ /dev/null @@ -1,24 +0,0 @@ -serviceLocator = new ServiceLocator(); - $this->logService = new LogService(); - $this->databaseService = new DatabaseService(); } public function testHasServices() { - $this->serviceLocator->add( - 'DesignPatterns\More\ServiceLocator\LogServiceInterface', - $this->logService - ); + $this->serviceLocator->addInstance(LogService::class, new LogService()); - $this->serviceLocator->add( - 'DesignPatterns\More\ServiceLocator\DatabaseServiceInterface', - $this->databaseService - ); - - $this->assertTrue($this->serviceLocator->has('DesignPatterns\More\ServiceLocator\LogServiceInterface')); - $this->assertTrue($this->serviceLocator->has('DesignPatterns\More\ServiceLocator\DatabaseServiceInterface')); - - $this->assertFalse($this->serviceLocator->has('DesignPatterns\More\ServiceLocator\FakeServiceInterface')); + $this->assertTrue($this->serviceLocator->has(LogService::class)); + $this->assertFalse($this->serviceLocator->has(self::class)); } - public function testServicesWithObject() + public function testGetWillInstantiateLogServiceIfNoInstanceHasBeenCreatedYet() { - $this->serviceLocator->add( - 'DesignPatterns\More\ServiceLocator\LogServiceInterface', - $this->logService - ); + $this->serviceLocator->addClass(LogService::class, []); + $logger = $this->serviceLocator->get(LogService::class); - $this->serviceLocator->add( - 'DesignPatterns\More\ServiceLocator\DatabaseServiceInterface', - $this->databaseService - ); - - $this->assertSame( - $this->logService, - $this->serviceLocator->get('DesignPatterns\More\ServiceLocator\LogServiceInterface') - ); - - $this->assertSame( - $this->databaseService, - $this->serviceLocator->get('DesignPatterns\More\ServiceLocator\DatabaseServiceInterface') - ); - } - - public function testServicesWithClass() - { - $this->serviceLocator->add( - 'DesignPatterns\More\ServiceLocator\LogServiceInterface', - get_class($this->logService) - ); - - $this->serviceLocator->add( - 'DesignPatterns\More\ServiceLocator\DatabaseServiceInterface', - get_class($this->databaseService) - ); - - $this->assertNotSame( - $this->logService, - $this->serviceLocator->get('DesignPatterns\More\ServiceLocator\LogServiceInterface') - ); - - $this->assertInstanceOf( - 'DesignPatterns\More\ServiceLocator\LogServiceInterface', - $this->serviceLocator->get('DesignPatterns\More\ServiceLocator\LogServiceInterface') - ); - - $this->assertNotSame( - $this->databaseService, - $this->serviceLocator->get('DesignPatterns\More\ServiceLocator\DatabaseServiceInterface') - ); - - $this->assertInstanceOf( - 'DesignPatterns\More\ServiceLocator\DatabaseServiceInterface', - $this->serviceLocator->get('DesignPatterns\More\ServiceLocator\DatabaseServiceInterface') - ); - } - - public function testServicesNotShared() - { - $this->serviceLocator->add( - 'DesignPatterns\More\ServiceLocator\LogServiceInterface', - $this->logService, - false - ); - - $this->serviceLocator->add( - 'DesignPatterns\More\ServiceLocator\DatabaseServiceInterface', - $this->databaseService, - false - ); - - $this->assertNotSame( - $this->logService, - $this->serviceLocator->get('DesignPatterns\More\ServiceLocator\LogServiceInterface') - ); - - $this->assertInstanceOf( - 'DesignPatterns\More\ServiceLocator\LogServiceInterface', - $this->serviceLocator->get('DesignPatterns\More\ServiceLocator\LogServiceInterface') - ); - - $this->assertNotSame( - $this->databaseService, - $this->serviceLocator->get('DesignPatterns\More\ServiceLocator\DatabaseServiceInterface') - ); - - $this->assertInstanceOf( - 'DesignPatterns\More\ServiceLocator\DatabaseServiceInterface', - $this->serviceLocator->get('DesignPatterns\More\ServiceLocator\DatabaseServiceInterface') - ); + $this->assertInstanceOf(LogService::class, $logger); } } diff --git a/README.md b/README.md index 440185f..b391b77 100755 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ The patterns can be structured in roughly three different categories. Please cli * [DependencyInjection](Structural/DependencyInjection) [:notebook:](http://en.wikipedia.org/wiki/Dependency_injection) * [Facade](Structural/Facade) [:notebook:](http://en.wikipedia.org/wiki/Facade_pattern) * [FluentInterface](Structural/FluentInterface) [:notebook:](http://en.wikipedia.org/wiki/Fluent_interface) +* [Flyweight](Structural/Flyweight) [:notebook:](https://en.wikipedia.org/wiki/Flyweight_pattern) * [Proxy](Structural/Proxy) [:notebook:](http://en.wikipedia.org/wiki/Proxy_pattern) * [Registry](Structural/Registry) [:notebook:](http://en.wikipedia.org/wiki/Service_locator_pattern) @@ -85,20 +86,20 @@ The patterns can be structured in roughly three different categories. Please cli ### [More](More) * [Delegation](More/Delegation) [:notebook:](http://en.wikipedia.org/wiki/Delegation_pattern) -* [ServiceLocator](More/ServiceLocator) [:notebook:](http://en.wikipedia.org/wiki/Service_locator_pattern) +* [ServiceLocator](More/ServiceLocator) [:notebook:](http://en.wikipedia.org/wiki/Service_locator_pattern) (is considered an anti-pattern! :no_entry:) * [Repository](More/Repository) * [EAV](More/EAV) [:notebook:](https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model) ## Contribute -Please feel free to fork and extend existing or add your own examples and send a pull request with your changes! +If you encounter any bugs or missing translations, please feel free to fork and send a pull request with your changes. To establish a consistent code quality, please check your code using [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) against [PSR2 standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) using `./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor .`. ## License (The MIT License) -Copyright (c) 2014 Dominik Liebler and [contributors](https://github.com/domnikl/DesignPatternsPHP/graphs/contributors) +Copyright (c) 2011 - 2017 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 index 3db54a9..43a7df4 100644 --- a/README.rst +++ b/README.rst @@ -34,9 +34,9 @@ Please click on **the title of every pattern's page** for a full explanation of 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 +If you encounter any bugs or missing translations, please feel free +to fork 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 .``. @@ -45,7 +45,7 @@ License (The MIT License) -Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_ +Copyright (c) 2011 - 2017 `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 diff --git a/Structural/Adapter/Book.php b/Structural/Adapter/Book.php index 6458beb..05d15cc 100644 --- a/Structural/Adapter/Book.php +++ b/Structural/Adapter/Book.php @@ -2,22 +2,25 @@ namespace DesignPatterns\Structural\Adapter; -/** - * Book is a concrete and standard paper book. - */ -class Book implements PaperBookInterface +class Book implements BookInterface { /** - * {@inheritdoc} + * @var int */ + private $page; + public function open() { + $this->page = 1; } - /** - * {@inheritdoc} - */ public function turnPage() { + $this->page++; + } + + public function getPage(): int + { + return $this->page; } } diff --git a/Structural/Adapter/BookInterface.php b/Structural/Adapter/BookInterface.php new file mode 100644 index 0000000..6ebabf4 --- /dev/null +++ b/Structural/Adapter/BookInterface.php @@ -0,0 +1,12 @@ +eBook = $ebook; + $this->eBook = $eBook; } /** @@ -30,14 +26,22 @@ class EBookAdapter implements PaperBookInterface */ public function open() { - $this->eBook->pressStart(); + $this->eBook->unlock(); } - /** - * turns pages. - */ public function turnPage() { $this->eBook->pressNext(); } + + /** + * notice the adapted behavior here: EBookInterface::getPage() will return two integers, but BookInterface + * supports only a current page getter, so we adapt the behavior here + * + * @return int + */ + public function getPage(): int + { + return $this->eBook->getPage()[0]; + } } diff --git a/Structural/Adapter/EBookInterface.php b/Structural/Adapter/EBookInterface.php index bd3dc26..bae5033 100644 --- a/Structural/Adapter/EBookInterface.php +++ b/Structural/Adapter/EBookInterface.php @@ -2,22 +2,16 @@ namespace DesignPatterns\Structural\Adapter; -/** - * EBookInterface is a contract for an electronic book. - */ interface EBookInterface { - /** - * go to next page. - * - * @return mixed - */ + public function unlock(); + public function pressNext(); /** - * start the book. + * returns current page and total number of pages, like [10, 100] is page 10 of 100 * - * @return mixed + * @return int[] */ - public function pressStart(); + public function getPage(): array; } diff --git a/Structural/Adapter/Kindle.php b/Structural/Adapter/Kindle.php index 06d4489..a150767 100644 --- a/Structural/Adapter/Kindle.php +++ b/Structural/Adapter/Kindle.php @@ -3,21 +3,37 @@ namespace DesignPatterns\Structural\Adapter; /** - * Kindle is a concrete electronic book. + * this is the adapted class. In production code, this could be a class from another package, some vendor code. + * Notice that it uses another naming scheme and the implementation does something similar but in another way */ class Kindle implements EBookInterface { /** - * {@inheritdoc} + * @var int */ + private $page = 1; + + /** + * @var int + */ + private $totalPages = 100; + public function pressNext() + { + $this->page++; + } + + public function unlock() { } /** - * {@inheritdoc} + * returns current page and total number of pages, like [10, 100] is page 10 of 100 + * + * @return int[] */ - public function pressStart() + public function getPage(): array { + return [$this->page, $this->totalPages]; } } diff --git a/Structural/Adapter/PaperBookInterface.php b/Structural/Adapter/PaperBookInterface.php deleted file mode 100644 index 4b62149..0000000 --- a/Structural/Adapter/PaperBookInterface.php +++ /dev/null @@ -1,23 +0,0 @@ -open(); + $book->turnPage(); + + $this->assertEquals(2, $book->getPage()); } - /** - * This client only knows paper book but surprise, surprise, the second book - * is in fact an electronic book, but both work the same way. - * - * @param PaperBookInterface $book - * - * @dataProvider getBook - */ - public function testIAmAnOldClient(PaperBookInterface $book) + public function testCanTurnPageOnKindleLikeInANormalBook() { - $this->assertTrue(method_exists($book, 'open')); - $this->assertTrue(method_exists($book, 'turnPage')); + $kindle = new Kindle(); + $book = new EBookAdapter($kindle); + + $book->open(); + $book->turnPage(); + + $this->assertEquals(2, $book->getPage()); } } diff --git a/Structural/Adapter/uml/Adapter.uml b/Structural/Adapter/uml/Adapter.uml index dec7779..ddcb6ef 100644 --- a/Structural/Adapter/uml/Adapter.uml +++ b/Structural/Adapter/uml/Adapter.uml @@ -1,41 +1,41 @@ - - - PHP - \DesignPatterns\Structural\Adapter\Book - - \DesignPatterns\Structural\Adapter\EBookAdapter - \DesignPatterns\Structural\Adapter\Book - \DesignPatterns\Structural\Adapter\Kindle - \DesignPatterns\Structural\Adapter\EBookInterface - \DesignPatterns\Structural\Adapter\PaperBookInterface - - - - - - - - - - - - - - - - - - - - - - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Structural\Adapter\Book + + \DesignPatterns\Structural\Adapter\Book + \DesignPatterns\Structural\Adapter\BookInterface + \DesignPatterns\Structural\Adapter\EBookAdapter + \DesignPatterns\Structural\Adapter\EBookInterface + \DesignPatterns\Structural\Adapter\Kindle + + + + + + + + + + + + + + + + + + + + + + + + Fields + Constants + Constructors + Methods + + private + + diff --git a/Structural/Adapter/uml/uml.png b/Structural/Adapter/uml/uml.png index 2cf82a1..2d7db9f 100644 Binary files a/Structural/Adapter/uml/uml.png and b/Structural/Adapter/uml/uml.png differ diff --git a/Structural/Adapter/uml/uml.svg b/Structural/Adapter/uml/uml.svg index 4eec346..28e2b9c 100644 --- a/Structural/Adapter/uml/uml.svg +++ b/Structural/Adapter/uml/uml.svg @@ -1,448 +1,1158 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - open() - - - - - - - - - - turnPage() - - - - - - - - - - - - - Book - - - Book - - - - - - - - - - - - - - - - - - - eBook - - - - - - - - - - - - - __construct(ebook) - - - - - - - - - - - - - open() - - - - - - - - - - turnPage() - - - - - - - - - - - - - EBookAdapter - - - EBookAdapter - - - - - - - - - - - - - - - - - - - pressNext() - - - - - - - - - - pressStart() - - - - - - - - - - - - - Kindle - - - Kindle - - - - - - - - - - - - - - - - - - - pressNext() - - - - - - - - - - pressStart() - - - - - - - - - - - - - EBookInterface - - - EBookInterface - - - - - - - - - - - - - - - - - - - turnPage() - - - - - - - - - - open() - - - - - - - - - - - - - PaperBookInterface - - - PaperBookInterface - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + page + + + + + + + + + + + + + + + + open() + + + + + + + + + + + + + turnPage() + + + + + + + + + + + + + getPage() + + + + + + + + + + + + + Book + + + Book + + + + + + + + + + + + + + + + + + + + + + page + + + + + + + + + + + + + + + + + + + open() + + + + + + + + + + + + + + + + turnPage() + + + + + + + + + + + + + + + + getPage() + + + + + + + + + + + + + Book + + + Book + + + + + + + + + + + + + + + + + + + + + + turnPage() + + + + + + + + + + + + + open() + + + + + + + + + + + + + getPage() + + + + + + + + + + + + + BookInterface + + + BookInterface + + + + + + + + + + + + + + + + + + + + + + turnPage() + + + + + + + + + + + + + + + + open() + + + + + + + + + + + + + + + + getPage() + + + + + + + + + + + + + BookInterface + + + BookInterface + + + + + + + + + + + + + + + + + + + + + + + + + eBook + + + + + + + + + + + + + + + + __construct(eBook) + + + + + + + + + + + + + + + + open() + + + + + + + + + + + + + turnPage() + + + + + + + + + + + + + getPage() + + + + + + + + + + + + + EBookAdapter + + + EBookAdapter + + + + + + + + + + + + + + + + + + + + + + eBook + + + + + + + + + + + + + + + + + + + __construct(eBook) + + + + + + + + + + + + + + + + + + + open() + + + + + + + + + + + + + + + + turnPage() + + + + + + + + + + + + + + + + getPage() + + + + + + + + + + + + + EBookAdapter + + + EBookAdapter + + + + + + + + + + + + + + + + + + + + + + unlock() + + + + + + + + + + + + + pressNext() + + + + + + + + + + + + + getPage() + + + + + + + + + + + + + EBookInterface + + + EBookInterface + + + + + + + + + + + + + + + + + + + + + + unlock() + + + + + + + + + + + + + + + + pressNext() + + + + + + + + + + + + + + + + getPage() + + + + + + + + + + + + + EBookInterface + + + EBookInterface + + + + + + + + + + + + + + + + + + + + + + + + + totalPages + + + + + + + + + + + + + + + + page + + + + + + + + + + + + + + + + pressNext() + + + + + + + + + + + + + unlock() + + + + + + + + + + + + + getPage() + + + + + + + + + + + + + Kindle + + + Kindle + + + + + + + + + + + + + + + + + + + + + + totalPages + + + + + + + + + + + + + + + + page + + + + + + + + + + + + + + + + + + + pressNext() + + + + + + + + + + + + + + + + unlock() + + + + + + + + + + + + + + + + getPage() + + + + + + + + + + + + + Kindle + + + Kindle + + + + + + + + + + + + + diff --git a/Structural/Bridge/Assemble.php b/Structural/Bridge/Assemble.php deleted file mode 100644 index 9b9d114..0000000 --- a/Structural/Bridge/Assemble.php +++ /dev/null @@ -1,11 +0,0 @@ -workShop1->work(); - $this->workShop2->work(); - } -} diff --git a/Structural/Bridge/FormatterInterface.php b/Structural/Bridge/FormatterInterface.php new file mode 100644 index 0000000..d59a344 --- /dev/null +++ b/Structural/Bridge/FormatterInterface.php @@ -0,0 +1,8 @@ +implementation->format('Hello World'); + } +} diff --git a/Structural/Bridge/HtmlFormatter.php b/Structural/Bridge/HtmlFormatter.php new file mode 100644 index 0000000..79e49b5 --- /dev/null +++ b/Structural/Bridge/HtmlFormatter.php @@ -0,0 +1,11 @@ +%s

', $text); + } +} diff --git a/Structural/Bridge/Motorcycle.php b/Structural/Bridge/Motorcycle.php deleted file mode 100644 index f008785..0000000 --- a/Structural/Bridge/Motorcycle.php +++ /dev/null @@ -1,21 +0,0 @@ -workShop1->work(); - $this->workShop2->work(); - } -} diff --git a/Structural/Bridge/PlainTextFormatter.php b/Structural/Bridge/PlainTextFormatter.php new file mode 100644 index 0000000..af46283 --- /dev/null +++ b/Structural/Bridge/PlainTextFormatter.php @@ -0,0 +1,11 @@ +`__ @@ -23,41 +23,35 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ -Workshop.php +FormatterInterface.php -.. literalinclude:: Workshop.php +.. literalinclude:: FormatterInterface.php :language: php :linenos: -Assemble.php +PlainTextFormatter.php -.. literalinclude:: Assemble.php +.. literalinclude:: PlainTextFormatter.php :language: php :linenos: -Produce.php +HtmlFormatter.php -.. literalinclude:: Produce.php +.. literalinclude:: HtmlFormatter.php :language: php :linenos: -Vehicle.php +Service.php -.. literalinclude:: Vehicle.php +.. literalinclude:: Service.php :language: php :linenos: -Motorcycle.php +HelloWorldService.php -.. literalinclude:: Motorcycle.php - :language: php - :linenos: - -Car.php - -.. literalinclude:: Car.php +.. literalinclude:: HelloWorldService.php :language: php :linenos: diff --git a/Structural/Bridge/Service.php b/Structural/Bridge/Service.php new file mode 100644 index 0000000..06c6252 --- /dev/null +++ b/Structural/Bridge/Service.php @@ -0,0 +1,29 @@ +implementation = $printer; + } + + /** + * @param FormatterInterface $printer + */ + public function setImplementation(FormatterInterface $printer) + { + $this->implementation = $printer; + } + + abstract public function get(); +} diff --git a/Structural/Bridge/Tests/BridgeTest.php b/Structural/Bridge/Tests/BridgeTest.php index 0a89a86..2f1fd8e 100644 --- a/Structural/Bridge/Tests/BridgeTest.php +++ b/Structural/Bridge/Tests/BridgeTest.php @@ -2,24 +2,20 @@ namespace DesignPatterns\Structural\Bridge\Tests; -use DesignPatterns\Structural\Bridge\Assemble; -use DesignPatterns\Structural\Bridge\Car; -use DesignPatterns\Structural\Bridge\Motorcycle; -use DesignPatterns\Structural\Bridge\Produce; +use DesignPatterns\Structural\Bridge\HelloWorldService; +use DesignPatterns\Structural\Bridge\HtmlFormatter; +use DesignPatterns\Structural\Bridge\PlainTextFormatter; +use PHPUnit\Framework\TestCase; -class BridgeTest extends \PHPUnit_Framework_TestCase +class BridgeTest extends TestCase { - public function testCar() + public function testCanPrintUsingThePlainTextPrinter() { - $vehicle = new Car(new Produce(), new Assemble()); - $this->expectOutputString('Car Produced Assembled'); - $vehicle->manufacture(); - } + $service = new HelloWorldService(new PlainTextFormatter()); + $this->assertEquals('Hello World', $service->get()); - public function testMotorcycle() - { - $vehicle = new Motorcycle(new Produce(), new Assemble()); - $this->expectOutputString('Motorcycle Produced Assembled'); - $vehicle->manufacture(); + // now change the implementation and use the HtmlFormatter instead + $service->setImplementation(new HtmlFormatter()); + $this->assertEquals('

Hello World

', $service->get()); } } diff --git a/Structural/Bridge/Vehicle.php b/Structural/Bridge/Vehicle.php deleted file mode 100644 index f519d70..0000000 --- a/Structural/Bridge/Vehicle.php +++ /dev/null @@ -1,22 +0,0 @@ -workShop1 = $workShop1; - $this->workShop2 = $workShop2; - } - - public function manufacture() - { - } -} diff --git a/Structural/Bridge/Workshop.php b/Structural/Bridge/Workshop.php deleted file mode 100644 index 9cb26c5..0000000 --- a/Structural/Bridge/Workshop.php +++ /dev/null @@ -1,11 +0,0 @@ - - - PHP - \DesignPatterns\Structural\Bridge\Vehicle - - \DesignPatterns\Structural\Bridge\Workshop - \DesignPatterns\Structural\Bridge\Car - \DesignPatterns\Structural\Bridge\Produce - \DesignPatterns\Structural\Bridge\Motorcycle - \DesignPatterns\Structural\Bridge\Assemble - \DesignPatterns\Structural\Bridge\Vehicle - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Structural\Bridge\HtmlFormatter + + \DesignPatterns\Structural\Bridge\PlainTextFormatter + \DesignPatterns\Structural\Bridge\FormatterInterface + \DesignPatterns\Structural\Bridge\Service + \DesignPatterns\Structural\Bridge\HelloWorldService + \DesignPatterns\Structural\Bridge\HtmlFormatter + + + + + + + + + + + + + + + + + + + + + + + + Fields + Constants + Methods + + private + + diff --git a/Structural/Bridge/uml/uml.png b/Structural/Bridge/uml/uml.png index df6ce3c..6de5b02 100644 Binary files a/Structural/Bridge/uml/uml.png and b/Structural/Bridge/uml/uml.png differ diff --git a/Structural/Bridge/uml/uml.svg b/Structural/Bridge/uml/uml.svg index 189a7dc..9483eab 100644 --- a/Structural/Bridge/uml/uml.svg +++ b/Structural/Bridge/uml/uml.svg @@ -1,451 +1,661 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - work() - - - - - - - - - - - - - Workshop - - - Workshop - - - - - - - - - - - - - - - - - - - __construct(workShop1, workShop2) - - - - - - - - - - - - - manufacture() - - - - - - - - - - - - - Car - - - Car - - - - - - - - - - - - - - - - - - - work() - - - - - - - - - - - - - Produce - - - Produce - - - - - - - - - - - - - - - - - - - __construct(workShop1, workShop2) - - - - - - - - - - - - - manufacture() - - - - - - - - - - - - - Motorcycle - - - Motorcycle - - - - - - - - - - - - - - - - - - - work() - - - - - - - - - - - - - Assemble - - - Assemble - - - - - - - - - - - - - - - - - - - workShop1 - - - - - - - - - - workShop2 - - - - - - - - - - - - - __construct(workShop1, workShop2) - - - - - - - - - - - - - manufacture() - - - - - - - - - - - - - Vehicle - - - Vehicle - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + format(text) + + + + + + + + + + + + + PlainTextFormatter + + + PlainTextFormatter + + + + + + + + + + + + + + + + + + + + + + format(text) + + + + + + + + + + + + + PlainTextFormatter + + + PlainTextFormatter + + + + + + + + + + + + + + + + + + + + + + format(text) + + + + + + + + + + + + + FormatterInterface + + + FormatterInterface + + + + + + + + + + + + + + + + + + + + + + format(text) + + + + + + + + + + + + + FormatterInterface + + + FormatterInterface + + + + + + + + + + + + + + + + + + + + + + + + + implementation + + + + + + + + + + + + + + + + setImplementation(printer) + + + + + + + + + + + + + get() + + + + + + + + + + + + + Service + + + Service + + + + + + + + + + + + + + + + + + + + + + implementation + + + + + + + + + + + + + + + + + + + setImplementation(printer) + + + + + + + + + + + + + + + + get() + + + + + + + + + + + + + Service + + + Service + + + + + + + + + + + + + + + + + + + + + + get() + + + + + + + + + + + + + HelloWorldService + + + HelloWorldService + + + + + + + + + + + + + + + + + + + + + + get() + + + + + + + + + + + + + HelloWorldService + + + HelloWorldService + + + + + + + + + + + + + + + + + + + + + + format(text) + + + + + + + + + + + + + HtmlFormatter + + + HtmlFormatter + + + + + + + + + + + + + + + + + + + + + + format(text) + + + + + + + + + + + + + HtmlFormatter + + + HtmlFormatter + + + + + + + + + + + + + diff --git a/Structural/Composite/Form.php b/Structural/Composite/Form.php index 42f1bc1..6db2d3f 100644 --- a/Structural/Composite/Form.php +++ b/Structural/Composite/Form.php @@ -6,12 +6,12 @@ namespace DesignPatterns\Structural\Composite; * The composite node MUST extend the component contract. This is mandatory for building * a tree of components. */ -class Form extends FormElement +class Form implements RenderableInterface { /** - * @var array|FormElement[] + * @var RenderableInterface[] */ - protected $elements; + private $elements; /** * runs through all elements and calls render() on them, then returns the complete representation @@ -19,25 +19,25 @@ class Form extends FormElement * * from the outside, one will not see this and the form will act like a single object instance * - * @param int $indent - * * @return string */ - public function render($indent = 0) + public function render(): string { - $formCode = ''; + $formCode = '
'; foreach ($this->elements as $element) { - $formCode .= $element->render($indent + 1).PHP_EOL; + $formCode .= $element->render(); } + $formCode .= '
'; + return $formCode; } /** - * @param FormElement $element + * @param RenderableInterface $element */ - public function addElement(FormElement $element) + public function addElement(RenderableInterface $element) { $this->elements[] = $element; } diff --git a/Structural/Composite/FormElement.php b/Structural/Composite/FormElement.php deleted file mode 100644 index 0055aee..0000000 --- a/Structural/Composite/FormElement.php +++ /dev/null @@ -1,18 +0,0 @@ -'; + return ''; } } diff --git a/Structural/Composite/README.rst b/Structural/Composite/README.rst index 66d8f16..be4279a 100644 --- a/Structural/Composite/README.rst +++ b/Structural/Composite/README.rst @@ -26,11 +26,11 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ -FormElement.php +RenderableInterface.php -.. literalinclude:: FormElement.php +.. literalinclude:: RenderableInterface.php :language: php :linenos: diff --git a/Structural/Composite/RenderableInterface.php b/Structural/Composite/RenderableInterface.php new file mode 100644 index 0000000..444f707 --- /dev/null +++ b/Structural/Composite/RenderableInterface.php @@ -0,0 +1,8 @@ +addElement(new Composite\TextElement()); + $form->addElement(new Composite\TextElement('Email:')); $form->addElement(new Composite\InputElement()); $embed = new Composite\Form(); - $embed->addElement(new Composite\TextElement()); + $embed->addElement(new Composite\TextElement('Password:')); $embed->addElement(new Composite\InputElement()); - $form->addElement($embed); // here we have a embedded form (like SF2 does) + $form->addElement($embed); - $this->assertRegExp('#^\s{4}#m', $form->render()); - } + // This is just an example, in a real world scenario it is important to remember that web browsers do not + // currently support nested forms - /** - * The all point of this pattern, a Composite must inherit from the node - * if you want to builld trees. - */ - public function testFormImplementsFormEelement() - { - $className = 'DesignPatterns\Structural\Composite\Form'; - $abstractName = 'DesignPatterns\Structural\Composite\FormElement'; - $this->assertTrue(is_subclass_of($className, $abstractName)); + $this->assertEquals( + '
Email:Password:
', + $form->render() + ); } } diff --git a/Structural/Composite/TextElement.php b/Structural/Composite/TextElement.php index 48b33ba..55a868b 100644 --- a/Structural/Composite/TextElement.php +++ b/Structural/Composite/TextElement.php @@ -2,20 +2,20 @@ namespace DesignPatterns\Structural\Composite; -/** - * Class TextElement. - */ -class TextElement extends FormElement +class TextElement implements RenderableInterface { /** - * renders the text element. - * - * @param int $indent - * - * @return mixed|string + * @var string */ - public function render($indent = 0) + private $text; + + public function __construct(string $text) { - return str_repeat(' ', $indent).'this is a text element'; + $this->text = $text; + } + + public function render(): string + { + return $this->text; } } diff --git a/Structural/Composite/uml/Composite.uml b/Structural/Composite/uml/Composite.uml index 326dfd3..a874b2f 100644 --- a/Structural/Composite/uml/Composite.uml +++ b/Structural/Composite/uml/Composite.uml @@ -1,42 +1,39 @@ - - - PHP - \DesignPatterns\Structural\Composite\InputElement - - \DesignPatterns\Structural\Composite\TextElement - \DesignPatterns\Structural\Composite\FormElement - \DesignPatterns\Structural\Composite\InputElement - \DesignPatterns\Structural\Composite\Form - - - - - - - - - - - - - - - - - - - - - - - \DesignPatterns\Structural\Composite\InputElement - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Structural\Composite\Form + + \DesignPatterns\Structural\Composite\RenderableInterface + \DesignPatterns\Structural\Composite\InputElement + \DesignPatterns\Structural\Composite\TextElement + \DesignPatterns\Structural\Composite\Form + + + + + + + + + + + + + + + + + + + + + + + + Methods + Constants + Fields + + private + + diff --git a/Structural/Composite/uml/uml.png b/Structural/Composite/uml/uml.png index 5fed73d..1d8ad76 100644 Binary files a/Structural/Composite/uml/uml.png and b/Structural/Composite/uml/uml.png differ diff --git a/Structural/Composite/uml/uml.svg b/Structural/Composite/uml/uml.svg index c587818..ac9c76e 100644 --- a/Structural/Composite/uml/uml.svg +++ b/Structural/Composite/uml/uml.svg @@ -1,284 +1,606 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - render(indent) - - - - - - - - - - - - - TextElement - - - TextElement - - - - - - - - - - - - - - - - - - - render(indent) - - - - - - - - - - - - - FormElement - - - FormElement - - - - - - - - - - - - - - - - - - - render(indent) - - - - - - - - - - - - - InputElement - - - InputElement - - - - - - - - - - - - - - - - - - - elements - - - - - - - - - - - - - render(indent) - - - - - - - - - - addElement(element) - - - - - - - - - - - - - Form - - - Form - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + render() + + + + + + + + + + + + + RenderableInterface + + + RenderableInterface + + + + + + + + + + + + + + + + + + + + + + render() + + + + + + + + + + + + + RenderableInterface + + + RenderableInterface + + + + + + + + + + + + + + + + + + + + + + render() + + + + + + + + + + + + + InputElement + + + InputElement + + + + + + + + + + + + + + + + + + + + + + render() + + + + + + + + + + + + + InputElement + + + InputElement + + + + + + + + + + + + + + + + + + + + + + + + + text + + + + + + + + + + + + + + + + render() + + + + + + + + + + + + + TextElement + + + TextElement + + + + + + + + + + + + + + + + + + + + + + text + + + + + + + + + + + + + + + + + + + render() + + + + + + + + + + + + + TextElement + + + TextElement + + + + + + + + + + + + + + + + + + + + + + + + + elements + + + + + + + + + + + + + + + + render() + + + + + + + + + + + + + addElement(element) + + + + + + + + + + + + + Form + + + Form + + + + + + + + + + + + + + + + + + + + + + elements + + + + + + + + + + + + + + + + + + + render() + + + + + + + + + + + + + + + + addElement(element) + + + + + + + + + + + + + Form + + + Form + + + + + + + + + + + + + diff --git a/Structural/DataMapper/README.rst b/Structural/DataMapper/README.rst index 5180243..cd2834f 100644 --- a/Structural/DataMapper/README.rst +++ b/Structural/DataMapper/README.rst @@ -33,7 +33,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ User.php @@ -47,6 +47,12 @@ UserMapper.php :language: php :linenos: +StorageAdapter.php + +.. literalinclude:: StorageAdapter.php + :language: php + :linenos: + Test ---- diff --git a/Structural/DataMapper/StorageAdapter.php b/Structural/DataMapper/StorageAdapter.php new file mode 100644 index 0000000..2c9caef --- /dev/null +++ b/Structural/DataMapper/StorageAdapter.php @@ -0,0 +1,30 @@ +data = $data; + } + + /** + * @param int $id + * + * @return array|null + */ + public function find(int $id) + { + if (isset($this->data[$id])) { + return $this->data[$id]; + } + + return null; + } +} diff --git a/Structural/DataMapper/Tests/DataMapperTest.php b/Structural/DataMapper/Tests/DataMapperTest.php index 551c11e..fd03f45 100644 --- a/Structural/DataMapper/Tests/DataMapperTest.php +++ b/Structural/DataMapper/Tests/DataMapperTest.php @@ -2,109 +2,31 @@ namespace DesignPatterns\Structural\DataMapper\Tests; +use DesignPatterns\Structural\DataMapper\StorageAdapter; use DesignPatterns\Structural\DataMapper\User; use DesignPatterns\Structural\DataMapper\UserMapper; +use PHPUnit\Framework\TestCase; -/** - * UserMapperTest tests the datamapper pattern. - */ -class DataMapperTest extends \PHPUnit_Framework_TestCase +class DataMapperTest extends TestCase { - /** - * @var UserMapper - */ - protected $mapper; - - /** - * @var DBAL - */ - protected $dbal; - - protected function setUp() + public function testCanMapUserFromStorage() { - $this->dbal = $this->getMockBuilder('DesignPatterns\Structural\DataMapper\DBAL') - ->disableAutoload() - ->setMethods(array('insert', 'update', 'find', 'findAll')) - ->getMock(); + $storage = new StorageAdapter([1 => ['username' => 'domnikl', 'email' => 'liebler.dominik@gmail.com']]); + $mapper = new UserMapper($storage); - $this->mapper = new UserMapper($this->dbal); - } + $user = $mapper->findById(1); - public function getNewUser() - { - return array(array(new User(null, 'Odysseus', 'Odysseus@ithaca.gr'))); - } - - public function getExistingUser() - { - return array(array(new User(1, 'Odysseus', 'Odysseus@ithaca.gr'))); - } - - /** - * @dataProvider getNewUser - */ - public function testPersistNew(User $user) - { - $this->dbal->expects($this->once()) - ->method('insert'); - $this->mapper->save($user); - } - - /** - * @dataProvider getExistingUser - */ - public function testPersistExisting(User $user) - { - $this->dbal->expects($this->once()) - ->method('update'); - $this->mapper->save($user); - } - - /** - * @dataProvider getExistingUser - */ - public function testRestoreOne(User $existing) - { - $row = array( - 'userid' => 1, - 'username' => 'Odysseus', - 'email' => 'Odysseus@ithaca.gr', - ); - $rows = new \ArrayIterator(array($row)); - $this->dbal->expects($this->once()) - ->method('find') - ->with(1) - ->will($this->returnValue($rows)); - - $user = $this->mapper->findById(1); - $this->assertEquals($existing, $user); - } - - /** - * @dataProvider getExistingUser - */ - public function testRestoreMulti(User $existing) - { - $rows = array(array('userid' => 1, 'username' => 'Odysseus', 'email' => 'Odysseus@ithaca.gr')); - $this->dbal->expects($this->once()) - ->method('findAll') - ->will($this->returnValue($rows)); - - $user = $this->mapper->findAll(); - $this->assertEquals(array($existing), $user); + $this->assertInstanceOf(User::class, $user); } /** * @expectedException \InvalidArgumentException - * @expectedExceptionMessage User #404 not found */ - public function testNotFound() + public function testWillNotMapInvalidData() { - $this->dbal->expects($this->once()) - ->method('find') - ->with(404) - ->will($this->returnValue(array())); + $storage = new StorageAdapter([]); + $mapper = new UserMapper($storage); - $user = $this->mapper->findById(404); + $mapper->findById(1); } } diff --git a/Structural/DataMapper/User.php b/Structural/DataMapper/User.php index 8d8d2b2..8a6fd04 100644 --- a/Structural/DataMapper/User.php +++ b/Structural/DataMapper/User.php @@ -2,58 +2,36 @@ namespace DesignPatterns\Structural\DataMapper; -/** - * DataMapper pattern. - * - * This is our representation of a DataBase record in the memory (Entity) - * - * Validation would also go in this object - */ class User { /** - * @var int + * @var string */ - protected $userId; + private $username; /** * @var string */ - protected $username; + private $email; - /** - * @var string - */ - protected $email; - - /** - * @param null $id - * @param null $username - * @param null $email - */ - public function __construct($id = null, $username = null, $email = null) + public static function fromState(array $state): User { - $this->userId = $id; + // validate state before accessing keys! + + return new self( + $state['username'], + $state['email'] + ); + } + + public function __construct(string $username, string $email) + { + // validate parameters before setting them! + $this->username = $username; $this->email = $email; } - /** - * @return int - */ - public function getUserId() - { - return $this->userId; - } - - /** - * @param int $userId - */ - public function setUserID($userId) - { - $this->userId = $userId; - } - /** * @return string */ @@ -62,14 +40,6 @@ class User return $this->username; } - /** - * @param string $username - */ - public function setUsername($username) - { - $this->username = $username; - } - /** * @return string */ @@ -77,12 +47,4 @@ class User { return $this->email; } - - /** - * @param string $email - */ - public function setEmail($email) - { - $this->email = $email; - } } diff --git a/Structural/DataMapper/UserMapper.php b/Structural/DataMapper/UserMapper.php index f147063..415246a 100644 --- a/Structural/DataMapper/UserMapper.php +++ b/Structural/DataMapper/UserMapper.php @@ -2,107 +2,44 @@ namespace DesignPatterns\Structural\DataMapper; -/** - * class UserMapper. - */ class UserMapper { /** - * @var DBAL + * @var StorageAdapter */ - protected $adapter; + private $adapter; /** - * @param DBAL $dbLayer + * @param StorageAdapter $storage */ - public function __construct(DBAL $dbLayer) + public function __construct(StorageAdapter $storage) { - $this->adapter = $dbLayer; + $this->adapter = $storage; } /** - * saves a user object from memory to Database. - * - * @param User $user - * - * @return bool - */ - public function save(User $user) - { - /* $data keys should correspond to valid Table columns on the Database */ - $data = array( - 'userid' => $user->getUserId(), - 'username' => $user->getUsername(), - 'email' => $user->getEmail(), - ); - - /* if no ID specified create new user else update the one in the Database */ - if (null === ($id = $user->getUserId())) { - unset($data['userid']); - $this->adapter->insert($data); - - return true; - } else { - $this->adapter->update($data, array('userid = ?' => $id)); - - return true; - } - } - - /** - * finds a user from Database based on ID and returns a User object located - * in memory. + * finds a user from storage based on ID and returns a User object located + * in memory. Normally this kind of logic will be implemented using the Repository pattern. + * However the important part is in mapRowToUser() below, that will create a business object from the + * data fetched from storage * * @param int $id * - * @throws \InvalidArgumentException - * * @return User */ - public function findById($id) + public function findById(int $id): User { $result = $this->adapter->find($id); - if (0 == count($result)) { + if ($result === null) { throw new \InvalidArgumentException("User #$id not found"); } - $row = $result->current(); - return $this->mapObject($row); + return $this->mapRowToUser($result); } - /** - * fetches an array from Database and returns an array of User objects - * located in memory. - * - * @return array - */ - public function findAll() + private function mapRowToUser(array $row): User { - $resultSet = $this->adapter->findAll(); - $entries = array(); - - foreach ($resultSet as $row) { - $entries[] = $this->mapObject($row); - } - - return $entries; - } - - /** - * Maps a table row to an object. - * - * @param array $row - * - * @return User - */ - protected function mapObject(array $row) - { - $entry = new User(); - $entry->setUserID($row['userid']); - $entry->setUsername($row['username']); - $entry->setEmail($row['email']); - - return $entry; + return User::fromState($row); } } diff --git a/Structural/DataMapper/uml/DataMapper.uml b/Structural/DataMapper/uml/DataMapper.uml index 697e1f9..720faf8 100644 --- a/Structural/DataMapper/uml/DataMapper.uml +++ b/Structural/DataMapper/uml/DataMapper.uml @@ -1,23 +1,23 @@ - - - PHP - \DesignPatterns\Structural\DataMapper\User - - \DesignPatterns\Structural\DataMapper\User - \DesignPatterns\Structural\DataMapper\UserMapper - - - - - - \DesignPatterns\Structural\DataMapper\User - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Structural\DataMapper\StorageAdapter + + \DesignPatterns\Structural\DataMapper\UserMapper + \DesignPatterns\Structural\DataMapper\StorageAdapter + \DesignPatterns\Structural\DataMapper\User + + + + + + \DesignPatterns\Structural\DataMapper\StorageAdapter + + + Methods + Fields + Constants + + private + + diff --git a/Structural/DataMapper/uml/uml.png b/Structural/DataMapper/uml/uml.png index 97cd26a..d2f59ea 100644 Binary files a/Structural/DataMapper/uml/uml.png and b/Structural/DataMapper/uml/uml.png differ diff --git a/Structural/DataMapper/uml/uml.svg b/Structural/DataMapper/uml/uml.svg index d65a9c9..612769f 100644 --- a/Structural/DataMapper/uml/uml.svg +++ b/Structural/DataMapper/uml/uml.svg @@ -1,403 +1,680 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - userId - - - - - - - - - - username - - - - - - - - - - email - - - - - - - - - - - - - __construct(id, username, email) - - - - - - - - - - - - - getUserId() - - - - - - - - - - setUserID(userId) - - - - - - - - - - getUsername() - - - - - - - - - - setUsername(username) - - - - - - - - - - getEmail() - - - - - - - - - - setEmail(email) - - - - - - - - - - - - - User - - - User - - - - - - - - - - - - - - - - - - - adapter - - - - - - - - - - - - - __construct(dbLayer) - - - - - - - - - - - - - save(user) - - - - - - - - - - findById(id) - - - - - - - - - - findAll() - - - - - - - - - - mapObject(row) - - - - - - - - - - - - - UserMapper - - - UserMapper - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + adapter + + + + + + + + + + + + + + + + findById(id) + + + + + + + + + + + + + mapRowToUser(row) + + + + + + + + + + + + + UserMapper + + + UserMapper + + + + + + + + + + + + + + + + + + + + + + adapter + + + + + + + + + + + + + + + + + + + findById(id) + + + + + + + + + + + + + + + + mapRowToUser(row) + + + + + + + + + + + + + UserMapper + + + UserMapper + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + data + + + + + + + + + + + + + + + + find(id) + + + + + + + + + + + + + StorageAdapter + + + StorageAdapter + + + + + + + + + + + + + + + + + + + + + + data + + + + + + + + + + + + + + + + + + + find(id) + + + + + + + + + + + + + StorageAdapter + + + StorageAdapter + + + + + + + + + + + + + + + + + + + + + + + + + email + + + + + + + + + + + + + + + + username + + + + + + + + + + + + + + + + fromState(state) + + + + + + + + + + + + + getUsername() + + + + + + + + + + + + + getEmail() + + + + + + + + + + + + + User + + + User + + + + + + + + + + + + + + + + + + + + + + email + + + + + + + + + + + + + + + + username + + + + + + + + + + + + + + + + + + + + + + fromState(state) + + + + + + + + + + + + + + + + getUsername() + + + + + + + + + + + + + + + + getEmail() + + + + + + + + + + + + + User + + + User + + + diff --git a/Structural/Decorator/Decorator.php b/Structural/Decorator/Decorator.php deleted file mode 100644 index 0b8fde3..0000000 --- a/Structural/Decorator/Decorator.php +++ /dev/null @@ -1,31 +0,0 @@ -wrapped = $wrappable; - } -} diff --git a/Structural/Decorator/JsonRenderer.php b/Structural/Decorator/JsonRenderer.php new file mode 100644 index 0000000..9cc4066 --- /dev/null +++ b/Structural/Decorator/JsonRenderer.php @@ -0,0 +1,11 @@ +wrapped->renderData()); + } +} diff --git a/Structural/Decorator/README.rst b/Structural/Decorator/README.rst index b57a608..702fe12 100644 --- a/Structural/Decorator/README.rst +++ b/Structural/Decorator/README.rst @@ -23,11 +23,11 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ -RendererInterface.php +RenderableInterface.php -.. literalinclude:: RendererInterface.php +.. literalinclude:: RenderableInterface.php :language: php :linenos: @@ -37,21 +37,21 @@ Webservice.php :language: php :linenos: -Decorator.php +RendererDecorator.php -.. literalinclude:: Decorator.php +.. literalinclude:: RendererDecorator.php :language: php :linenos: -RenderInXml.php +XmlRenderer.php -.. literalinclude:: RenderInXml.php +.. literalinclude:: XmlRenderer.php :language: php :linenos: -RenderInJson.php +JsonRenderer.php -.. literalinclude:: RenderInJson.php +.. literalinclude:: JsonRenderer.php :language: php :linenos: diff --git a/Structural/Decorator/RenderInJson.php b/Structural/Decorator/RenderInJson.php deleted file mode 100644 index 71943bd..0000000 --- a/Structural/Decorator/RenderInJson.php +++ /dev/null @@ -1,21 +0,0 @@ -wrapped->renderData(); - - return json_encode($output); - } -} diff --git a/Structural/Decorator/RenderInXml.php b/Structural/Decorator/RenderInXml.php deleted file mode 100644 index 2eab7ca..0000000 --- a/Structural/Decorator/RenderInXml.php +++ /dev/null @@ -1,29 +0,0 @@ -wrapped->renderData(); - - // do some fancy conversion to xml from array ... - - $doc = new \DOMDocument(); - - foreach ($output as $key => $val) { - $doc->appendChild($doc->createElement($key, $val)); - } - - return $doc->saveXML(); - } -} diff --git a/Structural/Decorator/RenderableInterface.php b/Structural/Decorator/RenderableInterface.php new file mode 100644 index 0000000..07e11d1 --- /dev/null +++ b/Structural/Decorator/RenderableInterface.php @@ -0,0 +1,8 @@ +wrapped = $renderer; + } +} diff --git a/Structural/Decorator/RendererInterface.php b/Structural/Decorator/RendererInterface.php deleted file mode 100644 index 92b00ef..0000000 --- a/Structural/Decorator/RendererInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -service = new Decorator\Webservice(array('foo' => 'bar')); + $this->service = new Decorator\Webservice('foobar'); } public function testJsonDecorator() { - // Wrap service with a JSON decorator for renderers - $service = new Decorator\RenderInJson($this->service); - // Our Renderer will now output JSON instead of an array - $this->assertEquals('{"foo":"bar"}', $service->renderData()); + $service = new Decorator\JsonRenderer($this->service); + + $this->assertEquals('"foobar"', $service->renderData()); } public function testXmlDecorator() { - // 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'; - $this->assertXmlStringEqualsXmlString($xml, $service->renderData()); - } + $service = new Decorator\XmlRenderer($this->service); - /** - * The first key-point of this pattern :. - */ - public function testDecoratorMustImplementsRenderer() - { - $className = 'DesignPatterns\Structural\Decorator\Decorator'; - $interfaceName = 'DesignPatterns\Structural\Decorator\RendererInterface'; - $this->assertTrue(is_subclass_of($className, $interfaceName)); - } - - /** - * 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. - */ - public function testDecoratorOnlyAcceptRenderer() - { - $mock = $this->getMock('DesignPatterns\Structural\Decorator\RendererInterface'); - $dec = $this->getMockForAbstractClass('DesignPatterns\Structural\Decorator\Decorator', array($mock)); - $this->assertNotNull($dec); + $this->assertXmlStringEqualsXmlString('foobar', $service->renderData()); } } diff --git a/Structural/Decorator/Webservice.php b/Structural/Decorator/Webservice.php index e2bcc69..6715a22 100644 --- a/Structural/Decorator/Webservice.php +++ b/Structural/Decorator/Webservice.php @@ -2,28 +2,19 @@ namespace DesignPatterns\Structural\Decorator; -/** - * Class Webservice. - */ -class Webservice implements RendererInterface +class Webservice implements RenderableInterface { /** - * @var mixed + * @var string */ - protected $data; + private $data; - /** - * @param mixed $data - */ - public function __construct($data) + public function __construct(string $data) { $this->data = $data; } - /** - * @return string - */ - public function renderData() + public function renderData(): string { return $this->data; } diff --git a/Structural/Decorator/XmlRenderer.php b/Structural/Decorator/XmlRenderer.php new file mode 100644 index 0000000..012da47 --- /dev/null +++ b/Structural/Decorator/XmlRenderer.php @@ -0,0 +1,15 @@ +wrapped->renderData(); + $doc->appendChild($doc->createElement('content', $data)); + + return $doc->saveXML(); + } +} diff --git a/Structural/DependencyInjection/AbstractConfig.php b/Structural/DependencyInjection/AbstractConfig.php deleted file mode 100644 index f2da4dc..0000000 --- a/Structural/DependencyInjection/AbstractConfig.php +++ /dev/null @@ -1,19 +0,0 @@ -storage = $storage; - } -} diff --git a/Structural/DependencyInjection/ArrayConfig.php b/Structural/DependencyInjection/ArrayConfig.php deleted file mode 100644 index f26c089..0000000 --- a/Structural/DependencyInjection/ArrayConfig.php +++ /dev/null @@ -1,39 +0,0 @@ -storage[$key])) { - return $this->storage[$key]; - } - - return $default; - } - - /** - * Set parameter. - * - * @param string|int $key - * @param mixed $value - */ - public function set($key, $value) - { - $this->storage[$key] = $value; - } -} diff --git a/Structural/DependencyInjection/Connection.php b/Structural/DependencyInjection/Connection.php deleted file mode 100644 index d389089..0000000 --- a/Structural/DependencyInjection/Connection.php +++ /dev/null @@ -1,50 +0,0 @@ -configuration = $config; - } - - /** - * connection using the injected config. - */ - public function connect() - { - $host = $this->configuration->get('host'); - // connection to host, authentication etc... - - //if connected - $this->host = $host; - } - - /* - * Get currently connected host - * - * @return string - */ - - public function getHost() - { - return $this->host; - } -} diff --git a/Structural/DependencyInjection/DatabaseConfiguration.php b/Structural/DependencyInjection/DatabaseConfiguration.php new file mode 100644 index 0000000..51d72d7 --- /dev/null +++ b/Structural/DependencyInjection/DatabaseConfiguration.php @@ -0,0 +1,54 @@ +host = $host; + $this->port = $port; + $this->username = $username; + $this->password = $password; + } + + public function getHost(): string + { + return $this->host; + } + + public function getPort(): int + { + return $this->port; + } + + public function getUsername(): string + { + return $this->username; + } + + public function getPassword(): string + { + return $this->password; + } +} diff --git a/Structural/DependencyInjection/DatabaseConnection.php b/Structural/DependencyInjection/DatabaseConnection.php new file mode 100644 index 0000000..b5af8ba --- /dev/null +++ b/Structural/DependencyInjection/DatabaseConnection.php @@ -0,0 +1,34 @@ +configuration = $config; + } + + public function getDsn(): string + { + // this is just for the sake of demonstration, not a real DSN + // notice that only the injected config is used here, so there is + // a real separation of concerns here + + return sprintf( + '%s:%s@%s:%d', + $this->configuration->getUsername(), + $this->configuration->getPassword(), + $this->configuration->getHost(), + $this->configuration->getPort() + ); + } +} diff --git a/Structural/DependencyInjection/Parameters.php b/Structural/DependencyInjection/Parameters.php deleted file mode 100644 index c49f4c7..0000000 --- a/Structural/DependencyInjection/Parameters.php +++ /dev/null @@ -1,26 +0,0 @@ -`__. +directly in ``DatabaseConnection``, which is not very good for testing and +extending it. Examples -------- @@ -43,29 +36,17 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ -AbstractConfig.php +DatabaseConfiguration.php -.. literalinclude:: AbstractConfig.php +.. literalinclude:: DatabaseConfiguration.php :language: php :linenos: -Parameters.php +DatabaseConnection.php -.. literalinclude:: Parameters.php - :language: php - :linenos: - -ArrayConfig.php - -.. literalinclude:: ArrayConfig.php - :language: php - :linenos: - -Connection.php - -.. literalinclude:: Connection.php +.. literalinclude:: DatabaseConnection.php :language: php :linenos: @@ -78,11 +59,5 @@ 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/DependencyInjection/Tests/DependencyInjectionTest.php b/Structural/DependencyInjection/Tests/DependencyInjectionTest.php index 6df82a7..c2375f3 100644 --- a/Structural/DependencyInjection/Tests/DependencyInjectionTest.php +++ b/Structural/DependencyInjection/Tests/DependencyInjectionTest.php @@ -2,24 +2,17 @@ namespace DesignPatterns\Structural\DependencyInjection\Tests; -use DesignPatterns\Structural\DependencyInjection\ArrayConfig; -use DesignPatterns\Structural\DependencyInjection\Connection; +use DesignPatterns\Structural\DependencyInjection\DatabaseConfiguration; +use DesignPatterns\Structural\DependencyInjection\DatabaseConnection; +use PHPUnit\Framework\TestCase; -class DependencyInjectionTest extends \PHPUnit_Framework_TestCase +class DependencyInjectionTest extends TestCase { - protected $config; - protected $source; - - public function setUp() - { - $this->source = include 'config.php'; - $this->config = new ArrayConfig($this->source); - } - public function testDependencyInjection() { - $connection = new Connection($this->config); - $connection->connect(); - $this->assertEquals($this->source['host'], $connection->getHost()); + $config = new DatabaseConfiguration('localhost', 3306, 'domnikl', '1234'); + $connection = new DatabaseConnection($config); + + $this->assertEquals('domnikl:1234@localhost:3306', $connection->getDsn()); } } diff --git a/Structural/DependencyInjection/Tests/config.php b/Structural/DependencyInjection/Tests/config.php deleted file mode 100644 index 29d3683..0000000 --- a/Structural/DependencyInjection/Tests/config.php +++ /dev/null @@ -1,3 +0,0 @@ - 'github.com'); diff --git a/Structural/DependencyInjection/uml/DependencyInjection.uml b/Structural/DependencyInjection/uml/DependencyInjection.uml index e058b19..2434332 100644 --- a/Structural/DependencyInjection/uml/DependencyInjection.uml +++ b/Structural/DependencyInjection/uml/DependencyInjection.uml @@ -1,38 +1,20 @@ - - - PHP - \DesignPatterns\Structural\DependencyInjection\AbstractConfig - - \DesignPatterns\Structural\DependencyInjection\Connection - \DesignPatterns\Structural\DependencyInjection\ArrayConfig - \DesignPatterns\Structural\DependencyInjection\Parameters - \DesignPatterns\Structural\DependencyInjection\AbstractConfig - - - - - - - - - - - - - - - - - - - \DesignPatterns\Structural\DependencyInjection\AbstractConfig - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Structural\DependencyInjection\DatabaseConfiguration + + \DesignPatterns\Structural\DependencyInjection\DatabaseConnection + \DesignPatterns\Structural\DependencyInjection\DatabaseConfiguration + + + + + + + Methods + Constants + Fields + + private + + diff --git a/Structural/DependencyInjection/uml/uml.png b/Structural/DependencyInjection/uml/uml.png index 67e6ca1..992d9a1 100644 Binary files a/Structural/DependencyInjection/uml/uml.png and b/Structural/DependencyInjection/uml/uml.png differ diff --git a/Structural/DependencyInjection/uml/uml.svg b/Structural/DependencyInjection/uml/uml.svg index 78d603d..1e15816 100644 --- a/Structural/DependencyInjection/uml/uml.svg +++ b/Structural/DependencyInjection/uml/uml.svg @@ -1,425 +1,573 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - configuration - - - - - - - - - - host - - - - - - - - - - - - - __construct(config) - - - - - - - - - - - - - connect() - - - - - - - - - - getHost() - - - - - - - - - - - - - Connection - - - Connection - - - - - - - - - - - - - - - - - - - get(key, default) - - - - - - - - - - set(key, value) - - - - - - - - - - - - - ArrayConfig - - - ArrayConfig - - - - - - - - - - - - - - - - - - - get(key) - - - - - - - - - - set(key, value) - - - - - - - - - - - - - Parameters - - - Parameters - - - - - - - - - - - - - - - - - - - storage - - - - - - - - - - - - - __construct(storage) - - - - - - - - - - - - - AbstractConfig - - - AbstractConfig - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + configuration + + + + + + + + + + + + + + + + getDsn() + + + + + + + + + + + + + DatabaseConnection + + + DatabaseConnection + + + + + + + + + + + + + + + + + + + + + + configuration + + + + + + + + + + + + + + + + + + + getDsn() + + + + + + + + + + + + + DatabaseConnection + + + DatabaseConnection + + + + + + + + + + + + + + + + + + + + + + + + + password + + + + + + + + + + + + + + + + port + + + + + + + + + + + + + + + + host + + + + + + + + + + + + + + + + username + + + + + + + + + + + + + + + + getHost() + + + + + + + + + + + + + getPort() + + + + + + + + + + + + + getUsername() + + + + + + + + + + + + + getPassword() + + + + + + + + + + + + + DatabaseConfiguration + + + DatabaseConfiguration + + + + + + + + + + + + + + + + + + + + + + password + + + + + + + + + + + + + + + + port + + + + + + + + + + + + + + + + host + + + + + + + + + + + + + + + + username + + + + + + + + + + + + + + + + + + + getHost() + + + + + + + + + + + + + + + + getPort() + + + + + + + + + + + + + + + + getUsername() + + + + + + + + + + + + + + + + getPassword() + + + + + + + + + + + + + DatabaseConfiguration + + + DatabaseConfiguration + + + diff --git a/Structural/Facade/BiosInterface.php b/Structural/Facade/BiosInterface.php index 823af04..ba6bdbe 100644 --- a/Structural/Facade/BiosInterface.php +++ b/Structural/Facade/BiosInterface.php @@ -2,30 +2,13 @@ namespace DesignPatterns\Structural\Facade; -/** - * Class BiosInterface. - */ interface BiosInterface { - /** - * execute the BIOS. - */ public function execute(); - /** - * wait for halt. - */ public function waitForKeyPress(); - /** - * launches the OS. - * - * @param OsInterface $os - */ public function launch(OsInterface $os); - /** - * power down BIOS. - */ public function powerDown(); } diff --git a/Structural/Facade/Facade.php b/Structural/Facade/Facade.php index 50c665d..bda8b46 100644 --- a/Structural/Facade/Facade.php +++ b/Structural/Facade/Facade.php @@ -2,25 +2,19 @@ namespace DesignPatterns\Structural\Facade; -/** - * - */ class Facade { /** * @var OsInterface */ - protected $os; + private $os; /** * @var BiosInterface */ - protected $bios; + private $bios; /** - * This is the perfect time to use a dependency injection container - * to create an instance of this class. - * * @param BiosInterface $bios * @param OsInterface $os */ @@ -30,9 +24,6 @@ class Facade $this->os = $os; } - /** - * turn on the system. - */ public function turnOn() { $this->bios->execute(); @@ -40,9 +31,6 @@ class Facade $this->bios->launch($this->os); } - /** - * turn off the system. - */ public function turnOff() { $this->os->halt(); diff --git a/Structural/Facade/OsInterface.php b/Structural/Facade/OsInterface.php index 8394fd4..1b3a93e 100644 --- a/Structural/Facade/OsInterface.php +++ b/Structural/Facade/OsInterface.php @@ -2,13 +2,9 @@ namespace DesignPatterns\Structural\Facade; -/** - * Class OsInterface. - */ interface OsInterface { - /** - * halt the OS. - */ public function halt(); + + public function getName(): string; } diff --git a/Structural/Facade/README.rst b/Structural/Facade/README.rst index da20b13..46b729b 100644 --- a/Structural/Facade/README.rst +++ b/Structural/Facade/README.rst @@ -33,7 +33,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Facade.php diff --git a/Structural/Facade/Tests/FacadeTest.php b/Structural/Facade/Tests/FacadeTest.php index e6038a0..de75ae2 100644 --- a/Structural/Facade/Tests/FacadeTest.php +++ b/Structural/Facade/Tests/FacadeTest.php @@ -2,45 +2,35 @@ namespace DesignPatterns\Structural\Facade\Tests; -use DesignPatterns\Structural\Facade\Facade as Computer; +use DesignPatterns\Structural\Facade\Facade; use DesignPatterns\Structural\Facade\OsInterface; +use PHPUnit\Framework\TestCase; -/** - * FacadeTest shows example of facades. - */ -class FacadeTest extends \PHPUnit_Framework_TestCase +class FacadeTest extends TestCase { - public function getComputer() + public function testComputerOn() { + /** @var OsInterface|\PHPUnit_Framework_MockObject_MockObject $os */ + $os = $this->createMock('DesignPatterns\Structural\Facade\OsInterface'); + + $os->method('getName') + ->will($this->returnValue('Linux')); + $bios = $this->getMockBuilder('DesignPatterns\Structural\Facade\BiosInterface') - ->setMethods(array('launch', 'execute', 'waitForKeyPress')) - ->disableAutoload() - ->getMock(); - $operatingSys = $this->getMockBuilder('DesignPatterns\Structural\Facade\OsInterface') - ->setMethods(array('getName')) - ->disableAutoload() - ->getMock(); + ->setMethods(['launch', 'execute', 'waitForKeyPress']) + ->disableAutoload() + ->getMock(); + $bios->expects($this->once()) - ->method('launch') - ->with($operatingSys); - $operatingSys - ->expects($this->once()) - ->method('getName') - ->will($this->returnValue('Linux')); + ->method('launch') + ->with($os); - $facade = new Computer($bios, $operatingSys); + $facade = new Facade($bios, $os); - return array(array($facade, $operatingSys)); - } - - /** - * @dataProvider getComputer - */ - public function testComputerOn(Computer $facade, OsInterface $os) - { - // interface is simpler : + // the facade interface is simple $facade->turnOn(); - // but I can access to lower component + + // but you can also access the underlying components $this->assertEquals('Linux', $os->getName()); } } diff --git a/Structural/Facade/uml/Facade.uml b/Structural/Facade/uml/Facade.uml index d6bdd03..8835df8 100644 --- a/Structural/Facade/uml/Facade.uml +++ b/Structural/Facade/uml/Facade.uml @@ -1,24 +1,23 @@ - - - PHP - \DesignPatterns\Structural\Facade\BiosInterface - - \DesignPatterns\Structural\Facade\BiosInterface - \DesignPatterns\Structural\Facade\OsInterface - \DesignPatterns\Structural\Facade\Facade - - - - - - \DesignPatterns\Structural\Facade\BiosInterface - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Structural\Facade\BiosInterface + + \DesignPatterns\Structural\Facade\BiosInterface + \DesignPatterns\Structural\Facade\Facade + \DesignPatterns\Structural\Facade\OsInterface + + + + + + \DesignPatterns\Structural\Facade\BiosInterface + + + Methods + Constants + Fields + + private + + diff --git a/Structural/Facade/uml/uml.png b/Structural/Facade/uml/uml.png index da5097a..fcea5f2 100644 Binary files a/Structural/Facade/uml/uml.png and b/Structural/Facade/uml/uml.png differ diff --git a/Structural/Facade/uml/uml.svg b/Structural/Facade/uml/uml.svg index 2e7b400..a14db50 100644 --- a/Structural/Facade/uml/uml.svg +++ b/Structural/Facade/uml/uml.svg @@ -1,324 +1,653 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - execute() - - - - - - - - - - waitForKeyPress() - - - - - - - - - - launch(os) - - - - - - - - - - powerDown() - - - - - - - - - - - - - BiosInterface - - - BiosInterface - - - - - - - - - - - - - - - - - - - halt() - - - - - - - - - - - - - OsInterface - - - OsInterface - - - - - - - - - - - - - - - - - - - os - - - - - - - - - - bios - - - - - - - - - - - - - __construct(bios, os) - - - - - - - - - - - - - turnOn() - - - - - - - - - - turnOff() - - - - - - - - - - - - - Facade - - - Facade - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + execute() + + + + + + + + + + + + + waitForKeyPress() + + + + + + + + + + + + + launch(os) + + + + + + + + + + + + + powerDown() + + + + + + + + + + + + + BiosInterface + + + BiosInterface + + + + + + + + + + + + + + + + + + + + + + execute() + + + + + + + + + + + + + + + + waitForKeyPress() + + + + + + + + + + + + + + + + launch(os) + + + + + + + + + + + + + + + + powerDown() + + + + + + + + + + + + + BiosInterface + + + BiosInterface + + + + + + + + + + + + + + + + + + + + + + + + + os + + + + + + + + + + + + + + + + bios + + + + + + + + + + + + + + + + turnOn() + + + + + + + + + + + + + turnOff() + + + + + + + + + + + + + Facade + + + Facade + + + + + + + + + + + + + + + + + + + + + + os + + + + + + + + + + + + + + + + bios + + + + + + + + + + + + + + + + + + + turnOn() + + + + + + + + + + + + + + + + turnOff() + + + + + + + + + + + + + Facade + + + Facade + + + + + + + + + + + + + + + + + + + + + + halt() + + + + + + + + + + + + + getName() + + + + + + + + + + + + + OsInterface + + + OsInterface + + + + + + + + + + + + + + + + + + + + + + halt() + + + + + + + + + + + + + + + + getName() + + + + + + + + + + + + + OsInterface + + + OsInterface + + + diff --git a/Structural/FluentInterface/README.rst b/Structural/FluentInterface/README.rst index 2fcef3b..6eb6b50 100644 --- a/Structural/FluentInterface/README.rst +++ b/Structural/FluentInterface/README.rst @@ -25,7 +25,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Sql.php diff --git a/Structural/FluentInterface/Sql.php b/Structural/FluentInterface/Sql.php index 58ba491..ed54992 100644 --- a/Structural/FluentInterface/Sql.php +++ b/Structural/FluentInterface/Sql.php @@ -2,79 +2,51 @@ namespace DesignPatterns\Structural\FluentInterface; -/** - * class SQL. - */ class Sql { /** * @var array */ - protected $fields = array(); + private $fields = []; /** * @var array */ - protected $from = array(); + private $from = []; /** * @var array */ - protected $where = array(); + private $where = []; - /** - * adds select fields. - * - * @param array $fields - * - * @return SQL - */ - public function select(array $fields = array()) + public function select(array $fields): Sql { $this->fields = $fields; return $this; } - /** - * adds a FROM clause. - * - * @param string $table - * @param string $alias - * - * @return SQL - */ - public function from($table, $alias) + public function from(string $table, string $alias): Sql { $this->from[] = $table.' AS '.$alias; return $this; } - /** - * adds a WHERE condition. - * - * @param string $condition - * - * @return SQL - */ - public function where($condition) + public function where(string $condition): Sql { $this->where[] = $condition; return $this; } - /** - * Gets the query, just an example of building a query, - * no check on consistency. - * - * @return string - */ - public function getQuery() + public function __toString(): string { - return 'SELECT '.implode(',', $this->fields) - .' FROM '.implode(',', $this->from) - .' WHERE '.implode(' AND ', $this->where); + return sprintf( + 'SELECT %s FROM %s WHERE %s', + join(', ', $this->fields), + join(', ', $this->from), + join(' AND ', $this->where) + ); } } diff --git a/Structural/FluentInterface/Tests/FluentInterfaceTest.php b/Structural/FluentInterface/Tests/FluentInterfaceTest.php index ae4e656..ff1c058 100644 --- a/Structural/FluentInterface/Tests/FluentInterfaceTest.php +++ b/Structural/FluentInterface/Tests/FluentInterfaceTest.php @@ -3,20 +3,17 @@ namespace DesignPatterns\Structural\FluentInterface\Tests; use DesignPatterns\Structural\FluentInterface\Sql; +use PHPUnit\Framework\TestCase; -/** - * FluentInterfaceTest tests the fluent interface SQL. - */ -class FluentInterfaceTest extends \PHPUnit_Framework_TestCase +class FluentInterfaceTest extends TestCase { public function testBuildSQL() { - $instance = new Sql(); - $query = $instance->select(array('foo', 'bar')) + $query = (new Sql()) + ->select(['foo', 'bar']) ->from('foobar', 'f') - ->where('f.bar = ?') - ->getQuery(); + ->where('f.bar = ?'); - $this->assertEquals('SELECT foo,bar FROM foobar AS f WHERE f.bar = ?', $query); + $this->assertEquals('SELECT foo, bar FROM foobar AS f WHERE f.bar = ?', (string) $query); } } diff --git a/Structural/FluentInterface/uml/FluentInterface.uml b/Structural/FluentInterface/uml/FluentInterface.uml index 8fca787..552b641 100644 --- a/Structural/FluentInterface/uml/FluentInterface.uml +++ b/Structural/FluentInterface/uml/FluentInterface.uml @@ -1,22 +1,19 @@ - - - PHP - \DesignPatterns\Structural\FluentInterface\Sql - - \DesignPatterns\Structural\FluentInterface\Sql - - - - - - \DesignPatterns\Structural\FluentInterface\Sql - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Structural\FluentInterface\Sql + + \DesignPatterns\Structural\FluentInterface\Sql + + + + + + + Fields + Constants + Methods + + private + + diff --git a/Structural/FluentInterface/uml/uml.png b/Structural/FluentInterface/uml/uml.png index e49aa57..2f38396 100644 Binary files a/Structural/FluentInterface/uml/uml.png and b/Structural/FluentInterface/uml/uml.png differ diff --git a/Structural/FluentInterface/uml/uml.svg b/Structural/FluentInterface/uml/uml.svg index 60a8564..9418314 100644 --- a/Structural/FluentInterface/uml/uml.svg +++ b/Structural/FluentInterface/uml/uml.svg @@ -1,191 +1,377 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fields - - - - - - - - - - from - - - - - - - - - - where - - - - - - - - - - - - - select(fields) - - - - - - - - - - from(table, alias) - - - - - - - - - - where(condition) - - - - - - - - - - getQuery() - - - - - - - - - - - - - Sql - - - Sql - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + from + + + + + + + + + + + + + + + + where + + + + + + + + + + + + + + + + fields + + + + + + + + + + + + + + + + select(fields) + + + + + + + + + + + + + from(table, alias) + + + + + + + + + + + + + where(condition) + + + + + + + + + + + + + __toString() + + + + + + + + + + + + + Sql + + + Sql + + + + + + + + + + + + + + + + + + + + + + from + + + + + + + + + + + + + + + + where + + + + + + + + + + + + + + + + fields + + + + + + + + + + + + + + + + + + + select(fields) + + + + + + + + + + + + + + + + from(table, alias) + + + + + + + + + + + + + + + + where(condition) + + + + + + + + + + + + + + + + __toString() + + + + + + + + + + + + + Sql + + + Sql + + + diff --git a/Structural/Flyweight/CharacterFlyweight.php b/Structural/Flyweight/CharacterFlyweight.php new file mode 100644 index 0000000..d1e7954 --- /dev/null +++ b/Structural/Flyweight/CharacterFlyweight.php @@ -0,0 +1,31 @@ +name = $name; + } + + public function render(string $font): string + { + // Clients supply the context-dependent information that the flyweight needs to draw itself + // For flyweights representing characters, extrinsic state usually contains e.g. the font. + + return sprintf('Character %s with font %s', $this->name, $font); + } +} diff --git a/Structural/Flyweight/FlyweightFactory.php b/Structural/Flyweight/FlyweightFactory.php new file mode 100644 index 0000000..a295a22 --- /dev/null +++ b/Structural/Flyweight/FlyweightFactory.php @@ -0,0 +1,29 @@ +pool[$name])) { + $this->pool[$name] = new CharacterFlyweight($name); + } + + return $this->pool[$name]; + } + + public function count(): int + { + return count($this->pool); + } +} diff --git a/Structural/Flyweight/FlyweightInterface.php b/Structural/Flyweight/FlyweightInterface.php new file mode 100644 index 0000000..032a1be --- /dev/null +++ b/Structural/Flyweight/FlyweightInterface.php @@ -0,0 +1,8 @@ +characters as $char) { + foreach ($this->fonts as $font) { + $flyweight = $factory->get($char); + $rendered = $flyweight->render($font); + + $this->assertEquals(sprintf('Character %s with font %s', $char, $font), $rendered); + } + } + + // Flyweight pattern ensures that instances are shared + // instead of having hundreds of thousands of individual objects + // there must be one instance for every char that has been reused for displaying in different fonts + $this->assertCount(count($this->characters), $factory); + } +} diff --git a/Structural/Flyweight/uml/Flyweight.uml b/Structural/Flyweight/uml/Flyweight.uml new file mode 100644 index 0000000..61c78dd --- /dev/null +++ b/Structural/Flyweight/uml/Flyweight.uml @@ -0,0 +1,26 @@ + + + PHP + \DesignPatterns\Structural\Flyweight\CharacterFlyweight + + \DesignPatterns\Structural\Flyweight\CharacterFlyweight + \DesignPatterns\Structural\Flyweight\FlyweightFactory + \DesignPatterns\Structural\Flyweight\FlyweightInterface + + + + + + + + + + + + Fields + Constants + Methods + + private + + diff --git a/Structural/Flyweight/uml/uml.png b/Structural/Flyweight/uml/uml.png new file mode 100644 index 0000000..26af3e3 Binary files /dev/null and b/Structural/Flyweight/uml/uml.png differ diff --git a/Structural/Flyweight/uml/uml.svg b/Structural/Flyweight/uml/uml.svg new file mode 100644 index 0000000..fc0d70b --- /dev/null +++ b/Structural/Flyweight/uml/uml.svg @@ -0,0 +1,503 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + render(font) + + + + + + + + + + + + + CharacterFlyweight + + + CharacterFlyweight + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + render(font) + + + + + + + + + + + + + CharacterFlyweight + + + CharacterFlyweight + + + + + + + + + + + + + + + + + + + + + + + + + pool + + + + + + + + + + + + + + + + get(name) + + + + + + + + + + + + + count() + + + + + + + + + + + + + FlyweightFactory + + + FlyweightFactory + + + + + + + + + + + + + + + + + + + + + + pool + + + + + + + + + + + + + + + + + + + get(name) + + + + + + + + + + + + + + + + count() + + + + + + + + + + + + + FlyweightFactory + + + FlyweightFactory + + + + + + + + + + + + + + + + + + + + + + render(extrinsicState) + + + + + + + + + + + + + FlyweightInterface + + + FlyweightInterface + + + + + + + + + + + + + + + + + + + + + + render(extrinsicState) + + + + + + + + + + + + + FlyweightInterface + + + FlyweightInterface + + + + + + + + + diff --git a/Structural/Proxy/README.rst b/Structural/Proxy/README.rst index e65475b..554a0fc 100644 --- a/Structural/Proxy/README.rst +++ b/Structural/Proxy/README.rst @@ -23,7 +23,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Record.php diff --git a/Structural/Proxy/Record.php b/Structural/Proxy/Record.php index 7ae4a3c..ea018b2 100644 --- a/Structural/Proxy/Record.php +++ b/Structural/Proxy/Record.php @@ -3,49 +3,38 @@ namespace DesignPatterns\Structural\Proxy; /** - * class Record. + * @property string username */ class Record { /** - * @var array|null + * @var string[] */ - protected $data; + private $data; /** - * @param null $data + * @param string[] $data */ - public function __construct($data = null) + public function __construct(array $data = []) { - $this->data = (array) $data; + $this->data = $data; } /** - * magic setter. - * * @param string $name - * @param mixed $value - * - * @return void + * @param string $value */ - public function __set($name, $value) + public function __set(string $name, string $value) { - $this->data[(string) $name] = $value; + $this->data[$name] = $value; } - /** - * magic getter. - * - * @param string $name - * - * @return mixed|null - */ - public function __get($name) + public function __get(string $name): string { - if (array_key_exists($name, $this->data)) { - return $this->data[(string) $name]; - } else { - return; + if (!isset($this->data[$name])) { + throw new \OutOfRangeException('Invalid name given'); } + + return $this->data[$name]; } } diff --git a/Structural/Proxy/RecordProxy.php b/Structural/Proxy/RecordProxy.php index f8c78a8..4d29ee8 100644 --- a/Structural/Proxy/RecordProxy.php +++ b/Structural/Proxy/RecordProxy.php @@ -2,25 +2,22 @@ namespace DesignPatterns\Structural\Proxy; -/** - * Class RecordProxy. - */ class RecordProxy extends Record { /** * @var bool */ - protected $isDirty = false; + private $isDirty = false; /** * @var bool */ - protected $isInitialized = false; + private $isInitialized = false; /** * @param array $data */ - public function __construct($data) + public function __construct(array $data) { parent::__construct($data); @@ -28,23 +25,25 @@ class RecordProxy extends Record // since Record will hold our business logic, we don't want to // implement this behaviour there, but instead in a new proxy class // that extends the Record class - if (null !== $data) { + if (count($data) > 0) { $this->isInitialized = true; $this->isDirty = true; } } /** - * magic setter. - * * @param string $name - * @param mixed $value - * - * @return void + * @param string $value */ - public function __set($name, $value) + public function __set(string $name, string $value) { $this->isDirty = true; + parent::__set($name, $value); } + + public function isDirty(): bool + { + return $this->isDirty; + } } diff --git a/Structural/Proxy/Tests/ProxyTest.php b/Structural/Proxy/Tests/ProxyTest.php new file mode 100644 index 0000000..f2cf2f4 --- /dev/null +++ b/Structural/Proxy/Tests/ProxyTest.php @@ -0,0 +1,25 @@ +username = 'baz'; + + $this->assertTrue($recordProxy->isDirty()); + } + + public function testProxyIsInstanceOfRecord() + { + $recordProxy = new RecordProxy([]); + $recordProxy->username = 'baz'; + + $this->assertInstanceOf(RecordProxy::class, $recordProxy); + } +} diff --git a/Structural/README.md b/Structural/README.md index 6def831..40f2c10 100644 --- a/Structural/README.md +++ b/Structural/README.md @@ -12,5 +12,6 @@ entities. * [DependencyInjection](DependencyInjection) [:notebook:](http://en.wikipedia.org/wiki/Dependency_injection) * [Facade](Facade) [:notebook:](http://en.wikipedia.org/wiki/Facade_pattern) * [FluentInterface](FluentInterface) [:notebook:](http://en.wikipedia.org/wiki/Fluent_interface) +* [Flyweight](Flyweight) [:notebook:](https://en.wikipedia.org/wiki/Flyweight_pattern) * [Proxy](Proxy) [:notebook:](http://en.wikipedia.org/wiki/Proxy_pattern) * [Registry](Registry) [:notebook:](http://en.wikipedia.org/wiki/Service_locator_pattern) diff --git a/Structural/README.rst b/Structural/README.rst index fcf7c58..8715963 100644 --- a/Structural/README.rst +++ b/Structural/README.rst @@ -16,6 +16,7 @@ relationships between entities. DependencyInjection/README Facade/README FluentInterface/README + Flyweight/README Proxy/README Registry/README diff --git a/Structural/Registry/README.rst b/Structural/Registry/README.rst index 8a92604..440c108 100644 --- a/Structural/Registry/README.rst +++ b/Structural/Registry/README.rst @@ -6,7 +6,8 @@ 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) +static methods (or using the Singleton pattern). Remember that this introduces +global state, which should be avoided at all times! Instead implement it using Dependency Injection! Examples -------- @@ -26,7 +27,7 @@ UML Diagram Code ---- -You can also find these code on `GitHub`_ +You can also find this code on `GitHub`_ Registry.php diff --git a/Structural/Registry/Registry.php b/Structural/Registry/Registry.php index e40d0c3..dccaf6f 100644 --- a/Structural/Registry/Registry.php +++ b/Structural/Registry/Registry.php @@ -2,46 +2,51 @@ namespace DesignPatterns\Structural\Registry; -/** - * class Registry. - */ abstract class Registry { const LOGGER = 'logger'; /** + * this introduces global state in your application which can not be mocked up for testing + * and is therefor considered an anti-pattern! Use dependency injection instead! + * * @var array */ - protected static $storedValues = array(); + private static $storedValues = []; + + /** + * @var array + */ + private static $allowedKeys = [ + self::LOGGER, + ]; /** - * sets a value. - * * @param string $key * @param mixed $value * - * @static - * * @return void */ - public static function set($key, $value) + public static function set(string $key, $value) { + if (!in_array($key, self::$allowedKeys)) { + throw new \InvalidArgumentException('Invalid key given'); + } + self::$storedValues[$key] = $value; } /** - * gets a value from the registry. - * * @param string $key * - * @static - * * @return mixed */ - public static function get($key) + public static function get(string $key) { + if (!in_array($key, self::$allowedKeys) || !isset(self::$storedValues[$key])) { + throw new \InvalidArgumentException('Invalid key given'); + } + return self::$storedValues[$key]; } - - // typically there would be methods to check if a key has already been registered and so on ... } diff --git a/Structural/Registry/Tests/RegistryTest.php b/Structural/Registry/Tests/RegistryTest.php index 9561abe..a026415 100644 --- a/Structural/Registry/Tests/RegistryTest.php +++ b/Structural/Registry/Tests/RegistryTest.php @@ -3,18 +3,41 @@ namespace DesignPatterns\Structural\Registry\Tests; use DesignPatterns\Structural\Registry\Registry; +use stdClass; +use PHPUnit\Framework\TestCase; -class RegistryTest extends \PHPUnit_Framework_TestCase +class RegistryTest extends TestCase { public function testSetAndGetLogger() { $key = Registry::LOGGER; - $object = new \StdClass(); + $logger = new stdClass(); - Registry::set($key, $object); - $actual = Registry::get($key); + Registry::set($key, $logger); + $storedLogger = Registry::get($key); - $this->assertEquals($object, $actual); - $this->assertInstanceOf('StdClass', $actual); + $this->assertSame($logger, $storedLogger); + $this->assertInstanceOf(stdClass::class, $storedLogger); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testThrowsExceptionWhenTryingToSetInvalidKey() + { + Registry::set('foobar', new stdClass()); + } + + /** + * notice @runInSeparateProcess here: without it, a previous test might have set it already and + * testing would not be possible. That's why you should implement Dependency Injection where an + * injected class may easily be replaced by a mockup + * + * @runInSeparateProcess + * @expectedException \InvalidArgumentException + */ + public function testThrowsExceptionWhenTryingToGetNotSetKey() + { + Registry::get(Registry::LOGGER); } } diff --git a/ansible/playbook.yml b/ansible/playbook.yml index 33e3fda..150b16a 100755 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -1,6 +1,6 @@ --- - hosts: all - sudo: true + become: yes vars_files: - vars/all.yml roles: @@ -9,3 +9,4 @@ - php - xdebug - app + - composer diff --git a/ansible/roles/app/tasks/main.yml b/ansible/roles/app/tasks/main.yml index c330e48..59e8b64 100755 --- a/ansible/roles/app/tasks/main.yml +++ b/ansible/roles/app/tasks/main.yml @@ -1,5 +1,4 @@ --- # 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/composer/tasks/main.yml b/ansible/roles/composer/tasks/main.yml new file mode 100644 index 0000000..27df507 --- /dev/null +++ b/ansible/roles/composer/tasks/main.yml @@ -0,0 +1,10 @@ +- name: Install Composer + shell: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer creates=/usr/local/bin/composer + +- name: Increase process timeout + shell: composer --global config process-timeout {{ composer.timeout }} + +- name: Install packages + shell: composer install --optimize-autoloader --prefer-source + args: + chdir: /vagrant \ No newline at end of file diff --git a/ansible/roles/php/tasks/main.yml b/ansible/roles/php/tasks/main.yml index 38f2f78..03fede2 100755 --- a/ansible/roles/php/tasks/main.yml +++ b/ansible/roles/php/tasks/main.yml @@ -1,20 +1,19 @@ --- +- name: Update apt + apt: update_cache=yes autoremove=yes + - 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 php7 + apt: pkg=php7.0 state=latest - name: Install PHP Packages - sudo: yes - apt: pkg={{ item }} state=latest - with_items: php.packages + 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 index e1cfffa..ae079f2 100755 --- a/ansible/roles/php/tasks/php-cli.yml +++ b/ansible/roles/php/tasks/php-cli.yml @@ -1,10 +1,12 @@ --- -- 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' + lineinfile: + dest: /etc/php/7.0/cli/php.ini + regexp: ';?opcache.enable=\d' + line: 'opcache.enable=1' + +- name: ensure timezone is set in cli php.ini + lineinfile: + dest: /etc/php/7.0/cli/php.ini + regexp: 'date.timezone =' + line: 'date.timezone = {{ server.timezone }}' \ No newline at end of file diff --git a/ansible/roles/server/tasks/main.yml b/ansible/roles/server/tasks/main.yml index f1ffc08..78efb9f 100755 --- a/ansible/roles/server/tasks/main.yml +++ b/ansible/roles/server/tasks/main.yml @@ -1,31 +1,25 @@ --- - name: Update apt - sudo: yes apt: update_cache=yes - name: Install System Packages - sudo: yes - apt: pkg={{ item }} state=latest + 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 + 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/vagrant_local/tasks/main.yml b/ansible/roles/vagrant_local/tasks/main.yml index cd53609..70cad53 100755 --- a/ansible/roles/vagrant_local/tasks/main.yml +++ b/ansible/roles/vagrant_local/tasks/main.yml @@ -8,4 +8,10 @@ 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 + 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/tasks/main.yml b/ansible/roles/xdebug/tasks/main.yml index e38815d..380ee2b 100755 --- a/ansible/roles/xdebug/tasks/main.yml +++ b/ansible/roles/xdebug/tasks/main.yml @@ -1,4 +1,3 @@ --- - name: Install xDebug - sudo: yes apt: pkg=php5-xdebug state=latest diff --git a/ansible/vars/all.yml b/ansible/vars/all.yml index b5559e6..25f56c7 100755 --- a/ansible/vars/all.yml +++ b/ansible/vars/all.yml @@ -1,15 +1,35 @@ --- server: install: '1' - packages: [vim, htop, iotop, bwm-ng] + packages: + - vim + - htop + - iotop + - bwm-ng + - git 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 } + vm: + hostname: design-patterns + php: install: '1' - ppa: php5-5.6 - packages: [php5-cli, php5-intl, php5-mcrypt, php5-mysql, php5-curl, php5-json] + ppa: php + packages: + - php7.0-cli + - php7.0-intl + - php7.0-mcrypt + - php7.0-mysql + - php7.0-curl + - php7.0-json + - php7.0-xml + - php7.0-mbstring + xdebug: install: '1' + +composer: + timeout: 2400 \ No newline at end of file diff --git a/composer.json b/composer.json index 71610e4..bdf73ac 100644 --- a/composer.json +++ b/composer.json @@ -8,8 +8,12 @@ } ], "minimum-stability": "stable", + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0" + }, "require-dev": { - "phpunit/phpunit": "^4.6", + "phpunit/phpunit": "^6.0", "squizlabs/php_codesniffer": "1.5.*" }, "autoload": { diff --git a/composer.lock b/composer.lock index 202b73e..863381e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,59 @@ "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": [], + "content-hash": "967b2d81af5c0ae65ab57db374efe747", + "packages": [ + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + } + ], "packages-dev": [ { "name": "doctrine/instantiator", @@ -60,41 +110,132 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { - "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", + "name": "myclabs/deep-copy", + "version": "1.6.0", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-01-26T22:05:40+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "phpDocumentor": [ + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27T11:43:31+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ "src/" ] } @@ -106,37 +247,88 @@ "authors": [ { "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "email": "me@mikevanriel.com" } ], - "time": "2015-02-03 12:10:50" + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-09-30T07:12:33+00:00" }, { - "name": "phpspec/prophecy", - "version": "v1.5.0", + "name": "phpdocumentor/type-resolver", + "version": "0.2.1", "source": { "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1" + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { - "phpspec/phpspec": "~2.0" + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2016-11-25T06:54:22+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8 || ^5.6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -169,43 +361,44 @@ "spy", "stub" ], - "time": "2015-08-13 10:07:40" + "time": "2017-03-02T20:05:34+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "2.2.4", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "reference": "4e99e1c4f9b05cbf4d6e84b100b3ff4107cf8cd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4e99e1c4f9b05cbf4d6e84b100b3ff4107cf8cd1", + "reference": "4e99e1c4f9b05cbf4d6e84b100b3ff4107cf8cd1", "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" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.11 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^2.0", + "sebastian/version": "^2.0" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" + "ext-xdebug": "^2.5", + "phpunit/phpunit": "^6.0" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.5.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { @@ -231,20 +424,20 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2017-03-06T14:22:16+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", "shasum": "" }, "require": { @@ -278,7 +471,7 @@ "filesystem", "iterator" ], - "time": "2015-06-21 13:08:43" + "time": "2016-10-03T07:40:28+00:00" }, { "name": "phpunit/php-text-template", @@ -319,26 +512,34 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.7", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -360,20 +561,20 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "1.4.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", "shasum": "" }, "require": { @@ -409,45 +610,55 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2017-02-27T10:12:30+00:00" }, { "name": "phpunit/phpunit", - "version": "4.8.18", + "version": "6.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3" + "reference": "47ee3fa1bca5c50f1d25105201eb20df777bd7b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa33d4ad96481b91df343d83e8c8aabed6b1dfd3", - "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/47ee3fa1bca5c50f1d25105201eb20df777bd7b6", + "reference": "47ee3fa1bca5c50f1d25105201eb20df777bd7b6", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "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" + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.3", + "php": "^7.0", + "phpspec/prophecy": "^1.6.2", + "phpunit/php-code-coverage": "^5.0", + "phpunit/php-file-iterator": "^1.4", + "phpunit/php-text-template": "^1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^4.0", + "sebastian/comparator": "^1.2.4 || ^2.0", + "sebastian/diff": "^1.2", + "sebastian/environment": "^2.0", + "sebastian/exporter": "^2.0 || ^3.0", + "sebastian/global-state": "^1.1 || ^2.0", + "sebastian/object-enumerator": "^2.0 || ^3.0", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" }, "suggest": { - "phpunit/php-invoker": "~1.1" + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" }, "bin": [ "phpunit" @@ -455,7 +666,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.8.x-dev" + "dev-master": "6.0.x-dev" } }, "autoload": { @@ -481,30 +692,33 @@ "testing", "xunit" ], - "time": "2015-11-11 11:32:49" + "time": "2017-03-02T15:24:03+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "reference": "eabce450df194817a7d7e27e19013569a903a2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/eabce450df194817a7d7e27e19013569a903a2bf", + "reference": "eabce450df194817a7d7e27e19013569a903a2bf", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "php": "^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^3.0" + }, + "conflict": { + "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-soap": "*" @@ -512,7 +726,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -537,34 +751,79 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2017-03-03T06:30:20+00:00" }, { - "name": "sebastian/comparator", - "version": "1.2.0", + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "20f84f468cb67efee293246e6a09619b891f55f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/20f84f468cb67efee293246e6a09619b891f55f0", + "reference": "20f84f468cb67efee293246e6a09619b891f55f0", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/diff": "^1.2", + "sebastian/exporter": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -601,32 +860,32 @@ "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2017-03-03T06:26:08+00:00" }, { "name": "sebastian/diff", - "version": "1.3.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "~4.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -649,36 +908,36 @@ } ], "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", + "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ "diff" ], - "time": "2015-02-22 15:13:53" + "time": "2015-12-08T07:14:41+00:00" }, { "name": "sebastian/environment", - "version": "1.3.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -703,33 +962,34 @@ "environment", "hhvm" ], - "time": "2015-08-03 06:14:51" + "time": "2016-11-26T07:53:53+00:00" }, { "name": "sebastian/exporter", - "version": "1.2.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + "reference": "b82d077cb3459e393abcf4867ae8f7230dcb51f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/b82d077cb3459e393abcf4867ae8f7230dcb51f6", + "reference": "b82d077cb3459e393abcf4867ae8f7230dcb51f6", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -769,7 +1029,7 @@ "export", "exporter" ], - "time": "2015-06-21 07:55:53" + "time": "2017-03-03T06:25:06+00:00" }, { "name": "sebastian/global-state", @@ -820,32 +1080,78 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2015-10-12T03:26:01+00:00" }, { - "name": "sebastian/recursion-context", - "version": "1.0.1", + "name": "sebastian/object-enumerator", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "de6e32f7192dfea2e4bedc892434f4830b5c5794" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/de6e32f7192dfea2e4bedc892434f4830b5c5794", + "reference": "de6e32f7192dfea2e4bedc892434f4830b5c5794", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-03-03T06:21:01+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -873,23 +1179,73 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-06-21 08:04:50" + "time": "2017-03-03T06:23:57+00:00" }, { - "name": "sebastian/version", - "version": "1.0.6", + "name": "sebastian/resource-operations", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", "shasum": "" }, + "require": { + "php": ">=5.6.0" + }, "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": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -908,7 +1264,7 @@ ], "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" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -983,34 +1339,38 @@ "phpcs", "standards" ], - "time": "2014-12-04 22:32:15" + "time": "2014-12-04T22:32:15+00:00" }, { - "name": "symfony/yaml", - "version": "v2.7.6", + "name": "webmozart/assert", + "version": "1.2.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "eca9019c88fbe250164affd107bc8057771f3f4d" + "url": "https://github.com/webmozart/assert.git", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d", - "reference": "eca9019c88fbe250164affd107bc8057771f3f4d", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "1.3-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "Webmozart\\Assert\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1019,17 +1379,17 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2015-10-11 09:39:48" + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23T20:04:58+00:00" } ], "aliases": [], @@ -1037,6 +1397,8 @@ "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "php": ">=7.0" + }, "platform-dev": [] } diff --git a/locale/ca/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po b/locale/ca/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po index b5277a5..19f8d8d 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po @@ -62,7 +62,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/ChainOfResponsibilities/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/ChainOfResponsibilities/README.rst:36 diff --git a/locale/ca/LC_MESSAGES/Behavioral/Command/README.po b/locale/ca/LC_MESSAGES/Behavioral/Command/README.po index 29319a3..158d346 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/Command/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/Command/README.po @@ -71,7 +71,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Command/README.rst:41 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Command/README.rst:43 diff --git a/locale/ca/LC_MESSAGES/Behavioral/Iterator/README.po b/locale/ca/LC_MESSAGES/Behavioral/Iterator/README.po index 3000658..25ccf3a 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/Iterator/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/Iterator/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -20,9 +20,7 @@ msgid "Purpose" msgstr "" #: ../../Behavioral/Iterator/README.rst:7 -msgid "" -"To make an object iterable and to make it appear like a collection of " -"objects." +msgid "To make an object iterable and to make it appear like a collection of objects." msgstr "" #: ../../Behavioral/Iterator/README.rst:11 @@ -55,7 +53,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Iterator/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Iterator/README.rst:36 diff --git a/locale/ca/LC_MESSAGES/Behavioral/Mediator/README.po b/locale/ca/LC_MESSAGES/Behavioral/Mediator/README.po index 9c6694b..e9a44dd 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/Mediator/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/Mediator/README.po @@ -21,8 +21,8 @@ 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 " +"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)." msgstr "" @@ -42,7 +42,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Mediator/README.rst:25 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Mediator/README.rst:27 diff --git a/locale/ca/LC_MESSAGES/Behavioral/Memento/README.po b/locale/ca/LC_MESSAGES/Behavioral/Memento/README.po index 913069a..2d4b2e1 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/Memento/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/Memento/README.po @@ -1,15 +1,22 @@ -# +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-29 12:18+0200\n" +"POT-Creation-Date: 2016-06-03 23:59+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-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.3.4\n" #: ../../Behavioral/Memento/README.rst:2 msgid "`Memento`__" @@ -21,65 +28,97 @@ msgstr "" #: ../../Behavioral/Memento/README.rst:7 msgid "" -"Provide the ability to restore an object to its previous state (undo via " -"rollback)." +"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)." msgstr "" -#: ../../Behavioral/Memento/README.rst:10 +#: ../../Behavioral/Memento/README.rst:12 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." +"The memento pattern is implemented with three objects: the Originator, a " +"Caretaker and a Memento." msgstr "" -#: ../../Behavioral/Memento/README.rst:23 +#: ../../Behavioral/Memento/README.rst:15 +msgid "" +"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)." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:24 +msgid "" +"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*." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:33 +msgid "" +"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." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:39 msgid "Examples" msgstr "" -#: ../../Behavioral/Memento/README.rst:25 +#: ../../Behavioral/Memento/README.rst:41 msgid "The seed of a pseudorandom number generator" msgstr "" -#: ../../Behavioral/Memento/README.rst:26 +#: ../../Behavioral/Memento/README.rst:42 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" +#: ../../Behavioral/Memento/README.rst:43 +msgid "" +"Control for intermediate states of `ORM Model " +"`_ before saving" msgstr "" #: ../../Behavioral/Memento/README.rst:46 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:53 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:55 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:57 +msgid "Memento.php" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:63 msgid "Originator.php" msgstr "" -#: ../../Behavioral/Memento/README.rst:52 +#: ../../Behavioral/Memento/README.rst:69 msgid "Caretaker.php" msgstr "" -#: ../../Behavioral/Memento/README.rst:59 +#: ../../Behavioral/Memento/README.rst:76 msgid "Test" msgstr "" -#: ../../Behavioral/Memento/README.rst:61 +#: ../../Behavioral/Memento/README.rst:78 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 index 35b77f6..a397fc5 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/NullObject/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/NullObject/README.po @@ -75,7 +75,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/NullObject/README.rst:39 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/NullObject/README.rst:41 diff --git a/locale/ca/LC_MESSAGES/Behavioral/Observer/README.po b/locale/ca/LC_MESSAGES/Behavioral/Observer/README.po index 6aea8e9..8a43616 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/Observer/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/Observer/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -22,7 +22,7 @@ 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 " +"\"Subject\" object changes its state, the attached \"Observers\" will be " "notified. It is used to shorten the amount of coupled objects and uses loose" " coupling instead." msgstr "" @@ -55,7 +55,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Observer/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Observer/README.rst:36 diff --git a/locale/ca/LC_MESSAGES/Behavioral/Specification/README.po b/locale/ca/LC_MESSAGES/Behavioral/Specification/README.po index 54e3b64..7b1982b 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/Specification/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/Specification/README.po @@ -44,7 +44,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Specification/README.rst:27 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Specification/README.rst:29 diff --git a/locale/ca/LC_MESSAGES/Behavioral/State/README.po b/locale/ca/LC_MESSAGES/Behavioral/State/README.po index f71fbfa..2ced881 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/State/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/State/README.po @@ -35,7 +35,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/State/README.rst:21 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/State/README.rst:23 diff --git a/locale/ca/LC_MESSAGES/Behavioral/Strategy/README.po b/locale/ca/LC_MESSAGES/Behavioral/Strategy/README.po index dd5797e..c3b9fea 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/Strategy/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/Strategy/README.po @@ -64,7 +64,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Strategy/README.rst:35 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Strategy/README.rst:37 diff --git a/locale/ca/LC_MESSAGES/Behavioral/TemplateMethod/README.po b/locale/ca/LC_MESSAGES/Behavioral/TemplateMethod/README.po index 4f6fa81..331d234 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/TemplateMethod/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/TemplateMethod/README.po @@ -59,7 +59,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/TemplateMethod/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/TemplateMethod/README.rst:36 diff --git a/locale/ca/LC_MESSAGES/Behavioral/Visitor/README.po b/locale/ca/LC_MESSAGES/Behavioral/Visitor/README.po index cab0ea9..08784a3 100644 --- a/locale/ca/LC_MESSAGES/Behavioral/Visitor/README.po +++ b/locale/ca/LC_MESSAGES/Behavioral/Visitor/README.po @@ -43,7 +43,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Visitor/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Visitor/README.rst:28 diff --git a/locale/ca/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/ca/LC_MESSAGES/Creational/AbstractFactory/README.po index 04a383e..5f30dba 100644 --- a/locale/ca/LC_MESSAGES/Creational/AbstractFactory/README.po +++ b/locale/ca/LC_MESSAGES/Creational/AbstractFactory/README.po @@ -36,7 +36,7 @@ msgid "Code" msgstr "" #: ../../Creational/AbstractFactory/README.rst:22 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/AbstractFactory/README.rst:24 diff --git a/locale/ca/LC_MESSAGES/Creational/Builder/README.po b/locale/ca/LC_MESSAGES/Creational/Builder/README.po index 79d4fe3..52e2701 100644 --- a/locale/ca/LC_MESSAGES/Creational/Builder/README.po +++ b/locale/ca/LC_MESSAGES/Creational/Builder/README.po @@ -58,7 +58,7 @@ msgid "Code" msgstr "" #: ../../Creational/Builder/README.rst:33 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/Builder/README.rst:35 diff --git a/locale/ca/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/ca/LC_MESSAGES/Creational/FactoryMethod/README.po index b65c56b..9640841 100644 --- a/locale/ca/LC_MESSAGES/Creational/FactoryMethod/README.po +++ b/locale/ca/LC_MESSAGES/Creational/FactoryMethod/README.po @@ -50,7 +50,7 @@ msgid "Code" msgstr "" #: ../../Creational/FactoryMethod/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/FactoryMethod/README.rst:31 diff --git a/locale/ca/LC_MESSAGES/Creational/Multiton/README.po b/locale/ca/LC_MESSAGES/Creational/Multiton/README.po index 702271d..d6892a9 100644 --- a/locale/ca/LC_MESSAGES/Creational/Multiton/README.po +++ b/locale/ca/LC_MESSAGES/Creational/Multiton/README.po @@ -52,7 +52,7 @@ msgid "Code" msgstr "" #: ../../Creational/Multiton/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/Multiton/README.rst:31 diff --git a/locale/ca/LC_MESSAGES/Creational/Pool/README.po b/locale/ca/LC_MESSAGES/Creational/Pool/README.po index 8defedd..899f583 100644 --- a/locale/ca/LC_MESSAGES/Creational/Pool/README.po +++ b/locale/ca/LC_MESSAGES/Creational/Pool/README.po @@ -53,7 +53,7 @@ msgid "Code" msgstr "" #: ../../Creational/Pool/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/Pool/README.rst:36 diff --git a/locale/ca/LC_MESSAGES/Creational/Prototype/README.po b/locale/ca/LC_MESSAGES/Creational/Prototype/README.po index fac09ef..14e0bc2 100644 --- a/locale/ca/LC_MESSAGES/Creational/Prototype/README.po +++ b/locale/ca/LC_MESSAGES/Creational/Prototype/README.po @@ -44,7 +44,7 @@ msgid "Code" msgstr "" #: ../../Creational/Prototype/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/Prototype/README.rst:28 diff --git a/locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po index 74e85d4..6501749 100644 --- a/locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po +++ b/locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -44,7 +44,7 @@ msgid "Code" msgstr "" #: ../../Creational/SimpleFactory/README.rst:25 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/SimpleFactory/README.rst:27 diff --git a/locale/ca/LC_MESSAGES/Creational/Singleton/README.po b/locale/ca/LC_MESSAGES/Creational/Singleton/README.po index 5d108ca..a80a777 100644 --- a/locale/ca/LC_MESSAGES/Creational/Singleton/README.po +++ b/locale/ca/LC_MESSAGES/Creational/Singleton/README.po @@ -59,7 +59,7 @@ msgid "Code" msgstr "" #: ../../Creational/Singleton/README.rst:32 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/Singleton/README.rst:34 diff --git a/locale/ca/LC_MESSAGES/Creational/StaticFactory/README.po b/locale/ca/LC_MESSAGES/Creational/StaticFactory/README.po index 4a6f64e..538587f 100644 --- a/locale/ca/LC_MESSAGES/Creational/StaticFactory/README.po +++ b/locale/ca/LC_MESSAGES/Creational/StaticFactory/README.po @@ -47,7 +47,7 @@ msgid "Code" msgstr "" #: ../../Creational/StaticFactory/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/StaticFactory/README.rst:31 diff --git a/locale/ca/LC_MESSAGES/More/Delegation/README.po b/locale/ca/LC_MESSAGES/More/Delegation/README.po index 169e8fd..907d828 100644 --- a/locale/ca/LC_MESSAGES/More/Delegation/README.po +++ b/locale/ca/LC_MESSAGES/More/Delegation/README.po @@ -1,15 +1,22 @@ -# +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-29 12:18+0200\n" +"POT-Creation-Date: 2016-06-03 23:59+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-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.3.4\n" #: ../../More/Delegation/README.rst:2 msgid "`Delegation`__" @@ -19,14 +26,26 @@ msgstr "" msgid "Purpose" msgstr "" -#: ../../More/Delegation/README.rst:7 ../../More/Delegation/README.rst:12 -msgid "..." +#: ../../More/Delegation/README.rst:7 +msgid "" +"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." msgstr "" #: ../../More/Delegation/README.rst:10 msgid "Examples" msgstr "" +#: ../../More/Delegation/README.rst:12 +msgid "" +"Please review JuniorDeveloper.php, TeamLead.php, and then Usage.php to " +"see it all tied together." +msgstr "" + #: ../../More/Delegation/README.rst:15 msgid "UML Diagram" msgstr "" @@ -36,7 +55,7 @@ msgid "Code" msgstr "" #: ../../More/Delegation/README.rst:24 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../More/Delegation/README.rst:26 @@ -58,3 +77,4 @@ msgstr "" #: ../../More/Delegation/README.rst:47 msgid "Tests/DelegationTest.php" msgstr "" + diff --git a/locale/ca/LC_MESSAGES/More/EAV/README.po b/locale/ca/LC_MESSAGES/More/EAV/README.po new file mode 100644 index 0000000..d0113c0 --- /dev/null +++ b/locale/ca/LC_MESSAGES/More/EAV/README.po @@ -0,0 +1,78 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../More/EAV/README.rst:2 +msgid "`Entity-Attribute-Value (EAV)`__" +msgstr "" + +#: ../../More/EAV/README.rst:4 +msgid "" +"The Entity–attribute–value (EAV) pattern in order to implement EAV model " +"with PHP." +msgstr "" + +#: ../../More/EAV/README.rst:7 +msgid "Purpose" +msgstr "" + +#: ../../More/EAV/README.rst:9 +msgid "" +"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." +msgstr "" + +#: ../../More/EAV/README.rst:15 +msgid "Examples" +msgstr "" + +#: ../../More/EAV/README.rst:17 +msgid "Check full work example in `example.php`_ file." +msgstr "" + +#: ../../More/EAV/README.rst:90 +msgid "UML Diagram" +msgstr "" + +#: ../../More/EAV/README.rst:97 +msgid "Code" +msgstr "" + +#: ../../More/EAV/README.rst:99 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../More/EAV/README.rst:102 +msgid "Test" +msgstr "" + +#: ../../More/EAV/README.rst:104 +msgid "Tests/EntityTest.php" +msgstr "" + +#: ../../More/EAV/README.rst:110 +msgid "Tests/AttributeTest.php" +msgstr "" + +#: ../../More/EAV/README.rst:116 +msgid "Tests/ValueTest.php" +msgstr "" + diff --git a/locale/ca/LC_MESSAGES/More/Repository/README.po b/locale/ca/LC_MESSAGES/More/Repository/README.po index d9ecc90..5a37043 100644 --- a/locale/ca/LC_MESSAGES/More/Repository/README.po +++ b/locale/ca/LC_MESSAGES/More/Repository/README.po @@ -52,7 +52,7 @@ msgid "Code" msgstr "" #: ../../More/Repository/README.rst:32 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../More/Repository/README.rst:34 diff --git a/locale/ca/LC_MESSAGES/More/ServiceLocator/README.po b/locale/ca/LC_MESSAGES/More/ServiceLocator/README.po index 9808a92..8efac15 100644 --- a/locale/ca/LC_MESSAGES/More/ServiceLocator/README.po +++ b/locale/ca/LC_MESSAGES/More/ServiceLocator/README.po @@ -58,7 +58,7 @@ msgid "Code" msgstr "" #: ../../More/ServiceLocator/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../More/ServiceLocator/README.rst:38 diff --git a/locale/ca/LC_MESSAGES/README.po b/locale/ca/LC_MESSAGES/README.po index 3a26db2..8588590 100644 --- a/locale/ca/LC_MESSAGES/README.po +++ b/locale/ca/LC_MESSAGES/README.po @@ -62,7 +62,7 @@ msgid "(The MIT License)" msgstr "" #: ../../README.rst:48 -msgid "Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_" +msgid "Copyright (c) 2011 - 2016 `Dominik Liebler`_ and `contributors`_" msgstr "" #: ../../README.rst:50 diff --git a/locale/ca/LC_MESSAGES/Structural/Adapter/README.po b/locale/ca/LC_MESSAGES/Structural/Adapter/README.po index b351fc9..00c1d2f 100644 --- a/locale/ca/LC_MESSAGES/Structural/Adapter/README.po +++ b/locale/ca/LC_MESSAGES/Structural/Adapter/README.po @@ -23,7 +23,7 @@ msgstr "" 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 " +"incompatible interfaces by providing its interface to clients while using " "the original interface." msgstr "" @@ -50,7 +50,7 @@ msgid "Code" msgstr "" #: ../../Structural/Adapter/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Adapter/README.rst:31 diff --git a/locale/ca/LC_MESSAGES/Structural/Bridge/README.po b/locale/ca/LC_MESSAGES/Structural/Bridge/README.po index a27619b..e2ee3f6 100644 --- a/locale/ca/LC_MESSAGES/Structural/Bridge/README.po +++ b/locale/ca/LC_MESSAGES/Structural/Bridge/README.po @@ -42,7 +42,7 @@ msgid "Code" msgstr "" #: ../../Structural/Bridge/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Bridge/README.rst:28 diff --git a/locale/ca/LC_MESSAGES/Structural/Composite/README.po b/locale/ca/LC_MESSAGES/Structural/Composite/README.po index 90ddd21..a5b59d4 100644 --- a/locale/ca/LC_MESSAGES/Structural/Composite/README.po +++ b/locale/ca/LC_MESSAGES/Structural/Composite/README.po @@ -50,7 +50,7 @@ msgid "Code" msgstr "" #: ../../Structural/Composite/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Composite/README.rst:31 diff --git a/locale/ca/LC_MESSAGES/Structural/DataMapper/README.po b/locale/ca/LC_MESSAGES/Structural/DataMapper/README.po index 5ccd9a3..6093eea 100644 --- a/locale/ca/LC_MESSAGES/Structural/DataMapper/README.po +++ b/locale/ca/LC_MESSAGES/Structural/DataMapper/README.po @@ -57,7 +57,7 @@ msgid "Code" msgstr "" #: ../../Structural/DataMapper/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/DataMapper/README.rst:38 diff --git a/locale/ca/LC_MESSAGES/Structural/Decorator/README.po b/locale/ca/LC_MESSAGES/Structural/Decorator/README.po index 0ecf351..124019f 100644 --- a/locale/ca/LC_MESSAGES/Structural/Decorator/README.po +++ b/locale/ca/LC_MESSAGES/Structural/Decorator/README.po @@ -46,7 +46,7 @@ msgid "Code" msgstr "" #: ../../Structural/Decorator/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Decorator/README.rst:28 diff --git a/locale/ca/LC_MESSAGES/Structural/DependencyInjection/README.po b/locale/ca/LC_MESSAGES/Structural/DependencyInjection/README.po index 0834846..7eeeb06 100644 --- a/locale/ca/LC_MESSAGES/Structural/DependencyInjection/README.po +++ b/locale/ca/LC_MESSAGES/Structural/DependencyInjection/README.po @@ -75,7 +75,7 @@ msgid "Code" msgstr "" #: ../../Structural/DependencyInjection/README.rst:46 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/DependencyInjection/README.rst:48 diff --git a/locale/ca/LC_MESSAGES/Structural/Facade/README.po b/locale/ca/LC_MESSAGES/Structural/Facade/README.po index 1d78bf4..81358f4 100644 --- a/locale/ca/LC_MESSAGES/Structural/Facade/README.po +++ b/locale/ca/LC_MESSAGES/Structural/Facade/README.po @@ -63,7 +63,7 @@ msgid "Code" msgstr "" #: ../../Structural/Facade/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Facade/README.rst:38 diff --git a/locale/ca/LC_MESSAGES/Structural/FluentInterface/README.po b/locale/ca/LC_MESSAGES/Structural/FluentInterface/README.po index 0e58551..4331b7c 100644 --- a/locale/ca/LC_MESSAGES/Structural/FluentInterface/README.po +++ b/locale/ca/LC_MESSAGES/Structural/FluentInterface/README.po @@ -50,7 +50,7 @@ msgid "Code" msgstr "" #: ../../Structural/FluentInterface/README.rst:28 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/FluentInterface/README.rst:30 diff --git a/locale/ca/LC_MESSAGES/Structural/Flyweight/README.po b/locale/ca/LC_MESSAGES/Structural/Flyweight/README.po new file mode 100644 index 0000000..cfa8492 --- /dev/null +++ b/locale/ca/LC_MESSAGES/Structural/Flyweight/README.po @@ -0,0 +1,69 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../Structural/Flyweight/README.rst:2 +msgid "`Flyweight`__" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:5 +msgid "Purpose" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:7 +msgid "" +"To minimise memory usage, a Flyweight shares as much as possible memory " +"with similar objects. It is needed when a large amount of objects is used" +" that don't differ much in state. A common practice is to hold state in " +"external data structures and pass them to the flyweight object when " +"needed." +msgstr "" + +#: ../../Structural/Flyweight/README.rst:12 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:19 +msgid "Code" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:21 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:23 +msgid "FlyweightInterface.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:29 +msgid "CharacterFlyweight.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:35 +msgid "FlyweightFactory.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:42 +msgid "Test" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:44 +msgid "Tests/FlyweightTest.php" +msgstr "" + diff --git a/locale/ca/LC_MESSAGES/Structural/Proxy/README.po b/locale/ca/LC_MESSAGES/Structural/Proxy/README.po index 290eacc..1e52782 100644 --- a/locale/ca/LC_MESSAGES/Structural/Proxy/README.po +++ b/locale/ca/LC_MESSAGES/Structural/Proxy/README.po @@ -43,7 +43,7 @@ msgid "Code" msgstr "" #: ../../Structural/Proxy/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Proxy/README.rst:28 diff --git a/locale/ca/LC_MESSAGES/Structural/Registry/README.po b/locale/ca/LC_MESSAGES/Structural/Registry/README.po index 843138c..104a57d 100644 --- a/locale/ca/LC_MESSAGES/Structural/Registry/README.po +++ b/locale/ca/LC_MESSAGES/Structural/Registry/README.po @@ -32,8 +32,8 @@ msgstr "" #: ../../Structural/Registry/README.rst:14 msgid "" -"Zend Framework: ``Zend_Registry`` holds the application's logger object, " -"front controller etc." +"Zend Framework 1: ``Zend_Registry`` holds the application's logger " +"object, front controller etc." msgstr "" #: ../../Structural/Registry/README.rst:16 @@ -51,7 +51,7 @@ msgid "Code" msgstr "" #: ../../Structural/Registry/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Registry/README.rst:31 diff --git a/locale/de/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po b/locale/de/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po new file mode 100644 index 0000000..b84bf8a --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po @@ -0,0 +1,96 @@ +# +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: 2016-03-28 19:48+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:2 +msgid "`Chain Of Responsibilities`__" +msgstr "`Chain Of Responsibilities`__" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:5 +msgid "Purpose:" +msgstr "Zweck:" + +#: ../../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 "" +"Um eine Kette von Objekten zu bauen, die einen Aufruf in sequentieller Folge abzuarbeiten. Wenn ein Objekt den " +"Aufruf nicht bearbeiten kann, delegiert es die Anfrage weiter an das nächste Objekt und so weiter. So lange, bis " +"die Anfrage von einem Objekt erfolgreich abgearbeitet werden kann." + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:12 +msgid "Examples:" +msgstr "Beispiele:" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:14 +msgid "logging framework, where each chain element decides autonomously what to do with a log message" +msgstr "" +"Logging Framework, in dem jedes Element der Kette automatisch entscheidet, was es mit einer Logmessage tun möchte" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:16 +msgid "a Spam filter" +msgstr "ein Spamfilter" + +#: ../../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 "" +"Caching: das erste Objekt ist Beispielsweise eine Memcache-Instanz. Wenn es einen „Miss“ hat, dann wird an das " +"nächste Element weitergeleitet, das eine Datenbank-Abfrage unternimmt" + +#: ../../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 ist eine Kette von Controller Action Filters. In der Ausführung wird in der Kette " +"immer weitergereicht und nur wenn alle Filter „ja“ sagen, wird die Aktion am Ende ausgeführt." + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:25 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:32 +msgid "Code" +msgstr "Code" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:34 +msgid "You can also find this code on `GitHub`_" +msgstr "Du kannst den Code auch auf `GitHub` einsehen_" + +#: ../../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 "Теst" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:63 +msgid "Tests/ChainTest.php" +msgstr "Tests/ChainTest.php" diff --git a/locale/de/LC_MESSAGES/Behavioral/Command/README.po b/locale/de/LC_MESSAGES/Behavioral/Command/README.po new file mode 100644 index 0000000..3e90fb0 --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/Command/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: 2016-03-28 19:56+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../Behavioral/Command/README.rst:2 +msgid "`Command`__" +msgstr "`Command`__" + +#: ../../Behavioral/Command/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Behavioral/Command/README.rst:7 +msgid "To encapsulate invocation and decoupling." +msgstr "Um Ausführung zu kapseln und Entkopplung zu erreichen." + +#: ../../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 "" +"Wir haben einen Invoker (Ausführer) und einen Receiver (Empfänger). Dieses Pattern benutzt ein " +"„Command“ um die Ausführung einer Methode and einen Empfänger zu delegieren und eine " +"einheitliche „execute“ Methode bereitzustellen. Damit weiß der Ausführer nur von der „execute“-" +"Methode, um den Befehl auszuführen. Der Empfänger wird dadurch vom Aufrufer entkoppelt." + +#: ../../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 "" +"Der zweite Aspekt dieses Musters ist die `undo()` Methode, die die Ausführung der `execute()` " +"Methode rückgängig machen kann. Befehlen können außerdem aggregiert werden, um komplexe " +"Befehle mit minimalem Aufwand und mit Komposition (anstatt Vererbung) zu erstellen." + +#: ../../Behavioral/Command/README.rst:21 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Behavioral/Command/README.rst:23 +msgid "A text editor : all events are Command which can be undone, stacked and saved." +msgstr "" +"Ein Texteditor: alle Ereignisse sind Befehle, die rückgängig gemacht, gestapelt und " +"gespeichert werden können." + +#: ../../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: Commands die auf der Konsole ausgeführt werden können, werden als Command Muster " +"entwickelt." + +#: ../../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 "" +"Komplexe Konsolentools bestehen aus Subcommands, um die Aufgaben besser zu modulariseren. " +"Jedes dieser Commands kann als Command-Pattern implementiert werden (z.B. vagrant)." + +#: ../../Behavioral/Command/README.rst:32 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Behavioral/Command/README.rst:39 +msgid "Code" +msgstr "Code" + +#: ../../Behavioral/Command/README.rst:41 +msgid "You can also find this code on `GitHub`_" +msgstr "Du kannst diesen Code auch auf `GitHub` einsehen_" + +#: ../../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 "Теst" + +#: ../../Behavioral/Command/README.rst:70 +msgid "Tests/CommandTest.php" +msgstr "Tests/CommandTest.php" diff --git a/locale/de/LC_MESSAGES/Behavioral/Iterator/README.po b/locale/de/LC_MESSAGES/Behavioral/Iterator/README.po new file mode 100644 index 0000000..0d137cc --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/Iterator/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: 2016-04-04 13:12+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Behavioral/Iterator/README.rst:2 +msgid "`Iterator`__" +msgstr "`Iterator`__" + +#: ../../Behavioral/Iterator/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Behavioral/Iterator/README.rst:7 +msgid "To make an object iterable and to make it appear like a collection of objects." +msgstr "" +"Um ein Objekt iterierbar zu machen und es nach außen aussehen zu lassen wie eine Sammlung von " +"Objekten." + +#: ../../Behavioral/Iterator/README.rst:11 +msgid "Examples" +msgstr "Beispiele" + +#: ../../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 "" +"Um eine Datei zeilenweise zu verarbeiten, in dem man über die Zeilen iteriert (die selbst auch " +"Objekte sind)" + +#: ../../Behavioral/Iterator/README.rst:18 +msgid "Note" +msgstr "Hinweis" + +#: ../../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 "" +"Standard PHP Library (SPL) stellt ein Interface `Iterator` bereit, das zu diesem Zweck bestens " +"geeignet ist. Oftmals sollte man das Countable Interface auch implementieren, um " +"``count($object)`` auf dem Objekt zu erlauben." + +#: ../../Behavioral/Iterator/README.rst:25 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Behavioral/Iterator/README.rst:32 +msgid "Code" +msgstr "Code" + +#: ../../Behavioral/Iterator/README.rst:34 +msgid "You can also find this code on `GitHub`_" +msgstr "Du kannst den Code auch auf `GitHub` einsehen_" + +#: ../../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 "Теst" + +#: ../../Behavioral/Iterator/README.rst:63 +msgid "Tests/IteratorTest.php" +msgstr "Tests/IteratorTest.php" diff --git a/locale/de/LC_MESSAGES/Behavioral/Mediator/README.po b/locale/de/LC_MESSAGES/Behavioral/Mediator/README.po new file mode 100644 index 0000000..6915d6f --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/Mediator/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: 2016-04-03 12:46+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../Behavioral/Mediator/README.rst:2 +msgid "`Mediator`__" +msgstr "`Mediator`__" + +#: ../../Behavioral/Mediator/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Behavioral/Mediator/README.rst:7 +msgid "" +"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)." +msgstr "" +"Dieses Muster bietet eine einfache Möglichkeit, viele, miteinander arbeitende Komponenten zu " +"entkoppeln. Es ist eine gute Alternative für das Observer-Pattern, wenn du eine „zentrale " +"Intelligenz“ wie z.B. einen Controller (nicht im MVC-Sinne) in deiner Architektur hast." + +#: ../../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 "" +"Alle Komponenten (genannt Kollegen) sind nur abhängig vom MediatorInterface und das ist gut so, " +"denn in der Objektorientierten Programmierung ist ein guter Freund besser als viele. Das ist das " +"beste Feature bei diesem Muster." + +#: ../../Behavioral/Mediator/README.rst:16 +msgid "UML Diagram" +msgstr "UML-Diagramm" + +#: ../../Behavioral/Mediator/README.rst:23 +msgid "Code" +msgstr "Code" + +#: ../../Behavioral/Mediator/README.rst:25 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code hierzu auf `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 "Test" + +#: ../../Behavioral/Mediator/README.rst:66 +msgid "Tests/MediatorTest.php" +msgstr "Tests/MediatorTest.php" diff --git a/locale/de/LC_MESSAGES/Behavioral/Memento/README.po b/locale/de/LC_MESSAGES/Behavioral/Memento/README.po new file mode 100644 index 0000000..f00407c --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/Memento/README.po @@ -0,0 +1,225 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../Behavioral/Memento/README.rst:2 +msgid "`Memento`__" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:5 +msgid "Purpose" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:7 +msgid "" +"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)." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:12 +msgid "" +"The memento pattern is implemented with three objects: the Originator, a " +"Caretaker and a Memento." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:15 +msgid "" +"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)." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:24 +msgid "" +"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*." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:33 +msgid "" +"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." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:39 +msgid "Examples" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:41 +msgid "The seed of a pseudorandom number generator" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:42 +msgid "The state in a finite state machine" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:43 +msgid "" +"Control for intermediate states of `ORM Model " +"`_ before saving" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:46 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:53 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:55 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:57 +msgid "Memento.php" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:63 +msgid "Originator.php" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:69 +msgid "Caretaker.php" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:76 +msgid "Test" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:78 +msgid "Tests/MementoTest.php" +msgstr "" + + +#. # +#. 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: 2016-04-03 12:52+0200\n" +#. "Last-Translator: Dominik Liebler \n" +#. "MIME-Version: 1.0\n" +#. "Content-Type: text/plain; charset=UTF-8\n" +#. "Content-Transfer-Encoding: 8bit\n" +#. "Language: de\n" +#. "Language-Team: \n" +#. "X-Generator: Poedit 1.8.7\n" +#. +#. #: ../../Behavioral/Memento/README.rst:2 +#. msgid "`Memento`__" +#. msgstr "`Memento`__" +#. +#. #: ../../Behavioral/Memento/README.rst:5 +#. msgid "Purpose" +#. msgstr "Zweck" +#. +#. #: ../../Behavioral/Memento/README.rst:7 +#. msgid "" +#. "Provide the ability to restore an object to its previous state (undo via " +#. "rollback)." +#. msgstr "" +#. "Bietet die Möglichkeit, einen Objektzustand zu einem vorigen Zustand " +#. "zurückzusetzen (mit Hilfe eines Rollbacks)." +#. +#. #: ../../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 "" +#. "Das Memento-Muster wird mit Hilfe von drei Objekten implementiert: der " +#. "Originalton, ein Caretaker und das Memento. Der Originalton ist ein Objekt, " +#. "das einen internen State besitzt. Der Caretaker wird etwas mit dem Originalton " +#. "machen, aber möchte evtl. diese Änderung auch rückgängig machen wollen. Der " +#. "Caretaker fragt den Originalton zuerst nach dem Memento-Objekt. Dann wird die " +#. "angefragte Operation (oder Sequenz von Änderungen) ausgeführt. Um diese " +#. "Änderung zurückzurollen, wird das Memento-Objekt an den Originalton " +#. "zurückgegeben. Das Memento-Objekt selbst ist intransparent, so dass der " +#. "Caretaker selbstständig keine Änderungen am Objekt durchführen kann. Bei der " +#. "Implementierung dieses Musters ist darauf zu achten, dass der Originator auch " +#. "Seiteneffekte auslösen kann, das Pattern aber nur auf einem einzelnen Objekt " +#. "operiert." +#. +#. #: ../../Behavioral/Memento/README.rst:23 +#. msgid "Examples" +#. msgstr "Beispiele" +#. +#. #: ../../Behavioral/Memento/README.rst:25 +#. msgid "The seed of a pseudorandom number generator" +#. msgstr "Das seeden eines Pseudozufallszahlengenerators" +#. +#. #: ../../Behavioral/Memento/README.rst:26 +#. msgid "The state in a finite state machine" +#. msgstr "Der State in einer FSM (Finite State Machine)" +#. +#. #: ../../Behavioral/Memento/README.rst:29 +#. msgid "UML Diagram" +#. msgstr "UML-Diagramm" +#. +#. #: ../../Behavioral/Memento/README.rst:36 +#. msgid "Code" +#. msgstr "Code" +#. +#. #: ../../Behavioral/Memento/README.rst:38 +#. msgid "You can also find this code on `GitHub`_" +#. msgstr "Du findest den Code hierzu auf `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 "Test" +#. +#. #: ../../Behavioral/Memento/README.rst:61 +#. msgid "Tests/MementoTest.php" +#. msgstr "Tests/MementoTest.php" diff --git a/locale/de/LC_MESSAGES/Behavioral/NullObject/README.po b/locale/de/LC_MESSAGES/Behavioral/NullObject/README.po new file mode 100644 index 0000000..08ad9f7 --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/NullObject/README.po @@ -0,0 +1,109 @@ +# +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: 2016-04-03 12:58+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../Behavioral/NullObject/README.rst:2 +msgid "`Null Object`__" +msgstr "`Null Object`__" + +#: ../../Behavioral/NullObject/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 ist keines der Gang-Of-Four Design Patterns aber ein Muster, dass immer wieder häufig auftritt " +"und deswegen erwähnt werden sollte. Es hat folgende Vorzüge:" + +#: ../../Behavioral/NullObject/README.rst:11 +msgid "Client code is simplified" +msgstr "Client Code wird vereinfacht" + +#: ../../Behavioral/NullObject/README.rst:12 +msgid "Reduces the chance of null pointer exceptions" +msgstr "Verringert die Möglichkeit einer Nullpoint-Exception" + +#: ../../Behavioral/NullObject/README.rst:13 +msgid "Fewer conditionals require less test cases" +msgstr "Weniger Ausnahmefälle bedingen weniger Testfälle" + +#: ../../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 "" +"Methoden, die ein Objekt oder Null zurückgeben, sollten stattdessen ein Objekt oder ``NullObject`` " +"zurückgeben. ``NullObject``s vereinfachen Boilerplate-code wie z.B. ``if (!is_null($obj)) { $obj-" +">callSomething(); }`` zu ``$obj->callSomething();``, indem sie die konditionale Prüfung im Clientcode " +"entfernen." + +#: ../../Behavioral/NullObject/README.rst:22 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Behavioral/NullObject/README.rst:24 +msgid "Symfony2: null logger of profiler" +msgstr "Symfony2: Null Logger im Profiler" + +#: ../../Behavioral/NullObject/README.rst:25 +msgid "Symfony2: null output in Symfony/Console" +msgstr "Symfony 2: Null-Output in Symfony/Console" + +#: ../../Behavioral/NullObject/README.rst:26 +msgid "null handler in a Chain of Responsibilities pattern" +msgstr "Nullhandler in einem Chain Of Responsibilities Pattern " + +#: ../../Behavioral/NullObject/README.rst:27 +msgid "null command in a Command pattern" +msgstr "Null Command in einem Command-Pattern" + +#: ../../Behavioral/NullObject/README.rst:30 +msgid "UML Diagram" +msgstr "UML-Diagramm" + +#: ../../Behavioral/NullObject/README.rst:37 +msgid "Code" +msgstr "Code" + +#: ../../Behavioral/NullObject/README.rst:39 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code hierzu auf `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 "Test" + +#: ../../Behavioral/NullObject/README.rst:68 +msgid "Tests/LoggerTest.php" +msgstr "Tests/LoggerTest.php" diff --git a/locale/de/LC_MESSAGES/Behavioral/Observer/README.po b/locale/de/LC_MESSAGES/Behavioral/Observer/README.po new file mode 100644 index 0000000..86de6a8 --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/Observer/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: 2016-04-03 14:25+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../Behavioral/Observer/README.rst:2 +msgid "`Observer`__" +msgstr "`Observer`__" + +#: ../../Behavioral/Observer/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Behavioral/Observer/README.rst:7 +msgid "" +"To implement a publish/subscribe behaviour to an object, whenever a \"Subject\" object changes its " +"state, the attached \"Observers\" will be notified. It is used to shorten the amount of coupled objects " +"and uses loose coupling instead." +msgstr "" +"Um einen Publish/Subscribe-Mechanismus in einem Objekt zu implementieren, werden bei Änderungen an " +"einem „Subject“-State die registrierten „Observer“ benachrichtigt. Es wird benutzt, um die Menge von " +"gekoppelten Objekten zu reduzieren und stattdessen eine lose Kopplung zu ermöglichen." + +#: ../../Behavioral/Observer/README.rst:13 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Behavioral/Observer/README.rst:15 +msgid "a message queue system is observed to show the progress of a job in a GUI" +msgstr "" +"ein Message-Queue-System wird auf Änderungen überwacht, um den Fortschritt eines Jobs in einer GUI " +"anzuzeigen" + +#: ../../Behavioral/Observer/README.rst:19 +msgid "Note" +msgstr "Hinweis" + +#: ../../Behavioral/Observer/README.rst:21 +msgid "" +"PHP already defines two interfaces that can help to implement this pattern: SplObserver and SplSubject." +msgstr "" +"In der PHP-Standardbibliothek sind bereits zwei Interfaces enthalten, die bei der Implementierung " +"dieses Musters helfen: SplObserver und SplSubject." + +#: ../../Behavioral/Observer/README.rst:25 +msgid "UML Diagram" +msgstr "UML-Diagramm" + +#: ../../Behavioral/Observer/README.rst:32 +msgid "Code" +msgstr "Code" + +#: ../../Behavioral/Observer/README.rst:34 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code hierzu auf `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 "Test" + +#: ../../Behavioral/Observer/README.rst:51 +msgid "Tests/ObserverTest.php" +msgstr "Tests/ObserverTest.php" diff --git a/locale/de/LC_MESSAGES/Behavioral/README.po b/locale/de/LC_MESSAGES/Behavioral/README.po new file mode 100644 index 0000000..a6b8847 --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/README.po @@ -0,0 +1,26 @@ +# +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: 2016-04-03 14:28+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../Behavioral/README.rst:2 +msgid "`Behavioral`__" +msgstr "`Verhaltensmuster`__" + +#: ../../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 "" +"Design Patterns, die gängige Kommunikationsmuster zwischen mehreren Objekten definieren, sind in der Softwareentwicklung als sog. " +"Verhaltensmuster bekannt. Mit diesen Patterns kann die Flexibilität in einer Architektur signifikant verbessert werden." diff --git a/locale/de/LC_MESSAGES/Behavioral/Specification/README.po b/locale/de/LC_MESSAGES/Behavioral/Specification/README.po new file mode 100644 index 0000000..2dbb78b --- /dev/null +++ b/locale/de/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: 2016-04-03 14:30+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../Behavioral/Specification/README.rst:2 +msgid "`Specification`__" +msgstr "`Specification`__" + +#: ../../Behavioral/Specification/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Bildet eine klare Spezifikation von Businessregeln ab, gegen die Objekte geprüft werden können. Die " +"Specification Klasse besitzt eine Methode namens ``isSatisfiedBy``, die entweder true oder false zurückgibt, " +"je nachdem ob das Objekt den Regeln des Business entspricht oder nicht." + +#: ../../Behavioral/Specification/README.rst:13 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Behavioral/Specification/README.rst:15 +msgid "`RulerZ `__" +msgstr "`RulerZ `__" + +#: ../../Behavioral/Specification/README.rst:18 +msgid "UML Diagram" +msgstr "UML-Diagramm" + +#: ../../Behavioral/Specification/README.rst:25 +msgid "Code" +msgstr "Code" + +#: ../../Behavioral/Specification/README.rst:27 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code hierzu auf `GitHub`_" + +#: ../../Behavioral/Specification/README.rst:29 +msgid "Item.php" +msgstr "Item.php" + +#: ../../Behavioral/Specification/README.rst:35 +msgid "SpecificationInterface.php" +msgstr "SpecificationInterface.php" + +#: ../../Behavioral/Specification/README.rst:41 +msgid "AbstractSpecification.php" +msgstr "AbstractSpecification.php" + +#: ../../Behavioral/Specification/README.rst:47 +msgid "Either.php" +msgstr "Either.php" + +#: ../../Behavioral/Specification/README.rst:53 +msgid "PriceSpecification.php" +msgstr "PriceSpecification.php" + +#: ../../Behavioral/Specification/README.rst:59 +msgid "Plus.php" +msgstr "Plus.php" + +#: ../../Behavioral/Specification/README.rst:65 +msgid "Not.php" +msgstr "Not.php" + +#: ../../Behavioral/Specification/README.rst:72 +msgid "Test" +msgstr "Test" + +#: ../../Behavioral/Specification/README.rst:74 +msgid "Tests/SpecificationTest.php" +msgstr "Tests/SpecificationTest.php" diff --git a/locale/de/LC_MESSAGES/Behavioral/State/README.po b/locale/de/LC_MESSAGES/Behavioral/State/README.po new file mode 100644 index 0000000..a4bbc2f --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/State/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: 2016-04-03 14:32+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../Behavioral/State/README.rst:2 +msgid "`State`__" +msgstr "`State`__" + +#: ../../Behavioral/State/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Kapselt verschiedene Verhaltensweisen für die selbe Routine basierend auf einem Objekt-State. " +"Das kann ein sauberer Weg für ein Objekt sein, sein Verhalten während der Laufzeit ohne komplexe " +"konditionale Bedingungen ändern zu können." + +#: ../../Behavioral/State/README.rst:12 +msgid "UML Diagram" +msgstr "UML-Diagramm" + +#: ../../Behavioral/State/README.rst:19 +msgid "Code" +msgstr "Code" + +#: ../../Behavioral/State/README.rst:21 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code hierzu auf `GitHub`_" + +#: ../../Behavioral/State/README.rst:23 +msgid "OrderController.php" +msgstr "OrderController.php" + +#: ../../Behavioral/State/README.rst:29 +msgid "OrderFactory.php" +msgstr "OrderFactory.php" + +#: ../../Behavioral/State/README.rst:35 +msgid "OrderInterface.php" +msgstr "OrderInterface.php" + +#: ../../Behavioral/State/README.rst:41 +msgid "ShippingOrder.php" +msgstr "ShippingOrder.php" + +#: ../../Behavioral/State/README.rst:47 +msgid "CreateOrder.php" +msgstr "CreateOrder.php" + +#: ../../Behavioral/State/README.rst:54 +msgid "Test" +msgstr "Test" diff --git a/locale/de/LC_MESSAGES/Behavioral/Strategy/README.po b/locale/de/LC_MESSAGES/Behavioral/Strategy/README.po new file mode 100644 index 0000000..0649cff --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/Strategy/README.po @@ -0,0 +1,98 @@ +# +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: 2016-04-03 14:35+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../Behavioral/Strategy/README.rst:2 +msgid "`Strategy`__" +msgstr "`Strategy`__" + +#: ../../Behavioral/Strategy/README.rst:5 +msgid "Terminology:" +msgstr "Terminologie:" + +#: ../../Behavioral/Strategy/README.rst:7 +msgid "Context" +msgstr "Context" + +#: ../../Behavioral/Strategy/README.rst:8 +msgid "Strategy" +msgstr "Strategy" + +#: ../../Behavioral/Strategy/README.rst:9 +msgid "Concrete Strategy" +msgstr "Concrete Strategy" + +#: ../../Behavioral/Strategy/README.rst:12 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Mehrere Strategien zu trennen und schnelles Hin- und Herrschaften zwischen diesen zu ermöglichen. " +"Außerdem ist dieses Muster eine perfekte Alternative zu Vererbung von einer abstrakten Klasse." + +#: ../../Behavioral/Strategy/README.rst:19 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Behavioral/Strategy/README.rst:21 +msgid "sorting a list of objects, one strategy by date, the other by id" +msgstr "" +"eine Liste an Objekten zu sortieren, wobei jede Strategie dies anhand anderer Daten vornimmt " +"(Datum, ID, etc.)" + +#: ../../Behavioral/Strategy/README.rst:22 +msgid "simplify unit testing: e.g. switching between file and in-memory storage" +msgstr "" +"Unit-Tests zu vereinfachen indem zwischen darunterliegendem Storage umgeschalten wird: Datei vs. in-" +"Memory" + +#: ../../Behavioral/Strategy/README.rst:26 +msgid "UML Diagram" +msgstr "UML-Diagramm" + +#: ../../Behavioral/Strategy/README.rst:33 +msgid "Code" +msgstr "Code" + +#: ../../Behavioral/Strategy/README.rst:35 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code hierzu auf `GitHub`_" + +#: ../../Behavioral/Strategy/README.rst:37 +msgid "ObjectCollection.php" +msgstr "ObjectCollection.php" + +#: ../../Behavioral/Strategy/README.rst:43 +msgid "ComparatorInterface.php" +msgstr "ComparatorInterface.php" + +#: ../../Behavioral/Strategy/README.rst:49 +msgid "DateComparator.php" +msgstr "DateComparator.php" + +#: ../../Behavioral/Strategy/README.rst:55 +msgid "IdComparator.php" +msgstr "IdComparator.php" + +#: ../../Behavioral/Strategy/README.rst:62 +msgid "Test" +msgstr "Test" + +#: ../../Behavioral/Strategy/README.rst:64 +msgid "Tests/StrategyTest.php" +msgstr "Tests/StrategyTest.php" diff --git a/locale/de/LC_MESSAGES/Behavioral/TemplateMethod/README.po b/locale/de/LC_MESSAGES/Behavioral/TemplateMethod/README.po new file mode 100644 index 0000000..e5d5359 --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/TemplateMethod/README.po @@ -0,0 +1,86 @@ +# +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: 2016-04-03 14:40+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../Behavioral/TemplateMethod/README.rst:2 +msgid "`Template Method`__" +msgstr "`Template Method`__" + +#: ../../Behavioral/TemplateMethod/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Behavioral/TemplateMethod/README.rst:7 +msgid "Template Method is a behavioral design pattern." +msgstr "Template Methode ist ein Verhaltensmuster." + +#: ../../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 "" +"Vielleicht kennst du diesen Fall schon. Die Idee hierbei ist, mehrere Subklassen „finalisieren“ das Verhalten eines " +"Algorithmus." + +#: ../../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 "" +"Z.B. das „Hollywood Prinzip“: „Don’t call us, we call you.“ Diese Klasse wird nicht von der Subklasse aufgerufen, " +"sondern im Gegenteil. Das passiert über eine Abstraktion." + +#: ../../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 "" +"In anderen Worten: es gibt ein Gerüst eines Algorithmus, bestens geeignet für eine Framework-Bibliothek. Der User kann " +"dabei eine Methode implementieren und die Superklasse übernimmt alles weitere." + +#: ../../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 "Es ist ein einfacher Weg, um konkrete Klasse zu entkoppeln und Copy-Paste zu minimieren." + +#: ../../Behavioral/TemplateMethod/README.rst:25 +msgid "UML Diagram" +msgstr "UML-Diagramm" + +#: ../../Behavioral/TemplateMethod/README.rst:32 +msgid "Code" +msgstr "Code" + +#: ../../Behavioral/TemplateMethod/README.rst:34 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code hierzu auf `GitHub`_" + +#: ../../Behavioral/TemplateMethod/README.rst:36 +msgid "Journey.php" +msgstr "Journey.php" + +#: ../../Behavioral/TemplateMethod/README.rst:42 +msgid "BeachJourney.php" +msgstr "BeachJourney.php" + +#: ../../Behavioral/TemplateMethod/README.rst:48 +msgid "CityJourney.php" +msgstr "CityJourney.php" + +#: ../../Behavioral/TemplateMethod/README.rst:55 +msgid "Test" +msgstr "Test" + +#: ../../Behavioral/TemplateMethod/README.rst:57 +msgid "Tests/JourneyTest.php" +msgstr "Tests/JourneyTest.php" diff --git a/locale/de/LC_MESSAGES/Behavioral/Visitor/README.po b/locale/de/LC_MESSAGES/Behavioral/Visitor/README.po new file mode 100644 index 0000000..5384b89 --- /dev/null +++ b/locale/de/LC_MESSAGES/Behavioral/Visitor/README.po @@ -0,0 +1,80 @@ +# +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: 2016-04-03 14:43+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../Behavioral/Visitor/README.rst:2 +msgid "`Visitor`__" +msgstr "`Visitor`__" + +#: ../../Behavioral/Visitor/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Das Visitor-Muster ermöglicht es, Operationen auf Objekten an andere Objekte zu übergeben. Der " +"Hauptgrund dafür ist Separation Of Concerns. Klassen müssen dafür einen Vertrag definieren, um " +"Besucher „herein zu bitten“ (in der ``Role::accept``Methode in diesem Beispiel)." + +#: ../../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 "" +"Der Vertrag ist eine Abstrakte Klasse aber diese kann auch ein sauberes Interface besitzen. In " +"diesem Fall entscheidet jeder Besucher selbst welche Methode er aufruft." + +#: ../../Behavioral/Visitor/README.rst:17 +msgid "UML Diagram" +msgstr "UML-Diagramm" + +#: ../../Behavioral/Visitor/README.rst:24 +msgid "Code" +msgstr "Code" + +#: ../../Behavioral/Visitor/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code hierzu auf `GitHub`_" + +#: ../../Behavioral/Visitor/README.rst:28 +msgid "RoleVisitorInterface.php" +msgstr "RoleVisitorInterface.php" + +#: ../../Behavioral/Visitor/README.rst:34 +msgid "RolePrintVisitor.php" +msgstr "RolePrintVisitor.php" + +#: ../../Behavioral/Visitor/README.rst:40 +msgid "Role.php" +msgstr "Role.php" + +#: ../../Behavioral/Visitor/README.rst:46 +msgid "User.php" +msgstr "User.php" + +#: ../../Behavioral/Visitor/README.rst:52 +msgid "Group.php" +msgstr "Group.php" + +#: ../../Behavioral/Visitor/README.rst:59 +msgid "Test" +msgstr "Test" + +#: ../../Behavioral/Visitor/README.rst:61 +msgid "Tests/VisitorTest.php" +msgstr "Tests/VisitorTest.php" diff --git a/locale/de/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/de/LC_MESSAGES/Creational/AbstractFactory/README.po new file mode 100644 index 0000000..ef9802d --- /dev/null +++ b/locale/de/LC_MESSAGES/Creational/AbstractFactory/README.po @@ -0,0 +1,95 @@ +# +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: 2016-04-04 08:20+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Creational/AbstractFactory/README.rst:2 +msgid "`Abstract Factory`__" +msgstr "`Abstract Factory`__" + +#: ../../Creational/AbstractFactory/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Um eine Serie von verwandten oder abhängigen Objekten zu erzeugen, ohne " +"deren konkrete Klassen spezifizieren zu müssen. Im Normalfall " +"implementieren alle diese dasselbe Interface. Der Client der abstrakten " +"Fabrik interessiert sich nicht dafür, wie die Objekte erzeugt werden, er " +"weiß nur, wie die Objekte zueinander gehören." + +#: ../../Creational/AbstractFactory/README.rst:13 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Creational/AbstractFactory/README.rst:20 +msgid "Code" +msgstr "Code" + +#: ../../Creational/AbstractFactory/README.rst:22 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `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 "Теst" + +#: ../../Creational/AbstractFactory/README.rst:87 +msgid "Tests/AbstractFactoryTest.php" +msgstr "Tests/AbstractFactoryTest.php" diff --git a/locale/de/LC_MESSAGES/Creational/Builder/README.po b/locale/de/LC_MESSAGES/Creational/Builder/README.po new file mode 100644 index 0000000..5572e5a --- /dev/null +++ b/locale/de/LC_MESSAGES/Creational/Builder/README.po @@ -0,0 +1,120 @@ +# +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: 2016-04-04 08:22+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Creational/Builder/README.rst:2 +msgid "`Builder`__" +msgstr "`Builder`__" + +#: ../../Creational/Builder/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Creational/Builder/README.rst:7 +msgid "Builder is an interface that build parts of a complex object." +msgstr "Builder ist ein Interface, das Teile eines komplexen Objekts aufbaut." + +#: ../../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 "" +"Manchmal, wenn der Builder ein gutes Bild davon hat, was er bauen solle, " +"dann kann dieses Interface aus auch einer abstrakten Klasse mit " +"Standardmethoden bestehen (siehe Adapter)." + +#: ../../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 "" +"Wenn du einen komplexen Vererbungsbaum für ein Objekt hast, ist es nur " +"logisch, dass auch der Builder über eine komplexe Vererbungshierarchie " +"verfügt." + +#: ../../Creational/Builder/README.rst:15 +msgid "" +"Note: Builders have often a fluent interface, see the mock builder of " +"PHPUnit for example." +msgstr "" +"Hinweis: Builder haben oft auch ein Fluent Interface, siehe z.B. der " +"Mockbuilder in PHPUnit." + +#: ../../Creational/Builder/README.rst:19 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Creational/Builder/README.rst:21 +msgid "PHPUnit: Mock Builder" +msgstr "PHPUnit: Mock Builder" + +#: ../../Creational/Builder/README.rst:24 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Creational/Builder/README.rst:31 +msgid "Code" +msgstr "Code" + +#: ../../Creational/Builder/README.rst:33 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `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 "Теst" + +#: ../../Creational/Builder/README.rst:98 +msgid "Tests/DirectorTest.php" +msgstr "Tests/DirectorTest.php" diff --git a/locale/de/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/de/LC_MESSAGES/Creational/FactoryMethod/README.po new file mode 100644 index 0000000..d17699d --- /dev/null +++ b/locale/de/LC_MESSAGES/Creational/FactoryMethod/README.po @@ -0,0 +1,102 @@ +# +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: 2016-04-04 08:25+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Creational/FactoryMethod/README.rst:2 +msgid "`Factory Method`__" +msgstr "`Factory Method`__" + +#: ../../Creational/FactoryMethod/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Der Vorteil gegenüber einer SimpleFactory ist, dass die Factory über eine " +"Kindklasse erweitert werden kann, sodass es verschiedene Wege geben kann, " +"ein Objekt zu erzeugen" + +#: ../../Creational/FactoryMethod/README.rst:10 +msgid "For simple case, this abstract class could be just an interface" +msgstr "" +"Für einfache Fälle kann statt der abstrakten Klasse auch einfach nur ein " +"Interface existieren" + +#: ../../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 "" +"Dieses Muster ist ein \"echtes\" Muster, da es das \"D\" in S.O.L.I.D. " +"implementiert, das \"Dependency Inversion Prinzip\"." + +#: ../../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 "" +"Die FactoryMethod ist abhängig von einer Abstraktion, nicht der konkreten " +"Klasse. Das ist der entscheidende Vorteil gegenüber der SimpleFactory oder " +"StaticFactory." + +#: ../../Creational/FactoryMethod/README.rst:20 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Creational/FactoryMethod/README.rst:27 +msgid "Code" +msgstr "Code" + +#: ../../Creational/FactoryMethod/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `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 "Теst" + +#: ../../Creational/FactoryMethod/README.rst:76 +msgid "Tests/FactoryMethodTest.php" +msgstr "Tests/FactoryMethodTest.php" diff --git a/locale/de/LC_MESSAGES/Creational/Multiton/README.po b/locale/de/LC_MESSAGES/Creational/Multiton/README.po new file mode 100644 index 0000000..f6a2a20 --- /dev/null +++ b/locale/de/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: 2016-04-04 08:27+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\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 "" +"**DIESES MUSTER IST EIN ANTI-PATTERN! FÜR BESSERE TESTBARKEIT UND " +"WARTBARKEIT VERWENDE STATTDESSEN DEPENDENCY INJECTION!**" + +#: ../../Creational/Multiton/README.rst:8 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"stellt eine Liste an benamten Instanzen bereit, genauso wie ein Singleton, " +"aber mit n Instanzen." + +#: ../../Creational/Multiton/README.rst:14 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Creational/Multiton/README.rst:16 +msgid "2 DB Connectors, e.g. one for MySQL, the other for SQLite" +msgstr "" +"zwei Datenbank-Konnektoren, z.B. einer für MySQL, ein anderer für SQLite" + +#: ../../Creational/Multiton/README.rst:17 +msgid "multiple Loggers (one for debug messages, one for errors)" +msgstr "mehrere Logger (einer für Debugmeldungen, einer für Fehler)" + +#: ../../Creational/Multiton/README.rst:20 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Creational/Multiton/README.rst:27 +msgid "Code" +msgstr "Code" + +#: ../../Creational/Multiton/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Creational/Multiton/README.rst:31 +msgid "Multiton.php" +msgstr "Multiton.php" + +#: ../../Creational/Multiton/README.rst:38 +msgid "Test" +msgstr "Теst" diff --git a/locale/de/LC_MESSAGES/Creational/Pool/README.po b/locale/de/LC_MESSAGES/Creational/Pool/README.po new file mode 100644 index 0000000..a77401d --- /dev/null +++ b/locale/de/LC_MESSAGES/Creational/Pool/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: 2016-04-04 08:35+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Creational/Pool/README.rst:2 +msgid "`Pool`__" +msgstr "`Pool`__" + +#: ../../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 "" +"Das **Objekt Pool Pattern** ist ein Erzeugungsmuster, das ein Set von " +"initialisierten Objekten bereithält - ein \"Pool\" - statt jedesmal ein " +"neues Objekt zu erzeugen und wieder zu zerstören bei Bedarf. Der Client des " +"Pools fragt ein Objekt an und erhält es von dem Pool, führt alle " +"gewünschten Operationen aus und gibt anschließend das Objekt zurück. Das " +"Objekt selbst ist wie eine spezielle Factory implementiert." + +#: ../../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 "" +"Dieses Muster kann die Performance einer Anwendung entscheidend verbessern, " +"wenn die Erzeugung von Objekten teuer ist, oft neue Objekte erzeugt werden " +"müssen und die gleichzeitig verwendete Anzahl von Instanzen eher gering " +"ist. Das Objekt im Pool wird in konstanter Zeit erzeugt, wohingegen die " +"Erzeugung neuer Objekte (vorallem über das Netzwerk) variable Zeit in " +"Anspruch nimmt und bei hoher Auslastung zum Problem führen würde." + +#: ../../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 "" +"Diese Vorteile können vorallem bei teuren Objekterzeugungen ausgespielt " +"werden, wie z.B. Datenbankverbindungen, Socketverbindungen, Threads und " +"großen Grafikobjekten wie Schriften oder Bitmaps. In manchen Situationen, " +"in denen Objekte nur Speicher verbrauchen, aber nicht von externen " +"Resourcen abhängig sind, wird das Muster nicht effizient sein und kann " +"stattdessen die Performance beinträchtigen." + +#: ../../Creational/Pool/README.rst:25 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Creational/Pool/README.rst:32 +msgid "Code" +msgstr "Code" + +#: ../../Creational/Pool/README.rst:34 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Creational/Pool/README.rst:36 +msgid "Pool.php" +msgstr "Pool.php" + +#: ../../Creational/Pool/README.rst:42 +msgid "Processor.php" +msgstr "Processor.php" + +#: ../../Creational/Pool/README.rst:48 +msgid "Worker.php" +msgstr "Worker.php" + +#: ../../Creational/Pool/README.rst:55 +msgid "Test" +msgstr "Теst" + +#: ../../Creational/Pool/README.rst:57 +msgid "Tests/PoolTest.php" +msgstr "Tests/PoolTest.php" + +#: ../../Creational/Pool/README.rst:63 +msgid "Tests/TestWorker.php" +msgstr "Tests/TestWorker.php" diff --git a/locale/de/LC_MESSAGES/Creational/Prototype/README.po b/locale/de/LC_MESSAGES/Creational/Prototype/README.po new file mode 100644 index 0000000..59840c7 --- /dev/null +++ b/locale/de/LC_MESSAGES/Creational/Prototype/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: 2016-04-04 08:36+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Creational/Prototype/README.rst:2 +msgid "`Prototype`__" +msgstr "`Prototype`__" + +#: ../../Creational/Prototype/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Um die Kosten der Erzeugung von Objekten über den normalen Weg (new Foo()) " +"zu vermeiden und stattdessen einen Prototyp zu erzeugen, der bei Bedarf " +"gecloned werden kann." + +#: ../../Creational/Prototype/README.rst:11 +msgid "Examples" +msgstr "Beispiele" + +#: ../../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 "" +"Große Mengen von Daten (z.B. 1 Mio. Zeilen werden in einer Datenbank über " +"ein ORM erzeugt)." + +#: ../../Creational/Prototype/README.rst:17 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Creational/Prototype/README.rst:24 +msgid "Code" +msgstr "Code" + +#: ../../Creational/Prototype/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `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 "Теst" diff --git a/locale/de/LC_MESSAGES/Creational/README.po b/locale/de/LC_MESSAGES/Creational/README.po new file mode 100644 index 0000000..827bc24 --- /dev/null +++ b/locale/de/LC_MESSAGES/Creational/README.po @@ -0,0 +1,33 @@ +# +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: 2016-04-04 08:39+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Creational/README.rst:2 +msgid "`Creational`__" +msgstr "`Erzeugung`__" + +#: ../../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 "" +"In der Softwareentwicklung bezeichnet man die Muster, die neue Objekte in " +"passender Art und Weise erzeugen als Erzeugungsmuster. Die einfache Form " +"der Erzeugung kann in bestimmten Situationen zu Problemen oder erhöhte " +"Komplexität im Design führen. Erzeugungsmuster lösen dieses Problem, in dem " +"sie Objekterzeugung kontrollieren." diff --git a/locale/de/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/de/LC_MESSAGES/Creational/SimpleFactory/README.po new file mode 100644 index 0000000..9c216de --- /dev/null +++ b/locale/de/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -0,0 +1,80 @@ +# +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: 2016-04-04 08:41+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Creational/SimpleFactory/README.rst:2 +msgid "Simple Factory" +msgstr "Simple Factory" + +#: ../../Creational/SimpleFactory/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Creational/SimpleFactory/README.rst:7 +msgid "SimpleFactory is a simple factory pattern." +msgstr "SimpleFactory ist ein vereinfachtes Factory Muster." + +#: ../../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 "" +"Es hebt sich von der Static Factory ab, in dem es KEINE statischen Methoden " +"anbietet, da statische Methoden global verfügbar sind und damit sich " +"Probleme bei z.B. der Testbarkeit ergeben können." + +#: ../../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 "" +"Deshalb kann es mehrere Factories geben, die verschieden parametrisiert " +"werden können und durch Kindklassen erweitert und für Tests gemocked werden " +"können." + +#: ../../Creational/SimpleFactory/README.rst:16 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Creational/SimpleFactory/README.rst:23 +msgid "Code" +msgstr "Code" + +#: ../../Creational/SimpleFactory/README.rst:25 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Creational/SimpleFactory/README.rst:27 +msgid "SimpleFactory.php" +msgstr "SimpleFactory.php" + +#: ../../Creational/SimpleFactory/README.rst:33 +msgid "VehicleInterface.php" +msgstr "VehicleInterface.php" + +#: ../../Creational/SimpleFactory/README.rst:39 +msgid "Bicycle.php" +msgstr "Bicycle.php" + +#: ../../Creational/SimpleFactory/README.rst:45 +msgid "Scooter.php" +msgstr "Scooter.php" + +#: ../../Creational/SimpleFactory/README.rst:52 +msgid "Test" +msgstr "Теst" + +#: ../../Creational/SimpleFactory/README.rst:54 +msgid "Tests/SimpleFactoryTest.php" +msgstr "Tests/SimpleFactoryTest.php" diff --git a/locale/de/LC_MESSAGES/Creational/Singleton/README.po b/locale/de/LC_MESSAGES/Creational/Singleton/README.po new file mode 100644 index 0000000..6c62928 --- /dev/null +++ b/locale/de/LC_MESSAGES/Creational/Singleton/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: 2016-04-04 08:44+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\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 "" +"**DIESES MUSTER IST EIN ANTI-PATTERN! FÜR BESSERE TESTBARKEIT UND " +"WARTBARKEIT, VERWENDE DAS DEPENDENCY INJECTION MUSTER!**" + +#: ../../Creational/Singleton/README.rst:8 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Creational/Singleton/README.rst:10 +msgid "" +"To have only one instance of this object in the application that will " +"handle all calls." +msgstr "" +"Um nur eine einzelne Instanz eines Objekts in der Anwendung zu verwenden, " +"die alle Aufrufe abarbeitet." + +#: ../../Creational/Singleton/README.rst:14 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Creational/Singleton/README.rst:16 +msgid "DB Connector" +msgstr "DB Konnektor" + +#: ../../Creational/Singleton/README.rst:17 +msgid "" +"Logger (may also be a Multiton if there are many log files for several " +"purposes)" +msgstr "" +"Logger (kann auch ein Multiton sein, falls es mehrere Logfiles für " +"verschiedene Zwecke gibt)" + +#: ../../Creational/Singleton/README.rst:19 +msgid "" +"Lock file for the application (there is only one in the filesystem ...)" +msgstr "" +"Lock file für die Anwendung (falls diese nur einmal auf dem System laufen " +"darf ...)" + +#: ../../Creational/Singleton/README.rst:23 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Creational/Singleton/README.rst:30 +msgid "Code" +msgstr "Code" + +#: ../../Creational/Singleton/README.rst:32 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Creational/Singleton/README.rst:34 +msgid "Singleton.php" +msgstr "Singleton.php" + +#: ../../Creational/Singleton/README.rst:41 +msgid "Test" +msgstr "Теst" + +#: ../../Creational/Singleton/README.rst:43 +msgid "Tests/SingletonTest.php" +msgstr "Tests/SingletonTest.php" diff --git a/locale/de/LC_MESSAGES/Creational/StaticFactory/README.po b/locale/de/LC_MESSAGES/Creational/StaticFactory/README.po new file mode 100644 index 0000000..8281af6 --- /dev/null +++ b/locale/de/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: 2016-04-04 08:47+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Creational/StaticFactory/README.rst:2 +msgid "Static Factory" +msgstr "Static Factory" + +#: ../../Creational/StaticFactory/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Ähnlich zur AbstractFactory wird dieses Pattern dafür verwendet, eine Serie " +"von Objekten zu erzeugen, die zueinander in Beziehung stehen oder " +"voneinander abhängig sind. Der Unterschied liegt darin, dass die Static " +"Factory nur eine statische Methode zur Verfügung stellt, um alle Arten von " +"Objekten zu erzeugen. Diese heißt typischerweise ``factory`` oder ``build``." + +#: ../../Creational/StaticFactory/README.rst:14 +msgid "Examples" +msgstr "Beispiele" + +#: ../../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`` oder ``_Frontend`` benutzen eine " +"Factory Methode, um Cache Backends oder Frontends zu erzeugen" + +#: ../../Creational/StaticFactory/README.rst:20 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Creational/StaticFactory/README.rst:27 +msgid "Code" +msgstr "Code" + +#: ../../Creational/StaticFactory/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `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 "Теst" + +#: ../../Creational/StaticFactory/README.rst:58 +msgid "Tests/StaticFactoryTest.php" +msgstr "Tests/StaticFactoryTest.php" diff --git a/locale/de/LC_MESSAGES/More/Delegation/README.po b/locale/de/LC_MESSAGES/More/Delegation/README.po new file mode 100644 index 0000000..907d828 --- /dev/null +++ b/locale/de/LC_MESSAGES/More/Delegation/README.po @@ -0,0 +1,80 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../More/Delegation/README.rst:2 +msgid "`Delegation`__" +msgstr "" + +#: ../../More/Delegation/README.rst:5 +msgid "Purpose" +msgstr "" + +#: ../../More/Delegation/README.rst:7 +msgid "" +"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." +msgstr "" + +#: ../../More/Delegation/README.rst:10 +msgid "Examples" +msgstr "" + +#: ../../More/Delegation/README.rst:12 +msgid "" +"Please review JuniorDeveloper.php, TeamLead.php, and then Usage.php to " +"see it all tied together." +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 this 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/de/LC_MESSAGES/More/EAV/README.po b/locale/de/LC_MESSAGES/More/EAV/README.po new file mode 100644 index 0000000..d0113c0 --- /dev/null +++ b/locale/de/LC_MESSAGES/More/EAV/README.po @@ -0,0 +1,78 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../More/EAV/README.rst:2 +msgid "`Entity-Attribute-Value (EAV)`__" +msgstr "" + +#: ../../More/EAV/README.rst:4 +msgid "" +"The Entity–attribute–value (EAV) pattern in order to implement EAV model " +"with PHP." +msgstr "" + +#: ../../More/EAV/README.rst:7 +msgid "Purpose" +msgstr "" + +#: ../../More/EAV/README.rst:9 +msgid "" +"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." +msgstr "" + +#: ../../More/EAV/README.rst:15 +msgid "Examples" +msgstr "" + +#: ../../More/EAV/README.rst:17 +msgid "Check full work example in `example.php`_ file." +msgstr "" + +#: ../../More/EAV/README.rst:90 +msgid "UML Diagram" +msgstr "" + +#: ../../More/EAV/README.rst:97 +msgid "Code" +msgstr "" + +#: ../../More/EAV/README.rst:99 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../More/EAV/README.rst:102 +msgid "Test" +msgstr "" + +#: ../../More/EAV/README.rst:104 +msgid "Tests/EntityTest.php" +msgstr "" + +#: ../../More/EAV/README.rst:110 +msgid "Tests/AttributeTest.php" +msgstr "" + +#: ../../More/EAV/README.rst:116 +msgid "Tests/ValueTest.php" +msgstr "" + diff --git a/locale/de/LC_MESSAGES/More/README.po b/locale/de/LC_MESSAGES/More/README.po new file mode 100644 index 0000000..a733fa2 --- /dev/null +++ b/locale/de/LC_MESSAGES/More/README.po @@ -0,0 +1,18 @@ +# +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: 2016-04-04 08:13+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../More/README.rst:2 +msgid "More" +msgstr "Weitere" diff --git a/locale/de/LC_MESSAGES/More/Repository/README.po b/locale/de/LC_MESSAGES/More/Repository/README.po new file mode 100644 index 0000000..152a3e7 --- /dev/null +++ b/locale/de/LC_MESSAGES/More/Repository/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: 2016-04-04 08:09+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../More/Repository/README.rst:2 +msgid "Repository" +msgstr "Repository" + +#: ../../More/Repository/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Vermittelt zwischen dem Domain- und Data-Mapping-Layer indem es ein " +"Interface wie für eine Collection implementierung, um auf Domainobjekte zu " +"zugreifen. Das Repository kapselt dabei alle persistierten Objekte und die " +"Operationen auf diesen um eine objektorientierte Sicht auf die " +"Persistenzschicht zu implementieren. Das Repository unterstützt damit die " +"saubere Trennung und eine Abhängigkeit in nur eine Richtung von Domain- und " +"Data-Mapping-Layern." + +#: ../../More/Repository/README.rst:16 +msgid "Examples" +msgstr "Beispiele" + +#: ../../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 "" +"Doctrine 2 ORM: Repository vermittelt zwischen Entity und DBAL und enthält " +"verschiedene Methoden, um Entities zu erhalten" + +#: ../../More/Repository/README.rst:20 +msgid "Laravel Framework" +msgstr "Laravel Framework" + +#: ../../More/Repository/README.rst:23 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../More/Repository/README.rst:30 +msgid "Code" +msgstr "Code" + +#: ../../More/Repository/README.rst:32 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../More/Repository/README.rst:34 +msgid "Post.php" +msgstr "Post.php" + +#: ../../More/Repository/README.rst:40 +msgid "PostRepository.php" +msgstr "PostRepository.php" + +#: ../../More/Repository/README.rst:46 +msgid "Storage.php" +msgstr "Storage.php" + +#: ../../More/Repository/README.rst:52 +msgid "MemoryStorage.php" +msgstr "MemoryStorage.php" + +#: ../../More/Repository/README.rst:59 +msgid "Test" +msgstr "Теst" diff --git a/locale/de/LC_MESSAGES/More/ServiceLocator/README.po b/locale/de/LC_MESSAGES/More/ServiceLocator/README.po new file mode 100644 index 0000000..d3914c8 --- /dev/null +++ b/locale/de/LC_MESSAGES/More/ServiceLocator/README.po @@ -0,0 +1,108 @@ +# +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: 2016-04-04 08:13+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../More/ServiceLocator/README.rst:2 +msgid "`Service Locator`__" +msgstr "`Service Locator`__" + +#: ../../More/ServiceLocator/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Um eine lose gekoppelte Architektur zu erhalten, die testbar, wartbar und " +"erweiterbar ist. Sowohl das Dependency Injection, als auch das Service " +"Locator Pattern sind Implementierungen des Inverse Of Control Patterns." + +#: ../../More/ServiceLocator/README.rst:12 +msgid "Usage" +msgstr "Verwendung" + +#: ../../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 "" +"Mit dem Service Locator kann ein Service anhand eines Interfaces " +"registriert werden. Mit dem Interface kann dann ein Service erhalten und " +"verwendet werden, ohne dass die Anwendung die genaue Implementierung kennen " +"muss. Der Service Locator selbst kann im Bootstrapping der Anwendung " +"konfiguriert und injiziert werden." + +#: ../../More/ServiceLocator/README.rst:20 +msgid "Examples" +msgstr "Beispiele" + +#: ../../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 "" +"Zend Framework 2 macht intensiven Gebrauch vom Service Locator, um im " +"Framework Services zu erstellen und zu teilen (z.B. EventManager, " +"ModuleManager, alle eigenen Services, die durch Module bereitgestellt " +"werden, usw...)" + +#: ../../More/ServiceLocator/README.rst:27 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../More/ServiceLocator/README.rst:34 +msgid "Code" +msgstr "Code" + +#: ../../More/ServiceLocator/README.rst:36 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../More/ServiceLocator/README.rst:38 +msgid "ServiceLocatorInterface.php" +msgstr "ServiceLocatorInterface.php" + +#: ../../More/ServiceLocator/README.rst:44 +msgid "ServiceLocator.php" +msgstr "ServiceLocator.php" + +#: ../../More/ServiceLocator/README.rst:50 +msgid "LogServiceInterface.php" +msgstr "LogServiceInterface.php" + +#: ../../More/ServiceLocator/README.rst:56 +msgid "LogService.php" +msgstr "LogService.php" + +#: ../../More/ServiceLocator/README.rst:62 +msgid "DatabaseServiceInterface.php" +msgstr "DatabaseServiceInterface.php" + +#: ../../More/ServiceLocator/README.rst:68 +msgid "DatabaseService.php" +msgstr "DatabaseService.php" + +#: ../../More/ServiceLocator/README.rst:75 +msgid "Test" +msgstr "Теst" + +#: ../../More/ServiceLocator/README.rst:77 +msgid "Tests/ServiceLocatorTest.php" +msgstr "Tests/ServiceLocatorTest.php" diff --git a/locale/de/LC_MESSAGES/README.po b/locale/de/LC_MESSAGES/README.po new file mode 100644 index 0000000..3cd8baa --- /dev/null +++ b/locale/de/LC_MESSAGES/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: 2016-03-28 20:54+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7\n" + +#: ../../README.rst:5 +msgid "DesignPatternsPHP" +msgstr "DesignPatternsPHP" + +#: ../../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 "" +"Das ist eine Sammlung bekannter Entwurfsmuster (sog. Design Patterns) und Beispielcode, wie man diese in PHP implementieren " +"kann. Für jedes Muster gibt es Beispiele (die meisten davon aus dem Zend Framework, Symfony2 oder Doctrine2, da diese " +"Frameworks weit verbreitet und bekannt sind)." + +#: ../../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 "" +"Ich denke das Problem mit den Mustern ist, dass sie eigentlich sehr bekannt und gut dokumentiert sind, allerdings viele " +"nicht wissen, wann und wie man sie einsetzt." + +#: ../../README.rst:20 +msgid "Patterns" +msgstr "Muster" + +#: ../../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 "" +"Die Patterns können grob in drei Kategorien eingeteilt werden. Um eine vollständige Beschreibung der Muster lesen zu können, " +"klicke bitte auf **die Titelseite des jeweiligen Entwurfsmusters**." + +#: ../../README.rst:35 +msgid "Contribute" +msgstr "Beitragen" + +#: ../../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 "" +"Um die Beispiele zu erweitern oder neue Patterns zu ergänzen kannst du gerne das Projekt forken und bearbeiten! Um eine gute " +"Codequalität zu gewährleisten, benutze bitte `PHP CodeSniffer` mit dem `PSR2 Standard`: `./vendor/bin/phpcs -p --" +"standard=PSR2 --ignore=vendor .`." + +#: ../../README.rst:44 +msgid "License" +msgstr "Lizenz" + +#: ../../README.rst:46 +msgid "(The MIT License)" +msgstr "(The MIT License)" + +#: ../../README.rst:48 +msgid "Copyright (c) 2011 - 2016 `Dominik Liebler`_ and `contributors`_" +msgstr "Copyright (c) 2011 - 2016 `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/de/LC_MESSAGES/Structural/Adapter/README.po b/locale/de/LC_MESSAGES/Structural/Adapter/README.po new file mode 100644 index 0000000..d02f228 --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/Adapter/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: 2016-04-04 07:27+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Structural/Adapter/README.rst:2 +msgid "`Adapter / Wrapper`__" +msgstr "`Adapter / Wrapper`__" + +#: ../../Structural/Adapter/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 its interface to clients while using " +"the original interface." +msgstr "" +"Um ein Interface für eine Klasse in ein kompatibles Interface zu " +"übersetzen. Ein Adapter erlaubt Klassen miteinander zu arbeiten die " +"normalerweise aufgrund von inkompatiblen Interfaces nicht miteinander " +"arbeiten könnten, indem ein Interface für die originalen Klassen zur " +"Verfügung gestellt wird." + +#: ../../Structural/Adapter/README.rst:13 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Structural/Adapter/README.rst:15 +msgid "DB Client libraries adapter" +msgstr "Datenbank-Adapter" + +#: ../../Structural/Adapter/README.rst:16 +msgid "" +"using multiple different webservices and adapters normalize data so that " +"the outcome is the same for all" +msgstr "" +"verschiedene Webservices zu verwenden, bei denen mit Hilfe eines Adapters " +"für jeden die Daten aufbereitet werden, so dass nach außen dasselbe " +"Ergebnis zu erwarten ist" + +#: ../../Structural/Adapter/README.rst:20 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Structural/Adapter/README.rst:27 +msgid "Code" +msgstr "Code" + +#: ../../Structural/Adapter/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Structural/Adapter/README.rst:31 +msgid "PaperBookInterface.php" +msgstr "PaperBookInterface.php" + +#: ../../Structural/Adapter/README.rst:37 +msgid "Book.php" +msgstr "Book.php" + +#: ../../Structural/Adapter/README.rst:43 +msgid "EBookAdapter.php" +msgstr "EBookAdapter.php" + +#: ../../Structural/Adapter/README.rst:49 +msgid "EBookInterface.php" +msgstr "EBookInterface.php" + +#: ../../Structural/Adapter/README.rst:55 +msgid "Kindle.php" +msgstr "Kindle.php" + +#: ../../Structural/Adapter/README.rst:62 +msgid "Test" +msgstr "Теst" + +#: ../../Structural/Adapter/README.rst:64 +msgid "Tests/AdapterTest.php" +msgstr "Tests/AdapterTest.php" diff --git a/locale/de/LC_MESSAGES/Structural/Bridge/README.po b/locale/de/LC_MESSAGES/Structural/Bridge/README.po new file mode 100644 index 0000000..62dd226 --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/Bridge/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: 2016-04-04 07:28+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Structural/Bridge/README.rst:2 +msgid "`Bridge`__" +msgstr "`Bridge`__" + +#: ../../Structural/Bridge/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Structural/Bridge/README.rst:7 +msgid "" +"Decouple an abstraction from its implementation so that the two can vary " +"independently." +msgstr "" +"Eine Abstraktion von seiner Implementierung zu entkoppeln, sodass sich " +"diese unterscheiden können." + +#: ../../Structural/Bridge/README.rst:11 +msgid "Sample:" +msgstr "Beispiel:" + +#: ../../Structural/Bridge/README.rst:13 +msgid "`Symfony DoctrineBridge `__" +msgstr "" +"`Symfony DoctrineBridge `__" + +#: ../../Structural/Bridge/README.rst:17 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Structural/Bridge/README.rst:24 +msgid "Code" +msgstr "Code" + +#: ../../Structural/Bridge/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Structural/Bridge/README.rst:28 +msgid "Workshop.php" +msgstr "Workshop.php" + +#: ../../Structural/Bridge/README.rst:34 +msgid "Assemble.php" +msgstr "Assemble.php" + +#: ../../Structural/Bridge/README.rst:40 +msgid "Produce.php" +msgstr "Produce.php" + +#: ../../Structural/Bridge/README.rst:46 +msgid "Vehicle.php" +msgstr "Vehicle.php" + +#: ../../Structural/Bridge/README.rst:52 +msgid "Motorcycle.php" +msgstr "Motorcycle.php" + +#: ../../Structural/Bridge/README.rst:58 +msgid "Car.php" +msgstr "Car.php" + +#: ../../Structural/Bridge/README.rst:65 +msgid "Test" +msgstr "Теst" + +#: ../../Structural/Bridge/README.rst:67 +msgid "Tests/BridgeTest.php" +msgstr "Tests/BridgeTest.php" diff --git a/locale/de/LC_MESSAGES/Structural/Composite/README.po b/locale/de/LC_MESSAGES/Structural/Composite/README.po new file mode 100644 index 0000000..3bb2f07 --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/Composite/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: 2016-04-04 07:31+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Structural/Composite/README.rst:2 +msgid "`Composite`__" +msgstr "`Composite`__" + +#: ../../Structural/Composite/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Structural/Composite/README.rst:7 +msgid "" +"To treat a group of objects the same way as a single instance of the object." +msgstr "" +"Eine Gruppe von Objekten genauso zu behandeln wie eine einzelne Instanz " +"eines Objekts." + +#: ../../Structural/Composite/README.rst:11 +msgid "Examples" +msgstr "Beispiele" + +#: ../../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 "" +"Eine Formular-Klasseninstanz behandelt alle seine beinhalteten Formelemente " +"wie eine eine einzelne Instanz des Formulars. Wenn ``render()`` aufgerufen " +"wird, werden alle Kindelemente durchlaufen und auf jedem wieder " +"``render()`` aufgerufen." + +#: ../../Structural/Composite/README.rst:16 +msgid "" +"``Zend_Config``: a tree of configuration options, each one is a " +"``Zend_Config`` object itself" +msgstr "" +"``Zend_Config``: ein Baum aus Konfigurationsoptionen, bei dem jedes Objekt " +"wieder eine Instanz von``Zend_Config`` ist" + +#: ../../Structural/Composite/README.rst:20 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Structural/Composite/README.rst:27 +msgid "Code" +msgstr "Code" + +#: ../../Structural/Composite/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Structural/Composite/README.rst:31 +msgid "FormElement.php" +msgstr "FormElement.php" + +#: ../../Structural/Composite/README.rst:37 +msgid "Form.php" +msgstr "Form.php" + +#: ../../Structural/Composite/README.rst:43 +msgid "InputElement.php" +msgstr "InputElement.php" + +#: ../../Structural/Composite/README.rst:49 +msgid "TextElement.php" +msgstr "TextElement.php" + +#: ../../Structural/Composite/README.rst:56 +msgid "Test" +msgstr "Теst" + +#: ../../Structural/Composite/README.rst:58 +msgid "Tests/CompositeTest.php" +msgstr "Tests/CompositeTest.php" diff --git a/locale/de/LC_MESSAGES/Structural/DataMapper/README.po b/locale/de/LC_MESSAGES/Structural/DataMapper/README.po new file mode 100644 index 0000000..0caf1e7 --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/DataMapper/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: 2016-04-04 07:37+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Structural/DataMapper/README.rst:2 +msgid "`Data Mapper`__" +msgstr "`Data Mapper`__" + +#: ../../Structural/DataMapper/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Ein Data Mapper ist Teil der Datenzugriffsschicht (Data Access Layer), die " +"für den bidirektionalen Zugriff auf Daten aus einem persistenten Speicher " +"(oftmals eine relationale Datenbank) in den Domain Layer der Anwendung und " +"zurück zuständig ist. Das Ziel dieses Patterns ist es, die jeweiligen Layer " +"zu trennen und unabhängig voneinander zu gestalten. Der Layer besteht aus " +"einem oder mehreren Mappern (oder Data Access Objects), die den Austasch " +"von Daten regeln. Mapper können dabei unterschiedlich komplex aufgebaut " +"sein. Generische Mapper werden viele verschiedene Domain Entity Typen " +"verarbeiten können, aber auch spezialisierte Mapper sind denkbar." + +#: ../../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 "" +"Im Gegensatz zum Active Record Pattern folgt dieses Muster dem Single " +"Responsibility Prinzip." + +#: ../../Structural/DataMapper/README.rst:21 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Structural/DataMapper/README.rst:23 +msgid "" +"DB Object Relational Mapper (ORM) : Doctrine2 uses DAO named as " +"\"EntityRepository\"" +msgstr "" +"DB Object Relational Mapper (ORM) : Doctrine2 использует DAO под названием " +"\"EntityRepository\"" + +#: ../../Structural/DataMapper/README.rst:27 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Structural/DataMapper/README.rst:34 +msgid "Code" +msgstr "Code" + +#: ../../Structural/DataMapper/README.rst:36 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Structural/DataMapper/README.rst:38 +msgid "User.php" +msgstr "User.php" + +#: ../../Structural/DataMapper/README.rst:44 +msgid "UserMapper.php" +msgstr "UserMapper.php" + +#: ../../Structural/DataMapper/README.rst:51 +msgid "Test" +msgstr "Теst" + +#: ../../Structural/DataMapper/README.rst:53 +msgid "Tests/DataMapperTest.php" +msgstr "Tests/DataMapperTest.php" diff --git a/locale/de/LC_MESSAGES/Structural/Decorator/README.po b/locale/de/LC_MESSAGES/Structural/Decorator/README.po new file mode 100644 index 0000000..c9e07db --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/Decorator/README.po @@ -0,0 +1,80 @@ +# +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: 2016-04-04 07:42+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Structural/Decorator/README.rst:2 +msgid "`Decorator`__" +msgstr "`Decorator`__" + +#: ../../Structural/Decorator/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Structural/Decorator/README.rst:7 +msgid "To dynamically add new functionality to class instances." +msgstr "neue Funktionalität dynamisch zu Klasseninstanzen hinzuzufügen." + +#: ../../Structural/Decorator/README.rst:10 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Structural/Decorator/README.rst:12 +msgid "Zend Framework: decorators for ``Zend_Form_Element`` instances" +msgstr "Zend Framework: Dekoratoren für ``Zend_Form_Element`` Instanzen" + +#: ../../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 "Web Service Layer: JSON- und XML-Dekoratoren für einen REST Service" + +#: ../../Structural/Decorator/README.rst:17 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Structural/Decorator/README.rst:24 +msgid "Code" +msgstr "Code" + +#: ../../Structural/Decorator/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Structural/Decorator/README.rst:28 +msgid "RendererInterface.php" +msgstr "RendererInterface.php" + +#: ../../Structural/Decorator/README.rst:34 +msgid "Webservice.php" +msgstr "Webservice.php" + +#: ../../Structural/Decorator/README.rst:40 +msgid "Decorator.php" +msgstr "Decorator.php" + +#: ../../Structural/Decorator/README.rst:46 +msgid "RenderInXml.php" +msgstr "RenderInXml.php" + +#: ../../Structural/Decorator/README.rst:52 +msgid "RenderInJson.php" +msgstr "RenderInJson.php" + +#: ../../Structural/Decorator/README.rst:59 +msgid "Test" +msgstr "Теst" + +#: ../../Structural/Decorator/README.rst:61 +msgid "Tests/DecoratorTest.php" +msgstr "Tests/DecoratorTest.php" diff --git a/locale/de/LC_MESSAGES/Structural/DependencyInjection/README.po b/locale/de/LC_MESSAGES/Structural/DependencyInjection/README.po new file mode 100644 index 0000000..101df4f --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/DependencyInjection/README.po @@ -0,0 +1,128 @@ +# +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: 2016-04-04 08:17+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Structural/DependencyInjection/README.rst:2 +msgid "`Dependency Injection`__" +msgstr "`Dependency Injection`__" + +#: ../../Structural/DependencyInjection/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Structural/DependencyInjection/README.rst:7 +msgid "" +"To implement a loosely coupled architecture in order to get better " +"testable, maintainable and extendable code." +msgstr "" +"Eine lose gekoppelte Architektur zu implementieren, um besser testbaren, " +"wartbaren und erweiterbaren Code zu erreichen." + +#: ../../Structural/DependencyInjection/README.rst:11 +msgid "Usage" +msgstr "Verwendung" + +#: ../../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 "" +"Die Konfiguration wird injiziert und ``Connection`` wird sich von ``" +"$config`` selbstständig nehmen, was es braucht. Ohne DI würde die " +"Konfiguration direkt in ``Connection`` erzeugt, was sich schlecht testen " +"und erweitern lässt." + +#: ../../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 "" +"Beachte, dass wir in ``Connection`` dem Inversion of Control Prinzip " +"folgen, indem wir ``$config`` das ``Parameters`` Interface implementieren " +"lassen. Das entkoppelt unsere Komponenten. Wir interessieren uns auch nicht " +"für die Quelle der benötigten Informationen, alles was an der Stelle " +"wichtig ist, ist, dass ``$config`` bestimmte Methoden zum Auslesen der " +"Informationen bereitstellt. Weiteres zu Inversion of control gibt es`hier " +"`__." + +#: ../../Structural/DependencyInjection/README.rst:26 +msgid "Examples" +msgstr "Beispiele" + +#: ../../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 "" +"Das Doctrine2 ORM benutzt Dependency Injection für z.B. die Konfiguration, " +"die in ein ``Connection`` injiziert wird. Für Testzwecke lässt sich diese " +"leicht durch ein gemocktes Objekt austauschen." + +#: ../../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 "" +"Symfony2 und Zend Framework 2 bieten beide Dependency Injection Container " +"an, die selbstständig vorkonfigurierte Objekte bei Bedarf erzeugen und " +"diese in z.B. Controller injizieren können." + +#: ../../Structural/DependencyInjection/README.rst:37 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Structural/DependencyInjection/README.rst:44 +msgid "Code" +msgstr "Code" + +#: ../../Structural/DependencyInjection/README.rst:46 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Structural/DependencyInjection/README.rst:48 +msgid "AbstractConfig.php" +msgstr "AbstractConfig.php" + +#: ../../Structural/DependencyInjection/README.rst:54 +msgid "Parameters.php" +msgstr "Parameters.php" + +#: ../../Structural/DependencyInjection/README.rst:60 +msgid "ArrayConfig.php" +msgstr "ArrayConfig.php" + +#: ../../Structural/DependencyInjection/README.rst:66 +msgid "Connection.php" +msgstr "Connection.php" + +#: ../../Structural/DependencyInjection/README.rst:73 +msgid "Test" +msgstr "Теst" + +#: ../../Structural/DependencyInjection/README.rst:75 +msgid "Tests/DependencyInjectionTest.php" +msgstr "Tests/DependencyInjectionTest.php" + +#: ../../Structural/DependencyInjection/README.rst:81 +msgid "Tests/config.php" +msgstr "Tests/config.php" diff --git a/locale/de/LC_MESSAGES/Structural/Facade/README.po b/locale/de/LC_MESSAGES/Structural/Facade/README.po new file mode 100644 index 0000000..ee3902c --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/Facade/README.po @@ -0,0 +1,102 @@ +# +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: 2016-04-04 07:56+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Structural/Facade/README.rst:2 +msgid "`Facade`__" +msgstr "`Facade`__" + +#: ../../Structural/Facade/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Das primäre Ziel des Facade-Musters ist nicht, dir das Lesen von komplexen " +"API Dokumentationen zu ersparen. Das kann ein Seiteneffekt sein. Es ist " +"vielmehr das Ziel, Kopplungen zu vermeiden und dem Gesetz von Demeter zu " +"folgen." + +#: ../../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 "" +"Eine Facade dient dazu, den Client von einem Subsystem zu entkopplen, indem " +"ein oder mehrere Interfaces einzuführen und damit Komplexität zu verringern." + +#: ../../Structural/Facade/README.rst:15 +msgid "A facade does not forbid you the access to the sub-system" +msgstr "Eine Facade verbietet nicht den Zugriff auf das Subsystem" + +#: ../../Structural/Facade/README.rst:16 +msgid "You can (you should) have multiple facades for one sub-system" +msgstr "" +"Es ist nicht unüblich, mehrere Fassaden für ein Subsystem zu implementieren" + +#: ../../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 "" +"Deshalb besitzt eine gute Facade keine ``new`` Aufrufe. Falls es mehrere " +"Erzeugungsmethoden pro Methode gibt, handelt es sicht nicht um eine Facade, " +"sondern um einen Builder oder [Abstract\\|Static\\|Simple] Factory [Method]." + +#: ../../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 "" +"Bestenfalls besitzt eine Facade kein ``new`` und einen Konstruktor mit Type-" +"Hints als Parameter. Falls du neue Instanzen erzeugen willst, kannst du " +"eine Factory als Argument verwenden." + +#: ../../Structural/Facade/README.rst:27 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Structural/Facade/README.rst:34 +msgid "Code" +msgstr "Code" + +#: ../../Structural/Facade/README.rst:36 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Structural/Facade/README.rst:38 +msgid "Facade.php" +msgstr "Facade.php" + +#: ../../Structural/Facade/README.rst:44 +msgid "OsInterface.php" +msgstr "OsInterface.php" + +#: ../../Structural/Facade/README.rst:50 +msgid "BiosInterface.php" +msgstr "BiosInterface.php" + +#: ../../Structural/Facade/README.rst:57 +msgid "Test" +msgstr "Теst" + +#: ../../Structural/Facade/README.rst:59 +msgid "Tests/FacadeTest.php" +msgstr "Tests/FacadeTest.php" diff --git a/locale/de/LC_MESSAGES/Structural/FluentInterface/README.po b/locale/de/LC_MESSAGES/Structural/FluentInterface/README.po new file mode 100644 index 0000000..f51776a --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/FluentInterface/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: 2016-04-04 07:57+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Structural/FluentInterface/README.rst:2 +msgid "`Fluent Interface`__" +msgstr "`Fluent Interface`__" + +#: ../../Structural/FluentInterface/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Structural/FluentInterface/README.rst:7 +msgid "" +"To write code that is easy readable just like sentences in a natural " +"language (like English)." +msgstr "" +"Um Code zu schreiben, der wie ein Satz in einer natürlichen Sprache gelesen " +"werden kann (z.B. in Englisch)" + +#: ../../Structural/FluentInterface/README.rst:11 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Structural/FluentInterface/README.rst:13 +msgid "Doctrine2's QueryBuilder works something like that example class below" +msgstr "" +"Doctrine2's QueryBuilder funktioniert ähnlich zu dem Beispiel hier unten" + +#: ../../Structural/FluentInterface/README.rst:15 +msgid "PHPUnit uses fluent interfaces to build mock objects" +msgstr "PHPUnit verwendet ein Fluent Interface, um Mockobjekte zu erstellen" + +#: ../../Structural/FluentInterface/README.rst:16 +msgid "Yii Framework: CDbCommand and CActiveRecord use this pattern, too" +msgstr "" +"Yii Framework: CDbCommand und CActiveRecord verwenden auch dieses Muster" + +#: ../../Structural/FluentInterface/README.rst:19 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Structural/FluentInterface/README.rst:26 +msgid "Code" +msgstr "Code" + +#: ../../Structural/FluentInterface/README.rst:28 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Structural/FluentInterface/README.rst:30 +msgid "Sql.php" +msgstr "Sql.php" + +#: ../../Structural/FluentInterface/README.rst:37 +msgid "Test" +msgstr "Теst" + +#: ../../Structural/FluentInterface/README.rst:39 +msgid "Tests/FluentInterfaceTest.php" +msgstr "Tests/FluentInterfaceTest.php" diff --git a/locale/de/LC_MESSAGES/Structural/Flyweight/README.po b/locale/de/LC_MESSAGES/Structural/Flyweight/README.po new file mode 100644 index 0000000..cfa8492 --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/Flyweight/README.po @@ -0,0 +1,69 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../Structural/Flyweight/README.rst:2 +msgid "`Flyweight`__" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:5 +msgid "Purpose" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:7 +msgid "" +"To minimise memory usage, a Flyweight shares as much as possible memory " +"with similar objects. It is needed when a large amount of objects is used" +" that don't differ much in state. A common practice is to hold state in " +"external data structures and pass them to the flyweight object when " +"needed." +msgstr "" + +#: ../../Structural/Flyweight/README.rst:12 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:19 +msgid "Code" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:21 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:23 +msgid "FlyweightInterface.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:29 +msgid "CharacterFlyweight.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:35 +msgid "FlyweightFactory.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:42 +msgid "Test" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:44 +msgid "Tests/FlyweightTest.php" +msgstr "" + diff --git a/locale/de/LC_MESSAGES/Structural/Proxy/README.po b/locale/de/LC_MESSAGES/Structural/Proxy/README.po new file mode 100644 index 0000000..3d85bb4 --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/Proxy/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: 2016-04-04 07:59+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Structural/Proxy/README.rst:2 +msgid "`Proxy`__" +msgstr "`Proxy`__" + +#: ../../Structural/Proxy/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../Structural/Proxy/README.rst:7 +msgid "To interface to anything that is expensive or impossible to duplicate." +msgstr "" +"Um ein Interface bereitzustellen, das teuer oder unmöglich zu duplizieren " +"ist" + +#: ../../Structural/Proxy/README.rst:10 +msgid "Examples" +msgstr "Beispiele" + +#: ../../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 "" +"Doctrine2 verwendet Proxies, um sein Framework zu implementieren (z.B. Lazy " +"Initialization), der User arbeitet aber dennoch mit seinen eigenen Entity " +"Klassen und wird niemals die Proxies anpassen" + +#: ../../Structural/Proxy/README.rst:17 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Structural/Proxy/README.rst:24 +msgid "Code" +msgstr "Code" + +#: ../../Structural/Proxy/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Structural/Proxy/README.rst:28 +msgid "Record.php" +msgstr "Record.php" + +#: ../../Structural/Proxy/README.rst:34 +msgid "RecordProxy.php" +msgstr "RecordProxy.php" + +#: ../../Structural/Proxy/README.rst:41 +msgid "Test" +msgstr "Теst" diff --git a/locale/de/LC_MESSAGES/Structural/README.po b/locale/de/LC_MESSAGES/Structural/README.po new file mode 100644 index 0000000..1404b66 --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/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: 2016-04-04 08:03+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Structural/README.rst:2 +msgid "`Structural`__" +msgstr "`Strukturell`__" + +#: ../../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 "" +"In der Softwareentwicklung bezeichnet man Strukturelle Muster als die " +"Design Patterns, die das Design vereinfachen, indem sie Beziehungen " +"zwischen Objekten realisieren." diff --git a/locale/de/LC_MESSAGES/Structural/Registry/README.po b/locale/de/LC_MESSAGES/Structural/Registry/README.po new file mode 100644 index 0000000..efda2fd --- /dev/null +++ b/locale/de/LC_MESSAGES/Structural/Registry/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: 2016-04-04 08:02+0200\n" +"Last-Translator: Dominik Liebler \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.7.1\n" + +#: ../../Structural/Registry/README.rst:2 +msgid "`Registry`__" +msgstr "`Registry`__" + +#: ../../Structural/Registry/README.rst:5 +msgid "Purpose" +msgstr "Zweck" + +#: ../../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 "" +"Einen zentralen Speicher für Objekte zu implementieren, die oft " +"innerhalb der Anwendung benötigt werden. Wird üblicherweise als " +"abstrakte Klasse mit statischen Methoden (oder als Singleton) " +"implementiert" + +#: ../../Structural/Registry/README.rst:12 +msgid "Examples" +msgstr "Beispiele" + +#: ../../Structural/Registry/README.rst:14 +msgid "" +"Zend Framework 1: ``Zend_Registry`` holds the application's logger " +"object, front controller etc." +msgstr "" +"Zend Framework 1: ``Zend_Registry`` hält die zentralen Objekte der " +"Anwendung: z.B. Logger oder Front Controller" + +#: ../../Structural/Registry/README.rst:16 +msgid "" +"Yii Framework: ``CWebApplication`` holds all the application components, " +"such as ``CWebUser``, ``CUrlManager``, etc." +msgstr "" +"Yii Framework: ``CWebApplication`` hält alle Anwendungskomponenten, wie " +"z.B.``CWebUser``, ``CUrlManager``, etc." + +#: ../../Structural/Registry/README.rst:20 +msgid "UML Diagram" +msgstr "UML Diagramm" + +#: ../../Structural/Registry/README.rst:27 +msgid "Code" +msgstr "Code" + +#: ../../Structural/Registry/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "Du findest den Code auch auf `GitHub`_" + +#: ../../Structural/Registry/README.rst:31 +msgid "Registry.php" +msgstr "Registry.php" + +#: ../../Structural/Registry/README.rst:38 +msgid "Test" +msgstr "Теst" + +#: ../../Structural/Registry/README.rst:40 +msgid "Tests/RegistryTest.php" +msgstr "Tests/RegistryTest.php" diff --git a/locale/es/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po b/locale/es/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po index b5277a5..19f8d8d 100644 --- a/locale/es/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po @@ -62,7 +62,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/ChainOfResponsibilities/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/ChainOfResponsibilities/README.rst:36 diff --git a/locale/es/LC_MESSAGES/Behavioral/Command/README.po b/locale/es/LC_MESSAGES/Behavioral/Command/README.po index 29319a3..158d346 100644 --- a/locale/es/LC_MESSAGES/Behavioral/Command/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/Command/README.po @@ -71,7 +71,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Command/README.rst:41 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Command/README.rst:43 diff --git a/locale/es/LC_MESSAGES/Behavioral/Iterator/README.po b/locale/es/LC_MESSAGES/Behavioral/Iterator/README.po index 3000658..25ccf3a 100644 --- a/locale/es/LC_MESSAGES/Behavioral/Iterator/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/Iterator/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -20,9 +20,7 @@ msgid "Purpose" msgstr "" #: ../../Behavioral/Iterator/README.rst:7 -msgid "" -"To make an object iterable and to make it appear like a collection of " -"objects." +msgid "To make an object iterable and to make it appear like a collection of objects." msgstr "" #: ../../Behavioral/Iterator/README.rst:11 @@ -55,7 +53,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Iterator/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Iterator/README.rst:36 diff --git a/locale/es/LC_MESSAGES/Behavioral/Mediator/README.po b/locale/es/LC_MESSAGES/Behavioral/Mediator/README.po index 9c6694b..e9a44dd 100644 --- a/locale/es/LC_MESSAGES/Behavioral/Mediator/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/Mediator/README.po @@ -21,8 +21,8 @@ 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 " +"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)." msgstr "" @@ -42,7 +42,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Mediator/README.rst:25 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Mediator/README.rst:27 diff --git a/locale/es/LC_MESSAGES/Behavioral/Memento/README.po b/locale/es/LC_MESSAGES/Behavioral/Memento/README.po index 913069a..13c073e 100644 --- a/locale/es/LC_MESSAGES/Behavioral/Memento/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/Memento/README.po @@ -1,15 +1,22 @@ -# +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-29 12:18+0200\n" +"POT-Creation-Date: 2016-06-03 23:59+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-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.3.4\n" #: ../../Behavioral/Memento/README.rst:2 msgid "`Memento`__" @@ -21,65 +28,184 @@ msgstr "" #: ../../Behavioral/Memento/README.rst:7 msgid "" -"Provide the ability to restore an object to its previous state (undo via " -"rollback)." +"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)." msgstr "" -#: ../../Behavioral/Memento/README.rst:10 +#: ../../Behavioral/Memento/README.rst:12 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." +"The memento pattern is implemented with three objects: the Originator, a " +"Caretaker and a Memento." msgstr "" -#: ../../Behavioral/Memento/README.rst:23 +#: ../../Behavioral/Memento/README.rst:15 +msgid "" +"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)." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:24 +msgid "" +"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*." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:33 +msgid "" +"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." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:39 msgid "Examples" msgstr "" -#: ../../Behavioral/Memento/README.rst:25 +#: ../../Behavioral/Memento/README.rst:41 msgid "The seed of a pseudorandom number generator" msgstr "" -#: ../../Behavioral/Memento/README.rst:26 +#: ../../Behavioral/Memento/README.rst:42 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" +#: ../../Behavioral/Memento/README.rst:43 +msgid "" +"Control for intermediate states of `ORM Model " +"`_ before saving" msgstr "" #: ../../Behavioral/Memento/README.rst:46 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:53 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:55 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:57 +msgid "Memento.php" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:63 msgid "Originator.php" msgstr "" -#: ../../Behavioral/Memento/README.rst:52 +#: ../../Behavioral/Memento/README.rst:69 msgid "Caretaker.php" msgstr "" -#: ../../Behavioral/Memento/README.rst:59 +#: ../../Behavioral/Memento/README.rst:76 msgid "Test" msgstr "" -#: ../../Behavioral/Memento/README.rst:61 +#: ../../Behavioral/Memento/README.rst:78 msgid "Tests/MementoTest.php" msgstr "" + + + +#. # +#. 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 this 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 index 35b77f6..a397fc5 100644 --- a/locale/es/LC_MESSAGES/Behavioral/NullObject/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/NullObject/README.po @@ -75,7 +75,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/NullObject/README.rst:39 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/NullObject/README.rst:41 diff --git a/locale/es/LC_MESSAGES/Behavioral/Observer/README.po b/locale/es/LC_MESSAGES/Behavioral/Observer/README.po index 6aea8e9..8a43616 100644 --- a/locale/es/LC_MESSAGES/Behavioral/Observer/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/Observer/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -22,7 +22,7 @@ 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 " +"\"Subject\" object changes its state, the attached \"Observers\" will be " "notified. It is used to shorten the amount of coupled objects and uses loose" " coupling instead." msgstr "" @@ -55,7 +55,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Observer/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Observer/README.rst:36 diff --git a/locale/es/LC_MESSAGES/Behavioral/Specification/README.po b/locale/es/LC_MESSAGES/Behavioral/Specification/README.po index 54e3b64..7b1982b 100644 --- a/locale/es/LC_MESSAGES/Behavioral/Specification/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/Specification/README.po @@ -44,7 +44,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Specification/README.rst:27 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Specification/README.rst:29 diff --git a/locale/es/LC_MESSAGES/Behavioral/State/README.po b/locale/es/LC_MESSAGES/Behavioral/State/README.po index f71fbfa..2ced881 100644 --- a/locale/es/LC_MESSAGES/Behavioral/State/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/State/README.po @@ -35,7 +35,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/State/README.rst:21 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/State/README.rst:23 diff --git a/locale/es/LC_MESSAGES/Behavioral/Strategy/README.po b/locale/es/LC_MESSAGES/Behavioral/Strategy/README.po index dd5797e..c3b9fea 100644 --- a/locale/es/LC_MESSAGES/Behavioral/Strategy/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/Strategy/README.po @@ -64,7 +64,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Strategy/README.rst:35 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Strategy/README.rst:37 diff --git a/locale/es/LC_MESSAGES/Behavioral/TemplateMethod/README.po b/locale/es/LC_MESSAGES/Behavioral/TemplateMethod/README.po index 4f6fa81..331d234 100644 --- a/locale/es/LC_MESSAGES/Behavioral/TemplateMethod/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/TemplateMethod/README.po @@ -59,7 +59,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/TemplateMethod/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/TemplateMethod/README.rst:36 diff --git a/locale/es/LC_MESSAGES/Behavioral/Visitor/README.po b/locale/es/LC_MESSAGES/Behavioral/Visitor/README.po index cab0ea9..08784a3 100644 --- a/locale/es/LC_MESSAGES/Behavioral/Visitor/README.po +++ b/locale/es/LC_MESSAGES/Behavioral/Visitor/README.po @@ -43,7 +43,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Visitor/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Visitor/README.rst:28 diff --git a/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po index 8c9340b..32767b0 100644 --- a/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po +++ b/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po @@ -42,7 +42,7 @@ msgid "Code" msgstr "Código" #: ../../Creational/AbstractFactory/README.rst:22 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/AbstractFactory/README.rst:24 diff --git a/locale/es/LC_MESSAGES/Creational/Builder/README.po b/locale/es/LC_MESSAGES/Creational/Builder/README.po index 0cbdd58..2460300 100644 --- a/locale/es/LC_MESSAGES/Creational/Builder/README.po +++ b/locale/es/LC_MESSAGES/Creational/Builder/README.po @@ -69,7 +69,7 @@ msgid "Code" msgstr "Código" #: ../../Creational/Builder/README.rst:33 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/Builder/README.rst:35 diff --git a/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po index 550573a..2767257 100644 --- a/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po +++ b/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po @@ -57,7 +57,7 @@ msgid "Code" msgstr "Código" #: ../../Creational/FactoryMethod/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/FactoryMethod/README.rst:31 diff --git a/locale/es/LC_MESSAGES/Creational/Multiton/README.po b/locale/es/LC_MESSAGES/Creational/Multiton/README.po index c32fbaa..e19694b 100644 --- a/locale/es/LC_MESSAGES/Creational/Multiton/README.po +++ b/locale/es/LC_MESSAGES/Creational/Multiton/README.po @@ -59,7 +59,7 @@ msgid "Code" msgstr "Código" #: ../../Creational/Multiton/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/Multiton/README.rst:31 diff --git a/locale/es/LC_MESSAGES/Creational/Pool/README.po b/locale/es/LC_MESSAGES/Creational/Pool/README.po index 99fbef8..0a1367a 100644 --- a/locale/es/LC_MESSAGES/Creational/Pool/README.po +++ b/locale/es/LC_MESSAGES/Creational/Pool/README.po @@ -66,7 +66,7 @@ msgid "Code" msgstr "Código" #: ../../Creational/Pool/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/Pool/README.rst:36 diff --git a/locale/es/LC_MESSAGES/Creational/Prototype/README.po b/locale/es/LC_MESSAGES/Creational/Prototype/README.po index dfd8b5e..f723c87 100644 --- a/locale/es/LC_MESSAGES/Creational/Prototype/README.po +++ b/locale/es/LC_MESSAGES/Creational/Prototype/README.po @@ -50,7 +50,7 @@ msgid "Code" msgstr "Código" #: ../../Creational/Prototype/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/Prototype/README.rst:28 diff --git a/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po index 0b517cd..2776923 100644 --- a/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po +++ b/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -44,7 +44,7 @@ msgid "Code" msgstr "" #: ../../Creational/SimpleFactory/README.rst:25 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/SimpleFactory/README.rst:27 diff --git a/locale/es/LC_MESSAGES/Creational/Singleton/README.po b/locale/es/LC_MESSAGES/Creational/Singleton/README.po index 0bb78f3..aadfa8f 100644 --- a/locale/es/LC_MESSAGES/Creational/Singleton/README.po +++ b/locale/es/LC_MESSAGES/Creational/Singleton/README.po @@ -68,7 +68,7 @@ msgid "Code" msgstr "Código" #: ../../Creational/Singleton/README.rst:32 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Puedes ver este código en `GitHub`_" #: ../../Creational/Singleton/README.rst:34 diff --git a/locale/es/LC_MESSAGES/Creational/StaticFactory/README.po b/locale/es/LC_MESSAGES/Creational/StaticFactory/README.po index 7005abb..038d1e4 100644 --- a/locale/es/LC_MESSAGES/Creational/StaticFactory/README.po +++ b/locale/es/LC_MESSAGES/Creational/StaticFactory/README.po @@ -56,7 +56,7 @@ msgid "Code" msgstr "Código" #: ../../Creational/StaticFactory/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/StaticFactory/README.rst:31 diff --git a/locale/es/LC_MESSAGES/More/Delegation/README.po b/locale/es/LC_MESSAGES/More/Delegation/README.po index 169e8fd..907d828 100644 --- a/locale/es/LC_MESSAGES/More/Delegation/README.po +++ b/locale/es/LC_MESSAGES/More/Delegation/README.po @@ -1,15 +1,22 @@ -# +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-29 12:18+0200\n" +"POT-Creation-Date: 2016-06-03 23:59+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-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.3.4\n" #: ../../More/Delegation/README.rst:2 msgid "`Delegation`__" @@ -19,14 +26,26 @@ msgstr "" msgid "Purpose" msgstr "" -#: ../../More/Delegation/README.rst:7 ../../More/Delegation/README.rst:12 -msgid "..." +#: ../../More/Delegation/README.rst:7 +msgid "" +"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." msgstr "" #: ../../More/Delegation/README.rst:10 msgid "Examples" msgstr "" +#: ../../More/Delegation/README.rst:12 +msgid "" +"Please review JuniorDeveloper.php, TeamLead.php, and then Usage.php to " +"see it all tied together." +msgstr "" + #: ../../More/Delegation/README.rst:15 msgid "UML Diagram" msgstr "" @@ -36,7 +55,7 @@ msgid "Code" msgstr "" #: ../../More/Delegation/README.rst:24 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../More/Delegation/README.rst:26 @@ -58,3 +77,4 @@ msgstr "" #: ../../More/Delegation/README.rst:47 msgid "Tests/DelegationTest.php" msgstr "" + diff --git a/locale/es/LC_MESSAGES/More/EAV/README.po b/locale/es/LC_MESSAGES/More/EAV/README.po new file mode 100644 index 0000000..d0113c0 --- /dev/null +++ b/locale/es/LC_MESSAGES/More/EAV/README.po @@ -0,0 +1,78 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../More/EAV/README.rst:2 +msgid "`Entity-Attribute-Value (EAV)`__" +msgstr "" + +#: ../../More/EAV/README.rst:4 +msgid "" +"The Entity–attribute–value (EAV) pattern in order to implement EAV model " +"with PHP." +msgstr "" + +#: ../../More/EAV/README.rst:7 +msgid "Purpose" +msgstr "" + +#: ../../More/EAV/README.rst:9 +msgid "" +"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." +msgstr "" + +#: ../../More/EAV/README.rst:15 +msgid "Examples" +msgstr "" + +#: ../../More/EAV/README.rst:17 +msgid "Check full work example in `example.php`_ file." +msgstr "" + +#: ../../More/EAV/README.rst:90 +msgid "UML Diagram" +msgstr "" + +#: ../../More/EAV/README.rst:97 +msgid "Code" +msgstr "" + +#: ../../More/EAV/README.rst:99 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../More/EAV/README.rst:102 +msgid "Test" +msgstr "" + +#: ../../More/EAV/README.rst:104 +msgid "Tests/EntityTest.php" +msgstr "" + +#: ../../More/EAV/README.rst:110 +msgid "Tests/AttributeTest.php" +msgstr "" + +#: ../../More/EAV/README.rst:116 +msgid "Tests/ValueTest.php" +msgstr "" + diff --git a/locale/es/LC_MESSAGES/More/Repository/README.po b/locale/es/LC_MESSAGES/More/Repository/README.po index d9ecc90..5a37043 100644 --- a/locale/es/LC_MESSAGES/More/Repository/README.po +++ b/locale/es/LC_MESSAGES/More/Repository/README.po @@ -52,7 +52,7 @@ msgid "Code" msgstr "" #: ../../More/Repository/README.rst:32 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../More/Repository/README.rst:34 diff --git a/locale/es/LC_MESSAGES/More/ServiceLocator/README.po b/locale/es/LC_MESSAGES/More/ServiceLocator/README.po index 9808a92..8efac15 100644 --- a/locale/es/LC_MESSAGES/More/ServiceLocator/README.po +++ b/locale/es/LC_MESSAGES/More/ServiceLocator/README.po @@ -58,7 +58,7 @@ msgid "Code" msgstr "" #: ../../More/ServiceLocator/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../More/ServiceLocator/README.rst:38 diff --git a/locale/es/LC_MESSAGES/README.po b/locale/es/LC_MESSAGES/README.po index ddebaed..80021bb 100644 --- a/locale/es/LC_MESSAGES/README.po +++ b/locale/es/LC_MESSAGES/README.po @@ -77,8 +77,8 @@ 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`_" +msgid "Copyright (c) 2011 - 2016 `Dominik Liebler`_ and `contributors`_" +msgstr "Copyright (c) 2011 - 2016 `Dominik Liebler`_ and `contributors`_" #: ../../README.rst:50 msgid "" diff --git a/locale/es/LC_MESSAGES/Structural/Adapter/README.po b/locale/es/LC_MESSAGES/Structural/Adapter/README.po index b351fc9..00c1d2f 100644 --- a/locale/es/LC_MESSAGES/Structural/Adapter/README.po +++ b/locale/es/LC_MESSAGES/Structural/Adapter/README.po @@ -23,7 +23,7 @@ msgstr "" 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 " +"incompatible interfaces by providing its interface to clients while using " "the original interface." msgstr "" @@ -50,7 +50,7 @@ msgid "Code" msgstr "" #: ../../Structural/Adapter/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Adapter/README.rst:31 diff --git a/locale/es/LC_MESSAGES/Structural/Bridge/README.po b/locale/es/LC_MESSAGES/Structural/Bridge/README.po index a27619b..e2ee3f6 100644 --- a/locale/es/LC_MESSAGES/Structural/Bridge/README.po +++ b/locale/es/LC_MESSAGES/Structural/Bridge/README.po @@ -42,7 +42,7 @@ msgid "Code" msgstr "" #: ../../Structural/Bridge/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Bridge/README.rst:28 diff --git a/locale/es/LC_MESSAGES/Structural/Composite/README.po b/locale/es/LC_MESSAGES/Structural/Composite/README.po index 90ddd21..a5b59d4 100644 --- a/locale/es/LC_MESSAGES/Structural/Composite/README.po +++ b/locale/es/LC_MESSAGES/Structural/Composite/README.po @@ -50,7 +50,7 @@ msgid "Code" msgstr "" #: ../../Structural/Composite/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Composite/README.rst:31 diff --git a/locale/es/LC_MESSAGES/Structural/DataMapper/README.po b/locale/es/LC_MESSAGES/Structural/DataMapper/README.po index 5ccd9a3..6093eea 100644 --- a/locale/es/LC_MESSAGES/Structural/DataMapper/README.po +++ b/locale/es/LC_MESSAGES/Structural/DataMapper/README.po @@ -57,7 +57,7 @@ msgid "Code" msgstr "" #: ../../Structural/DataMapper/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/DataMapper/README.rst:38 diff --git a/locale/es/LC_MESSAGES/Structural/Decorator/README.po b/locale/es/LC_MESSAGES/Structural/Decorator/README.po index 0ecf351..124019f 100644 --- a/locale/es/LC_MESSAGES/Structural/Decorator/README.po +++ b/locale/es/LC_MESSAGES/Structural/Decorator/README.po @@ -46,7 +46,7 @@ msgid "Code" msgstr "" #: ../../Structural/Decorator/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Decorator/README.rst:28 diff --git a/locale/es/LC_MESSAGES/Structural/DependencyInjection/README.po b/locale/es/LC_MESSAGES/Structural/DependencyInjection/README.po index 0834846..7eeeb06 100644 --- a/locale/es/LC_MESSAGES/Structural/DependencyInjection/README.po +++ b/locale/es/LC_MESSAGES/Structural/DependencyInjection/README.po @@ -75,7 +75,7 @@ msgid "Code" msgstr "" #: ../../Structural/DependencyInjection/README.rst:46 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/DependencyInjection/README.rst:48 diff --git a/locale/es/LC_MESSAGES/Structural/Facade/README.po b/locale/es/LC_MESSAGES/Structural/Facade/README.po index 1d78bf4..81358f4 100644 --- a/locale/es/LC_MESSAGES/Structural/Facade/README.po +++ b/locale/es/LC_MESSAGES/Structural/Facade/README.po @@ -63,7 +63,7 @@ msgid "Code" msgstr "" #: ../../Structural/Facade/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Facade/README.rst:38 diff --git a/locale/es/LC_MESSAGES/Structural/FluentInterface/README.po b/locale/es/LC_MESSAGES/Structural/FluentInterface/README.po index 0e58551..4331b7c 100644 --- a/locale/es/LC_MESSAGES/Structural/FluentInterface/README.po +++ b/locale/es/LC_MESSAGES/Structural/FluentInterface/README.po @@ -50,7 +50,7 @@ msgid "Code" msgstr "" #: ../../Structural/FluentInterface/README.rst:28 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/FluentInterface/README.rst:30 diff --git a/locale/es/LC_MESSAGES/Structural/Flyweight/README.po b/locale/es/LC_MESSAGES/Structural/Flyweight/README.po new file mode 100644 index 0000000..cfa8492 --- /dev/null +++ b/locale/es/LC_MESSAGES/Structural/Flyweight/README.po @@ -0,0 +1,69 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../Structural/Flyweight/README.rst:2 +msgid "`Flyweight`__" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:5 +msgid "Purpose" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:7 +msgid "" +"To minimise memory usage, a Flyweight shares as much as possible memory " +"with similar objects. It is needed when a large amount of objects is used" +" that don't differ much in state. A common practice is to hold state in " +"external data structures and pass them to the flyweight object when " +"needed." +msgstr "" + +#: ../../Structural/Flyweight/README.rst:12 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:19 +msgid "Code" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:21 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:23 +msgid "FlyweightInterface.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:29 +msgid "CharacterFlyweight.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:35 +msgid "FlyweightFactory.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:42 +msgid "Test" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:44 +msgid "Tests/FlyweightTest.php" +msgstr "" + diff --git a/locale/es/LC_MESSAGES/Structural/Proxy/README.po b/locale/es/LC_MESSAGES/Structural/Proxy/README.po index 290eacc..1e52782 100644 --- a/locale/es/LC_MESSAGES/Structural/Proxy/README.po +++ b/locale/es/LC_MESSAGES/Structural/Proxy/README.po @@ -43,7 +43,7 @@ msgid "Code" msgstr "" #: ../../Structural/Proxy/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Proxy/README.rst:28 diff --git a/locale/es/LC_MESSAGES/Structural/Registry/README.po b/locale/es/LC_MESSAGES/Structural/Registry/README.po index 843138c..104a57d 100644 --- a/locale/es/LC_MESSAGES/Structural/Registry/README.po +++ b/locale/es/LC_MESSAGES/Structural/Registry/README.po @@ -32,8 +32,8 @@ msgstr "" #: ../../Structural/Registry/README.rst:14 msgid "" -"Zend Framework: ``Zend_Registry`` holds the application's logger object, " -"front controller etc." +"Zend Framework 1: ``Zend_Registry`` holds the application's logger " +"object, front controller etc." msgstr "" #: ../../Structural/Registry/README.rst:16 @@ -51,7 +51,7 @@ msgid "Code" msgstr "" #: ../../Structural/Registry/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Registry/README.rst:31 diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po new file mode 100644 index 0000000..7cd38e1 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po @@ -0,0 +1,88 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 13:53-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:1 +msgid "Chain Of Responsibilities" +msgstr "Cadena de Responsabilidad" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"Para crear una cadena de objetos que atiendan una llamada en orden " +"secuencial. Si un objeto no puede atender la llamada, delega esta al " +"siguiente objeto en la cadena, y así sucesivamente." + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:11 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:14 +msgid "" +"Logging framework: where each chain element decides autonomously what to do " +"with a log message." +msgstr "" +"Un framework de registro de eventos: en la que cada elemento de la cadena " +"decide autónomamente que hacer con un mensaje de evento." + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:16 +msgid "A Spam filter." +msgstr "Un filtro de spam." + +#: ../../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 "" +"Almacenamiento en caché: la primera instancia p.ej. es una interfaz " +"Memcached, si esta \"falla\" delega la llamada a la interfaz de base de " +"datos." + +#: ../../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 "" +"Framework Yii: CFilterChain es una cadena de filtros de acción de " +"controlador. El punto de ejecución es pasado de un filtro al siguiente en " +"la cadena y solamente si un filtro responde \"sí\", la acción puede ser por " +"fin invocada." + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:24 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:28 +msgid "Alt ChainOfResponsibility UML Diagram" +msgstr "Alt DiagramaUML CadenaDeResponsabilidad" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:31 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:34 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:54 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/Command/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/Command/README.po new file mode 100644 index 0000000..781bd77 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/Command/README.po @@ -0,0 +1,101 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 16:43-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/Command/README.rst:1 +msgid "Command" +msgstr "Comando" + +#: ../../Behavioral/Command/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Behavioral/Command/README.rst:7 +msgid "To encapsulate invocation and decoupling." +msgstr "Encapsular la invocación y desacoplamiento." + +#: ../../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 "" +"Se tiene un invocador y un receptor. Este patrón usa un \"Comando\" para " +"delegar la llamada al método contra el Receptor y presenta el mismo método " +"\"ejecutar\". Por lo tanto, el Invocador solamente sabe que puede llamar a " +"\"ejecutar\" para procesar el Comando del cliente. El receptor está " +"desacoplado del Invocador." + +#: ../../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 "" +"El segundo aspecto de este patrón es el método deshacer(), que deshace el " +"método ejecutar(). El Comando puede ser también agregado para combinar " +"comandos más complejos con un mínimo de copiado-pegado apoyándose de " +"composición sobre herencia." + +#: ../../Behavioral/Command/README.rst:20 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Behavioral/Command/README.rst:23 +msgid "" +"A text editor : all events are Command which can be undone, stacked and " +"saved." +msgstr "" +"Un editor de texto: todos los eventos son Comandos que pueden ser deshechos, " +"apilados y guardados." + +#: ../../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: Comandos SF2 que pueden ser ejecutados desde la línea de comandos " +"(CLI) están construidos justamente con el patrón de Comando en mente." + +#: ../../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 "" +"Grandes herramientas CLI utilizan sub-comandos para distribuir varias tareas " +"y empaquetarlas en \"módulos\", cada uno de estos puede ser implementado con " +"el patrón de Comando (p.ej. vagrant)." + +#: ../../Behavioral/Command/README.rst:31 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/Command/README.rst:35 +msgid "Alt Command UML Diagram" +msgstr "Alt Diagrama UML Comando" + +#: ../../Behavioral/Command/README.rst:38 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/Command/README.rst:41 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/Command/README.rst:67 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/Iterator/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/Iterator/README.po new file mode 100644 index 0000000..35c81d3 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/Iterator/README.po @@ -0,0 +1,76 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 16:51-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/Iterator/README.rst:1 +msgid "Iterator" +msgstr "Iterador" + +#: ../../Behavioral/Iterator/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Behavioral/Iterator/README.rst:7 +msgid "" +"To make an object iterable and to make it appear like a collection of " +"objects." +msgstr "" +"Hacer que un objeto sea iterable y que parezca como una colección de objetos." + +#: ../../Behavioral/Iterator/README.rst:10 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../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 "" +"Procesar un archivo linea por línea iterando sobre todas las líneas (que " +"tienen una representación de objeto) para un archivo (que, por supuesto, " +"también es un objeto)." + +#: ../../Behavioral/Iterator/README.rst:17 +msgid "Note" +msgstr "Nota" + +#: ../../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 "" +"La Librería Estándar de PHP (SPL) define una interfaz Iterador que es más " +"adecuada para esto! Frecuentemente querrás implementar la interfaz " +"_Countable_ también, para permitir ``count($object)`` en tu objeto iterable." + +#: ../../Behavioral/Iterator/README.rst:24 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/Iterator/README.rst:28 +msgid "Alt Iterator UML Diagram" +msgstr "Alt Diagrama UML Iterador" + +#: ../../Behavioral/Iterator/README.rst:31 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/Iterator/README.rst:34 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/Iterator/README.rst:60 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/Mediator/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/Mediator/README.po new file mode 100644 index 0000000..481e8c4 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/Mediator/README.po @@ -0,0 +1,63 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 16:58-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/Mediator/README.rst:1 +msgid "Mediator" +msgstr "Mediador" + +#: ../../Behavioral/Mediator/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Behavioral/Mediator/README.rst:7 +msgid "" +"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)." +msgstr "" +"Este patrón provee una forma sencilla para desacoplar muchos componentes " +"que trabajan en conjunto. Es una buena alternativa al patrón Observador SI " +"se tiene una \"inteligencia central\", como un controlador (pero no en el " +"sentido de 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 "" +"Todos los componentes (llamados Colegas) están acopladas solamente a la " +"interfaz mediadora, lo cual es algo bueno porque, en OOP, un buen amigo es " +"mejor que muchos. Esta es la característica principal de este patrón." + +#: ../../Behavioral/Mediator/README.rst:15 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/Mediator/README.rst:19 +msgid "Alt Mediator UML Diagram" +msgstr "Alt Diagrama UML MEdiador" + +#: ../../Behavioral/Mediator/README.rst:22 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/Mediator/README.rst:25 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/Mediator/README.rst:63 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/Memento/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/Memento/README.po new file mode 100644 index 0000000..f6f8bec --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/Memento/README.po @@ -0,0 +1,136 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 17:05-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/Memento/README.rst:1 +msgid "Memento" +msgstr "Memento" + +#: ../../Behavioral/Memento/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Behavioral/Memento/README.rst:7 +msgid "" +"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 function " +"to return the current state)." +msgstr "" +"Provee la capacidad de restaurar un objeto a su estado anterior (deshacer a " +"través de *rollback*) u obtener acceso al estado del objeto sin revelar su " +"implementación (p.ej. el objeto no requiere tener una función para devolver " +"el estado actual)." + +#: ../../Behavioral/Memento/README.rst:12 +msgid "" +"The memento pattern is implemented with three objects: the Originator, a " +"Caretaker and a Memento." +msgstr "" +"El patrón Memento es implementado con tres objetos: el Originador, el " +"Portero y el Memento." + +#: ../../Behavioral/Memento/README.rst:15 +msgid "" +"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)." +msgstr "" +"Memento (Recuerdo) - un objeto que *contiene una impresión única y concreta " +"del estado* de cualquier objeto o recurso: cadena de texto, número, arreglo, " +"una instancia de alguna clase, etc. La unicidad en este caso no implicia la " +"prohibición existencial de estados similares en diferentes impresiones. Eso " +"significa que el estado puede ser extraído como un clon independiente. " +"Cualquier objeto almacenado en un Memento debe ser *una copia completa del " +"objeto original más que una referencia* al objeto original. El objeto " +"Memento es un \"objeto inmutable\" (un objeto que nadie puede o debe " +"modificar)." + +#: ../../Behavioral/Memento/README.rst:24 +msgid "" +"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*." +msgstr "" +"Originador - es un objeto que contiene *el estado actual de un objeto " +"externo de un tipo estrictamente especificado*. El originador puede crear " +"una copia única de este estado y devolverla envuelta en un Memento. El " +"originador no conoce el historial de cambios. Se puede establecer un estado " +"conreto al originador desde fuera, que será considerado como el actual. El " +"originador debe asegurarse que el estado corresponde con el tipo de objeto " +"permitido. El originador puede (sin ser forzoso) tener cualquier método, " +"pero *no deben hacer cambios al estado del objeto guardado*." + +#: ../../Behavioral/Memento/README.rst:33 +msgid "" +"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." +msgstr "" +"Portero - controla el historial de estados. El puede realizar cambios sobre " +"un objeto; tomar la decisión de guardar el estado de un objeto externo en el " +"originador, solicitar al originador la impresión del estado actual o " +"establecer el estado del originador a una impresión equivalente del " +"historial." + +#: ../../Behavioral/Memento/README.rst:38 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Behavioral/Memento/README.rst:41 +msgid "The seed of a pseudorandom number generator." +msgstr "La semilla de un generador de números aleatorios." + +#: ../../Behavioral/Memento/README.rst:42 +msgid "The state in a finite state machine." +msgstr "El estado en una máquina de estados finita." + +#: ../../Behavioral/Memento/README.rst:43 +msgid "" +"Control for intermediate states of `ORM Model `_ before saving." +msgstr "" +"Control de estados intermedios de un `Modelo ORM `_ antes de guardar." + +#: ../../Behavioral/Memento/README.rst:45 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/Memento/README.rst:49 +msgid "Alt Memento UML Diagram" +msgstr "Alt Diagrama UML Memento" + +#: ../../Behavioral/Memento/README.rst:52 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/Memento/README.rst:55 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/Memento/README.rst:75 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/NullObject/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/NullObject/README.po new file mode 100644 index 0000000..659c0b3 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/NullObject/README.po @@ -0,0 +1,96 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 17:25-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/NullObject/README.rst:1 +msgid "Null Object" +msgstr "Objeto Nulo" + +#: ../../Behavioral/NullObject/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"El Objeto Nulo no es un patrón del GoF (Gang of Four) pero un esquema que " +"aparece tan frecuentemente para ser considerada un patrón. Tiene los " +"siguientes beneficios:" + +#: ../../Behavioral/NullObject/README.rst:11 +msgid "Client code is simplified." +msgstr "Se simplifica el código del cliente." + +#: ../../Behavioral/NullObject/README.rst:12 +msgid "Reduces the chance of null pointer exceptions." +msgstr "Se reduce la probabilidad de excepciones de apuntador nulo." + +#: ../../Behavioral/NullObject/README.rst:13 +msgid "Fewer conditionals require less test cases." +msgstr "Menos condicionales requieren menos casos de prueba." + +#: ../../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 "" +"Los métodos que devuelven un objeto o nulo deben en su lugar devolver un " +"objeto u `` ObjetoNulo``. El Objeto Nulo simplifica el código repetitivo " +"como ``if (!is_null($obj)) { $obj->callSomething(); }`` a ``$obj-" +">callSomething();`` eliminando la verificación condicional en el código del " +"cliente." + +#: ../../Behavioral/NullObject/README.rst:21 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Behavioral/NullObject/README.rst:24 +msgid "Symfony2: null logger of profiler." +msgstr "Symfony2: registro de eventos nulo del perfilador." + +#: ../../Behavioral/NullObject/README.rst:25 +msgid "Symfony2: null output in Symfony/Console." +msgstr "Symfony2: salida nula en la consola de Symfony." + +#: ../../Behavioral/NullObject/README.rst:26 +msgid "null handler in a Chain of Responsibilities pattern." +msgstr "Manejador nulo en un patrón de Cadena de Responsabilidades." + +#: ../../Behavioral/NullObject/README.rst:27 +msgid "null command in a Command pattern." +msgstr "Comando nulo en un patrón de Comando." + +#: ../../Behavioral/NullObject/README.rst:29 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/NullObject/README.rst:33 +msgid "Alt NullObject UML Diagram" +msgstr "Alt Diagrama UML ObjetoNulo" + +#: ../../Behavioral/NullObject/README.rst:36 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/NullObject/README.rst:39 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/NullObject/README.rst:65 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/Observer/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/Observer/README.po new file mode 100644 index 0000000..d049a5e --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/Observer/README.po @@ -0,0 +1,77 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 19:53-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/Observer/README.rst:1 +msgid "Observer" +msgstr "Observador" + +#: ../../Behavioral/Observer/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Behavioral/Observer/README.rst:7 +msgid "" +"To implement a publish/subscribe behaviour to an object, whenever a \"Subject" +"\" object changes its state, the attached \"Observers\" will be notified. It " +"is used to shorten the amount of coupled objects and uses loose coupling " +"instead." +msgstr "" +"Implementar el comportamiento publicar/suscribir en un objeto, cuando un " +"objeto \"Sujeto\" cambia su estado, los \"Observadores\" suscritos serán " +"notificados. Es utilizado para reducir la cantidad de objetos acoplados y en " +"cambio utiliza un acoplamiento suelto." + +#: ../../Behavioral/Observer/README.rst:12 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Behavioral/Observer/README.rst:15 +msgid "" +"A message queue system is observed to show the progress of a job in a GUI." +msgstr "" +"Un sistema de cola de mensajes es observada para mostrar el progreso de un " +"trabajo en una interfaz gráfica (GUI)." + +#: ../../Behavioral/Observer/README.rst:17 +msgid "Note" +msgstr "Notas" + +#: ../../Behavioral/Observer/README.rst:20 +msgid "" +"PHP already defines two interfaces that can help to implement this pattern: " +"SplObserver and SplSubject." +msgstr "" +"PHP ya define dos interfaces que pueden ayudar a implementar este patrón: " +"SplObserver y SplSubject." + +#: ../../Behavioral/Observer/README.rst:23 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/Observer/README.rst:27 +msgid "Alt Observer UML Diagram" +msgstr "Alt Diagrama UML Observador" + +#: ../../Behavioral/Observer/README.rst:30 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/Observer/README.rst:33 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/Observer/README.rst:47 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/README.po new file mode 100644 index 0000000..bc46941 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/README.po @@ -0,0 +1,30 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 13:46-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/README.rst:1 +msgid "Behavioral" +msgstr "Comportamiento" + +#: ../../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 "" +"En la ingeniería de software, los patrones de diseño de comportamiento son " +"patrones que identifican patrones comunes de comunicación entre objetos y " +"llevan a cabo estos patrones. Al realizar esto, estos patrones incrementan " +"la flexibilidad en llevar a cabo esta comunicación." diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/Specification/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/Specification/README.po new file mode 100644 index 0000000..f21da97 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/Specification/README.po @@ -0,0 +1,58 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 19:34-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/Specification/README.rst:1 +msgid "Specification" +msgstr "Especificación" + +#: ../../Behavioral/Specification/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"Construye una clara especificación de reglas de negocios, con la cual los " +"objetos pueden ser verificados. La clase de especificación compuesta tiene " +"un método llamado ``isSatisfiedBy`` que devuelve ya sea verdadero o falso " +"dependiendo de si el objeto satisface la especificación." + +#: ../../Behavioral/Specification/README.rst:12 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Behavioral/Specification/README.rst:17 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/Specification/README.rst:21 +msgid "Alt Specification UML Diagram" +msgstr "Alt Diagrama UML Especificación" + +#: ../../Behavioral/Specification/README.rst:24 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/Specification/README.rst:27 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/Specification/README.rst:65 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/State/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/State/README.po new file mode 100644 index 0000000..1569b72 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/State/README.po @@ -0,0 +1,53 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 19:40-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/State/README.rst:1 +msgid "State" +msgstr "Estado" + +#: ../../Behavioral/State/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"Encapsular comportamiento que difiere para la misma rutina basada en el " +"estado de un objeto. Esta puede ser una forma más limpia para que un " +"objeto cambie su comportamiento durante la ejecución sin depender de " +"grandes sentencias condicionales monolíticas." + +#: ../../Behavioral/State/README.rst:11 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/State/README.rst:15 +msgid "Alt State UML Diagram" +msgstr "Alt Diagrama UML Estado" + +#: ../../Behavioral/State/README.rst:18 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/State/README.rst:21 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/State/README.rst:53 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/Strategy/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/Strategy/README.po new file mode 100644 index 0000000..54b02d3 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/Strategy/README.po @@ -0,0 +1,82 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 19:57-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/Strategy/README.rst:1 +#: ../../Behavioral/Strategy/README.rst:8 +msgid "Strategy" +msgstr "Estrategia" + +#: ../../Behavioral/Strategy/README.rst:4 +msgid "Terminology" +msgstr "Terminología" + +#: ../../Behavioral/Strategy/README.rst:7 +msgid "Context" +msgstr "Contexto" + +#: ../../Behavioral/Strategy/README.rst:9 +msgid "Concrete Strategy" +msgstr "Estrategia Concreta" + +#: ../../Behavioral/Strategy/README.rst:11 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"Para separar estrategias y habilitar el rápido intercambio entre ellas. " +"Este patrón también es una buena alternativa a la herencia (en vez de tener " +"una clase abstracta que es extendida)." + +#: ../../Behavioral/Strategy/README.rst:18 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Behavioral/Strategy/README.rst:21 +msgid "Sorting a list of objects, one strategy by date, the other by id." +msgstr "" +"Ordenar una lista de objetos, una estrategia por fecha, otra por " +"identificador." + +#: ../../Behavioral/Strategy/README.rst:22 +msgid "" +"Simplify unit testing: e.g. switching between file and in-memory storage." +msgstr "" +"Simplificar pruebas de unidad: p.ej. intercambiando entre almacenamiento en " +"archivo y almacenamiento en memoria." + +#: ../../Behavioral/Strategy/README.rst:25 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/Strategy/README.rst:29 +msgid "Alt Strategy UML Diagram" +msgstr "Alt Diagrama UML Estrategia" + +#: ../../Behavioral/Strategy/README.rst:32 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/Strategy/README.rst:35 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/Strategy/README.rst:61 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/TemplateMethod/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/TemplateMethod/README.po new file mode 100644 index 0000000..5de45ab --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/TemplateMethod/README.po @@ -0,0 +1,83 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:01-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/TemplateMethod/README.rst:1 +msgid "Template Method" +msgstr "Método Plantilla" + +#: ../../Behavioral/TemplateMethod/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Behavioral/TemplateMethod/README.rst:7 +msgid "Template Method is a behavioral design pattern." +msgstr "Método Plantilla es un patrón de diseño de comportamiento." + +#: ../../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 "" +"Posiblemente ya hayas encontrado este patrón muchas veces. La idea es dejar " +"que las subclases de esta plantilla abstracta \"terminen\" el comportamiento " +"de un algoritmo." + +#: ../../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 "" +"También conocido como \"El Principio Hollywood\": \"No nos llames, nosotros " +"te llamaremos.\" Esta clase no es llamada por las subclases, sino a la " +"inversa. ¿Cómo? Con abstracción claramente." + +#: ../../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 does " +"the job." +msgstr "" +"En otras palabras, este es un esqueleto del algoritmo, muy adecuado para " +"librerías de *frameworks*. El usuario solamente tiene que implementar un " +"método y la superclase hace el trabajo." + +#: ../../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 "" +"Es una forma fácil para desacoplar clases concretas y reducir el copiado-" +"pegado, es por esto que lo encontrarás en todos lados." + +#: ../../Behavioral/TemplateMethod/README.rst:24 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/TemplateMethod/README.rst:28 +msgid "Alt TemplateMethod UML Diagram" +msgstr "Alt Diagrama UML MétodoPlantilla" + +#: ../../Behavioral/TemplateMethod/README.rst:31 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/TemplateMethod/README.rst:34 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/TemplateMethod/README.rst:54 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Behavioral/Visitor/README.po b/locale/es_MX/LC_MESSAGES/Behavioral/Visitor/README.po new file mode 100644 index 0000000..68b976f --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Behavioral/Visitor/README.po @@ -0,0 +1,64 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:06-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Behavioral/Visitor/README.rst:1 +msgid "Visitor" +msgstr "Visitante" + +#: ../../Behavioral/Visitor/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"El patrón Visitante permite externalizar operaciones de un objeto hacia " +"otros objetos. La razón principal para hacer esto es para mantener la " +"separación de propósitos. Las clases deben definir un contrato para permitir " +"visitantes (el método ``Role::accept`` en el ejemplo)." + +#: ../../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 "" +"El contrato es una clase abstracta pero puedes tener una interface. En ese " +"caso, cada Visitante tiene que elegir por él mismo qué método invocar en el " +"visitante." + +#: ../../Behavioral/Visitor/README.rst:16 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Behavioral/Visitor/README.rst:20 +msgid "Alt Visitor UML Diagram" +msgstr "Alt Diagrama UML Visitante" + +#: ../../Behavioral/Visitor/README.rst:23 +msgid "Code" +msgstr "Código" + +#: ../../Behavioral/Visitor/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Behavioral/Visitor/README.rst:58 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/es_MX/LC_MESSAGES/Creational/AbstractFactory/README.po new file mode 100644 index 0000000..e905440 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Creational/AbstractFactory/README.po @@ -0,0 +1,54 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:17-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Creational/AbstractFactory/README.rst:1 +msgid "Abstract Factory" +msgstr "Fábrica Abstracta" + +#: ../../Creational/AbstractFactory/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"Crear series de objetos relacionados o dependientes sin especificar su " +"clase concreta. Usualmente todas clases creadas implementan la misma " +"interfaz. Al cliente de la fábrica abstracta no le importa cómo son creados " +"estos objetos, solamente sabe cómo se funcionan en conjunto." + +#: ../../Creational/AbstractFactory/README.rst:12 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Creational/AbstractFactory/README.rst:16 +msgid "Alt AbstractFactory UML Diagram" +msgstr "Alt Diagrama UML FábricaAbstracta" + +#: ../../Creational/AbstractFactory/README.rst:19 +msgid "Code" +msgstr "Código" + +#: ../../Creational/AbstractFactory/README.rst:22 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Creational/AbstractFactory/README.rst:60 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Creational/Builder/README.po b/locale/es_MX/LC_MESSAGES/Creational/Builder/README.po new file mode 100644 index 0000000..7f70c3d --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Creational/Builder/README.po @@ -0,0 +1,80 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:20-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Creational/Builder/README.rst:1 +msgid "Builder" +msgstr "Constructor" + +#: ../../Creational/Builder/README.rst:4 +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 partes 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 tiene mejor conocimiento de lo que construye, " +"esta interfaz puede 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 se tiene un árbol de herencia compleja de objetos, es lógico que se " +"tendrá un árbol de herencia complejo para los constructores también." + +#: ../../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, como referencia " +"está el constructor de imitaciones (mock) de PHPUnit." + +#: ../../Creational/Builder/README.rst:18 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Creational/Builder/README.rst:21 +msgid "PHPUnit: Mock Builder" +msgstr "PHPUnit: Constructor de Imitaciones (Mock)" + +#: ../../Creational/Builder/README.rst:23 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Creational/Builder/README.rst:27 +msgid "Alt Builder UML Diagram" +msgstr "Alt Diagrama UML Constructor" + +#: ../../Creational/Builder/README.rst:30 +msgid "Code" +msgstr "Código" + +#: ../../Creational/Builder/README.rst:33 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Creational/Builder/README.rst:95 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/es_MX/LC_MESSAGES/Creational/FactoryMethod/README.po new file mode 100644 index 0000000..161f644 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Creational/FactoryMethod/README.po @@ -0,0 +1,74 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:25-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Creational/FactoryMethod/README.rst:1 +msgid "Factory Method" +msgstr "Método Fábrica" + +#: ../../Creational/FactoryMethod/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"Un punto a favor sobre la Fábrica Simple es que se pueden crear subclases " +"para implementar diferentes formas de crear objetos." + +#: ../../Creational/FactoryMethod/README.rst:10 +msgid "For simple case, this abstract class could be just an interface." +msgstr "" +"Para un caso simple, esta clase abstracta podría ser simplemente una " +"interfaz." + +#: ../../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 es un patrón \"real\" de diseño porque realiza el Principio de " +"Inversión de Dependencia, también conocido como la \"D\" de los principios 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 "" +"Esto significa que la clase del Método Fábrica depende de abstracciones, no " +"clases concretas. Este es el verdadero truco comparado con la Fábrica Simple " +"o Fábrica Estática." + +#: ../../Creational/FactoryMethod/README.rst:19 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Creational/FactoryMethod/README.rst:23 +msgid "Alt FactoryMethod UML Diagram" +msgstr "Alt Diagrama UML MétodoFábrica" + +#: ../../Creational/FactoryMethod/README.rst:26 +msgid "Code" +msgstr "Código" + +#: ../../Creational/FactoryMethod/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Creational/FactoryMethod/README.rst:73 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Creational/Multiton/README.po b/locale/es_MX/LC_MESSAGES/Creational/Multiton/README.po new file mode 100644 index 0000000..c13b460 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Creational/Multiton/README.po @@ -0,0 +1,73 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:30-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Creational/Multiton/README.rst:1 +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 "" +"**¡ESTE ES CONSIDERADO COMO UN ANTI-PATRÓN! PARA UNA MEJOR CAPACIDAD DE " +"PRUEBAS Y MANTENIMIENTO UTILIZA INYECCIÓN DE DEPENDENCIAS!**" + +#: ../../Creational/Multiton/README.rst:7 +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 solamente una lista de instancias nombradas que se pueden utilizar, " +"como un Singleton pero con n instancias." + +#: ../../Creational/Multiton/README.rst:13 +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, p.ej. uno para MySQL y otro para SQLite" + +#: ../../Creational/Multiton/README.rst:17 +msgid "multiple Loggers (one for debug messages, one for errors)" +msgstr "" +"Múltiples registradores de eventos (uno para mensajes de depuración y otro " +"para errores)" + +#: ../../Creational/Multiton/README.rst:19 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Creational/Multiton/README.rst:23 +msgid "Alt Multiton UML Diagram" +msgstr "Alt Diagrama UML Multiton" + +#: ../../Creational/Multiton/README.rst:26 +msgid "Code" +msgstr "Código" + +#: ../../Creational/Multiton/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Creational/Multiton/README.rst:37 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Creational/Pool/README.po b/locale/es_MX/LC_MESSAGES/Creational/Pool/README.po new file mode 100644 index 0000000..e1f67a8 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Creational/Pool/README.po @@ -0,0 +1,88 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:36-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Creational/Pool/README.rst:1 +msgid "Pool" +msgstr "*Pool*" + +#: ../../Creational/Pool/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Creational/Pool/README.rst:7 +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 de *pool* de objetos** es un patrón de diseño creacional que " +"utiliza un set the objetos inicializados listos para su uso – una \"alberca" +"\" (pool) – en vez de asignarlos y destruirlos bajo demanda. Un cliente del " +"*pool* solicita un objeto del *pool* y realiza operaciones en el objeto " +"devuelto. Cuando el cliente ha terminado, regresa el objeto, el cual es de " +"un tipo específico de objeto de fábrica, al *pool* en lugar de destruirlo." + +#: ../../Creational/Pool/README.rst:14 +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 "" +"*Pooling* de objetos puede ofrecer un aumento significativo de rendimiento " +"en situaciones en las que el costo de inicializar una instancia de clase es " +"alto, el número de instancias de clase es alto y el número de instancias en " +"uso es bajo. El objeto solicitado se obtiene en un tiempo predecible cuando " +"la creación de nuevos objetos (especialmente a través de la red) puede " +"variar en tiempo." + +#: ../../Creational/Pool/README.rst:21 +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 son en su mayoría ciertos para objetos que son " +"costosos con respecto al tiempo, como las conexiones de base de datos, " +"conexiones de socket, hilos y objetos gráficos grandes como fuentes o mapas " +"de bits. En algunas situaciones, un *pool* simple de objetos (que no " +"contienen recursos externos, sino solamente ocupan memoria) puede no ser " +"eficiente y puede ocasionar una disminución de rendimiento." + +#: ../../Creational/Pool/README.rst:27 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Creational/Pool/README.rst:31 +msgid "Alt Pool UML Diagram" +msgstr "Alt Diagrama UML Pool" + +#: ../../Creational/Pool/README.rst:34 +msgid "Code" +msgstr "Código" + +#: ../../Creational/Pool/README.rst:37 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Creational/Pool/README.rst:51 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Creational/Prototype/README.po b/locale/es_MX/LC_MESSAGES/Creational/Prototype/README.po new file mode 100644 index 0000000..cd6dc98 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Creational/Prototype/README.po @@ -0,0 +1,62 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:48-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Creational/Prototype/README.rst:1 +msgid "Prototype" +msgstr "Prototipo" + +#: ../../Creational/Prototype/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"Para evitar el costo de crear objetos de la manera tradicional (new Foo()) " +"y en cambio crear un prototipo y clonarlo." + +#: ../../Creational/Prototype/README.rst:10 +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 (p.ej. crear 1,000,000 registros en una base de " +"datos de una vez a través de ORM)." + +#: ../../Creational/Prototype/README.rst:16 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Creational/Prototype/README.rst:20 +msgid "Alt Prototype UML Diagram" +msgstr "Alt Diagrama UML Prototipo" + +#: ../../Creational/Prototype/README.rst:23 +msgid "Code" +msgstr "Código" + +#: ../../Creational/Prototype/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Creational/Prototype/README.rst:46 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Creational/README.po b/locale/es_MX/LC_MESSAGES/Creational/README.po new file mode 100644 index 0000000..7c4a55e --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Creational/README.po @@ -0,0 +1,33 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:15-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Creational/README.rst:1 +msgid "Creational" +msgstr "Creacional" + +#: ../../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 de software, los patrones de diseño creacionales son patrones " +"de diseño que se ocupan de los mecanismos de creación de objetos, tratando " +"de crear objetos de tal forma que se ajuste a la situación. La forma básica " +"de creación de objetos puede resultar en problemas de diseño o complejidad " +"añadida al diseño. Los patrones de diseño creacional resuelven este problema " +"mediante controlando de alguna manera la creación de los objetos." diff --git a/locale/es_MX/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/es_MX/LC_MESSAGES/Creational/SimpleFactory/README.po new file mode 100644 index 0000000..71fccdf --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -0,0 +1,64 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:50-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Creational/SimpleFactory/README.rst:1 +msgid "Simple Factory" +msgstr "Fábrica Simple" + +#: ../../Creational/SimpleFactory/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Creational/SimpleFactory/README.rst:7 +msgid "SimpleFactory is a simple factory pattern." +msgstr "La Fábrica Simple es un patrón de diseño de fábrica simple." + +#: ../../Creational/SimpleFactory/README.rst:9 +msgid "" +"It differs from the static factory because it is not static. " +"Therefore, you can have multiple factories, differently parametrized, you can subclass it and you can mock it." +msgstr "" +"Difiere de la Fábrica Estática porque no es estática. " +"Por lo tanto, se pueden tener varias fábricas parametrizadas de forma " +"diferente, se pueden crear subclases y se pueden generar imitaciones (mock) de " +"ellas." + +#: ../../Creational/SimpleFactory/README.rst:11 +msgid "It always should be preferred over a static factory!" +msgstr "¡Siempre se debe preferir esta a una Fábrica Estática!" + +#: ../../Creational/SimpleFactory/README.rst:13 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Creational/SimpleFactory/README.rst:17 +msgid "Alt SimpleFactory UML Diagram" +msgstr "Alt Diagrama UML FábricaSimple" + +#: ../../Creational/SimpleFactory/README.rst:20 +msgid "Code" +msgstr "Código" + +#: ../../Creational/SimpleFactory/README.rst:23 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Creational/SimpleFactory/README.rst:43 +msgid "Usage" +msgstr "Utilización" + +#: ../../Creational/SimpleFactory/README.rst:52 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Creational/Singleton/README.po b/locale/es_MX/LC_MESSAGES/Creational/Singleton/README.po new file mode 100644 index 0000000..db43dea --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Creational/Singleton/README.po @@ -0,0 +1,80 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:55-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Creational/Singleton/README.rst:1 +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 "" +"****¡ESTE ES CONSIDERADO COMO UN ANTI-PATRÓN! PARA UNA MEJOR CAPACIDAD DE " +"PRUEBAS Y MANTENIMIENTO UTILIZA INYECCIÓN DE DEPENDENCIAS!**" + +#: ../../Creational/Singleton/README.rst:7 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Creational/Singleton/README.rst:10 +msgid "" +"To have only one instance of this object in the application that will handle " +"all calls." +msgstr "" +"Tener solamente una instancia de este objeto en la aplicación que atenderá " +"todas las llamadas." + +#: ../../Creational/Singleton/README.rst:13 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Creational/Singleton/README.rst:16 +msgid "DB Connector" +msgstr "Conector de 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 "" +"Registrador de Eventos (puede ser también un Multiton si hay archivos de " +"registro de eventos para diferentes propósitos)" + +#: ../../Creational/Singleton/README.rst:19 +msgid "Lock file for the application (there is only one in the filesystem ...)" +msgstr "" +"Un archivo de bloqueo para la aplicación (solamente hay uno en el sistema de " +"archivos...)" + +#: ../../Creational/Singleton/README.rst:22 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Creational/Singleton/README.rst:26 +msgid "Alt Singleton UML Diagram" +msgstr "Alt Diagrama UML Singleton" + +#: ../../Creational/Singleton/README.rst:29 +msgid "Code" +msgstr "Código" + +#: ../../Creational/Singleton/README.rst:32 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Creational/Singleton/README.rst:40 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Creational/StaticFactory/README.po b/locale/es_MX/LC_MESSAGES/Creational/StaticFactory/README.po new file mode 100644 index 0000000..af0bba5 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Creational/StaticFactory/README.po @@ -0,0 +1,68 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 20:58-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Creational/StaticFactory/README.rst:1 +msgid "Static Factory" +msgstr "Fábrica Estática" + +#: ../../Creational/StaticFactory/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"Similar a la Fábrica Abstracta, este patrones utilizado para crear series de " +"objetos relacionados o dependientes. La diferencia entre este patrón y la " +"Fábrica Abstracta es que la Fábrica Estática utiliza solamente un método " +"estático para crear todo tipo de objetos que puede crear. Usualmente es " +"llamado ``factory`` or ``build``." + +#: ../../Creational/StaticFactory/README.rst:13 +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`` o ``_Frontend`` utiliza un método de " +"fabricación para crear *backends* o *frontends* de caché." + +#: ../../Creational/StaticFactory/README.rst:19 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Creational/StaticFactory/README.rst:23 +msgid "Alt StaticFactory UML Diagram" +msgstr "Alt Diagrama UML FábricaEstática" + +#: ../../Creational/StaticFactory/README.rst:26 +msgid "Code" +msgstr "Código" + +#: ../../Creational/StaticFactory/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Creational/StaticFactory/README.rst:55 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/More/Delegation/README.po b/locale/es_MX/LC_MESSAGES/More/Delegation/README.po new file mode 100644 index 0000000..0485555 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/More/Delegation/README.po @@ -0,0 +1,72 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 12:56-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../More/Delegation/README.rst:1 +msgid "Delegation" +msgstr "Delegación" + +#: ../../More/Delegation/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../More/Delegation/README.rst:7 +msgid "" +"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." +msgstr "" +"Demostrar el patrón Delegador, en el cual un objeto, en vez de desempeñar " +"una de sus tareas asignadas, delega esta tarea a un objeto de ayuda " +"asociado. En este caso *TeamLead* (líder de equipo) establece *writeCode* " +"(escribe código) y *Usage* (uso) utiliza esta función, mientras que " +"*TeamLead* delega *writeCode* a JuniorDeveloper (desarrolaldor junior) a " +"través de la funcióin *writeBadCode* (escribe mal código). Esto invierte la " +"responsabilidad de tal manera que *Usage* está ejecutando *writeBadCode* sin " +"saberlo." + +#: ../../More/Delegation/README.rst:13 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../More/Delegation/README.rst:16 +msgid "" +"Please review JuniorDeveloper.php, TeamLead.php, and then Usage.php to see " +"it all tied together." +msgstr "" +"Por favor revisa JuniorDeveloper.php, TeamLead.php y luego Usage.php para " +"ver como se integran en conjunto." + +#: ../../More/Delegation/README.rst:18 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../More/Delegation/README.rst:22 +msgid "Alt Delegation UML Diagram" +msgstr "Alt Diagrama UML Delegacion" + +#: ../../More/Delegation/README.rst:25 +msgid "Code" +msgstr "Código" + +#: ../../More/Delegation/README.rst:28 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../More/Delegation/README.rst:42 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/More/EAV/README.po b/locale/es_MX/LC_MESSAGES/More/EAV/README.po new file mode 100644 index 0000000..ecb0b40 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/More/EAV/README.po @@ -0,0 +1,61 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 13:04-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../More/EAV/README.rst:1 +msgid "Entity-Attribute-Value (EAV)" +msgstr "Entidad-Atributo-Valor (EAV)" + +#: ../../More/EAV/README.rst:4 +msgid "" +"The Entity–attribute–value (EAV) pattern in order to implement EAV model " +"with PHP." +msgstr "El patrón Entidad-Atributo-Valor (EAV) para ser implementado en PHP." + +#: ../../More/EAV/README.rst:6 +msgid "Purpose" +msgstr "Propósito" + +#: ../../More/EAV/README.rst:9 +msgid "" +"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." +msgstr "" +"El modelo Entidad-Atributo-Valor (EAV) es un modelo de datos para describir " +"entidades en las que el número de atributos (propiedades, parámetros) que " +"se pueden utilizar para describirlos es potencialmente vasto, pero el " +"número que realmente va a aplicar para una entidad en concreto es " +"relativamente modesto." + +#: ../../More/EAV/README.rst:14 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../More/EAV/README.rst:18 +msgid "EAV UML Diagram" +msgstr "Alt Diagrama UML EAV" + +#: ../../More/EAV/README.rst:21 +msgid "Code" +msgstr "Código" + +#: ../../More/EAV/README.rst:24 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../More/EAV/README.rst:44 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/More/README.po b/locale/es_MX/LC_MESSAGES/More/README.po new file mode 100644 index 0000000..67d69aa --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/More/README.po @@ -0,0 +1,17 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 12:53-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../More/README.rst:1 +msgid "More" +msgstr "Más" diff --git a/locale/es_MX/LC_MESSAGES/More/Repository/README.po b/locale/es_MX/LC_MESSAGES/More/Repository/README.po new file mode 100644 index 0000000..f7d7982 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/More/Repository/README.po @@ -0,0 +1,76 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 13:08-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../More/Repository/README.rst:1 +msgid "Repository" +msgstr "Repositorio" + +#: ../../More/Repository/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"Mediar entre las capas de dominio y mapeo de datos usando una interfaz tipo " +"colección para acceder a los objetos del dominio. El Repositorio encapsula " +"el set de objetos persistenes en el almacenamiento de datos y las " +"operaciones realizadas sobre ellos, proporcionando una vista más orientada " +"a objeto de la capa de persistencia. El Repositorio también soporta el " +"objetivo de lograr una separación limpia y dependencia unidireccional entre " +"las capas de dominio y mapeo de datos." + +#: ../../More/Repository/README.rst:15 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../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 "" +"Doctrine 2 ORM (Mapeo Objeto-Relacional): existe un Repositorio que media " +"entre la Entidad y la Capa de Acceso a Base de Datos y contiene métodos " +"para recuperar objetos" + +#: ../../More/Repository/README.rst:20 +msgid "Laravel Framework" +msgstr "Framework Laravel" + +#: ../../More/Repository/README.rst:22 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../More/Repository/README.rst:26 +msgid "Alt Repository UML Diagram" +msgstr "Alt Diagrama UML Repositorio" + +#: ../../More/Repository/README.rst:29 +msgid "Code" +msgstr "Código" + +#: ../../More/Repository/README.rst:32 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../More/Repository/README.rst:52 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/More/ServiceLocator/README.po b/locale/es_MX/LC_MESSAGES/More/ServiceLocator/README.po new file mode 100644 index 0000000..21e769c --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/More/ServiceLocator/README.po @@ -0,0 +1,84 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 13:15-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../More/ServiceLocator/README.rst:1 +msgid "Service Locator" +msgstr "Localizador de Servicio" + +#: ../../More/ServiceLocator/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"Implementar una arquitectura ligeramente acoplada para obtener código que se " +"puede probar, mantener y extender de mejor forma. El patrón DI (Inyección de " +"Dependencia) y Servicio de Localización son una implementación del patrón de " +"Inversión de Control." + +#: ../../More/ServiceLocator/README.rst:11 +msgid "Usage" +msgstr "Utilización" + +#: ../../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 "" +"Con ``ServiceLocator`` (Localizador de Servicio) se puede registrar un " +"servicio para una interfaz concreta. Mediante el uso de la interfaz se puede " +"recuperar el servicio y utilizarlo en las clases de la aplicación sin saber " +"su implementación. Se puede configurar e inyectar el objeto Localizador de " +"Servicio en la secuencia de arranque/inicialización." + +#: ../../More/ServiceLocator/README.rst:19 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../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 "" +"Zend Framework 2 utiliza el Localizador de Servicio para crear y compartir " +"servicios usados en el *framework* (p.ej. EventManager, ModuleManager, todos " +"los servicios personalizados del usuario provistos por los módulos, etc...)" + +#: ../../More/ServiceLocator/README.rst:26 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../More/ServiceLocator/README.rst:30 +msgid "Alt ServiceLocator UML Diagram" +msgstr "Alt Diagrama UML LocalizadorDeServicio" + +#: ../../More/ServiceLocator/README.rst:33 +msgid "Code" +msgstr "Código" + +#: ../../More/ServiceLocator/README.rst:36 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../More/ServiceLocator/README.rst:50 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/README.po b/locale/es_MX/LC_MESSAGES/README.po new file mode 100644 index 0000000..174972f --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/README.po @@ -0,0 +1,93 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-22 13:06-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../README.rst:4 +msgid "DesignPatternsPHP" +msgstr "DesignPatternsPHP (Patrones de Diseño en PHP)" + +#: ../../README.rst:9 +msgid "Documentation Status" +msgstr "Estatus de la documentación" + +#: ../../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 es una colección de `patrones de diseño`_ conocidos y ejemplos de " +"código de cómo implementarlos en PHP. Cada patrón tiene una pequeña lista de " +"ejemplos (la mayoría de Zend Framework, Symfony2 o Doctrine2, ya que es el " +"software que me es más familiar)." + +#: ../../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 "" +"Creo que el problema con los patrones es que muchas veces las personas los " +"conocen pero no saben cuando aplicar cual." + +#: ../../README.rst:19 +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 se pueden organizar a grandes rasgos en tres diferentes " +"categorías. Por favor has click en **el título de cada página de los " +"patrones** para una explicación completa del patrón en Wikipedia." + +#: ../../README.rst:34 +msgid "Contribute" +msgstr "Contribuciones" + +#: ../../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 ten la libertad de copiar el repositorio y extender o agregar tus " +"propios ejemplos y envía un *pull request* con tus cambios! Para establecer " +"una calidad de código consistente, por favor revisa tu código usando `PHP " +"CodeSniffer`_ contra el `estándar PSR2`_ usando ``./vendor/bin/phpcs -p --" +"standard=PSR2 --ignore=vendor .``." + +#: ../../README.rst:43 +msgid "License" +msgstr "Licencia" + +#: ../../README.rst:69 +msgid "`design patterns`" +msgstr "`patrones de diseño`" + +#: ../../README.rst:70 +msgid "`PHP CodeSniffer`" +msgstr "" + +#: ../../README.rst:71 +msgid "`PSR2 standard`" +msgstr "`estándar PSR2`" + +#: ../../README.rst:73 +msgid "`contributors`" +msgstr "`contribuidores`" \ No newline at end of file diff --git a/locale/es_MX/LC_MESSAGES/Structural/Adapter/README.po b/locale/es_MX/LC_MESSAGES/Structural/Adapter/README.po new file mode 100644 index 0000000..dfbe036 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/Adapter/README.po @@ -0,0 +1,70 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 13:25-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/Adapter/README.rst:1 +msgid "Adapter" +msgstr "Adaptador" + +#: ../../Structural/Adapter/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 its interface to clients while using " +"the original interface." +msgstr "" +"Traducir una interfaz para una clase en una interfaz compatible. Un " +"adaptador permite a la clases, que normalmente no podrían interactuar debido " +"a interfaces incompatibles, trabajar de forma conjunta proporcionando su " +"interfaz a los clientes mientras se usa la interfaz original." + +#: ../../Structural/Adapter/README.rst:12 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Structural/Adapter/README.rst:15 +msgid "DB Client libraries adapter" +msgstr "Adaptadores de librerías de Cleintes de Base de Datos" + +#: ../../Structural/Adapter/README.rst:16 +msgid "" +"using multiple different webservices and adapters normalize data so that the " +"outcome is the same for all" +msgstr "" +"Usando mútliples y diferentes servicios web y adaptadores normalizando la " +"información de tal manera que el resultado es el mismo para todos" + +#: ../../Structural/Adapter/README.rst:19 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Structural/Adapter/README.rst:23 +msgid "Alt Adapter UML Diagram" +msgstr "Alt Diagrama UML Adaptador" + +#: ../../Structural/Adapter/README.rst:26 +msgid "Code" +msgstr "Código" + +#: ../../Structural/Adapter/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Structural/Adapter/README.rst:61 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Structural/Bridge/README.po b/locale/es_MX/LC_MESSAGES/Structural/Bridge/README.po new file mode 100644 index 0000000..155f4bf --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/Bridge/README.po @@ -0,0 +1,59 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 13:30-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/Bridge/README.rst:1 +msgid "Bridge" +msgstr "Puente" + +#: ../../Structural/Bridge/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Structural/Bridge/README.rst:7 +msgid "" +"Decouple an abstraction from its implementation so that the two can vary " +"independently." +msgstr "" +"Desacoplar una abstracción de su implementación para que ambas puedan " +"variar independientemente." + +#: ../../Structural/Bridge/README.rst:10 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Structural/Bridge/README.rst:13 +msgid "`Symfony DoctrineBridge `__" +msgstr "" +"`Symfony DoctrineBridge `__" + +#: ../../Structural/Bridge/README.rst:16 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Structural/Bridge/README.rst:20 +msgid "Alt Bridge UML Diagram" +msgstr "Alt Diagrama UML Puente" + +#: ../../Structural/Bridge/README.rst:23 +msgid "Code" +msgstr "Código" + +#: ../../Structural/Bridge/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Structural/Bridge/README.rst:58 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Structural/Composite/README.po b/locale/es_MX/LC_MESSAGES/Structural/Composite/README.po new file mode 100644 index 0000000..2dcaeef --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/Composite/README.po @@ -0,0 +1,72 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 13:31-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/Composite/README.rst:1 +msgid "Composite" +msgstr "Composición" + +#: ../../Structural/Composite/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Structural/Composite/README.rst:7 +msgid "" +"To treat a group of objects the same way as a single instance of the object." +msgstr "" +"Tratar un grupo de objetos de la misma manera que una sola instancia del " +"objeto." + +#: ../../Structural/Composite/README.rst:10 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../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 "" +"Una instancia de la clase forma se encarga de todos sus elementos de la " +"misma manera que una sola instancia de un elemento, cuando ``render``() es " +"llamado, el objeto recorre todos sus hijos y ejecuta el método ``render()`` " +"en ellos" + +#: ../../Structural/Composite/README.rst:16 +msgid "" +"``Zend_Config``: a tree of configuration options, each one is a " +"``Zend_Config`` object itself" +msgstr "" +"``Zend_Config``: un árbol de opciones de configuración, cada una es un " +"objeto ``Zend_Config`` a su vez" + +#: ../../Structural/Composite/README.rst:19 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Structural/Composite/README.rst:23 +msgid "Alt Composite UML Diagram" +msgstr "Alta Diagrama UML Composición" + +#: ../../Structural/Composite/README.rst:26 +msgid "Code" +msgstr "Código" + +#: ../../Structural/Composite/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Structural/Composite/README.rst:55 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Structural/DataMapper/README.po b/locale/es_MX/LC_MESSAGES/Structural/DataMapper/README.po new file mode 100644 index 0000000..3a4be64 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/DataMapper/README.po @@ -0,0 +1,86 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 13:44-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/DataMapper/README.rst:1 +msgid "Data Mapper" +msgstr "Mapeo de Datos" + +#: ../../Structural/DataMapperREADME.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Structural/DataMapperREADME.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 "" +"Un Mapeo de Datos, es una Capa de Acceso a Datos que realiza transferencia " +"bidireccional de datos entre el Almacenamiento persistente de datos (por lo " +"general una base de datos relacional) y una represnetación en memoria de los " +"datos (capa de dominio). El objetivo del patrón es mantener la " +"representación en memoria y la información almacenada en el almacenamiento " +"persistente independiente una de otra y del mapeo. La capa está compuesta " +"por uno o más mapeos (u Objetos de Acceso de Datos), realizando la " +"transferencia de datos. La implementación de mapeos pueden variar en " +"alcance. Los mapeos genéricos manejan muchos tipos de entidad del dominio, " +"mapeos dedicados solamente manejan uno o algunos." + +#: ../../Structural/DataMapperREADME.rst:17 +msgid "" +"The key point of this pattern is, unlike Active Record pattern, the data " +"model follows Single Responsibility Principle." +msgstr "" +"El punto principal de este patrón es, no como el patrón Registro Activo " +"(Active Record), que el modelo de datos sigua el Principio de " +"Responsabilidad Única (Single Responsibility Principle)." + +#: ../../Structural/DataMapperREADME.rst:20 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Structural/DataMapperREADME.rst:23 +msgid "" +"DB Object Relational Mapper (ORM) : Doctrine2 uses DAO named as " +"\"EntityRepository\"" +msgstr "" +"Mapeo Objeto-Relacional de Base de Datos (ORM) : Doctrine2 usa DAO nombrado " +"como \"EntityRepository\" (RepositorioEntidad)" + +#: ../../Structural/DataMapperREADME.rst:26 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Structural/DataMapperREADME.rst:30 +msgid "Alt DataMapper UML Diagram" +msgstr "Alt Diagrama UML MapeoDeDatos" + +#: ../../Structural/DataMapperREADME.rst:33 +msgid "Code" +msgstr "Código" + +#: ../../Structural/DataMapperREADME.rst:36 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Structural/DataMapperREADME.rst:56 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Structural/Decorator/README.po b/locale/es_MX/LC_MESSAGES/Structural/Decorator/README.po new file mode 100644 index 0000000..bcba840 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/Decorator/README.po @@ -0,0 +1,62 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 15:34-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/Decorator/README.rst:1 +msgid "Decorator" +msgstr "Decorador" + +#: ../../Structural/Decorator/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Structural/Decorator/README.rst:7 +msgid "To dynamically add new functionality to class instances." +msgstr "Agregar funcionalidad dinámicamente a instancias de clases." + +#: ../../Structural/Decorator/README.rst:9 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Structural/Decorator/README.rst:12 +msgid "Zend Framework: decorators for ``Zend_Form_Element`` instances" +msgstr "Zend Framework: decoradores para instancias de ``Zend_Form_Element``" + +#: ../../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 "" +"Capa de Servicios Web: Decoradores JSON y XML para los servicios REST (en " +"este caso, solamente uno de ellos debería ser permitido)" + +#: ../../Structural/Decorator/README.rst:16 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Structural/Decorator/README.rst:20 +msgid "Alt Decorator UML Diagram" +msgstr "Alt Diagrama UML Decorador" + +#: ../../Structural/Decorator/README.rst:23 +msgid "Code" +msgstr "Código" + +#: ../../Structural/Decorator/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Structural/Decorator/README.rst:58 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Structural/DependencyInjection/README.po b/locale/es_MX/LC_MESSAGES/Structural/DependencyInjection/README.po new file mode 100644 index 0000000..771f8de --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/DependencyInjection/README.po @@ -0,0 +1,94 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 15:36-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/DependencyInjection/README.rst:1 +msgid "Dependency Injection" +msgstr "Inyección de Dependencias" + +#: ../../Structural/DependencyInjection/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Structural/DependencyInjection/README.rst:7 +msgid "" +"To implement a loosely coupled architecture in order to get better testable, " +"maintainable and extendable code." +msgstr "" +"Implementar una arquitectura ligeramente acoplada para obtener un código que " +"se puede probar, mantener y extender con mayor facilidad." + +#: ../../Structural/DependencyInjection/README.rst:10 +msgid "Usage" +msgstr "Utilización" + +#: ../../Structural/DependencyInjection/README.rst:13 +msgid "" +"DatabaseConfiguration gets injected and ``DatabaseConnection`` will get all " +"that it needs from ``$config``. Without DI, the configuration would be " +"created directly in ``DatabaseConnection``, which is not very good for " +"testing and extending it." +msgstr "" +"DatabaseConfiguration (configuración de base de datos) es inyectado y " +"``DatabaseConnection`` (conexión de base de datos) obtendrá todo lo que " +"necesita de ``$config``. Sin Inyección de Dependencia, la configuración " +"necesitaría ser creada directamente en ``DatabaseConnection``, lo cual no es " +"muy recomendable para probar y extender." + +#: ../../Structural/DependencyInjection/README.rst:18 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Structural/DependencyInjection/README.rst:21 +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 "" +"El ORM (Mapeo Objeto-Relación) de Doctrine2 utiliza inyección de " +"dependencia, p.ej. la configuración que es inyectada en un objeto " +"``Connection`` (conexión). Por razones de pruebas, uno puede crear " +"fácilmente un objeto de imitación (mock) de la configuración e inyectarlo en " +"el objeto ``Connection``." + +#: ../../Structural/DependencyInjection/README.rst:25 +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 "" +"Symfony y Zend Framework2 ya cuentan con contenedores para Inyección de " +"Dependencia que crean objetos a través de un arreglo de configuración y los " +"inyectan cuando son necesarios (p.ej. en controladores)" + +#: ../../Structural/DependencyInjection/README.rst:29 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Structural/DependencyInjection/README.rst:33 +msgid "Alt DependencyInjection UML Diagram" +msgstr "Alt Diagrama InyecciónDeDependencia" + +#: ../../Structural/DependencyInjection/README.rst:36 +msgid "Code" +msgstr "Código" + +#: ../../Structural/DependencyInjection/README.rst:39 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Structural/DependencyInjection/README.rst:53 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Structural/Facade/README.po b/locale/es_MX/LC_MESSAGES/Structural/Facade/README.po new file mode 100644 index 0000000..d0fa794 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/Facade/README.po @@ -0,0 +1,89 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 15:45-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/Facade/README.rst:1 +msgid "Facade" +msgstr "Fachada" + +#: ../../Structural/Facade/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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 "" +"El principal objetivo del patrón de Fachada no es evitar que se lean " +"manuales complejos de una API, es solamente un efecto secundario. El " +"principal objetivo es reducir el acoplamiento y cumplir la Ley de Demeter." + +#: ../../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 "" +"Una Fachada está destinada a desacoplar un cleinte y un subsistema mediante " +"la incorporación de muchas interfaces (aunque muchas veces solamente una) y " +"por supuesto reducir la complejidad." + +#: ../../Structural/Facade/README.rst:15 +msgid "A facade does not forbid you the access to the sub-system" +msgstr "Una Fachada no impide el acceso al subsistema" + +#: ../../Structural/Facade/README.rst:16 +msgid "You can (you should) have multiple facades for one sub-system" +msgstr "Se puede (se debería) tener múltiples fachadas ára un subsistema" + +#: ../../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 "" +"Esto es por lo que una buena Fachada no tiene ``new`` en ella. Si existen " +"múltiples creaciones para cada método entonces no es una Fachada, es un " +"Constructor o una Fábrica [Abstracta\\|Estática\\|Simple] o un Método " +"Fábrica." + +#: ../../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 "" +"La mejor Fachada no tiene ``new`` y un constructor con parámetros con tipos " +"especificados por interfaz. Si se necesita la creación de nuevas instancias, " +"se debe utilizar una Fábrica como argumento." + +#: ../../Structural/Facade/README.rst:26 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Structural/Facade/README.rst:30 +msgid "Alt Facade UML Diagram" +msgstr "Alt Diagrmaa UML Fachada" + +#: ../../Structural/Facade/README.rst:33 +msgid "Code" +msgstr "Código" + +#: ../../Structural/Facade/README.rst:36 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Structural/Facade/README.rst:56 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Structural/FluentInterface/README.po b/locale/es_MX/LC_MESSAGES/Structural/FluentInterface/README.po new file mode 100644 index 0000000..62684ae --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/FluentInterface/README.po @@ -0,0 +1,67 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 16:03-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/FluentInterface/README.rst:1 +msgid "Fluent Interface" +msgstr "Interfaz Fluida" + +#: ../../Structural/FluentInterface/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Structural/FluentInterface/README.rst:7 +msgid "" +"To write code that is easy readable just like sentences in a natural " +"language (like English)." +msgstr "" +"Escribir código que sea fácilmente legible como si fueran enunciados en " +"lenguaje natural (como inglés)." + +#: ../../Structural/FluentInterface/README.rst:13 +msgid "Doctrine2's QueryBuilder works something like that example class below" +msgstr "" +"El Constructor de Consultas (QueryBuilder) de Doctrine2 funciona parecido a " +"la clase ejemplo que está más abajo" + +#: ../../Structural/FluentInterface/README.rst:15 +msgid "PHPUnit uses fluent interfaces to build mock objects" +msgstr "" +"PHPUnit utiliza una interfaces fluidas para crear objetos de imitación " +"(mock)" + +#: ../../Structural/FluentInterface/README.rst:16 +msgid "Yii Framework: CDbCommand and CActiveRecord use this pattern, too" +msgstr "" +"Yii Framework: CDbCommand y CActiveRecord utilizan este patrón también" + +#: ../../Structural/FluentInterface/README.rst:18 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Structural/FluentInterface/README.rst:22 +msgid "Alt FluentInterface UML Diagram" +msgstr "Alt Diagrama UML InterfazFluida" + +#: ../../Structural/FluentInterface/README.rst:25 +msgid "Code" +msgstr "Código" + +#: ../../Structural/FluentInterface/README.rst:28 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Structural/FluentInterface/README.rst:36 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Structural/Flyweight/README.po b/locale/es_MX/LC_MESSAGES/Structural/Flyweight/README.po new file mode 100644 index 0000000..4f626ae --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/Flyweight/README.po @@ -0,0 +1,55 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 16:07-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/Flyweight/README.rst:1 +msgid "Flyweight" +msgstr "Flyweight (\"Peso Mosca\")" + +#: ../../Structural/Flyweight/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Structural/Flyweight/README.rst:7 +msgid "" +"To minimise memory usage, a Flyweight shares as much as possible memory with " +"similar objects. It is needed when a large amount of objects is used that " +"don't differ much in state. A common practice is to hold state in external " +"data structures and pass them to the flyweight object when needed." +msgstr "" +"Minimizar el uso de memoria, un Flyweight comparte lo más posible la memoria " +"de objetos similares. Es necesario cuando se utiliza una gran cantidad de " +"objetos que no difieren mucho en su estado. Una práctica común es mantener " +"el estado en estructuras de datos externas y pasarlas al objeto Flyweight " +"cuando sean necesarias." + +#: ../../Structural/Flyweight/README.rst:11 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Structural/Flyweight/README.rst:15 +msgid "Alt Flyweight UML Diagram" +msgstr "Alt Diagrama UML Flyweight" + +#: ../../Structural/Flyweight/README.rst:18 +msgid "Code" +msgstr "Código" + +#: ../../Structural/Flyweight/README.rst:21 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Structural/Flyweight/README.rst:41 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Structural/Proxy/README.po b/locale/es_MX/LC_MESSAGES/Structural/Proxy/README.po new file mode 100644 index 0000000..a599442 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/Proxy/README.po @@ -0,0 +1,61 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 16:12-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/Proxy/README.rst:1 +msgid "Proxy" +msgstr "Proxy" + +#: ../../Structural/Proxy/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../Structural/Proxy/README.rst:7 +msgid "To interface to anything that is expensive or impossible to duplicate." +msgstr "" +"Interconectar cualquier cosa que sea muy costosa o imposible de duplicar." + +#: ../../Structural/Proxy/README.rst:9 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../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 "" +"Doctrine2 utiliza Proxies para implementar magia del framework (p.ej. " +"inicialización tardía) en ellos, mientras que el usuario aún trabaja con " +"sus propias clases de entidad y nunca tocará o suará los proxies" + +#: ../../Structural/Proxy/README.rst:16 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Structural/Proxy/README.rst:20 +msgid "Alt Proxy UML Diagram" +msgstr "Alt Diagrama UML Proxy" + +#: ../../Structural/Proxy/README.rst:23 +msgid "Code" +msgstr "Código" + +#: ../../Structural/Proxy/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Structural/Proxy/README.rst:40 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/es_MX/LC_MESSAGES/Structural/README.po b/locale/es_MX/LC_MESSAGES/Structural/README.po new file mode 100644 index 0000000..355d914 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/README.po @@ -0,0 +1,28 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 13:24-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/README.rst:1 +msgid "Structural" +msgstr "Estructural" + +#: ../../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 "" +"En ingeniería de software, los patrones de diseño estructurales son patrones " +"de diseño que facilitan el diseño identificando una forma sencilla para " +"establecer relaciones entre entidades." diff --git a/locale/es_MX/LC_MESSAGES/Structural/Registry/README.po b/locale/es_MX/LC_MESSAGES/Structural/Registry/README.po new file mode 100644 index 0000000..4c5dc88 --- /dev/null +++ b/locale/es_MX/LC_MESSAGES/Structural/Registry/README.po @@ -0,0 +1,77 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-23 16:15-0500\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"X-Generator: Poedit 1.8.9\n" +"Last-Translator: Axel Pardemann \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es_MX\n" + +#: ../../Structural/Registry/README.rst:1 +msgid "Registry" +msgstr "Registro" + +#: ../../Structural/Registry/README.rst:4 +msgid "Purpose" +msgstr "Propósito" + +#: ../../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). Remember that this " +"introduces global state, which should be avoided at all times! Instead " +"implement it using Dependency Injection!" +msgstr "" +"Implementar un almacenamiento central para objetos utilizados " +"frecuentemente a través de la aplicación, se implementa típicamente " +"utilizando una clase abstracta sólo con métodos estáticos (o utilizando el " +"patrón Singleton). Recuerda que esto introduce un estado global que debe " +"ser evitado siempre que se pueda! En vez de esto, impleméntalo utilizando " +"Inyección de Dependencia!" + +#: ../../Structural/Registry/README.rst:12 +msgid "Examples" +msgstr "Ejemplos" + +#: ../../Structural/Registry/README.rst:15 +msgid "" +"Zend Framework 1: ``Zend_Registry`` holds the application's logger object, " +"front controller etc." +msgstr "" +"Zend Framework 1: ``Zend_Registry`` contiene el objeto de registro de " +"eventos de la aplicación, controlador frontal, etc." + +#: ../../Structural/Registry/README.rst:17 +msgid "" +"Yii Framework: ``CWebApplication`` holds all the application components, " +"such as ``CWebUser``, ``CUrlManager``, etc." +msgstr "" +"Yii Framework: ``CWebApplication`` contiene todos los componenbtes de la " +"aplicación como ``CWebUser``, ``CUrlManager``, etc." + +#: ../../Structural/Registry/README.rst:20 +msgid "UML Diagram" +msgstr "Diagrama UML" + +#: ../../Structural/Registry/README.rst:24 +msgid "Alt Registry UML Diagram" +msgstr "Alt Diagrama UML Registro" + +#: ../../Structural/Registry/README.rst:27 +msgid "Code" +msgstr "Código" + +#: ../../Structural/Registry/README.rst:30 +msgid "You can also find this code on `GitHub`_" +msgstr "Puedes encontrar este código también en `GitHub`_" + +#: ../../Structural/Registry/README.rst:38 +msgid "Test" +msgstr "Pruebas" diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po index b5277a5..19f8d8d 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po @@ -62,7 +62,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/ChainOfResponsibilities/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/ChainOfResponsibilities/README.rst:36 diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Command/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Command/README.po index 29319a3..158d346 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/Command/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Command/README.po @@ -71,7 +71,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Command/README.rst:41 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Command/README.rst:43 diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Iterator/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Iterator/README.po index 3000658..25ccf3a 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/Iterator/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Iterator/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -20,9 +20,7 @@ msgid "Purpose" msgstr "" #: ../../Behavioral/Iterator/README.rst:7 -msgid "" -"To make an object iterable and to make it appear like a collection of " -"objects." +msgid "To make an object iterable and to make it appear like a collection of objects." msgstr "" #: ../../Behavioral/Iterator/README.rst:11 @@ -55,7 +53,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Iterator/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Iterator/README.rst:36 diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Mediator/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Mediator/README.po index 9c6694b..e9a44dd 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/Mediator/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Mediator/README.po @@ -21,8 +21,8 @@ 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 " +"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)." msgstr "" @@ -42,7 +42,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Mediator/README.rst:25 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Mediator/README.rst:27 diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Memento/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Memento/README.po index 913069a..13c073e 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/Memento/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Memento/README.po @@ -1,15 +1,22 @@ -# +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-29 12:18+0200\n" +"POT-Creation-Date: 2016-06-03 23:59+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-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.3.4\n" #: ../../Behavioral/Memento/README.rst:2 msgid "`Memento`__" @@ -21,65 +28,184 @@ msgstr "" #: ../../Behavioral/Memento/README.rst:7 msgid "" -"Provide the ability to restore an object to its previous state (undo via " -"rollback)." +"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)." msgstr "" -#: ../../Behavioral/Memento/README.rst:10 +#: ../../Behavioral/Memento/README.rst:12 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." +"The memento pattern is implemented with three objects: the Originator, a " +"Caretaker and a Memento." msgstr "" -#: ../../Behavioral/Memento/README.rst:23 +#: ../../Behavioral/Memento/README.rst:15 +msgid "" +"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)." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:24 +msgid "" +"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*." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:33 +msgid "" +"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." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:39 msgid "Examples" msgstr "" -#: ../../Behavioral/Memento/README.rst:25 +#: ../../Behavioral/Memento/README.rst:41 msgid "The seed of a pseudorandom number generator" msgstr "" -#: ../../Behavioral/Memento/README.rst:26 +#: ../../Behavioral/Memento/README.rst:42 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" +#: ../../Behavioral/Memento/README.rst:43 +msgid "" +"Control for intermediate states of `ORM Model " +"`_ before saving" msgstr "" #: ../../Behavioral/Memento/README.rst:46 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:53 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:55 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:57 +msgid "Memento.php" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:63 msgid "Originator.php" msgstr "" -#: ../../Behavioral/Memento/README.rst:52 +#: ../../Behavioral/Memento/README.rst:69 msgid "Caretaker.php" msgstr "" -#: ../../Behavioral/Memento/README.rst:59 +#: ../../Behavioral/Memento/README.rst:76 msgid "Test" msgstr "" -#: ../../Behavioral/Memento/README.rst:61 +#: ../../Behavioral/Memento/README.rst:78 msgid "Tests/MementoTest.php" msgstr "" + + + +#. # +#. 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 this 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 index 35b77f6..a397fc5 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/NullObject/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/NullObject/README.po @@ -75,7 +75,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/NullObject/README.rst:39 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/NullObject/README.rst:41 diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Observer/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Observer/README.po index 6aea8e9..8a43616 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/Observer/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Observer/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -22,7 +22,7 @@ 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 " +"\"Subject\" object changes its state, the attached \"Observers\" will be " "notified. It is used to shorten the amount of coupled objects and uses loose" " coupling instead." msgstr "" @@ -55,7 +55,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Observer/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Observer/README.rst:36 diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Specification/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Specification/README.po index 54e3b64..7b1982b 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/Specification/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Specification/README.po @@ -44,7 +44,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Specification/README.rst:27 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Specification/README.rst:29 diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/State/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/State/README.po index f71fbfa..2ced881 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/State/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/State/README.po @@ -35,7 +35,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/State/README.rst:21 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/State/README.rst:23 diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Strategy/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Strategy/README.po index dd5797e..c3b9fea 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/Strategy/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Strategy/README.po @@ -64,7 +64,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Strategy/README.rst:35 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Strategy/README.rst:37 diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/TemplateMethod/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/TemplateMethod/README.po index 4f6fa81..331d234 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/TemplateMethod/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/TemplateMethod/README.po @@ -59,7 +59,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/TemplateMethod/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/TemplateMethod/README.rst:36 diff --git a/locale/pt_BR/LC_MESSAGES/Behavioral/Visitor/README.po b/locale/pt_BR/LC_MESSAGES/Behavioral/Visitor/README.po index cab0ea9..08784a3 100644 --- a/locale/pt_BR/LC_MESSAGES/Behavioral/Visitor/README.po +++ b/locale/pt_BR/LC_MESSAGES/Behavioral/Visitor/README.po @@ -43,7 +43,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Visitor/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Visitor/README.rst:28 diff --git a/locale/pt_BR/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/pt_BR/LC_MESSAGES/Creational/AbstractFactory/README.po index fd6e4dd..b005aac 100644 --- a/locale/pt_BR/LC_MESSAGES/Creational/AbstractFactory/README.po +++ b/locale/pt_BR/LC_MESSAGES/Creational/AbstractFactory/README.po @@ -40,7 +40,7 @@ msgid "Code" msgstr "Código" #: ../../Creational/AbstractFactory/README.rst:22 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Você pode encontrar o código no `Github`_" #: ../../Creational/AbstractFactory/README.rst:24 diff --git a/locale/pt_BR/LC_MESSAGES/Creational/Builder/README.po b/locale/pt_BR/LC_MESSAGES/Creational/Builder/README.po index 4dcdf66..78d55d6 100644 --- a/locale/pt_BR/LC_MESSAGES/Creational/Builder/README.po +++ b/locale/pt_BR/LC_MESSAGES/Creational/Builder/README.po @@ -63,7 +63,7 @@ msgid "Code" msgstr "Código" #: ../../Creational/Builder/README.rst:33 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Você pode encontrar esse código no `Github`_" #: ../../Creational/Builder/README.rst:35 diff --git a/locale/pt_BR/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/pt_BR/LC_MESSAGES/Creational/FactoryMethod/README.po index ddbfdd7..34787ae 100644 --- a/locale/pt_BR/LC_MESSAGES/Creational/FactoryMethod/README.po +++ b/locale/pt_BR/LC_MESSAGES/Creational/FactoryMethod/README.po @@ -57,7 +57,7 @@ msgid "Code" msgstr "Código" #: ../../Creational/FactoryMethod/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Você pode encontrar este código no `Github`_" #: ../../Creational/FactoryMethod/README.rst:31 diff --git a/locale/pt_BR/LC_MESSAGES/Creational/Multiton/README.po b/locale/pt_BR/LC_MESSAGES/Creational/Multiton/README.po index 702271d..d6892a9 100644 --- a/locale/pt_BR/LC_MESSAGES/Creational/Multiton/README.po +++ b/locale/pt_BR/LC_MESSAGES/Creational/Multiton/README.po @@ -52,7 +52,7 @@ msgid "Code" msgstr "" #: ../../Creational/Multiton/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/Multiton/README.rst:31 diff --git a/locale/pt_BR/LC_MESSAGES/Creational/Pool/README.po b/locale/pt_BR/LC_MESSAGES/Creational/Pool/README.po index 8defedd..899f583 100644 --- a/locale/pt_BR/LC_MESSAGES/Creational/Pool/README.po +++ b/locale/pt_BR/LC_MESSAGES/Creational/Pool/README.po @@ -53,7 +53,7 @@ msgid "Code" msgstr "" #: ../../Creational/Pool/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/Pool/README.rst:36 diff --git a/locale/pt_BR/LC_MESSAGES/Creational/Prototype/README.po b/locale/pt_BR/LC_MESSAGES/Creational/Prototype/README.po index fac09ef..14e0bc2 100644 --- a/locale/pt_BR/LC_MESSAGES/Creational/Prototype/README.po +++ b/locale/pt_BR/LC_MESSAGES/Creational/Prototype/README.po @@ -44,7 +44,7 @@ msgid "Code" msgstr "" #: ../../Creational/Prototype/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/Prototype/README.rst:28 diff --git a/locale/pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po index 74e85d4..6501749 100644 --- a/locale/pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po +++ b/locale/pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -44,7 +44,7 @@ msgid "Code" msgstr "" #: ../../Creational/SimpleFactory/README.rst:25 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/SimpleFactory/README.rst:27 diff --git a/locale/pt_BR/LC_MESSAGES/Creational/Singleton/README.po b/locale/pt_BR/LC_MESSAGES/Creational/Singleton/README.po index 5d108ca..a80a777 100644 --- a/locale/pt_BR/LC_MESSAGES/Creational/Singleton/README.po +++ b/locale/pt_BR/LC_MESSAGES/Creational/Singleton/README.po @@ -59,7 +59,7 @@ msgid "Code" msgstr "" #: ../../Creational/Singleton/README.rst:32 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/Singleton/README.rst:34 diff --git a/locale/pt_BR/LC_MESSAGES/Creational/StaticFactory/README.po b/locale/pt_BR/LC_MESSAGES/Creational/StaticFactory/README.po index 4a6f64e..538587f 100644 --- a/locale/pt_BR/LC_MESSAGES/Creational/StaticFactory/README.po +++ b/locale/pt_BR/LC_MESSAGES/Creational/StaticFactory/README.po @@ -47,7 +47,7 @@ msgid "Code" msgstr "" #: ../../Creational/StaticFactory/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Creational/StaticFactory/README.rst:31 diff --git a/locale/pt_BR/LC_MESSAGES/More/Delegation/README.po b/locale/pt_BR/LC_MESSAGES/More/Delegation/README.po index 21a201b..907d828 100644 --- a/locale/pt_BR/LC_MESSAGES/More/Delegation/README.po +++ b/locale/pt_BR/LC_MESSAGES/More/Delegation/README.po @@ -1,15 +1,22 @@ -# +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-29 12:18+0200\n" +"POT-Creation-Date: 2016-06-03 23:59+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-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.3.4\n" #: ../../More/Delegation/README.rst:2 msgid "`Delegation`__" @@ -19,24 +26,36 @@ msgstr "" msgid "Purpose" msgstr "" -#: ../../More/Delegation/README.rst:7 ../../More/Delegation/README.rst:12 -msgid "..." +#: ../../More/Delegation/README.rst:7 +msgid "" +"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." msgstr "" #: ../../More/Delegation/README.rst:10 msgid "Examples" msgstr "" +#: ../../More/Delegation/README.rst:12 +msgid "" +"Please review JuniorDeveloper.php, TeamLead.php, and then Usage.php to " +"see it all tied together." +msgstr "" + #: ../../More/Delegation/README.rst:15 msgid "UML Diagram" -msgstr "Diagrama UML" +msgstr "" #: ../../More/Delegation/README.rst:22 msgid "Code" msgstr "" #: ../../More/Delegation/README.rst:24 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../More/Delegation/README.rst:26 @@ -58,3 +77,4 @@ msgstr "" #: ../../More/Delegation/README.rst:47 msgid "Tests/DelegationTest.php" msgstr "" + diff --git a/locale/pt_BR/LC_MESSAGES/More/EAV/README.po b/locale/pt_BR/LC_MESSAGES/More/EAV/README.po new file mode 100644 index 0000000..d0113c0 --- /dev/null +++ b/locale/pt_BR/LC_MESSAGES/More/EAV/README.po @@ -0,0 +1,78 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../More/EAV/README.rst:2 +msgid "`Entity-Attribute-Value (EAV)`__" +msgstr "" + +#: ../../More/EAV/README.rst:4 +msgid "" +"The Entity–attribute–value (EAV) pattern in order to implement EAV model " +"with PHP." +msgstr "" + +#: ../../More/EAV/README.rst:7 +msgid "Purpose" +msgstr "" + +#: ../../More/EAV/README.rst:9 +msgid "" +"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." +msgstr "" + +#: ../../More/EAV/README.rst:15 +msgid "Examples" +msgstr "" + +#: ../../More/EAV/README.rst:17 +msgid "Check full work example in `example.php`_ file." +msgstr "" + +#: ../../More/EAV/README.rst:90 +msgid "UML Diagram" +msgstr "" + +#: ../../More/EAV/README.rst:97 +msgid "Code" +msgstr "" + +#: ../../More/EAV/README.rst:99 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../More/EAV/README.rst:102 +msgid "Test" +msgstr "" + +#: ../../More/EAV/README.rst:104 +msgid "Tests/EntityTest.php" +msgstr "" + +#: ../../More/EAV/README.rst:110 +msgid "Tests/AttributeTest.php" +msgstr "" + +#: ../../More/EAV/README.rst:116 +msgid "Tests/ValueTest.php" +msgstr "" + diff --git a/locale/pt_BR/LC_MESSAGES/More/Repository/README.po b/locale/pt_BR/LC_MESSAGES/More/Repository/README.po index 7439b93..4118792 100644 --- a/locale/pt_BR/LC_MESSAGES/More/Repository/README.po +++ b/locale/pt_BR/LC_MESSAGES/More/Repository/README.po @@ -58,7 +58,7 @@ msgid "Code" msgstr "Código" #: ../../More/Repository/README.rst:32 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Você também pode encontrar esse código no `GitHub`_" #: ../../More/Repository/README.rst:34 diff --git a/locale/pt_BR/LC_MESSAGES/More/ServiceLocator/README.po b/locale/pt_BR/LC_MESSAGES/More/ServiceLocator/README.po index 9808a92..8efac15 100644 --- a/locale/pt_BR/LC_MESSAGES/More/ServiceLocator/README.po +++ b/locale/pt_BR/LC_MESSAGES/More/ServiceLocator/README.po @@ -58,7 +58,7 @@ msgid "Code" msgstr "" #: ../../More/ServiceLocator/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../More/ServiceLocator/README.rst:38 diff --git a/locale/pt_BR/LC_MESSAGES/README.po b/locale/pt_BR/LC_MESSAGES/README.po index a10ea0b..ab971d8 100644 --- a/locale/pt_BR/LC_MESSAGES/README.po +++ b/locale/pt_BR/LC_MESSAGES/README.po @@ -78,8 +78,8 @@ 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`_" +msgid "Copyright (c) 2011 - 2016 `Dominik Liebler`_ and `contributors`_" +msgstr "Copyright (c) 2011 - 2016 `Dominik Liebler`_ and `contributors`_" #: ../../README.rst:50 msgid "" diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Adapter/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Adapter/README.po index b8d541d..d8a9383 100644 --- a/locale/pt_BR/LC_MESSAGES/Structural/Adapter/README.po +++ b/locale/pt_BR/LC_MESSAGES/Structural/Adapter/README.po @@ -23,7 +23,7 @@ msgstr "Objetivo" 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 " +"incompatible interfaces by providing its interface to clients while using " "the original interface." msgstr "" "Para adaptar (compatibilizar) uma interface de uma classe a outra interface. Um " @@ -55,8 +55,13 @@ msgid "Code" msgstr "Código" #: ../../Structural/Adapter/README.rst:29 +<<<<<<< HEAD msgid "You can also find these code on `GitHub`_" msgstr "Você também pode encontrar este código no `Github`_" +======= +msgid "You can also find this code on `GitHub`_" +msgstr "" +>>>>>>> c1f0faccc8503a78a1b4cae192aaef127a2edb02 #: ../../Structural/Adapter/README.rst:31 msgid "PaperBookInterface.php" diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Bridge/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Bridge/README.po index a27619b..e2ee3f6 100644 --- a/locale/pt_BR/LC_MESSAGES/Structural/Bridge/README.po +++ b/locale/pt_BR/LC_MESSAGES/Structural/Bridge/README.po @@ -42,7 +42,7 @@ msgid "Code" msgstr "" #: ../../Structural/Bridge/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Bridge/README.rst:28 diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Composite/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Composite/README.po index 90ddd21..a5b59d4 100644 --- a/locale/pt_BR/LC_MESSAGES/Structural/Composite/README.po +++ b/locale/pt_BR/LC_MESSAGES/Structural/Composite/README.po @@ -50,7 +50,7 @@ msgid "Code" msgstr "" #: ../../Structural/Composite/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Composite/README.rst:31 diff --git a/locale/pt_BR/LC_MESSAGES/Structural/DataMapper/README.po b/locale/pt_BR/LC_MESSAGES/Structural/DataMapper/README.po index 5ccd9a3..6093eea 100644 --- a/locale/pt_BR/LC_MESSAGES/Structural/DataMapper/README.po +++ b/locale/pt_BR/LC_MESSAGES/Structural/DataMapper/README.po @@ -57,7 +57,7 @@ msgid "Code" msgstr "" #: ../../Structural/DataMapper/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/DataMapper/README.rst:38 diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Decorator/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Decorator/README.po index 0ecf351..124019f 100644 --- a/locale/pt_BR/LC_MESSAGES/Structural/Decorator/README.po +++ b/locale/pt_BR/LC_MESSAGES/Structural/Decorator/README.po @@ -46,7 +46,7 @@ msgid "Code" msgstr "" #: ../../Structural/Decorator/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Decorator/README.rst:28 diff --git a/locale/pt_BR/LC_MESSAGES/Structural/DependencyInjection/README.po b/locale/pt_BR/LC_MESSAGES/Structural/DependencyInjection/README.po index 0834846..7eeeb06 100644 --- a/locale/pt_BR/LC_MESSAGES/Structural/DependencyInjection/README.po +++ b/locale/pt_BR/LC_MESSAGES/Structural/DependencyInjection/README.po @@ -75,7 +75,7 @@ msgid "Code" msgstr "" #: ../../Structural/DependencyInjection/README.rst:46 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/DependencyInjection/README.rst:48 diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Facade/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Facade/README.po index 1d78bf4..81358f4 100644 --- a/locale/pt_BR/LC_MESSAGES/Structural/Facade/README.po +++ b/locale/pt_BR/LC_MESSAGES/Structural/Facade/README.po @@ -63,7 +63,7 @@ msgid "Code" msgstr "" #: ../../Structural/Facade/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Facade/README.rst:38 diff --git a/locale/pt_BR/LC_MESSAGES/Structural/FluentInterface/README.po b/locale/pt_BR/LC_MESSAGES/Structural/FluentInterface/README.po index 0e58551..4331b7c 100644 --- a/locale/pt_BR/LC_MESSAGES/Structural/FluentInterface/README.po +++ b/locale/pt_BR/LC_MESSAGES/Structural/FluentInterface/README.po @@ -50,7 +50,7 @@ msgid "Code" msgstr "" #: ../../Structural/FluentInterface/README.rst:28 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/FluentInterface/README.rst:30 diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Flyweight/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Flyweight/README.po new file mode 100644 index 0000000..cfa8492 --- /dev/null +++ b/locale/pt_BR/LC_MESSAGES/Structural/Flyweight/README.po @@ -0,0 +1,69 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../Structural/Flyweight/README.rst:2 +msgid "`Flyweight`__" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:5 +msgid "Purpose" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:7 +msgid "" +"To minimise memory usage, a Flyweight shares as much as possible memory " +"with similar objects. It is needed when a large amount of objects is used" +" that don't differ much in state. A common practice is to hold state in " +"external data structures and pass them to the flyweight object when " +"needed." +msgstr "" + +#: ../../Structural/Flyweight/README.rst:12 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:19 +msgid "Code" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:21 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:23 +msgid "FlyweightInterface.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:29 +msgid "CharacterFlyweight.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:35 +msgid "FlyweightFactory.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:42 +msgid "Test" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:44 +msgid "Tests/FlyweightTest.php" +msgstr "" + diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Proxy/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Proxy/README.po index 290eacc..1e52782 100644 --- a/locale/pt_BR/LC_MESSAGES/Structural/Proxy/README.po +++ b/locale/pt_BR/LC_MESSAGES/Structural/Proxy/README.po @@ -43,7 +43,7 @@ msgid "Code" msgstr "" #: ../../Structural/Proxy/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Proxy/README.rst:28 diff --git a/locale/pt_BR/LC_MESSAGES/Structural/Registry/README.po b/locale/pt_BR/LC_MESSAGES/Structural/Registry/README.po index 843138c..104a57d 100644 --- a/locale/pt_BR/LC_MESSAGES/Structural/Registry/README.po +++ b/locale/pt_BR/LC_MESSAGES/Structural/Registry/README.po @@ -32,8 +32,8 @@ msgstr "" #: ../../Structural/Registry/README.rst:14 msgid "" -"Zend Framework: ``Zend_Registry`` holds the application's logger object, " -"front controller etc." +"Zend Framework 1: ``Zend_Registry`` holds the application's logger " +"object, front controller etc." msgstr "" #: ../../Structural/Registry/README.rst:16 @@ -51,7 +51,7 @@ msgid "Code" msgstr "" #: ../../Structural/Registry/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Structural/Registry/README.rst:31 diff --git a/locale/ru/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po b/locale/ru/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po index d0dcfac..ba49fbe 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po @@ -73,7 +73,7 @@ msgid "Code" msgstr "Код" #: ../../Behavioral/ChainOfResponsibilities/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Behavioral/ChainOfResponsibilities/README.rst:36 diff --git a/locale/ru/LC_MESSAGES/Behavioral/Command/README.po b/locale/ru/LC_MESSAGES/Behavioral/Command/README.po index 4780baa..e32ecdd 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/Command/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/Command/README.po @@ -88,7 +88,7 @@ msgid "Code" msgstr "Код" #: ../../Behavioral/Command/README.rst:41 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы также можете найти этот код на `GitHub`_" #: ../../Behavioral/Command/README.rst:43 diff --git a/locale/ru/LC_MESSAGES/Behavioral/Iterator/README.po b/locale/ru/LC_MESSAGES/Behavioral/Iterator/README.po index 1d5061d..2c86150 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/Iterator/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/Iterator/README.po @@ -20,9 +20,7 @@ msgid "Purpose" msgstr "Назначение" #: ../../Behavioral/Iterator/README.rst:7 -msgid "" -"To make an object iterable and to make it appear like a collection of " -"objects." +msgid "To make an object iterable and to make it appear like a collection of objects." msgstr "" "Добавить коллекции объектов функционал последовательного доступа к " "содержащимся в ней экземплярам объектов без реализации этого функционала в " @@ -65,7 +63,7 @@ msgid "Code" msgstr "Код" #: ../../Behavioral/Iterator/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Также вы можете найти этот код на `GitHub`_" #: ../../Behavioral/Iterator/README.rst:36 diff --git a/locale/ru/LC_MESSAGES/Behavioral/Mediator/README.po b/locale/ru/LC_MESSAGES/Behavioral/Mediator/README.po index 13b8089..f6d53a2 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/Mediator/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/Mediator/README.po @@ -23,9 +23,9 @@ 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)." +"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)." msgstr "" "Этот паттерн позволяет снизить связность множества компонентов, работающих " "совместно. Объектам больше нет нужды вызывать друг друга напрямую. Это " @@ -51,7 +51,7 @@ msgid "Code" msgstr "Код" #: ../../Behavioral/Mediator/README.rst:25 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Behavioral/Mediator/README.rst:27 diff --git a/locale/ru/LC_MESSAGES/Behavioral/Memento/README.po b/locale/ru/LC_MESSAGES/Behavioral/Memento/README.po index 146f4f5..0fd6dab 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/Memento/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/Memento/README.po @@ -1,19 +1,26 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. # +#, fuzzy 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" +"POT-Creation-Date: 2016-06-03 23:59+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Eugene Glotov \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: ru\n" +"Generated-By: Babel 2.3.4\n" #: ../../Behavioral/Memento/README.rst:2 msgid "`Memento`__" -msgstr "`Хранитель`__" +msgstr "`Хранитель `_ (`Memento`__)" #: ../../Behavioral/Memento/README.rst:5 msgid "Purpose" @@ -21,95 +28,126 @@ msgstr "Назначение" #: ../../Behavioral/Memento/README.rst:7 msgid "" -"Provide the ability to restore an object to its previous state (undo via " -"rollback)." +"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)." msgstr "" -"Предоставляет возможность восстановить объект в его предыдущем состоянии или " -"получить доступ к состоянию объекта, не раскрывая его реализацию (т.е. сам " -"объект не обязан иметь функционал возврата текущего состояния)." +"Шаблон предоставляет возможность восстановить объект в его предыдущем состоянии " +"(отменить действие посредством отката к предыдущему состоянию) или получить " +"доступ к состоянию объекта, не раскрывая его реализацию (т.е. сам " +"объект не обязан иметь функциональность для возврата текущего состояния)." -#: ../../Behavioral/Memento/README.rst:10 +#: ../../Behavioral/Memento/README.rst:12 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." +"The memento pattern is implemented with three objects: the Originator, a " +"Caretaker and a Memento." +msgstr "" +"Шаблон Хранитель реализуется тремя объектами: \"Создателем\" (originator), " +"\"Опекуном\" (caretaker) и \"Хранитель\" (memento)." + +#: ../../Behavioral/Memento/README.rst:15 +msgid "" +"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)." +msgstr "" +"Хранитель - это объект, который *хранит конкретный снимок состояния* " +"некоторого объекта или ресурса: строки, числа, массива, экземпляра " +"класса и так далее. Уникальность в данном случае подразумевает не запрет на " +"существование одинаковых состояний в разных снимках, а то, что состояние " +"можно извлечь в виде независимой копии. Любой объект, сохраняемый в " +"Хранителе, должен быть *полной копией исходного объекта, а не ссылкой* на " +"исходный объект. Сам объект Хранитель является «непрозрачным объектом» (тот, " +"который никто не может и не должен изменять)." + +#: ../../Behavioral/Memento/README.rst:24 +msgid "" +"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*." msgstr "" -"Паттерн «Хранитель» реализуется тремя объектами: Создатель, Опекун и " -"Хранитель.\n" -"\n" -"Хранитель — объект, который *хранит конкретный уникальный слепок состояния* " -"любого объекта или ресурса: строка, число, массив, экземпляр класса и так " -"далее. Уникальность в данном случае подразумевает не запрет существования " -"одинаковых состояний в слепках, а то, что состояние можно извлечь в виде " -"независимого клона. Это значит, объект, сохраняемый в Хранитель, должен *быть " -"полной копией исходного объекта а не ссылкой* на исходный объект. Сам объект " -"Хранитель является «непрозрачным объектом» (тот, который никто не может и не " -"должен изменять).\n" -"\n" "Создатель — это объект, который *содержит в себе актуальное состояние внешнего " -"объекта строго заданного типа* и умеет создать уникальную копию этого " -"состояния, возвращая её обёрнутую в Хранитель. Создатель не знает истории " +"объекта строго заданного типа* и умеет создавать уникальную копию этого " +"состояния, возвращая её, обёрнутую в объект Хранителя. Создатель не знает истории " "изменений. Создателю можно принудительно установить конкретное состояние " -"извне, которое будет считаться актуальным. Создатель должен позаботиться, " +"извне, которое будет считаться актуальным. Создатель должен позаботиться о том, " "чтобы это состояние соответствовало типу объекта, с которым ему разрешено " "работать. Создатель может (но не обязан) иметь любые методы, но они *не могут " -"менять сохранённое состояние объекта*.\n" -"\n" -"Опекун *управляет историей слепков состояний*. Он может вносить изменения в " -"объект, принимать решение о сохранении состояния внешнего объекта в Создателе, " -"требовать от Создателя слепок текущего состояния, или привести состояние " -"Создателя в соответствие состоянию какого-то слепка из истории." +"менять сохранённое состояние объекта*." -#: ../../Behavioral/Memento/README.rst:23 +#: ../../Behavioral/Memento/README.rst:33 +msgid "" +"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." +msgstr "" +"Опекун *управляет историей снимков состояний*. Он может вносить изменения в " +"объект, принимать решение о сохранении состояния внешнего объекта в Создателе, " +"запрашивать от Создателя снимок текущего состояния, или привести состояние " +"Создателя в соответствие с состоянием какого-то снимка из истории." + +#: ../../Behavioral/Memento/README.rst:39 msgid "Examples" msgstr "Примеры" -#: ../../Behavioral/Memento/README.rst:25 +#: ../../Behavioral/Memento/README.rst:41 msgid "The seed of a pseudorandom number generator" msgstr "" -"`Семя `_ псевдослучайного генератора " +"`Зерно `_ генератора псевдослучайных " "чисел." -#: ../../Behavioral/Memento/README.rst:26 +#: ../../Behavioral/Memento/README.rst:42 msgid "The state in a finite state machine" msgstr "Состояние конечного автомата" -#: ../../Behavioral/Memento/README.rst:29 +#: ../../Behavioral/Memento/README.rst:43 +msgid "" +"Control for intermediate states of `ORM Model " +"`_ before saving" +msgstr "" +"Контроль промежуточных состояний модели в `ORM " +"`_ перед сохранением" + +#: ../../Behavioral/Memento/README.rst:46 msgid "UML Diagram" msgstr "UML Диаграмма" -#: ../../Behavioral/Memento/README.rst:36 +#: ../../Behavioral/Memento/README.rst:53 msgid "Code" msgstr "Код" -#: ../../Behavioral/Memento/README.rst:38 -msgid "You can also find these code on `GitHub`_" +#: ../../Behavioral/Memento/README.rst:55 +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" -#: ../../Behavioral/Memento/README.rst:40 +#: ../../Behavioral/Memento/README.rst:57 msgid "Memento.php" msgstr "Memento.php" -#: ../../Behavioral/Memento/README.rst:46 +#: ../../Behavioral/Memento/README.rst:63 msgid "Originator.php" msgstr "Originator.php" -#: ../../Behavioral/Memento/README.rst:52 +#: ../../Behavioral/Memento/README.rst:69 msgid "Caretaker.php" msgstr "Caretaker.php" -#: ../../Behavioral/Memento/README.rst:59 +#: ../../Behavioral/Memento/README.rst:76 msgid "Test" msgstr "Тест" -#: ../../Behavioral/Memento/README.rst:61 +#: ../../Behavioral/Memento/README.rst:78 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 index 7560c18..8b5a9ab 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/NullObject/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/NullObject/README.po @@ -84,7 +84,7 @@ msgid "Code" msgstr "Код" #: ../../Behavioral/NullObject/README.rst:39 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Behavioral/NullObject/README.rst:41 diff --git a/locale/ru/LC_MESSAGES/Behavioral/Observer/README.po b/locale/ru/LC_MESSAGES/Behavioral/Observer/README.po index fbd4f45..dc9403a 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/Observer/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/Observer/README.po @@ -22,7 +22,7 @@ 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 " +"\"Subject\" object changes its state, the attached \"Observers\" will be " "notified. It is used to shorten the amount of coupled objects and uses loose" " coupling instead." msgstr "" @@ -64,7 +64,7 @@ msgid "Code" msgstr "Код" #: ../../Behavioral/Observer/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Behavioral/Observer/README.rst:36 diff --git a/locale/ru/LC_MESSAGES/Behavioral/Specification/README.po b/locale/ru/LC_MESSAGES/Behavioral/Specification/README.po index 5c318ca..6ad7d8f 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/Specification/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/Specification/README.po @@ -48,7 +48,7 @@ msgid "Code" msgstr "Код" #: ../../Behavioral/Specification/README.rst:27 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Behavioral/Specification/README.rst:29 diff --git a/locale/ru/LC_MESSAGES/Behavioral/State/README.po b/locale/ru/LC_MESSAGES/Behavioral/State/README.po index 8fa08d0..1aaffdb 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/State/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/State/README.po @@ -39,7 +39,7 @@ msgid "Code" msgstr "Код" #: ../../Behavioral/State/README.rst:21 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Behavioral/State/README.rst:23 diff --git a/locale/ru/LC_MESSAGES/Behavioral/Strategy/README.po b/locale/ru/LC_MESSAGES/Behavioral/Strategy/README.po index cdd3bd5..8b237b2 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/Strategy/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/Strategy/README.po @@ -70,7 +70,7 @@ msgid "Code" msgstr "Код" #: ../../Behavioral/Strategy/README.rst:35 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Behavioral/Strategy/README.rst:37 diff --git a/locale/ru/LC_MESSAGES/Behavioral/TemplateMethod/README.po b/locale/ru/LC_MESSAGES/Behavioral/TemplateMethod/README.po index 2c0b68e..a68192c 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/TemplateMethod/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/TemplateMethod/README.po @@ -72,7 +72,7 @@ msgid "Code" msgstr "Код" #: ../../Behavioral/TemplateMethod/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Behavioral/TemplateMethod/README.rst:36 diff --git a/locale/ru/LC_MESSAGES/Behavioral/Visitor/README.po b/locale/ru/LC_MESSAGES/Behavioral/Visitor/README.po index 5bd8647..2c7b7f9 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/Visitor/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/Visitor/README.po @@ -51,7 +51,7 @@ msgid "Code" msgstr "Код" #: ../../Behavioral/Visitor/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Behavioral/Visitor/README.rst:28 diff --git a/locale/ru/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/ru/LC_MESSAGES/Creational/AbstractFactory/README.po index c5afbaf..72eb188 100644 --- a/locale/ru/LC_MESSAGES/Creational/AbstractFactory/README.po +++ b/locale/ru/LC_MESSAGES/Creational/AbstractFactory/README.po @@ -43,7 +43,7 @@ msgid "Code" msgstr "Код" #: ../../Creational/AbstractFactory/README.rst:22 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Creational/AbstractFactory/README.rst:24 diff --git a/locale/ru/LC_MESSAGES/Creational/Builder/README.po b/locale/ru/LC_MESSAGES/Creational/Builder/README.po index 27793e5..a195aee 100644 --- a/locale/ru/LC_MESSAGES/Creational/Builder/README.po +++ b/locale/ru/LC_MESSAGES/Creational/Builder/README.po @@ -66,7 +66,7 @@ msgid "Code" msgstr "Код" #: ../../Creational/Builder/README.rst:33 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Creational/Builder/README.rst:35 diff --git a/locale/ru/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/ru/LC_MESSAGES/Creational/FactoryMethod/README.po index 6b7a3f8..81ae5b7 100644 --- a/locale/ru/LC_MESSAGES/Creational/FactoryMethod/README.po +++ b/locale/ru/LC_MESSAGES/Creational/FactoryMethod/README.po @@ -61,7 +61,7 @@ msgid "Code" msgstr "Код" #: ../../Creational/FactoryMethod/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Creational/FactoryMethod/README.rst:31 diff --git a/locale/ru/LC_MESSAGES/Creational/Multiton/README.po b/locale/ru/LC_MESSAGES/Creational/Multiton/README.po index 43ff0de..2f51f06 100644 --- a/locale/ru/LC_MESSAGES/Creational/Multiton/README.po +++ b/locale/ru/LC_MESSAGES/Creational/Multiton/README.po @@ -60,7 +60,7 @@ msgid "Code" msgstr "Код" #: ../../Creational/Multiton/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Creational/Multiton/README.rst:31 diff --git a/locale/ru/LC_MESSAGES/Creational/Pool/README.po b/locale/ru/LC_MESSAGES/Creational/Pool/README.po index 1b35b8b..18c38bb 100644 --- a/locale/ru/LC_MESSAGES/Creational/Pool/README.po +++ b/locale/ru/LC_MESSAGES/Creational/Pool/README.po @@ -70,7 +70,7 @@ msgid "Code" msgstr "Код" #: ../../Creational/Pool/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Creational/Pool/README.rst:36 diff --git a/locale/ru/LC_MESSAGES/Creational/Prototype/README.po b/locale/ru/LC_MESSAGES/Creational/Prototype/README.po index 72b1ebc..6413834 100644 --- a/locale/ru/LC_MESSAGES/Creational/Prototype/README.po +++ b/locale/ru/LC_MESSAGES/Creational/Prototype/README.po @@ -50,7 +50,7 @@ msgid "Code" msgstr "Код" #: ../../Creational/Prototype/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Creational/Prototype/README.rst:28 diff --git a/locale/ru/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/ru/LC_MESSAGES/Creational/SimpleFactory/README.po index 4d50b56..fbdd8d4 100644 --- a/locale/ru/LC_MESSAGES/Creational/SimpleFactory/README.po +++ b/locale/ru/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -25,20 +25,23 @@ msgstr "SimpleFactory в примере ниже, это паттерн «Про #: ../../Creational/SimpleFactory/README.rst:9 msgid "" -"It differs from the static factory because it is NOT static and as you know:" -" static => global => evil!" +"It differs from the static factory because it is not static." msgstr "" "Она отличается от Статической Фабрики тем, что собственно *не является " -"статической*. Потому как вы должны знаеть: статическая => глобальная => зло!" +"статической*. Потому как вы должны понимать: статическая => глобальная => зло!" -#: ../../Creational/SimpleFactory/README.rst:12 +#: ../../Creational/SimpleFactory/README.rst:10 msgid "" -"Therefore, you can have multiple factories, differently parametrized, you " -"can subclass it and you can mock-up it." +"Therefore, you can have multiple factories, differently parametrized, you can subclass it and you can mock it." msgstr "" -"Таким образом, вы можете иметь несколько фабрик, параметризованных " -"различным образом. Вы можете унаследовать их и создавать макеты для " -"тестирования." +"Поэтому, вы можете иметь несколько фабрик, параметризованных различным " +"образом. Вы можете унаследовать их и создавать макеты для тестирования." + +#: ../../Creational/SimpleFactory/README.rst:11 +msgid "" +"It always should be preferred over a static factory!" +msgstr "" +"Простая фабрика всегда должна быть предпочтительнее статичной фабрики" #: ../../Creational/SimpleFactory/README.rst:16 msgid "UML Diagram" @@ -49,7 +52,7 @@ msgid "Code" msgstr "Код" #: ../../Creational/SimpleFactory/README.rst:25 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Creational/SimpleFactory/README.rst:27 diff --git a/locale/ru/LC_MESSAGES/Creational/Singleton/README.po b/locale/ru/LC_MESSAGES/Creational/Singleton/README.po index a08f6d4..561c773 100644 --- a/locale/ru/LC_MESSAGES/Creational/Singleton/README.po +++ b/locale/ru/LC_MESSAGES/Creational/Singleton/README.po @@ -71,7 +71,7 @@ msgid "Code" msgstr "Код" #: ../../Creational/Singleton/README.rst:32 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Creational/Singleton/README.rst:34 diff --git a/locale/ru/LC_MESSAGES/Creational/StaticFactory/README.po b/locale/ru/LC_MESSAGES/Creational/StaticFactory/README.po index 34f34a5..700c560 100644 --- a/locale/ru/LC_MESSAGES/Creational/StaticFactory/README.po +++ b/locale/ru/LC_MESSAGES/Creational/StaticFactory/README.po @@ -54,7 +54,7 @@ msgid "Code" msgstr "Код" #: ../../Creational/StaticFactory/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Creational/StaticFactory/README.rst:31 diff --git a/locale/ru/LC_MESSAGES/More/Delegation/README.po b/locale/ru/LC_MESSAGES/More/Delegation/README.po index 958fd7a..aac9b0c 100644 --- a/locale/ru/LC_MESSAGES/More/Delegation/README.po +++ b/locale/ru/LC_MESSAGES/More/Delegation/README.po @@ -1,15 +1,22 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. # +#, fuzzy 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:46+0300\n" -"Last-Translator: Eugene Glotov \n" +"POT-Creation-Date: 2016-06-03 23:59+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Nikita Strelkov \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: ru\n" +"Generated-By: Babel 2.3.4\n" #: ../../More/Delegation/README.rst:2 msgid "`Delegation`__" @@ -19,14 +26,35 @@ msgstr "`Делегирование , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Nikita Strelkov \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.3.4\n" + +#: ../../More/EAV/README.rst:2 +msgid "`Entity-Attribute-Value (EAV)`__" +msgstr "`Сущность-Артибут-Значение`__" + +#: ../../More/EAV/README.rst:4 +msgid "" +"The Entity–attribute–value (EAV) pattern in order to implement EAV model " +"with PHP." +msgstr "" +"Шаблон Сущность-Атрибут-Значение используется для реализации модели EAV " +"на PHP" + +#: ../../More/EAV/README.rst:7 +msgid "Purpose" +msgstr "Назначение" + +#: ../../More/EAV/README.rst:9 +msgid "" +"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." +msgstr "" +"Модель Сущность-Атрибут-Значение (EAV) - это модель данных, " +"предназначенная для описания сущностей, в которых количество атрибутов " +"(свойств, параметров), характеризующих их, потенциально огромно, " +"но то количество, которое реально будет использоваться в конкретной " +"сущности относительно мало." + +#: ../../More/EAV/README.rst:15 +msgid "Examples" +msgstr "Примеры" + +#: ../../More/EAV/README.rst:17 +msgid "Check full work example in `example.php`_ file." +msgstr "Смотри полный работоспособный пример в файле `example.php`_." + +#: ../../More/EAV/README.rst:90 +msgid "UML Diagram" +msgstr "UML Диаграмма" + +#: ../../More/EAV/README.rst:97 +msgid "Code" +msgstr "Code" + +#: ../../More/EAV/README.rst:99 +msgid "You can also find this code on `GitHub`_" +msgstr "Вы можете найти этот код на `GitHub`_" + +#: ../../More/EAV/README.rst:102 +msgid "Test" +msgstr "Тест" + +#: ../../More/EAV/README.rst:104 +msgid "Tests/EntityTest.php" +msgstr "Tests/EntityTest.php" + +#: ../../More/EAV/README.rst:110 +msgid "Tests/AttributeTest.php" +msgstr "Tests/AttributeTest.php" + +#: ../../More/EAV/README.rst:116 +msgid "Tests/ValueTest.php" +msgstr "Tests/ValueTest.php" + diff --git a/locale/ru/LC_MESSAGES/More/Repository/README.po b/locale/ru/LC_MESSAGES/More/Repository/README.po index 14748ab..0a09340 100644 --- a/locale/ru/LC_MESSAGES/More/Repository/README.po +++ b/locale/ru/LC_MESSAGES/More/Repository/README.po @@ -61,7 +61,7 @@ msgid "Code" msgstr "Код" #: ../../More/Repository/README.rst:32 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../More/Repository/README.rst:34 diff --git a/locale/ru/LC_MESSAGES/More/ServiceLocator/README.po b/locale/ru/LC_MESSAGES/More/ServiceLocator/README.po index 4031081..0eaa1e0 100644 --- a/locale/ru/LC_MESSAGES/More/ServiceLocator/README.po +++ b/locale/ru/LC_MESSAGES/More/ServiceLocator/README.po @@ -71,7 +71,7 @@ msgid "Code" msgstr "Код" #: ../../More/ServiceLocator/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../More/ServiceLocator/README.rst:38 diff --git a/locale/ru/LC_MESSAGES/README.po b/locale/ru/LC_MESSAGES/README.po index 5efb48e..5ef6690 100644 --- a/locale/ru/LC_MESSAGES/README.po +++ b/locale/ru/LC_MESSAGES/README.po @@ -76,8 +76,8 @@ 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`_" +msgid "Copyright (c) 2011 - 2016 `Dominik Liebler`_ and `contributors`_" +msgstr "Copyright (c) 2011 - 2016 `Dominik Liebler`_ and `contributors`_" #: ../../README.rst:50 msgid "" diff --git a/locale/ru/LC_MESSAGES/Structural/Adapter/README.po b/locale/ru/LC_MESSAGES/Structural/Adapter/README.po index a07bbcd..cc079cd 100644 --- a/locale/ru/LC_MESSAGES/Structural/Adapter/README.po +++ b/locale/ru/LC_MESSAGES/Structural/Adapter/README.po @@ -25,7 +25,7 @@ msgstr "Назначение" 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 " +"incompatible interfaces by providing its interface to clients while using " "the original interface." msgstr "" "Привести нестандартный или неудобный интерфейс какого-то класса в " @@ -60,7 +60,7 @@ msgid "Code" msgstr "Код" #: ../../Structural/Adapter/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Structural/Adapter/README.rst:31 diff --git a/locale/ru/LC_MESSAGES/Structural/Bridge/README.po b/locale/ru/LC_MESSAGES/Structural/Bridge/README.po index 4c6a9f6..9f91bbf 100644 --- a/locale/ru/LC_MESSAGES/Structural/Bridge/README.po +++ b/locale/ru/LC_MESSAGES/Structural/Bridge/README.po @@ -47,7 +47,7 @@ msgid "Code" msgstr "Код" #: ../../Structural/Bridge/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Structural/Bridge/README.rst:28 diff --git a/locale/ru/LC_MESSAGES/Structural/Composite/README.po b/locale/ru/LC_MESSAGES/Structural/Composite/README.po index b5ce0c8..5b79927 100644 --- a/locale/ru/LC_MESSAGES/Structural/Composite/README.po +++ b/locale/ru/LC_MESSAGES/Structural/Composite/README.po @@ -59,7 +59,7 @@ msgid "Code" msgstr "Код" #: ../../Structural/Composite/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Structural/Composite/README.rst:31 diff --git a/locale/ru/LC_MESSAGES/Structural/DataMapper/README.po b/locale/ru/LC_MESSAGES/Structural/DataMapper/README.po index be6ab4c..6376e95 100644 --- a/locale/ru/LC_MESSAGES/Structural/DataMapper/README.po +++ b/locale/ru/LC_MESSAGES/Structural/DataMapper/README.po @@ -74,7 +74,7 @@ msgid "Code" msgstr "Код" #: ../../Structural/DataMapper/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Structural/DataMapper/README.rst:38 diff --git a/locale/ru/LC_MESSAGES/Structural/Decorator/README.po b/locale/ru/LC_MESSAGES/Structural/Decorator/README.po index de0dc50..fe5d631 100644 --- a/locale/ru/LC_MESSAGES/Structural/Decorator/README.po +++ b/locale/ru/LC_MESSAGES/Structural/Decorator/README.po @@ -50,7 +50,7 @@ msgid "Code" msgstr "Код" #: ../../Structural/Decorator/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Structural/Decorator/README.rst:28 diff --git a/locale/ru/LC_MESSAGES/Structural/DependencyInjection/README.po b/locale/ru/LC_MESSAGES/Structural/DependencyInjection/README.po index 83986ad..b448699 100644 --- a/locale/ru/LC_MESSAGES/Structural/DependencyInjection/README.po +++ b/locale/ru/LC_MESSAGES/Structural/DependencyInjection/README.po @@ -85,7 +85,7 @@ msgid "" "objects via a configuration array and inject them where needed (i.e. in " "Controllers)" msgstr "" -"Symfony and Zend Framework 2 уже содержат контейнеры для DI, которые " +"Symfony и Zend Framework 2 уже содержат контейнеры для DI, которые " "создают объекты с помощью массива из конфигурации, и внедряют их в случае " "необходимости (т.е. в Контроллерах)." @@ -98,7 +98,7 @@ msgid "Code" msgstr "Код" #: ../../Structural/DependencyInjection/README.rst:46 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Structural/DependencyInjection/README.rst:48 diff --git a/locale/ru/LC_MESSAGES/Structural/Facade/README.po b/locale/ru/LC_MESSAGES/Structural/Facade/README.po index 5406898..0b279d6 100644 --- a/locale/ru/LC_MESSAGES/Structural/Facade/README.po +++ b/locale/ru/LC_MESSAGES/Structural/Facade/README.po @@ -82,7 +82,7 @@ msgid "Code" msgstr "Код" #: ../../Structural/Facade/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Structural/Facade/README.rst:38 diff --git a/locale/ru/LC_MESSAGES/Structural/FluentInterface/README.po b/locale/ru/LC_MESSAGES/Structural/FluentInterface/README.po index 18e0314..32f55f9 100644 --- a/locale/ru/LC_MESSAGES/Structural/FluentInterface/README.po +++ b/locale/ru/LC_MESSAGES/Structural/FluentInterface/README.po @@ -56,7 +56,7 @@ msgid "Code" msgstr "Код" #: ../../Structural/FluentInterface/README.rst:28 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Structural/FluentInterface/README.rst:30 diff --git a/locale/ru/LC_MESSAGES/Structural/Flyweight/README.po b/locale/ru/LC_MESSAGES/Structural/Flyweight/README.po new file mode 100644 index 0000000..9631fd1 --- /dev/null +++ b/locale/ru/LC_MESSAGES/Structural/Flyweight/README.po @@ -0,0 +1,74 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Nikita Strelkov \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.3.4\n" + +#: ../../Structural/Flyweight/README.rst:2 +msgid "`Flyweight`__" +msgstr "`Приспособленец `_ (`Flyweight`__)" + +#: ../../Structural/Flyweight/README.rst:5 +msgid "Purpose" +msgstr "Назначение" + +#: ../../Structural/Flyweight/README.rst:7 +msgid "" +"To minimise memory usage, a Flyweight shares as much as possible memory " +"with similar objects. It is needed when a large amount of objects is used" +" that don't differ much in state. A common practice is to hold state in " +"external data structures and pass them to the flyweight object when " +"needed." +msgstr "" +"Для уменьшения использования памяти Приспособленец разделяет как можно " +"больше памяти между аналогичными объектами. Это необходимо, когда " +"используется большое количество объектов, состояние которых не сильно " +"отличается. Обычной практикой является хранение состояния во внешних " +"структурах и передавать их в объект-приспособленец, когда необходимо." + +#: ../../Structural/Flyweight/README.rst:12 +msgid "UML Diagram" +msgstr "UML Диаграмма" + +#: ../../Structural/Flyweight/README.rst:19 +msgid "Code" +msgstr "Код" + +#: ../../Structural/Flyweight/README.rst:21 +msgid "You can also find this code on `GitHub`_" +msgstr "Вы можете найти этот код на `GitHub`_" + +#: ../../Structural/Flyweight/README.rst:23 +msgid "FlyweightInterface.php" +msgstr "FlyweightInterface.php" + +#: ../../Structural/Flyweight/README.rst:29 +msgid "CharacterFlyweight.php" +msgstr "CharacterFlyweight.php" + +#: ../../Structural/Flyweight/README.rst:35 +msgid "FlyweightFactory.php" +msgstr "FlyweightFactory.php" + +#: ../../Structural/Flyweight/README.rst:42 +msgid "Test" +msgstr "Тест" + +#: ../../Structural/Flyweight/README.rst:44 +msgid "Tests/FlyweightTest.php" +msgstr "Tests/FlyweightTest.php" + diff --git a/locale/ru/LC_MESSAGES/Structural/Proxy/README.po b/locale/ru/LC_MESSAGES/Structural/Proxy/README.po index 203b7b1..573bf5d 100644 --- a/locale/ru/LC_MESSAGES/Structural/Proxy/README.po +++ b/locale/ru/LC_MESSAGES/Structural/Proxy/README.po @@ -50,7 +50,7 @@ msgid "Code" msgstr "Код" #: ../../Structural/Proxy/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Structural/Proxy/README.rst:28 diff --git a/locale/ru/LC_MESSAGES/Structural/Registry/README.po b/locale/ru/LC_MESSAGES/Structural/Registry/README.po index b7b7fe4..e716af4 100644 --- a/locale/ru/LC_MESSAGES/Structural/Registry/README.po +++ b/locale/ru/LC_MESSAGES/Structural/Registry/README.po @@ -35,10 +35,10 @@ msgstr "Примеры" #: ../../Structural/Registry/README.rst:14 msgid "" -"Zend Framework: ``Zend_Registry`` holds the application's logger object, " -"front controller etc." +"Zend Framework 1: ``Zend_Registry`` holds the application's logger " +"object, front controller etc." msgstr "" -"Zend Framework: ``Zend_Registry`` содержит объект журналирования " +"Zend Framework 1: ``Zend_Registry`` содержит объект журналирования " "приложения (логгер), фронт-контроллер и т.д." #: ../../Structural/Registry/README.rst:16 @@ -58,7 +58,7 @@ msgid "Code" msgstr "Код" #: ../../Structural/Registry/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Structural/Registry/README.rst:31 diff --git a/locale/template/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.pot b/locale/template/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.pot new file mode 100644 index 0000000..9b42bd5 --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.pot @@ -0,0 +1,72 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:1 +msgid "Chain Of Responsibilities" +msgstr "" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:4 +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:11 +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:24 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:28 +msgid "Alt ChainOfResponsibility UML Diagram" +msgstr "" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:31 +msgid "Code" +msgstr "" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:34 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/ChainOfResponsibilities/README.rst:54 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/Command/README.pot b/locale/template/LC_MESSAGES/Behavioral/Command/README.pot new file mode 100644 index 0000000..33dd5b3 --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/Command/README.pot @@ -0,0 +1,81 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/Command/README.rst:1 +msgid "Command" +msgstr "" + +#: ../../Behavioral/Command/README.rst:4 +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:20 +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:31 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Command/README.rst:35 +msgid "Alt Command UML Diagram" +msgstr "" + +#: ../../Behavioral/Command/README.rst:38 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Command/README.rst:41 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Command/README.rst:67 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/Iterator/README.pot b/locale/template/LC_MESSAGES/Behavioral/Iterator/README.pot new file mode 100644 index 0000000..47d8c0d --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/Iterator/README.pot @@ -0,0 +1,63 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/Iterator/README.rst:1 +msgid "Iterator" +msgstr "" + +#: ../../Behavioral/Iterator/README.rst:4 +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:10 +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:17 +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:24 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Iterator/README.rst:28 +msgid "Alt Iterator UML Diagram" +msgstr "" + +#: ../../Behavioral/Iterator/README.rst:31 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Iterator/README.rst:34 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Iterator/README.rst:60 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/Mediator/README.pot b/locale/template/LC_MESSAGES/Behavioral/Mediator/README.pot new file mode 100644 index 0000000..a796de5 --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/Mediator/README.pot @@ -0,0 +1,51 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/Mediator/README.rst:1 +msgid "Mediator" +msgstr "" + +#: ../../Behavioral/Mediator/README.rst:4 +msgid "Purpose" +msgstr "" + +#: ../../Behavioral/Mediator/README.rst:7 +msgid "" +"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)." +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:15 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Mediator/README.rst:19 +msgid "Alt Mediator UML Diagram" +msgstr "" + +#: ../../Behavioral/Mediator/README.rst:22 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Mediator/README.rst:25 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Mediator/README.rst:63 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/Memento/README.pot b/locale/template/LC_MESSAGES/Behavioral/Memento/README.pot new file mode 100644 index 0000000..acff1b7 --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/Memento/README.pot @@ -0,0 +1,99 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/Memento/README.rst:1 +msgid "Memento" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:4 +msgid "Purpose" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:7 +msgid "" +"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 function " +"to return the current state)." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:12 +msgid "" +"The memento pattern is implemented with three objects: the Originator, a " +"Caretaker and a Memento." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:15 +msgid "" +"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)." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:24 +msgid "" +"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*." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:33 +msgid "" +"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." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:38 +msgid "Examples" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:41 +msgid "The seed of a pseudorandom number generator." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:42 +msgid "The state in a finite state machine." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:43 +msgid "Control for intermediate states of `ORM Model `_ before saving." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:45 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:49 +msgid "Alt Memento UML Diagram" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:52 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:55 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Memento/README.rst:75 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/NullObject/README.pot b/locale/template/LC_MESSAGES/Behavioral/NullObject/README.pot new file mode 100644 index 0000000..4f00a60 --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/NullObject/README.pot @@ -0,0 +1,85 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/NullObject/README.rst:1 +msgid "Null Object" +msgstr "" + +#: ../../Behavioral/NullObject/README.rst:4 +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:21 +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:29 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/NullObject/README.rst:33 +msgid "Alt NullObject UML Diagram" +msgstr "" + +#: ../../Behavioral/NullObject/README.rst:36 +msgid "Code" +msgstr "" + +#: ../../Behavioral/NullObject/README.rst:39 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/NullObject/README.rst:65 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/Observer/README.pot b/locale/template/LC_MESSAGES/Behavioral/Observer/README.pot new file mode 100644 index 0000000..db2937f --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/Observer/README.pot @@ -0,0 +1,63 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/Observer/README.rst:1 +msgid "Observer" +msgstr "" + +#: ../../Behavioral/Observer/README.rst:4 +msgid "Purpose" +msgstr "" + +#: ../../Behavioral/Observer/README.rst:7 +msgid "" +"To implement a publish/subscribe behaviour to an object, whenever a " +"\"Subject\" object changes its 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:12 +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:17 +msgid "Note" +msgstr "" + +#: ../../Behavioral/Observer/README.rst:20 +msgid "" +"PHP already defines two interfaces that can help to implement this " +"pattern: SplObserver and SplSubject." +msgstr "" + +#: ../../Behavioral/Observer/README.rst:23 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Observer/README.rst:27 +msgid "Alt Observer UML Diagram" +msgstr "" + +#: ../../Behavioral/Observer/README.rst:30 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Observer/README.rst:33 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Observer/README.rst:47 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/README.pot b/locale/template/LC_MESSAGES/Behavioral/README.pot new file mode 100644 index 0000000..9c7bfda --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/README.pot @@ -0,0 +1,21 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/README.rst:1 +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 "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/Specification/README.pot b/locale/template/LC_MESSAGES/Behavioral/Specification/README.pot new file mode 100644 index 0000000..36f7299 --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/Specification/README.pot @@ -0,0 +1,49 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/Specification/README.rst:1 +msgid "Specification" +msgstr "" + +#: ../../Behavioral/Specification/README.rst:4 +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:12 +msgid "Examples" +msgstr "" + +#: ../../Behavioral/Specification/README.rst:17 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Specification/README.rst:21 +msgid "Alt Specification UML Diagram" +msgstr "" + +#: ../../Behavioral/Specification/README.rst:24 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Specification/README.rst:27 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Specification/README.rst:65 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/State/README.pot b/locale/template/LC_MESSAGES/Behavioral/State/README.pot new file mode 100644 index 0000000..389d11f --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/State/README.pot @@ -0,0 +1,44 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/State/README.rst:1 +msgid "State" +msgstr "" + +#: ../../Behavioral/State/README.rst:4 +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:11 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/State/README.rst:15 +msgid "Alt State UML Diagram" +msgstr "" + +#: ../../Behavioral/State/README.rst:18 +msgid "Code" +msgstr "" + +#: ../../Behavioral/State/README.rst:21 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/State/README.rst:53 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/Strategy/README.pot b/locale/template/LC_MESSAGES/Behavioral/Strategy/README.pot new file mode 100644 index 0000000..95d7f0b --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/Strategy/README.pot @@ -0,0 +1,70 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/Strategy/README.rst:1 ../../Behavioral/Strategy/README.rst:8 +msgid "Strategy" +msgstr "" + +#: ../../Behavioral/Strategy/README.rst:4 +msgid "Terminology" +msgstr "" + +#: ../../Behavioral/Strategy/README.rst:7 +msgid "Context" +msgstr "" + +#: ../../Behavioral/Strategy/README.rst:9 +msgid "Concrete Strategy" +msgstr "" + +#: ../../Behavioral/Strategy/README.rst:11 +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:18 +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:25 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Strategy/README.rst:29 +msgid "Alt Strategy UML Diagram" +msgstr "" + +#: ../../Behavioral/Strategy/README.rst:32 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Strategy/README.rst:35 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Strategy/README.rst:61 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/TemplateMethod/README.pot b/locale/template/LC_MESSAGES/Behavioral/TemplateMethod/README.pot new file mode 100644 index 0000000..3ab5c5f --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/TemplateMethod/README.pot @@ -0,0 +1,68 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/TemplateMethod/README.rst:1 +msgid "Template Method" +msgstr "" + +#: ../../Behavioral/TemplateMethod/README.rst:4 +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 does 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:24 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/TemplateMethod/README.rst:28 +msgid "Alt TemplateMethod UML Diagram" +msgstr "" + +#: ../../Behavioral/TemplateMethod/README.rst:31 +msgid "Code" +msgstr "" + +#: ../../Behavioral/TemplateMethod/README.rst:34 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/TemplateMethod/README.rst:54 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Behavioral/Visitor/README.pot b/locale/template/LC_MESSAGES/Behavioral/Visitor/README.pot new file mode 100644 index 0000000..056651d --- /dev/null +++ b/locale/template/LC_MESSAGES/Behavioral/Visitor/README.pot @@ -0,0 +1,52 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Behavioral/Visitor/README.rst:1 +msgid "Visitor" +msgstr "" + +#: ../../Behavioral/Visitor/README.rst:4 +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:16 +msgid "UML Diagram" +msgstr "" + +#: ../../Behavioral/Visitor/README.rst:20 +msgid "Alt Visitor UML Diagram" +msgstr "" + +#: ../../Behavioral/Visitor/README.rst:23 +msgid "Code" +msgstr "" + +#: ../../Behavioral/Visitor/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Behavioral/Visitor/README.rst:58 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Creational/AbstractFactory/README.pot b/locale/template/LC_MESSAGES/Creational/AbstractFactory/README.pot new file mode 100644 index 0000000..5610f7d --- /dev/null +++ b/locale/template/LC_MESSAGES/Creational/AbstractFactory/README.pot @@ -0,0 +1,45 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Creational/AbstractFactory/README.rst:1 +msgid "Abstract Factory" +msgstr "" + +#: ../../Creational/AbstractFactory/README.rst:4 +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:12 +msgid "UML Diagram" +msgstr "" + +#: ../../Creational/AbstractFactory/README.rst:16 +msgid "Alt AbstractFactory UML Diagram" +msgstr "" + +#: ../../Creational/AbstractFactory/README.rst:19 +msgid "Code" +msgstr "" + +#: ../../Creational/AbstractFactory/README.rst:22 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Creational/AbstractFactory/README.rst:60 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Creational/Builder/README.pot b/locale/template/LC_MESSAGES/Creational/Builder/README.pot new file mode 100644 index 0000000..784edf6 --- /dev/null +++ b/locale/template/LC_MESSAGES/Creational/Builder/README.pot @@ -0,0 +1,67 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Creational/Builder/README.rst:1 +msgid "Builder" +msgstr "" + +#: ../../Creational/Builder/README.rst:4 +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:18 +msgid "Examples" +msgstr "" + +#: ../../Creational/Builder/README.rst:21 +msgid "PHPUnit: Mock Builder" +msgstr "" + +#: ../../Creational/Builder/README.rst:23 +msgid "UML Diagram" +msgstr "" + +#: ../../Creational/Builder/README.rst:27 +msgid "Alt Builder UML Diagram" +msgstr "" + +#: ../../Creational/Builder/README.rst:30 +msgid "Code" +msgstr "" + +#: ../../Creational/Builder/README.rst:33 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Creational/Builder/README.rst:95 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Creational/FactoryMethod/README.pot b/locale/template/LC_MESSAGES/Creational/FactoryMethod/README.pot new file mode 100644 index 0000000..2cf0eb8 --- /dev/null +++ b/locale/template/LC_MESSAGES/Creational/FactoryMethod/README.pot @@ -0,0 +1,60 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Creational/FactoryMethod/README.rst:1 +msgid "Factory Method" +msgstr "" + +#: ../../Creational/FactoryMethod/README.rst:4 +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:19 +msgid "UML Diagram" +msgstr "" + +#: ../../Creational/FactoryMethod/README.rst:23 +msgid "Alt FactoryMethod UML Diagram" +msgstr "" + +#: ../../Creational/FactoryMethod/README.rst:26 +msgid "Code" +msgstr "" + +#: ../../Creational/FactoryMethod/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Creational/FactoryMethod/README.rst:73 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Creational/Multiton/README.pot b/locale/template/LC_MESSAGES/Creational/Multiton/README.pot new file mode 100644 index 0000000..c9b8176 --- /dev/null +++ b/locale/template/LC_MESSAGES/Creational/Multiton/README.pot @@ -0,0 +1,61 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Creational/Multiton/README.rst:1 +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:7 +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:13 +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:19 +msgid "UML Diagram" +msgstr "" + +#: ../../Creational/Multiton/README.rst:23 +msgid "Alt Multiton UML Diagram" +msgstr "" + +#: ../../Creational/Multiton/README.rst:26 +msgid "Code" +msgstr "" + +#: ../../Creational/Multiton/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Creational/Multiton/README.rst:37 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Creational/Pool/README.pot b/locale/template/LC_MESSAGES/Creational/Pool/README.pot new file mode 100644 index 0000000..b8f06f2 --- /dev/null +++ b/locale/template/LC_MESSAGES/Creational/Pool/README.pot @@ -0,0 +1,66 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Creational/Pool/README.rst:1 +msgid "Pool" +msgstr "" + +#: ../../Creational/Pool/README.rst:4 +msgid "Purpose" +msgstr "" + +#: ../../Creational/Pool/README.rst:7 +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:14 +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:21 +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:27 +msgid "UML Diagram" +msgstr "" + +#: ../../Creational/Pool/README.rst:31 +msgid "Alt Pool UML Diagram" +msgstr "" + +#: ../../Creational/Pool/README.rst:34 +msgid "Code" +msgstr "" + +#: ../../Creational/Pool/README.rst:37 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Creational/Pool/README.rst:51 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Creational/Prototype/README.pot b/locale/template/LC_MESSAGES/Creational/Prototype/README.pot new file mode 100644 index 0000000..2cfa74b --- /dev/null +++ b/locale/template/LC_MESSAGES/Creational/Prototype/README.pot @@ -0,0 +1,53 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Creational/Prototype/README.rst:1 +msgid "Prototype" +msgstr "" + +#: ../../Creational/Prototype/README.rst:4 +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:10 +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:16 +msgid "UML Diagram" +msgstr "" + +#: ../../Creational/Prototype/README.rst:20 +msgid "Alt Prototype UML Diagram" +msgstr "" + +#: ../../Creational/Prototype/README.rst:23 +msgid "Code" +msgstr "" + +#: ../../Creational/Prototype/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Creational/Prototype/README.rst:46 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Creational/README.pot b/locale/template/LC_MESSAGES/Creational/README.pot new file mode 100644 index 0000000..d3d8b7d --- /dev/null +++ b/locale/template/LC_MESSAGES/Creational/README.pot @@ -0,0 +1,23 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Creational/README.rst:1 +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 "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Creational/SimpleFactory/README.pot b/locale/template/LC_MESSAGES/Creational/SimpleFactory/README.pot new file mode 100644 index 0000000..7af53ee --- /dev/null +++ b/locale/template/LC_MESSAGES/Creational/SimpleFactory/README.pot @@ -0,0 +1,55 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Creational/SimpleFactory/README.rst:1 +msgid "Simple Factory" +msgstr "" + +#: ../../Creational/SimpleFactory/README.rst:4 +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. " +"Therefore, you can have multiple factories, differently parametrized, you can subclass it and you can mock it." +msgstr "" + +#: ../../Creational/SimpleFactory/README.rst:11 +msgid "It always should be preferred over a static factory!" +msgstr "" + +#: ../../Creational/SimpleFactory/README.rst:13 +msgid "UML Diagram" +msgstr "" + +#: ../../Creational/SimpleFactory/README.rst:17 +msgid "Alt SimpleFactory UML Diagram" +msgstr "" + +#: ../../Creational/SimpleFactory/README.rst:20 +msgid "Code" +msgstr "" + +#: ../../Creational/SimpleFactory/README.rst:23 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Creational/SimpleFactory/README.rst:43 +msgid "Usage" +msgstr "" + +#: ../../Creational/SimpleFactory/README.rst:52 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Creational/Singleton/README.pot b/locale/template/LC_MESSAGES/Creational/Singleton/README.pot new file mode 100644 index 0000000..ef33719 --- /dev/null +++ b/locale/template/LC_MESSAGES/Creational/Singleton/README.pot @@ -0,0 +1,69 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Creational/Singleton/README.rst:1 +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:7 +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:13 +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:22 +msgid "UML Diagram" +msgstr "" + +#: ../../Creational/Singleton/README.rst:26 +msgid "Alt Singleton UML Diagram" +msgstr "" + +#: ../../Creational/Singleton/README.rst:29 +msgid "Code" +msgstr "" + +#: ../../Creational/Singleton/README.rst:32 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Creational/Singleton/README.rst:40 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Creational/StaticFactory/README.pot b/locale/template/LC_MESSAGES/Creational/StaticFactory/README.pot new file mode 100644 index 0000000..20a9d4e --- /dev/null +++ b/locale/template/LC_MESSAGES/Creational/StaticFactory/README.pot @@ -0,0 +1,56 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Creational/StaticFactory/README.rst:1 +msgid "Static Factory" +msgstr "" + +#: ../../Creational/StaticFactory/README.rst:4 +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:13 +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:19 +msgid "UML Diagram" +msgstr "" + +#: ../../Creational/StaticFactory/README.rst:23 +msgid "Alt StaticFactory UML Diagram" +msgstr "" + +#: ../../Creational/StaticFactory/README.rst:26 +msgid "Code" +msgstr "" + +#: ../../Creational/StaticFactory/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Creational/StaticFactory/README.rst:55 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/More/Delegation/README.pot b/locale/template/LC_MESSAGES/More/Delegation/README.pot new file mode 100644 index 0000000..a8b3182 --- /dev/null +++ b/locale/template/LC_MESSAGES/More/Delegation/README.pot @@ -0,0 +1,54 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../More/Delegation/README.rst:1 +msgid "Delegation" +msgstr "" + +#: ../../More/Delegation/README.rst:4 +msgid "Purpose" +msgstr "" + +#: ../../More/Delegation/README.rst:7 +msgid "" +"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." +msgstr "" + +#: ../../More/Delegation/README.rst:13 +msgid "Examples" +msgstr "" + +#: ../../More/Delegation/README.rst:16 +msgid "Please review JuniorDeveloper.php, TeamLead.php, and then Usage.php to see it all tied together." +msgstr "" + +#: ../../More/Delegation/README.rst:18 +msgid "UML Diagram" +msgstr "" + +#: ../../More/Delegation/README.rst:22 +msgid "Alt Delegation UML Diagram" +msgstr "" + +#: ../../More/Delegation/README.rst:25 +msgid "Code" +msgstr "" + +#: ../../More/Delegation/README.rst:28 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../More/Delegation/README.rst:42 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/More/EAV/README.pot b/locale/template/LC_MESSAGES/More/EAV/README.pot new file mode 100644 index 0000000..585e1aa --- /dev/null +++ b/locale/template/LC_MESSAGES/More/EAV/README.pot @@ -0,0 +1,49 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../More/EAV/README.rst:1 +msgid "Entity-Attribute-Value (EAV)" +msgstr "" + +#: ../../More/EAV/README.rst:4 +msgid "The Entity–attribute–value (EAV) pattern in order to implement EAV model with PHP." +msgstr "" + +#: ../../More/EAV/README.rst:6 +msgid "Purpose" +msgstr "" + +#: ../../More/EAV/README.rst:9 +msgid "" +"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." +msgstr "" + +#: ../../More/EAV/README.rst:14 +msgid "UML Diagram" +msgstr "" + +#: ../../More/EAV/README.rst:18 +msgid "EAV UML Diagram" +msgstr "" + +#: ../../More/EAV/README.rst:21 +msgid "Code" +msgstr "" + +#: ../../More/EAV/README.rst:24 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../More/EAV/README.rst:44 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/More/README.pot b/locale/template/LC_MESSAGES/More/README.pot new file mode 100644 index 0000000..78dfff1 --- /dev/null +++ b/locale/template/LC_MESSAGES/More/README.pot @@ -0,0 +1,13 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../More/README.rst:1 +msgid "More" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/More/Repository/README.pot b/locale/template/LC_MESSAGES/More/Repository/README.pot new file mode 100644 index 0000000..df5f973 --- /dev/null +++ b/locale/template/LC_MESSAGES/More/Repository/README.pot @@ -0,0 +1,62 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../More/Repository/README.rst:1 +msgid "Repository" +msgstr "" + +#: ../../More/Repository/README.rst:4 +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:15 +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:22 +msgid "UML Diagram" +msgstr "" + +#: ../../More/Repository/README.rst:26 +msgid "Alt Repository UML Diagram" +msgstr "" + +#: ../../More/Repository/README.rst:29 +msgid "Code" +msgstr "" + +#: ../../More/Repository/README.rst:32 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../More/Repository/README.rst:52 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/More/ServiceLocator/README.pot b/locale/template/LC_MESSAGES/More/ServiceLocator/README.pot new file mode 100644 index 0000000..1ac7074 --- /dev/null +++ b/locale/template/LC_MESSAGES/More/ServiceLocator/README.pot @@ -0,0 +1,67 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../More/ServiceLocator/README.rst:1 +msgid "Service Locator" +msgstr "" + +#: ../../More/ServiceLocator/README.rst:4 +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:11 +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:19 +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:26 +msgid "UML Diagram" +msgstr "" + +#: ../../More/ServiceLocator/README.rst:30 +msgid "Alt ServiceLocator UML Diagram" +msgstr "" + +#: ../../More/ServiceLocator/README.rst:33 +msgid "Code" +msgstr "" + +#: ../../More/ServiceLocator/README.rst:36 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../More/ServiceLocator/README.rst:50 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/README.pot b/locale/template/LC_MESSAGES/README.pot new file mode 100644 index 0000000..92b1114 --- /dev/null +++ b/locale/template/LC_MESSAGES/README.pot @@ -0,0 +1,71 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../README.rst:4 +msgid "DesignPatternsPHP" +msgstr "" + +#: ../../README.rst:9 +msgid "Documentation Status" +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:19 +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:34 +msgid "Contribute" +msgstr "" + +#: ../../README.rst:37 +msgid "" +"If you encounter any bugs or missing translations, please feel free " +"to fork 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:69 +msgid "`design patterns`" +msgstr "" + +#: ../../README.rst:70 +msgid "`PHP CodeSniffer`" +msgstr "" + +#: ../../README.rst:71 +msgid "`PSR2 standard`" +msgstr "" + +#: ../../README.rst:73 +msgid "`contributors`" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/Adapter/README.pot b/locale/template/LC_MESSAGES/Structural/Adapter/README.pot new file mode 100644 index 0000000..ffaf97c --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/Adapter/README.pot @@ -0,0 +1,59 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/Adapter/README.rst:1 +msgid "Adapter" +msgstr "" + +#: ../../Structural/Adapter/README.rst:4 +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 its interface to clients while " +"using the original interface." +msgstr "" + +#: ../../Structural/Adapter/README.rst:12 +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:19 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Adapter/README.rst:23 +msgid "Alt Adapter UML Diagram" +msgstr "" + +#: ../../Structural/Adapter/README.rst:26 +msgid "Code" +msgstr "" + +#: ../../Structural/Adapter/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Adapter/README.rst:61 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/Bridge/README.pot b/locale/template/LC_MESSAGES/Structural/Bridge/README.pot new file mode 100644 index 0000000..d9787fc --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/Bridge/README.pot @@ -0,0 +1,53 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/Bridge/README.rst:1 +msgid "Bridge" +msgstr "" + +#: ../../Structural/Bridge/README.rst:4 +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:10 +msgid "Examples" +msgstr "" + +#: ../../Structural/Bridge/README.rst:13 +msgid "" +"`Symfony " +"DoctrineBridge `__" +msgstr "" + +#: ../../Structural/Bridge/README.rst:16 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Bridge/README.rst:20 +msgid "Alt Bridge UML Diagram" +msgstr "" + +#: ../../Structural/Bridge/README.rst:23 +msgid "Code" +msgstr "" + +#: ../../Structural/Bridge/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Bridge/README.rst:58 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/Composite/README.pot b/locale/template/LC_MESSAGES/Structural/Composite/README.pot new file mode 100644 index 0000000..9419f7d --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/Composite/README.pot @@ -0,0 +1,60 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/Composite/README.rst:1 +msgid "Composite" +msgstr "" + +#: ../../Structural/Composite/README.rst:4 +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:10 +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:19 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Composite/README.rst:23 +msgid "Alt Composite UML Diagram" +msgstr "" + +#: ../../Structural/Composite/README.rst:26 +msgid "Code" +msgstr "" + +#: ../../Structural/Composite/README.rst:29 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Composite/README.rst:55 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/DataMapper/README.pot b/locale/template/LC_MESSAGES/Structural/DataMapper/README.pot new file mode 100644 index 0000000..8de3978 --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/DataMapper/README.pot @@ -0,0 +1,66 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/DataMapper/README.rst:1 +msgid "Data Mapper" +msgstr "" + +#: ../../Structural/DataMapperREADME.rst:4 +msgid "Purpose" +msgstr "" + +#: ../../Structural/DataMapperREADME.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/DataMapperREADME.rst:17 +msgid "" +"The key point of this pattern is, unlike Active Record pattern, the data " +"model follows Single Responsibility Principle." +msgstr "" + +#: ../../Structural/DataMapperREADME.rst:20 +msgid "Examples" +msgstr "" + +#: ../../Structural/DataMapperREADME.rst:23 +msgid "" +"DB Object Relational Mapper (ORM) : Doctrine2 uses DAO named as " +"\"EntityRepository\"" +msgstr "" + +#: ../../Structural/DataMapperREADME.rst:26 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/DataMapperREADME.rst:30 +msgid "Alt DataMapper UML Diagram" +msgstr "" + +#: ../../Structural/DataMapperREADME.rst:33 +msgid "Code" +msgstr "" + +#: ../../Structural/DataMapperREADME.rst:36 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/DataMapperREADME.rst:56 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/Decorator/README.pot b/locale/template/LC_MESSAGES/Structural/Decorator/README.pot new file mode 100644 index 0000000..cf1d44f --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/Decorator/README.pot @@ -0,0 +1,99 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/Decorator/README.rst:1 +msgid "Decorator" +msgstr "" + +#: ../../Structural/Decorator/README.rst:4 +msgid "Purpose" +msgstr "" + +#: ../../Structural/Decorator/README.rst:7 +msgid "To dynamically add new functionality to class instances." +msgstr "" + +#: ../../Structural/Decorator/README.rst:9 +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:16 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Decorator/README.rst:20 +msgid "Alt Decorator UML Diagram" +msgstr "" + +#: ../../Structural/Decorator/README.rst:23 +msgid "Code" +msgstr "" + +#: ../../Structural/Decorator/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Decorator/README.rst:58 +msgid "Test" +msgstr "" + +#: ../../Structural/Decorator/README.rst: +msgid "" +msgstr "" + +#: ../../Structural/Decorator/README.rst: +msgid "" +msgstr "" + +#: ../../Structural/Decorator/README.rst: +msgid "" +msgstr "" + +#: ../../Structural/Decorator/README.rst: +msgid "" +msgstr "" + +#: ../../Structural/Decorator/README.rst: +msgid "" +msgstr "" + +#: ../../Structural/Decorator/README.rst: +msgid "" +msgstr "" + +#: ../../Structural/Decorator/README.rst: +msgid "" +msgstr "" + +#: ../../Structural/Decorator/README.rst: +msgid "" +msgstr "" + +#: ../../Structural/Decorator/README.rst: +msgid "" +msgstr "" + +#: ../../Structural/Decorator/README.rst: +msgid "" +msgstr "" + +#: ../../Structural/Decorator/README.rst: +msgid "" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/DependencyInjection/README.pot b/locale/template/LC_MESSAGES/Structural/DependencyInjection/README.pot new file mode 100644 index 0000000..bbf9186 --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/DependencyInjection/README.pot @@ -0,0 +1,74 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/DependencyInjection/README.rst:1 +msgid "Dependency Injection" +msgstr "" + +#: ../../Structural/DependencyInjection/README.rst:4 +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:10 +msgid "Usage" +msgstr "" + +#: ../../Structural/DependencyInjection/README.rst:13 +msgid "" +"DatabaseConfiguration gets injected and ``DatabaseConnection`` will get all that it " +"needs from ``$config``. Without DI, the configuration would be created " +"directly in ``DatabaseConnection``, which is not very good for testing and " +"extending it." +msgstr "" + +#: ../../Structural/DependencyInjection/README.rst:18 +msgid "Examples" +msgstr "" + +#: ../../Structural/DependencyInjection/README.rst:21 +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:25 +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:29 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/DependencyInjection/README.rst:33 +msgid "Alt DependencyInjection UML Diagram" +msgstr "" + +#: ../../Structural/DependencyInjection/README.rst:36 +msgid "Code" +msgstr "" + +#: ../../Structural/DependencyInjection/README.rst:39 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/DependencyInjection/README.rst:53 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/Facade/README.pot b/locale/template/LC_MESSAGES/Structural/Facade/README.pot new file mode 100644 index 0000000..c519aee --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/Facade/README.pot @@ -0,0 +1,73 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/Facade/README.rst:1 +msgid "Facade" +msgstr "" + +#: ../../Structural/Facade/README.rst:4 +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:26 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Facade/README.rst:30 +msgid "Alt Facade UML Diagram" +msgstr "" + +#: ../../Structural/Facade/README.rst:33 +msgid "Code" +msgstr "" + +#: ../../Structural/Facade/README.rst:36 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Facade/README.rst:56 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/FluentInterface/README.pot b/locale/template/LC_MESSAGES/Structural/FluentInterface/README.pot new file mode 100644 index 0000000..b74af4b --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/FluentInterface/README.pot @@ -0,0 +1,57 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/FluentInterface/README.rst:1 +msgid "Fluent Interface" +msgstr "" + +#: ../../Structural/FluentInterface/README.rst:4 +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: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:18 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/FluentInterface/README.rst:22 +msgid "Alt FluentInterface UML Diagram" +msgstr "" + +#: ../../Structural/FluentInterface/README.rst:25 +msgid "Code" +msgstr "" + +#: ../../Structural/FluentInterface/README.rst:28 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/FluentInterface/README.rst:36 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/Flyweight/README.pot b/locale/template/LC_MESSAGES/Structural/Flyweight/README.pot new file mode 100644 index 0000000..b5c6bde --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/Flyweight/README.pot @@ -0,0 +1,44 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/Flyweight/README.rst:1 +msgid "Flyweight" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:4 +msgid "Purpose" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:7 +msgid "" +"To minimise memory usage, a Flyweight shares as much as possible memory with similar objects. It " +"is needed when a large amount of objects is used that don't differ much in state. A common practice is " +"to hold state in external data structures and pass them to the flyweight object when needed." +msgstr "" + +#: ../../Structural/Flyweight/README.rst:11 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:15 +msgid "Alt Flyweight UML Diagram" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:18 +msgid "Code" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:21 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:41 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/Proxy/README.pot b/locale/template/LC_MESSAGES/Structural/Proxy/README.pot new file mode 100644 index 0000000..836599c --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/Proxy/README.pot @@ -0,0 +1,52 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/Proxy/README.rst:1 +msgid "Proxy" +msgstr "" + +#: ../../Structural/Proxy/README.rst:4 +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:9 +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:16 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Proxy/README.rst:20 +msgid "Alt Proxy UML Diagram" +msgstr "" + +#: ../../Structural/Proxy/README.rst:23 +msgid "Code" +msgstr "" + +#: ../../Structural/Proxy/README.rst:26 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Proxy/README.rst:40 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/README.pot b/locale/template/LC_MESSAGES/Structural/README.pot new file mode 100644 index 0000000..7761812 --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/README.pot @@ -0,0 +1,20 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/README.rst:1 +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 "" \ No newline at end of file diff --git a/locale/template/LC_MESSAGES/Structural/Registry/README.pot b/locale/template/LC_MESSAGES/Structural/Registry/README.pot new file mode 100644 index 0000000..c580001 --- /dev/null +++ b/locale/template/LC_MESSAGES/Structural/Registry/README.pot @@ -0,0 +1,61 @@ +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP " +"d4972f03fc93de3ef10bb31220de49931487d5e0\n" +"POT-Creation-Date: 2016-09-19 17:00-0500\n" +"Last-Translator: Axel Pardemann \n" +"Content-Type: text/plain; " +"charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../Structural/Registry/README.rst:1 +msgid "Registry" +msgstr "" + +#: ../../Structural/Registry/README.rst:4 +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). Remember that this introduces " +"global state, which should be avoided at all times! Instead implement it using Dependency Injection!" +msgstr "" + +#: ../../Structural/Registry/README.rst:12 +msgid "Examples" +msgstr "" + +#: ../../Structural/Registry/README.rst:15 +msgid "" +"Zend Framework 1: ``Zend_Registry`` holds the application's logger " +"object, front controller etc." +msgstr "" + +#: ../../Structural/Registry/README.rst:17 +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:24 +msgid "Alt Registry UML Diagram" +msgstr "" + +#: ../../Structural/Registry/README.rst:27 +msgid "Code" +msgstr "" + +#: ../../Structural/Registry/README.rst:30 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Registry/README.rst:38 +msgid "Test" +msgstr "" \ No newline at end of file diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po index b5277a5..19f8d8d 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/ChainOfResponsibilities/README.po @@ -62,7 +62,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/ChainOfResponsibilities/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/ChainOfResponsibilities/README.rst:36 diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/Command/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/Command/README.po index 29319a3..158d346 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/Command/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/Command/README.po @@ -71,7 +71,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Command/README.rst:41 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Command/README.rst:43 diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/Iterator/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/Iterator/README.po index 3000658..25ccf3a 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/Iterator/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/Iterator/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -20,9 +20,7 @@ msgid "Purpose" msgstr "" #: ../../Behavioral/Iterator/README.rst:7 -msgid "" -"To make an object iterable and to make it appear like a collection of " -"objects." +msgid "To make an object iterable and to make it appear like a collection of objects." msgstr "" #: ../../Behavioral/Iterator/README.rst:11 @@ -55,7 +53,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Iterator/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Iterator/README.rst:36 diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/Mediator/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/Mediator/README.po index 9c6694b..e9a44dd 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/Mediator/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/Mediator/README.po @@ -21,8 +21,8 @@ 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 " +"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)." msgstr "" @@ -42,7 +42,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Mediator/README.rst:25 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Mediator/README.rst:27 diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/Memento/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/Memento/README.po index fa2378c..2d4b2e1 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/Memento/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/Memento/README.po @@ -1,15 +1,22 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. # +#, fuzzy msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-29 12:18+0200\n" +"POT-Creation-Date: 2016-06-03 23:59+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-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.3.4\n" #: ../../Behavioral/Memento/README.rst:2 msgid "`Memento`__" @@ -19,6 +26,52 @@ msgstr "" msgid "Purpose" msgstr "" +#: ../../Behavioral/Memento/README.rst:7 +msgid "" +"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)." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:12 +msgid "" +"The memento pattern is implemented with three objects: the Originator, a " +"Caretaker and a Memento." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:15 +msgid "" +"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)." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:24 +msgid "" +"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*." +msgstr "" + +#: ../../Behavioral/Memento/README.rst:33 +msgid "" +"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." +msgstr "" + #: ../../Behavioral/Memento/README.rst:39 msgid "Examples" msgstr "" @@ -31,6 +84,12 @@ msgstr "" msgid "The state in a finite state machine" msgstr "" +#: ../../Behavioral/Memento/README.rst:43 +msgid "" +"Control for intermediate states of `ORM Model " +"`_ before saving" +msgstr "" + #: ../../Behavioral/Memento/README.rst:46 msgid "UML Diagram" msgstr "" @@ -40,7 +99,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Memento/README.rst:55 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Memento/README.rst:57 @@ -63,73 +122,3 @@ msgstr "" msgid "Tests/MementoTest.php" msgstr "" -#: ../../Behavioral/Memento/README.rst:7 -msgid "" -"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)." -msgstr "" - -#: ../../Behavioral/Memento/README.rst:12 -msgid "" -"The memento pattern is implemented with three objects: the Originator, a " -"Caretaker and a Memento." -msgstr "" - -#: ../../Behavioral/Memento/README.rst:15 -msgid "" -"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)." -msgstr "" - -#: ../../Behavioral/Memento/README.rst:24 -msgid "" -"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*." -msgstr "" - -#: ../../Behavioral/Memento/README.rst:33 -msgid "" -"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." -msgstr "" - -#: ../../Behavioral/Memento/README.rst:43 -msgid "" -"Control for intermediate states of `ORM Model `_ before saving" -msgstr "" - -#~ msgid "" -#~ "Provide the ability to restore an object to its previous state (undo via " -#~ "rollback)." -#~ msgstr "" - -#~ 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 "" diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/NullObject/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/NullObject/README.po index 35b77f6..a397fc5 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/NullObject/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/NullObject/README.po @@ -75,7 +75,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/NullObject/README.rst:39 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/NullObject/README.rst:41 diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/Observer/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/Observer/README.po index 6aea8e9..8a43616 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/Observer/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/Observer/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -22,7 +22,7 @@ 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 " +"\"Subject\" object changes its state, the attached \"Observers\" will be " "notified. It is used to shorten the amount of coupled objects and uses loose" " coupling instead." msgstr "" @@ -55,7 +55,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Observer/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Observer/README.rst:36 diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/Specification/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/Specification/README.po index 54e3b64..7b1982b 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/Specification/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/Specification/README.po @@ -44,7 +44,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Specification/README.rst:27 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Specification/README.rst:29 diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/State/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/State/README.po index f71fbfa..2ced881 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/State/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/State/README.po @@ -35,7 +35,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/State/README.rst:21 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/State/README.rst:23 diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/Strategy/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/Strategy/README.po index dd5797e..c3b9fea 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/Strategy/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/Strategy/README.po @@ -64,7 +64,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Strategy/README.rst:35 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Strategy/README.rst:37 diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/TemplateMethod/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/TemplateMethod/README.po index 4f6fa81..331d234 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/TemplateMethod/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/TemplateMethod/README.po @@ -59,7 +59,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/TemplateMethod/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/TemplateMethod/README.rst:36 diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/Visitor/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/Visitor/README.po index cab0ea9..08784a3 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/Visitor/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/Visitor/README.po @@ -43,7 +43,7 @@ msgid "Code" msgstr "" #: ../../Behavioral/Visitor/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../Behavioral/Visitor/README.rst:28 diff --git a/locale/zh_CN/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/zh_CN/LC_MESSAGES/Creational/AbstractFactory/README.po index 990535d..d05610a 100644 --- a/locale/zh_CN/LC_MESSAGES/Creational/AbstractFactory/README.po +++ b/locale/zh_CN/LC_MESSAGES/Creational/AbstractFactory/README.po @@ -41,7 +41,7 @@ msgid "Code" msgstr "代码" #: ../../Creational/AbstractFactory/README.rst:22 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "在 `GitHub`_ 上查看代码" #: ../../Creational/AbstractFactory/README.rst:24 diff --git a/locale/zh_CN/LC_MESSAGES/Creational/Builder/README.po b/locale/zh_CN/LC_MESSAGES/Creational/Builder/README.po index 6345264..a86599a 100644 --- a/locale/zh_CN/LC_MESSAGES/Creational/Builder/README.po +++ b/locale/zh_CN/LC_MESSAGES/Creational/Builder/README.po @@ -63,7 +63,7 @@ msgid "Code" msgstr "代码" #: ../../Creational/Builder/README.rst:33 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Creational/Builder/README.rst:35 diff --git a/locale/zh_CN/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/zh_CN/LC_MESSAGES/Creational/FactoryMethod/README.po index 7927aad..5984bf2 100644 --- a/locale/zh_CN/LC_MESSAGES/Creational/FactoryMethod/README.po +++ b/locale/zh_CN/LC_MESSAGES/Creational/FactoryMethod/README.po @@ -54,7 +54,7 @@ msgid "Code" msgstr "代码" #: ../../Creational/FactoryMethod/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Creational/FactoryMethod/README.rst:31 diff --git a/locale/zh_CN/LC_MESSAGES/Creational/Multiton/README.po b/locale/zh_CN/LC_MESSAGES/Creational/Multiton/README.po index d187f1b..62cec8c 100644 --- a/locale/zh_CN/LC_MESSAGES/Creational/Multiton/README.po +++ b/locale/zh_CN/LC_MESSAGES/Creational/Multiton/README.po @@ -52,7 +52,7 @@ msgid "Code" msgstr "代码" #: ../../Creational/Multiton/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Creational/Multiton/README.rst:31 diff --git a/locale/zh_CN/LC_MESSAGES/Creational/Pool/README.po b/locale/zh_CN/LC_MESSAGES/Creational/Pool/README.po index 7012863..6e80455 100644 --- a/locale/zh_CN/LC_MESSAGES/Creational/Pool/README.po +++ b/locale/zh_CN/LC_MESSAGES/Creational/Pool/README.po @@ -63,7 +63,7 @@ msgid "Code" msgstr "代码" #: ../../Creational/Pool/README.rst:34 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Creational/Pool/README.rst:36 diff --git a/locale/zh_CN/LC_MESSAGES/Creational/Prototype/README.po b/locale/zh_CN/LC_MESSAGES/Creational/Prototype/README.po index 38043e9..851a9a6 100644 --- a/locale/zh_CN/LC_MESSAGES/Creational/Prototype/README.po +++ b/locale/zh_CN/LC_MESSAGES/Creational/Prototype/README.po @@ -46,7 +46,7 @@ msgid "Code" msgstr "代码" #: ../../Creational/Prototype/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Creational/Prototype/README.rst:28 diff --git a/locale/zh_CN/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/zh_CN/LC_MESSAGES/Creational/SimpleFactory/README.po index d8eb51c..fe7222d 100644 --- a/locale/zh_CN/LC_MESSAGES/Creational/SimpleFactory/README.po +++ b/locale/zh_CN/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -48,7 +48,7 @@ msgid "Code" msgstr "代码" #: ../../Creational/SimpleFactory/README.rst:25 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Creational/SimpleFactory/README.rst:27 diff --git a/locale/zh_CN/LC_MESSAGES/Creational/Singleton/README.po b/locale/zh_CN/LC_MESSAGES/Creational/Singleton/README.po index 9b3401f..ab2832f 100644 --- a/locale/zh_CN/LC_MESSAGES/Creational/Singleton/README.po +++ b/locale/zh_CN/LC_MESSAGES/Creational/Singleton/README.po @@ -60,7 +60,7 @@ msgid "Code" msgstr "代码" #: ../../Creational/Singleton/README.rst:32 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Creational/Singleton/README.rst:34 diff --git a/locale/zh_CN/LC_MESSAGES/Creational/StaticFactory/README.po b/locale/zh_CN/LC_MESSAGES/Creational/StaticFactory/README.po index 2b694a2..4e3c664 100644 --- a/locale/zh_CN/LC_MESSAGES/Creational/StaticFactory/README.po +++ b/locale/zh_CN/LC_MESSAGES/Creational/StaticFactory/README.po @@ -51,7 +51,7 @@ msgid "Code" msgstr "代码" #: ../../Creational/StaticFactory/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Creational/StaticFactory/README.rst:31 diff --git a/locale/zh_CN/LC_MESSAGES/More/Delegation/README.po b/locale/zh_CN/LC_MESSAGES/More/Delegation/README.po index 0b52512..907d828 100644 --- a/locale/zh_CN/LC_MESSAGES/More/Delegation/README.po +++ b/locale/zh_CN/LC_MESSAGES/More/Delegation/README.po @@ -1,15 +1,22 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. # +#, fuzzy msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-29 12:18+0200\n" +"POT-Creation-Date: 2016-06-03 23:59+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-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.3.4\n" #: ../../More/Delegation/README.rst:2 msgid "`Delegation`__" @@ -19,10 +26,26 @@ msgstr "" msgid "Purpose" msgstr "" +#: ../../More/Delegation/README.rst:7 +msgid "" +"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." +msgstr "" + #: ../../More/Delegation/README.rst:10 msgid "Examples" msgstr "" +#: ../../More/Delegation/README.rst:12 +msgid "" +"Please review JuniorDeveloper.php, TeamLead.php, and then Usage.php to " +"see it all tied together." +msgstr "" + #: ../../More/Delegation/README.rst:15 msgid "UML Diagram" msgstr "" @@ -32,7 +55,7 @@ msgid "Code" msgstr "" #: ../../More/Delegation/README.rst:24 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../More/Delegation/README.rst:26 @@ -55,21 +78,3 @@ msgstr "" msgid "Tests/DelegationTest.php" msgstr "" -#: ../../More/Delegation/README.rst:7 -msgid "" -"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." -msgstr "" - -#: ../../More/Delegation/README.rst:12 -msgid "" -"Please review JuniorDeveloper.php, TeamLead.php, and then Usage.php to see " -"it all tied together." -msgstr "" - -#~ msgid "..." -#~ msgstr "" diff --git a/locale/zh_CN/LC_MESSAGES/More/EAV/README.po b/locale/zh_CN/LC_MESSAGES/More/EAV/README.po new file mode 100644 index 0000000..d0113c0 --- /dev/null +++ b/locale/zh_CN/LC_MESSAGES/More/EAV/README.po @@ -0,0 +1,78 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../More/EAV/README.rst:2 +msgid "`Entity-Attribute-Value (EAV)`__" +msgstr "" + +#: ../../More/EAV/README.rst:4 +msgid "" +"The Entity–attribute–value (EAV) pattern in order to implement EAV model " +"with PHP." +msgstr "" + +#: ../../More/EAV/README.rst:7 +msgid "Purpose" +msgstr "" + +#: ../../More/EAV/README.rst:9 +msgid "" +"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." +msgstr "" + +#: ../../More/EAV/README.rst:15 +msgid "Examples" +msgstr "" + +#: ../../More/EAV/README.rst:17 +msgid "Check full work example in `example.php`_ file." +msgstr "" + +#: ../../More/EAV/README.rst:90 +msgid "UML Diagram" +msgstr "" + +#: ../../More/EAV/README.rst:97 +msgid "Code" +msgstr "" + +#: ../../More/EAV/README.rst:99 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../More/EAV/README.rst:102 +msgid "Test" +msgstr "" + +#: ../../More/EAV/README.rst:104 +msgid "Tests/EntityTest.php" +msgstr "" + +#: ../../More/EAV/README.rst:110 +msgid "Tests/AttributeTest.php" +msgstr "" + +#: ../../More/EAV/README.rst:116 +msgid "Tests/ValueTest.php" +msgstr "" + diff --git a/locale/zh_CN/LC_MESSAGES/More/Repository/README.po b/locale/zh_CN/LC_MESSAGES/More/Repository/README.po index d9ecc90..5a37043 100644 --- a/locale/zh_CN/LC_MESSAGES/More/Repository/README.po +++ b/locale/zh_CN/LC_MESSAGES/More/Repository/README.po @@ -52,7 +52,7 @@ msgid "Code" msgstr "" #: ../../More/Repository/README.rst:32 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../More/Repository/README.rst:34 diff --git a/locale/zh_CN/LC_MESSAGES/More/ServiceLocator/README.po b/locale/zh_CN/LC_MESSAGES/More/ServiceLocator/README.po index 9808a92..8efac15 100644 --- a/locale/zh_CN/LC_MESSAGES/More/ServiceLocator/README.po +++ b/locale/zh_CN/LC_MESSAGES/More/ServiceLocator/README.po @@ -58,7 +58,7 @@ msgid "Code" msgstr "" #: ../../More/ServiceLocator/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "" #: ../../More/ServiceLocator/README.rst:38 diff --git a/locale/zh_CN/LC_MESSAGES/README.po b/locale/zh_CN/LC_MESSAGES/README.po index b2d9e60..f3bae2c 100644 --- a/locale/zh_CN/LC_MESSAGES/README.po +++ b/locale/zh_CN/LC_MESSAGES/README.po @@ -71,8 +71,8 @@ msgid "(The MIT License)" msgstr "MIT 授权协议" #: ../../README.rst:48 -msgid "Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_" -msgstr "Copyright (c) 2014 `Dominik Liebler`_ 和 `贡献者`_" +msgid "Copyright (c) 2011 - 2016 `Dominik Liebler`_ and `contributors`_" +msgstr "Copyright (c) 2011 - 2016 `Dominik Liebler`_ 和 `贡献者`_" #: ../../README.rst:50 msgid "" diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Adapter/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Adapter/README.po index 99ac6ec..1f3bf23 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Adapter/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Adapter/README.po @@ -23,7 +23,7 @@ msgstr "目的" 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 " +"incompatible interfaces by providing its interface to clients while using " "the original interface." msgstr "" "将某个类的接口转换成与另一个接口兼容。适配器通过将原始接口进行转换,给用户" @@ -54,7 +54,7 @@ msgid "Code" msgstr "代码" #: ../../Structural/Adapter/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Adapter/README.rst:31 diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Bridge/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Bridge/README.po index 54266dc..c7b4ff4 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Bridge/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Bridge/README.po @@ -43,7 +43,7 @@ msgid "Code" msgstr "代码" #: ../../Structural/Bridge/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Bridge/README.rst:28 diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Composite/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Composite/README.po index 8c615d0..836f23c 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Composite/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Composite/README.po @@ -54,7 +54,7 @@ msgid "Code" msgstr "代码" #: ../../Structural/Composite/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Composite/README.rst:31 diff --git a/locale/zh_CN/LC_MESSAGES/Structural/DataMapper/README.po b/locale/zh_CN/LC_MESSAGES/Structural/DataMapper/README.po index 1dca56f..3f564a8 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/DataMapper/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/DataMapper/README.po @@ -65,7 +65,7 @@ msgid "Code" msgstr "代码" #: ../../Structural/DataMapper/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/DataMapper/README.rst:38 diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Decorator/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Decorator/README.po index e0c38b1..a55d5d5 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Decorator/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Decorator/README.po @@ -47,7 +47,7 @@ msgid "Code" msgstr "代码" #: ../../Structural/Decorator/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Decorator/README.rst:28 diff --git a/locale/zh_CN/LC_MESSAGES/Structural/DependencyInjection/README.po b/locale/zh_CN/LC_MESSAGES/Structural/DependencyInjection/README.po index 426e487..c015732 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/DependencyInjection/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/DependencyInjection/README.po @@ -85,7 +85,7 @@ msgid "Code" msgstr "代码" #: ../../Structural/DependencyInjection/README.rst:46 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/DependencyInjection/README.rst:48 diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Facade/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Facade/README.po index 110cc58..46cb2a3 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Facade/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Facade/README.po @@ -70,7 +70,7 @@ msgid "Code" msgstr "代码" #: ../../Structural/Facade/README.rst:36 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Facade/README.rst:38 diff --git a/locale/zh_CN/LC_MESSAGES/Structural/FluentInterface/README.po b/locale/zh_CN/LC_MESSAGES/Structural/FluentInterface/README.po index f0cc8d8..d5b7cfa 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/FluentInterface/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/FluentInterface/README.po @@ -51,7 +51,7 @@ msgid "Code" msgstr "代码" #: ../../Structural/FluentInterface/README.rst:28 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/FluentInterface/README.rst:30 diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Flyweight/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Flyweight/README.po new file mode 100644 index 0000000..cfa8492 --- /dev/null +++ b/locale/zh_CN/LC_MESSAGES/Structural/Flyweight/README.po @@ -0,0 +1,69 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, Dominik Liebler and contributors +# This file is distributed under the same license as the DesignPatternsPHP +# package. +# FIRST AUTHOR , 2016. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: DesignPatternsPHP 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-03 23:59+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" +"Generated-By: Babel 2.3.4\n" + +#: ../../Structural/Flyweight/README.rst:2 +msgid "`Flyweight`__" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:5 +msgid "Purpose" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:7 +msgid "" +"To minimise memory usage, a Flyweight shares as much as possible memory " +"with similar objects. It is needed when a large amount of objects is used" +" that don't differ much in state. A common practice is to hold state in " +"external data structures and pass them to the flyweight object when " +"needed." +msgstr "" + +#: ../../Structural/Flyweight/README.rst:12 +msgid "UML Diagram" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:19 +msgid "Code" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:21 +msgid "You can also find this code on `GitHub`_" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:23 +msgid "FlyweightInterface.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:29 +msgid "CharacterFlyweight.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:35 +msgid "FlyweightFactory.php" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:42 +msgid "Test" +msgstr "" + +#: ../../Structural/Flyweight/README.rst:44 +msgid "Tests/FlyweightTest.php" +msgstr "" + diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Proxy/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Proxy/README.po index 5df1caf..b20b852 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Proxy/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Proxy/README.po @@ -45,7 +45,7 @@ msgid "Code" msgstr "代码" #: ../../Structural/Proxy/README.rst:26 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Proxy/README.rst:28 diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po index f01d956..243c463 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po @@ -49,7 +49,7 @@ msgid "Code" msgstr "代码" #: ../../Structural/Registry/README.rst:29 -msgid "You can also find these code on `GitHub`_" +msgid "You can also find this code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Registry/README.rst:31 @@ -66,8 +66,8 @@ msgstr "" #: ../../Structural/Registry/README.rst:14 msgid "" -"Zend Framework 1: ``Zend_Registry`` holds the application's logger object, " -"front controller etc." +"Zend Framework 1: ``Zend_Registry`` holds the application's logger " +"object, front controller etc." msgstr "" "Zend Framework 1: ``Zend_Registry`` 持有应用的logger对象,前端控制器等。" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f08bbb2..12ff946 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,5 @@ - Behavioral/*/Tests