From 0ebafc5eaaac9ded775807321cec66ceea3f3b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=93=D0=BB?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B2?= Date: Sat, 30 May 2015 03:58:34 +0300 Subject: [PATCH 01/69] Memento pattern. - Caretaker should save history for normal pattern implementation. - Importent notes in code of Originator. - Readme with full pattern philosophy. - Tests and example of usage inside test. --- Behavioral/Memento/Caretaker.php | 29 +++-- Behavioral/Memento/Originator.php | 5 +- Behavioral/Memento/README.rst | 43 +++++--- Behavioral/Memento/Tests/MementoTest.php | 131 ++++++++++++++++++----- Behavioral/Memento/uml/uml.png | Bin 8364 -> 62525 bytes 5 files changed, 160 insertions(+), 48 deletions(-) diff --git a/Behavioral/Memento/Caretaker.php b/Behavioral/Memento/Caretaker.php index 340bb97..3a16fcd 100644 --- a/Behavioral/Memento/Caretaker.php +++ b/Behavioral/Memento/Caretaker.php @@ -4,12 +4,26 @@ namespace DesignPatterns\Behavioral\Memento; class Caretaker { - public static function run() + protected $history = array(); + + /** + * @return Memento + */ + public function getFromHistory($id) { - /* @var $savedStates Memento[] */ + return $this->history[$id]; + } - $savedStates = array(); + /** + * @param Memento $state + */ + public function saveToHistory(Memento $state) + { + $this->history[] = $state; + } + public function runCustomLogic() + { $originator = new Originator(); //Setting state to State1 @@ -17,17 +31,20 @@ class Caretaker //Setting state to State2 $originator->setState("State2"); //Saving State2 to Memento - $savedStates[] = $originator->saveToMemento(); + $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 - $savedStates[] = $originator->saveToMemento(); + $this->saveToHistory($originator->getStateAsMemento()); //Setting state to State4 $originator->setState("State4"); - $originator->restoreFromMemento($savedStates[1]); + $originator->restoreFromMemento($this->getFromHistory(1)); //State after restoring from Memento: State3 + + return $originator->getStateAsMemento()->getState(); } + } diff --git a/Behavioral/Memento/Originator.php b/Behavioral/Memento/Originator.php index fec4e45..3acb0c1 100644 --- a/Behavioral/Memento/Originator.php +++ b/Behavioral/Memento/Originator.php @@ -15,14 +15,17 @@ class Originator */ public function setState($state) { + // you must check type of state inside child of this class + // or use type-hinting for full pattern implementation $this->state = $state; } /** * @return Memento */ - public function saveToMemento() + public function getStateAsMemento() { + // you must save a separate copy in Memento $state = is_object($this->state) ? clone $this->state : $this->state; return new Memento($state); diff --git a/Behavioral/Memento/README.rst b/Behavioral/Memento/README.rst index 6696149..2cbc555 100644 --- a/Behavioral/Memento/README.rst +++ b/Behavioral/Memento/README.rst @@ -4,26 +4,43 @@ Purpose ------- -Provide the ability to restore an object to its previous state (undo via -rollback). +It provides the ability to restore an object to its previous state (undo +via rollback) or to gain access to state of the object, without revealing +its implementation (ie, the object is not required to have a functional +for return the current state). -The memento pattern is implemented with three objects: the originator, a -caretaker and a memento. 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. + +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 not imply the prohibition existence of similar +states in different snapshots. That means the state can be extracted as +the independent clone. Any object stored in the Memento should be +*a full copy of the original object rather than a reference* to the original +object. The Memento object is a "opaque object" (the object that no one can +or should change). + +Originator – it is an object that contains the *actual state of an external +object is strictly specified type*. Originator is able to create a unique +copy of this state and return it wrapped in a Memento. The Originator does +not know the history of changes. You can set a concrete state to Originator +from the outside, which will be considered as actual. The Originator must +make sure that given state corresponds the allowed type of object. Originator +may (but not should) have any methods, but they *they can't make changes to +the saved object state*. + +Caretaker *controls the states history*. He may make changes to an object; +take a decision to save the state of an external object in the Originator; +ask from the Originator snapshot of the current state; or set the Originator +state to equivalence with some snapshot from history. Examples -------- - The seed of a pseudorandom number generator - The state in a finite state machine +- Control for intermediate states of `ORM Model `_ before saving UML Diagram ----------- diff --git a/Behavioral/Memento/Tests/MementoTest.php b/Behavioral/Memento/Tests/MementoTest.php index 88110a6..ccc2097 100644 --- a/Behavioral/Memento/Tests/MementoTest.php +++ b/Behavioral/Memento/Tests/MementoTest.php @@ -2,6 +2,8 @@ namespace DesignPatterns\Behavioral\Memento\Tests; +use DesignPatterns\Behavioral\Memento\Caretaker; +use DesignPatterns\Behavioral\Memento\Memento; use DesignPatterns\Behavioral\Memento\Originator; /** @@ -10,6 +12,37 @@ use DesignPatterns\Behavioral\Memento\Originator; class MementoTest extends \PHPUnit_Framework_TestCase { + public function testUsageExample() + { + $originator = new Originator(); + $caretaker = new Caretaker(); + + $character = new \stdClass(); + $character->name = "Gandalf"; // new object + $originator->setState($character); // connect Originator to character object + + $character->name = "Gandalf the Grey"; // work on the object + $character->race = "Maia"; // still change something + $snapshot = $originator->getStateAsMemento(); // time to save state + $caretaker->saveToHistory($snapshot); // put state to log + + $character->name = "Sauron"; // change something + $character->race = "Ainur"; // and again + $this->assertAttributeEquals($character, "state", $originator); // state inside the Originator was equally changed + + $snapshot = $originator->getStateAsMemento(); // time to save another state + $caretaker->saveToHistory($snapshot); // put state to log + + $rollback = $caretaker->getFromHistory(0); + $originator->restoreFromMemento($rollback); // return to first state + $character = $rollback->getState(); // use character from old state + + $this->assertEquals("Gandalf the Grey", $character->name); // yes, that what we need + $character->name = "Gandalf the White"; // make new changes + + $this->assertAttributeEquals($character, "state", $originator); // and Originator linked to actual object again + } + public function testStringState() { $originator = new Originator(); @@ -18,52 +51,94 @@ class MementoTest extends \PHPUnit_Framework_TestCase $this->assertAttributeEquals("State1", "state", $originator); $originator->setState("State2"); - $this->assertAttributeEquals("State2", "state", $originator); - $savedState = $originator->saveToMemento(); - - $this->assertAttributeEquals("State2", "state", $savedState); + $snapshot = $originator->getStateAsMemento(); + $this->assertAttributeEquals("State2", "state", $snapshot); $originator->setState("State3"); - $this->assertAttributeEquals("State3", "state", $originator); - $originator->restoreFromMemento($savedState); - + $originator->restoreFromMemento($snapshot); $this->assertAttributeEquals("State2", "state", $originator); } - public function testObjectState() + public function testSnapshotIsClone() + { + $originator = new Originator(); + $object = new \stdClass(); + + $originator->setState($object); + $snapshot = $originator->getStateAsMemento(); + $object->new_property = 1; + + $this->assertAttributeEquals($object, "state", $originator); + $this->assertAttributeNotEquals($object, "state", $snapshot); + + $originator->restoreFromMemento($snapshot); + $this->assertAttributeNotEquals($object, "state", $originator); + } + + public function testCanChangeActualState() + { + $originator = new Originator(); + $first_state = new \stdClass(); + + $originator->setState($first_state); + $snapshot = $originator->getStateAsMemento(); + $second_state = $snapshot->getState(); + + $first_state->first_property = 1; // still actual + $second_state->second_property = 2; // just history + $this->assertAttributeEquals($first_state, "state", $originator); + $this->assertAttributeNotEquals($second_state, "state", $originator); + + $originator->restoreFromMemento($snapshot); + $first_state->first_property = 11; // now it lost state + $second_state->second_property = 22; // must be actual + $this->assertAttributeEquals($second_state, "state", $originator); + $this->assertAttributeNotEquals($first_state, "state", $originator); + } + + public function testStateWithDifferentObjects() { $originator = new Originator(); - $foo = new \stdClass(); - $foo->data = "foo"; + $first = new \stdClass(); + $first->data = "foo"; - $originator->setState($foo); + $originator->setState($first); + $this->assertAttributeEquals($first, "state", $originator); - $this->assertAttributeEquals($foo, "state", $originator); + $first_snapshot = $originator->getStateAsMemento(); + $this->assertAttributeEquals($first, "state", $first_snapshot); - $savedState = $originator->saveToMemento(); + $second = new \stdClass(); + $second->data = "bar"; + $originator->setState($second); + $this->assertAttributeEquals($second, "state", $originator); - $this->assertAttributeEquals($foo, "state", $savedState); + $originator->restoreFromMemento($first_snapshot); + $this->assertAttributeEquals($first, "state", $originator); + } - $bar = new \stdClass(); - $bar->data = "bar"; + public function testCaretaker() + { + $caretaker = new Caretaker(); + $memento1 = new Memento("foo"); + $memento2 = new Memento("bar"); + $caretaker->saveToHistory($memento1); + $caretaker->saveToHistory($memento2); + $this->assertAttributeEquals(array($memento1, $memento2), "history", $caretaker); + $this->assertEquals($memento1, $caretaker->getFromHistory(0)); + $this->assertEquals($memento2, $caretaker->getFromHistory(1)); - $originator->setState($bar); + } - $this->assertAttributeEquals($bar, "state", $originator); - - $originator->restoreFromMemento($savedState); - - $this->assertAttributeEquals($foo, "state", $originator); - - $foo->data = null; - - $this->assertAttributeNotEquals($foo, "state", $savedState); - - $this->assertAttributeNotEquals($foo, "state", $originator); + public function testCaretakerCustomLogic() + { + $caretaker = new Caretaker(); + $result = $caretaker->runCustomLogic(); + $this->assertEquals("State3", $result); } } diff --git a/Behavioral/Memento/uml/uml.png b/Behavioral/Memento/uml/uml.png index e96ea6951396c6d5101f156e6fccdb01365e0a89..0fde074e8a8f2f74c617bbc4a0e7323c2c346fb7 100644 GIT binary patch literal 62525 zcmc$lW0N3F6Ru~+wr$(CZQHhO+qP$Rykpz8ZQFBppZCQ13+F?3M0a#&MOS5I-Fano zguJX63?wEb0001tgt)LG0Kl){zXt#~=-)ey*}rfA0H9GVgoNZJgoNE zC23?jz#ADrJBbGV7>NHg)HR6X4UnNHq?$4q@E3mKP&Taz4MUman&v(d))mwm8~|g= z5Mn7%KK}F!wSL(EHzeTbvNvoToCldPoGWM)P#fHRad!4vJW55pj8e};(zhLl(uh-o z`q=?BPE>LHm%B%x^>XKr6X&aXOY*7eCJ%nP8xz{f`Ucd&x!|TrK zboq>*pnm9`a0a{ra?R>B`1=iJ1OBE(Fr}F>EG#tBAyWzFa-rw(nQ)lIVZ(^c&cQkc z8|<3A9%Z26z54^>OorBW??RLMp}3_jJNDcI=LX(m_lT6|OLW;Q%p`ZI3*I7STu z1;wvbE&*TVYGth0Ao^XXPXMHFeHoBO0n%L;7*?2mz4=stUO>Tk*w$V}Q;aC__@>)E zCQ#(S9()IZZTIZB;uI*z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wfyBET%piAy_dhIy*l0 zJNDKAiAjrRFL{sI{hVoNK!pbq`Eh)rO_UM}BVp0%fS%&D~O%b8%Uj=rWy7x;Kkrv|aqu#RXbg8qyfM z-xY%{34$}XvN0qy0q{kx4n;G~? zDW0<*%sW3y0u$Hq2x{*sq^T_$junE z$~S_wwaM*73pGQK7*-TrIW;UI5_Z_vyEAPIJd}j@-a^82;Tb$NN!S^NRQu0&LaJ*9 z4ffC@f|VeUZ=JgvZ_}grc*I*;=F*Z}UjZJ_=;&ybD>;4;_~N!5v`rg4L+X^ET^3c5 z`yf7?lBQi|K3;k(DRuZ!Vqbw+B&nPScl6;*ofV#@>6>4F*cXkH`quU!p{ubesA^W5 z+y{J7!BLSsK|Gd=+NA!lA?rI2V4&*!Z!Lx&TIzwa!+9QPx%1M2By*)!pPH@>`S)$Om%j(?P@Iv4 Date: Tue, 14 Jul 2015 10:40:36 -0400 Subject: [PATCH 02/69] Fix: Update composer itself in the before_install section --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9f10dff..53d81aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,8 +20,10 @@ cache: directories: - $HOME/.composer/cache -before_script: +before_install: - composer self-update + +before_script: - composer install --prefer-dist --no-interaction script: From a9917412e8d2b0374553ab3f481a318cabb57127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Tue, 14 Jul 2015 10:42:11 -0400 Subject: [PATCH 03/69] Fix: Install dependencies in install section --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 53d81aa..3d667d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ cache: before_install: - composer self-update -before_script: +install: - composer install --prefer-dist --no-interaction script: From c60ac4372e76c3012c7c9cf4dc2c863ddb728d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Tue, 14 Jul 2015 10:48:02 -0400 Subject: [PATCH 04/69] Enhancement: Validate composer.json and composer.lock on Travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3d667d8..9f379f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,8 @@ cache: before_install: - composer self-update - + - composer validate + install: - composer install --prefer-dist --no-interaction From 9a66be2ea1a5f1b63c02b1a167d39ff4c4bb8052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Mo=CC=88ller?= Date: Wed, 15 Jul 2015 10:25:10 -0400 Subject: [PATCH 05/69] Fix: Run composer update to update the lock file, too --- composer.lock | 798 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 666 insertions(+), 132 deletions(-) diff --git a/composer.lock b/composer.lock index 3d44d0c..a9fa4ad 100644 --- a/composer.lock +++ b/composer.lock @@ -1,55 +1,218 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" - ], - "hash": "5fb4edd1df6d1229395f973b68675bfe", - "packages": [ - + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" ], + "hash": "fd9fc5e6da0104ab5a4bd03fcf53f73a", + "packages": [], "packages-dev": [ { - "name": "phpunit/php-code-coverage", - "version": "1.2.13", + "name": "doctrine/instantiator", + "version": "1.0.5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94" + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", - "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": ">=1.3.0@stable", - "phpunit/php-text-template": ">=1.1.1@stable", - "phpunit/php-token-stream": ">=1.1.3@stable" + "php": ">=5.3,<8.0-DEV" }, "require-dev": { - "phpunit/phpunit": "3.7.*@dev" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.0.5" + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2015-02-03 12:10:50" + }, + { + "name": "phpspec/prophecy", + "version": "v1.4.1", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373", + "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "phpdocumentor/reflection-docblock": "~2.0", + "sebastian/comparator": "~1.1" + }, + "require-dev": { + "phpspec/phpspec": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2015-04-27 22:15:08" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.1.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "6044546998c7627ab997501a3d0db972b3db9790" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6044546998c7627ab997501a3d0db972b3db9790", + "reference": "6044546998c7627ab997501a3d0db972b3db9790", + "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.0", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" } }, "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -67,35 +230,37 @@ "testing", "xunit" ], - "time": "2013-09-10 08:14:32" + "time": "2015-07-13 11:25:58" }, { "name": "phpunit/php-file-iterator", - "version": "1.3.4", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb", + "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, "autoload": { "classmap": [ - "File/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -112,20 +277,20 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2015-04-02 05:19:05" }, { "name": "phpunit/php-text-template", - "version": "1.1.4", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23" + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5180896f51c5b3648ac946b05f9ec02be78a0b23", - "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { @@ -134,20 +299,17 @@ "type": "library", "autoload": { "classmap": [ - "Text/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -156,20 +318,20 @@ "keywords": [ "template" ], - "time": "2012-10-31 18:15:28" + "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", - "version": "1.0.5", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/83fe1bdc5d47658b727595c14da140da92b3d66d", + "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d", "shasum": "" }, "require": { @@ -178,13 +340,10 @@ "type": "library", "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -200,49 +359,48 @@ "keywords": [ "timer" ], - "time": "2013-08-02 07:42:54" + "time": "2015-06-13 07:35:30" }, { "name": "phpunit/php-token-stream", - "version": "1.2.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e" + "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5220af2a7929aa35cf663d97c89ad3d50cf5fa3e", - "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/7a9b0969488c3c54fd62b4d504b3ec758fd005d9", + "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9", "shasum": "" }, "require": { "ext-tokenizer": "*", "php": ">=5.3.3" }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.4-dev" } }, "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], "description": "Wrapper around PHP's tokenizer extension.", @@ -250,63 +408,61 @@ "keywords": [ "tokenizer" ], - "time": "2013-09-13 04:58:23" + "time": "2015-06-19 03:43:16" }, { "name": "phpunit/phpunit", - "version": "3.7.28", + "version": "4.6.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d" + "reference": "7b5fe98b28302a8b25693b2298bca74463336975" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d", - "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b5fe98b28302a8b25693b2298bca74463336975", + "reference": "7b5fe98b28302a8b25693b2298bca74463336975", "shasum": "" }, "require": { "ext-dom": "*", + "ext-json": "*", "ext-pcre": "*", "ext-reflection": "*", "ext-spl": "*", "php": ">=5.3.3", - "phpunit/php-code-coverage": "~1.2.1", - "phpunit/php-file-iterator": ">=1.3.1", - "phpunit/php-text-template": ">=1.1.1", - "phpunit/php-timer": ">=1.0.4", - "phpunit/phpunit-mock-objects": "~1.2.0", - "symfony/yaml": "~2.0" - }, - "require-dev": { - "pear-pear/pear": "1.9.4" + "phpspec/prophecy": "~1.3,>=1.3.1", + "phpunit/php-code-coverage": "~2.0,>=2.0.11", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "~1.0", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.2", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" }, "suggest": { - "ext-json": "*", - "ext-simplexml": "*", - "ext-tokenizer": "*", - "phpunit/php-invoker": ">=1.1.0,<1.2.0" + "phpunit/php-invoker": "~1.1" }, "bin": [ - "composer/bin/phpunit" + "phpunit" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "3.7.x-dev" + "dev-master": "4.6.x-dev" } }, "autoload": { "classmap": [ - "PHPUnit/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "", - "../../symfony/yaml/" - ], "license": [ "BSD-3-Clause" ], @@ -318,45 +474,51 @@ } ], "description": "The PHP Unit Testing framework.", - "homepage": "http://www.phpunit.de/", + "homepage": "https://phpunit.de/", "keywords": [ "phpunit", "testing", "xunit" ], - "time": "2013-10-17 07:27:40" + "time": "2015-06-03 05:03:30" }, { "name": "phpunit/phpunit-mock-objects", - "version": "1.2.3", + "version": "2.3.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875" + "reference": "1c330b1b6e1ea8fd15f2fbea46770576e366855c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875", - "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/1c330b1b6e1ea8fd15f2fbea46770576e366855c", + "reference": "1c330b1b6e1ea8fd15f2fbea46770576e366855c", "shasum": "" }, "require": { + "doctrine/instantiator": "~1.0,>=1.0.2", "php": ">=5.3.3", - "phpunit/php-text-template": ">=1.1.1@stable" + "phpunit/php-text-template": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" }, "suggest": { "ext-soap": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, "autoload": { "classmap": [ - "PHPUnit/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -373,20 +535,391 @@ "mock", "xunit" ], - "time": "2013-01-13 10:24:48" + "time": "2015-07-04 05:41:32" }, { - "name": "squizlabs/php_codesniffer", - "version": "1.5.1", + "name": "sebastian/comparator", + "version": "1.1.1", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "bd1e50b8c252c914881dba1dcef089219e430dbd" + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/bd1e50b8c252c914881dba1dcef089219e430dbd", - "reference": "bd1e50b8c252c914881dba1dcef089219e430dbd", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", + "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-01-29 16:28:08" + }, + { + "name": "sebastian/diff", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "http://www.github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-02-22 15:13:53" + }, + { + "name": "sebastian/environment", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e", + "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2015-01-01 10:01:08" + }, + { + "name": "sebastian/exporter", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "84839970d05254c73cde183a721c7af13aede943" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", + "reference": "84839970d05254c73cde183a721c7af13aede943", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2015-01-27 07:23:06" + }, + { + "name": "sebastian/global-state", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2014-10-06 09:23:50" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "3989662bbb30a29d20d9faa04a846af79b276252" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", + "reference": "3989662bbb30a29d20d9faa04a846af79b276252", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-01-24 09:48:32" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21 13:59:46" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "1.5.6", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6f3e42d311b882b25b4d409d23a289f4d3b803d5", + "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5", "shasum": "" }, "require": { @@ -400,6 +933,11 @@ "scripts/phpcs" ], "type": "library", + "extra": { + "branch-alias": { + "dev-phpcs-fixer": "2.0.x-dev" + } + }, "autoload": { "classmap": [ "CodeSniffer.php", @@ -443,34 +981,36 @@ "phpcs", "standards" ], - "time": "2013-12-12 03:08:49" + "time": "2014-12-04 22:32:15" }, { "name": "symfony/yaml", - "version": "v2.4.1", - "target-dir": "Symfony/Component/Yaml", + "version": "v2.7.2", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "4e1a237fc48145fae114b96458d799746ad89aa0" + "reference": "4bfbe0ed3909bfddd75b70c094391ec1f142f860" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/4e1a237fc48145fae114b96458d799746ad89aa0", - "reference": "4e1a237fc48145fae114b96458d799746ad89aa0", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/4bfbe0ed3909bfddd75b70c094391ec1f142f860", + "reference": "4bfbe0ed3909bfddd75b70c094391ec1f142f860", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Yaml\\": "" } }, @@ -485,25 +1025,19 @@ }, { "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2013-12-28 08:12:03" + "homepage": "https://symfony.com", + "time": "2015-07-01 11:25:50" } ], - "aliases": [ - - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": [ - - ], - "platform": [ - - ], - "platform-dev": [ - - ] + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] } From 1e16eb0c8be73542ac3398b9d7b3cf2bfdf15ac7 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Mon, 20 Jul 2015 17:01:36 +0800 Subject: [PATCH 06/69] add parameter type in Facade Test --- Structural/Facade/Tests/FacadeTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Structural/Facade/Tests/FacadeTest.php b/Structural/Facade/Tests/FacadeTest.php index eccb9be..18133e9 100644 --- a/Structural/Facade/Tests/FacadeTest.php +++ b/Structural/Facade/Tests/FacadeTest.php @@ -3,6 +3,7 @@ namespace DesignPatterns\Structural\Facade\Tests; use DesignPatterns\Structural\Facade\Facade as Computer; +use DesignPatterns\Structural\Facade\OsInterface; /** * FacadeTest shows example of facades @@ -35,7 +36,7 @@ class FacadeTest extends \PHPUnit_Framework_TestCase /** * @dataProvider getComputer */ - public function testComputerOn(Computer $facade, $os) + public function testComputerOn(Computer $facade, OsInterface $os) { // interface is simpler : $facade->turnOn(); From 1b068456c1b768848be3ce0544bf10d28d81c847 Mon Sep 17 00:00:00 2001 From: victor Date: Mon, 20 Jul 2015 18:32:30 +0300 Subject: [PATCH 07/69] Add Entity-Attribute-Value (EAV) pattern --- More/EAV/Attribute.php | 71 +++++++++++++++++++++++++++++++++++++ More/EAV/Entity.php | 71 +++++++++++++++++++++++++++++++++++++ More/EAV/Value.php | 52 +++++++++++++++++++++++++++ More/EAV/ValueInterface.php | 24 +++++++++++++ More/EAV/example.php | 68 +++++++++++++++++++++++++++++++++++ 5 files changed, 286 insertions(+) create mode 100644 More/EAV/Attribute.php create mode 100644 More/EAV/Entity.php create mode 100644 More/EAV/Value.php create mode 100644 More/EAV/ValueInterface.php create mode 100644 More/EAV/example.php diff --git a/More/EAV/Attribute.php b/More/EAV/Attribute.php new file mode 100644 index 0000000..43a5d4c --- /dev/null +++ b/More/EAV/Attribute.php @@ -0,0 +1,71 @@ +values; + } + + /** + * @param Value|ValueInterface $value + * @return $this + */ + public function addValue(ValueInterface $value) + { + // @TODO I think the $value should be checked for uniqueness first to avoid duplication in array. + $this->values[] = $value; + + return $this; + } + + /** + * @param Value|ValueInterface $value + * @return $this + */ + public function removeValue(ValueInterface $value) + { + if ($key = array_search($value, $this->values, true)) { + unset($this->values[$key]); + } + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } +} diff --git a/More/EAV/Entity.php b/More/EAV/Entity.php new file mode 100644 index 0000000..7234b7d --- /dev/null +++ b/More/EAV/Entity.php @@ -0,0 +1,71 @@ +values; + } + + /** + * @param Value|ValueInterface $value + * @return $this + */ + public function addValue(ValueInterface $value) + { + // @TODO I think the $value should be checked for uniqueness first to avoid duplication in array. + $this->values[] = $value; + + return $this; + } + + /** + * @param Value|ValueInterface $value + * @return $this + */ + public function removeValue(ValueInterface $value) + { + if ($key = array_search($value, $this->values, true)) { + unset($this->values[$key]); + } + + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } +} diff --git a/More/EAV/Value.php b/More/EAV/Value.php new file mode 100644 index 0000000..362ac5c --- /dev/null +++ b/More/EAV/Value.php @@ -0,0 +1,52 @@ +addValue($this); + $this->attribute = $attribute; + } + + /** + * @return Attribute + */ + public function getAttribute() + { + return $this->attribute; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } +} diff --git a/More/EAV/ValueInterface.php b/More/EAV/ValueInterface.php new file mode 100644 index 0000000..e0c299a --- /dev/null +++ b/More/EAV/ValueInterface.php @@ -0,0 +1,24 @@ +setName('Color'); +// color values +$colorSilver = (new Value($color))->setName('Silver'); +$colorGold = (new Value($color))->setName('Gold'); +$colorSpaceGrey = (new Value($color))->setName('Space Grey'); + +// memory attribute +$memory = (new Attribute())->setName('Memory'); +// memory values +$memory4Gb = (new Value($memory))->setName('4GB'); +$memory8Gb = (new Value($memory))->setName('8GB'); +$memory16Gb = (new Value($memory))->setName('16GB'); + +// storage attribute +$storage = (new Attribute())->setName('Storage'); +// 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'); + +// entities +$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) +; From f5c075f02dda9ef76a36ad13f414fd4e1b9c5b8a Mon Sep 17 00:00:00 2001 From: victor Date: Tue, 21 Jul 2015 10:57:01 +0300 Subject: [PATCH 08/69] Fix bugs and include Composer autoloader to example.php --- More/EAV/Attribute.php | 6 +++--- More/EAV/Entity.php | 6 +++--- More/EAV/Value.php | 5 ++++- More/EAV/ValueAccessInterface.php | 24 ++++++++++++++++++++++++ More/EAV/ValueInterface.php | 13 ++++--------- More/EAV/example.php | 2 ++ 6 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 More/EAV/ValueAccessInterface.php diff --git a/More/EAV/Attribute.php b/More/EAV/Attribute.php index 43a5d4c..f7af581 100644 --- a/More/EAV/Attribute.php +++ b/More/EAV/Attribute.php @@ -5,10 +5,10 @@ namespace DesignPatterns\More\EAV; /** * Class Attribute */ -class Attribute implements ValueInterface +class Attribute implements ValueAccessInterface { /** - * @var Value[]|ValueInterface[]|array + * @var array|Value[]|ValueInterface[] */ private $values = []; @@ -18,7 +18,7 @@ class Attribute implements ValueInterface private $name; /** - * @return Value[]|ValueInterface[]|array + * @return array|Value[]|ValueInterface[] */ public function getValues() { diff --git a/More/EAV/Entity.php b/More/EAV/Entity.php index 7234b7d..4da304a 100644 --- a/More/EAV/Entity.php +++ b/More/EAV/Entity.php @@ -5,10 +5,10 @@ namespace DesignPatterns\More\EAV; /** * Class Entity */ -class Entity implements ValueInterface +class Entity implements ValueAccessInterface { /** - * @var Value[]|ValueInterface[]|array + * @var array|Value[]|ValueInterface[] */ private $values = []; @@ -18,7 +18,7 @@ class Entity implements ValueInterface private $name; /** - * @return Value[]|ValueInterface[]|array + * @return array|Value[]|ValueInterface[] */ public function getValues() { diff --git a/More/EAV/Value.php b/More/EAV/Value.php index 362ac5c..9f1d3ae 100644 --- a/More/EAV/Value.php +++ b/More/EAV/Value.php @@ -5,7 +5,7 @@ namespace DesignPatterns\More\EAV; /** * Class Value */ -class Value +class Value implements ValueInterface { /** * @var Attribute @@ -17,6 +17,9 @@ class Value */ private $name; + /** + * @param Attribute $attribute + */ public function __construct(Attribute $attribute) { $attribute->addValue($this); diff --git a/More/EAV/ValueAccessInterface.php b/More/EAV/ValueAccessInterface.php new file mode 100644 index 0000000..ccb4725 --- /dev/null +++ b/More/EAV/ValueAccessInterface.php @@ -0,0 +1,24 @@ + Date: Tue, 21 Jul 2015 11:07:31 +0300 Subject: [PATCH 09/69] Add README template --- More/EAV/README.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 More/EAV/README.rst diff --git a/More/EAV/README.rst b/More/EAV/README.rst new file mode 100644 index 0000000..8aab2f1 --- /dev/null +++ b/More/EAV/README.rst @@ -0,0 +1,31 @@ +`Entity-Attribute-Value (EAV)`__ +================================ + +Purpose +------- + +... + +Examples +-------- + +... + +UML Diagram +----------- + +... + +Code +---- + +You can also find these code on `GitHub`_ + +Test +---- + +... + + +.. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/More/EAV +.. __: https://en.wikipedia.org/wiki/Entity–attribute–value_model From f7c032afe4cc844b6740b5085afaeabe13b76e44 Mon Sep 17 00:00:00 2001 From: athanro Date: Tue, 21 Jul 2015 17:17:36 +0200 Subject: [PATCH 10/69] fix CompositeTest namespace --- Structural/Composite/Tests/CompositeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Structural/Composite/Tests/CompositeTest.php b/Structural/Composite/Tests/CompositeTest.php index 71aa98e..f3ee1d1 100644 --- a/Structural/Composite/Tests/CompositeTest.php +++ b/Structural/Composite/Tests/CompositeTest.php @@ -1,6 +1,6 @@ Date: Thu, 23 Jul 2015 16:28:49 -0700 Subject: [PATCH 11/69] Filling out some basic readme --- More/Delegation/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/More/Delegation/README.rst b/More/Delegation/README.rst index b6172c6..78ae5b6 100644 --- a/More/Delegation/README.rst +++ b/More/Delegation/README.rst @@ -4,12 +4,12 @@ Purpose ------- -... +Demonstrate the Delegator pattern. Examples -------- -... +Please review JuniorDeveloper.php, TeamLead.php, and then Usage.php to see it all tied together. UML Diagram ----------- From 3ea4bf760371de2a5bbfcb70ddf3b530a626e146 Mon Sep 17 00:00:00 2001 From: Jasmine Hegman Date: Thu, 23 Jul 2015 16:31:44 -0700 Subject: [PATCH 12/69] Further explaining the pattern --- More/Delegation/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/More/Delegation/README.rst b/More/Delegation/README.rst index 78ae5b6..69306ad 100644 --- a/More/Delegation/README.rst +++ b/More/Delegation/README.rst @@ -4,7 +4,7 @@ Purpose ------- -Demonstrate the Delegator pattern. +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 -------- From d9b3cc2eb1f1fffc1ef49589676936825f402f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B8=CC=86=20=D0=A1=D0=BE?= =?UTF-8?q?=D0=B1=D0=BA=D0=B0=D0=BD=D1=8E=D0=BA?= Date: Thu, 6 Aug 2015 17:54:39 +0300 Subject: [PATCH 13/69] Fix typo in method annotation --- Creational/Builder/Director.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Creational/Builder/Director.php b/Creational/Builder/Director.php index d7f3aa3..3d125d9 100644 --- a/Creational/Builder/Director.php +++ b/Creational/Builder/Director.php @@ -12,7 +12,7 @@ class Director { /** - * The director don't know 'bout concrete part + * The director don't know about concrete part * * @param BuilderInterface $builder * From 991a10f5cdb9d9616f0426fc90e9132852afbc54 Mon Sep 17 00:00:00 2001 From: Eddie Abou-Jaoude Date: Sat, 15 Aug 2015 12:14:17 +0100 Subject: [PATCH 14/69] Update ignore to ignore vagrant files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 57f6f89..4a69314 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ /vendor/ _build/ *.mo +.vagrant/ +phpunit.xml From 5df676e75c042e389d2ed16a0cc20eefb4b1d42d Mon Sep 17 00:00:00 2001 From: Eddie Abou-Jaoude Date: Sat, 15 Aug 2015 12:20:19 +0100 Subject: [PATCH 15/69] composer phar added to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4a69314..c6fa3e1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ _build/ *.mo .vagrant/ phpunit.xml +composer.phar From 8f70b116522c7d2a637f21e1dd6e9e16857687c5 Mon Sep 17 00:00:00 2001 From: Eddie Abou-Jaoude Date: Sat, 15 Aug 2015 12:21:01 +0100 Subject: [PATCH 16/69] vagrant & ansible scripts added inc docs in README --- README.md | 32 +++++++++++ Vagrantfile | 59 +++++++++++++++++++++ ansible/inventories/dev | 2 + ansible/playbook.yml | 11 ++++ ansible/roles/app/tasks/main.yml | 5 ++ ansible/roles/php/handlers/main.yml | 3 ++ ansible/roles/php/tasks/configure.yml | 9 ++++ ansible/roles/php/tasks/main.yml | 25 +++++++++ ansible/roles/php/tasks/pecl.yml | 26 +++++++++ ansible/roles/php/tasks/php-cli.yml | 10 ++++ ansible/roles/php/templates/extension.tpl | 2 + ansible/roles/server/tasks/main.yml | 31 +++++++++++ ansible/roles/server/templates/timezone.tpl | 1 + ansible/roles/vagrant_local/tasks/main.yml | 11 ++++ ansible/roles/xdebug/defaults/main.yml | 7 +++ ansible/roles/xdebug/tasks/main.yml | 4 ++ ansible/vars/all.yml | 15 ++++++ ansible/windows.sh | 31 +++++++++++ 18 files changed, 284 insertions(+) create mode 100755 Vagrantfile create mode 100755 ansible/inventories/dev create mode 100755 ansible/playbook.yml create mode 100755 ansible/roles/app/tasks/main.yml create mode 100755 ansible/roles/php/handlers/main.yml create mode 100755 ansible/roles/php/tasks/configure.yml create mode 100755 ansible/roles/php/tasks/main.yml create mode 100755 ansible/roles/php/tasks/pecl.yml create mode 100755 ansible/roles/php/tasks/php-cli.yml create mode 100755 ansible/roles/php/templates/extension.tpl create mode 100755 ansible/roles/server/tasks/main.yml create mode 100755 ansible/roles/server/templates/timezone.tpl create mode 100755 ansible/roles/vagrant_local/tasks/main.yml create mode 100755 ansible/roles/xdebug/defaults/main.yml create mode 100755 ansible/roles/xdebug/tasks/main.yml create mode 100755 ansible/vars/all.yml create mode 100755 ansible/windows.sh diff --git a/README.md b/README.md index 0d9e054..f941f1b 100755 --- a/README.md +++ b/README.md @@ -13,12 +13,44 @@ I think the problem with patterns is that often people do know them but don't kn You should look at and run the tests to see what happens in the example. To do this, you should install dependencies with `Composer` first: +### [optional] Using a Virtual Machine (VM) + +If you wish to use a ready made VM environment, you can easily create one with Vagrant and Ansible. + +```bash +$ vagrant up +``` + +### Install dependencies + ```bash $ composer install ``` Read more about how to install and use `Composer` on your local machine [here](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx). +### Running test suite + +```bash +$ ./vendor/bin/phpunit +``` + +Output example + +```bash +vagrant@design-patterns:/vagrant$ ./vendor/bin/phpunit +PHPUnit 4.6.10 by Sebastian Bergmann and contributors. + +Configuration read from /vagrant/phpunit.xml + +................................................................. 65 / 71 ( 91%) +...... + +Time: 554 ms, Memory: 5.75Mb + +OK (71 tests, 128 assertions) +``` + ## Patterns The patterns can be structured in roughly three different categories. Please click on the [:notebook:](http://en.wikipedia.org/wiki/Software_design_pattern) for a full explanation of the pattern on Wikipedia. diff --git a/Vagrantfile b/Vagrantfile new file mode 100755 index 0000000..30f924c --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,59 @@ +################################################## +# Generated by phansible.com +################################################## + +#If your Vagrant version is lower than 1.5, you can still use this provisioning +#by commenting or removing the line below and providing the config.vm.box_url parameter, +#if it's not already defined in this Vagrantfile. Keep in mind that you won't be able +#to use the Vagrant Cloud and other newer Vagrant features. +Vagrant.require_version ">= 1.5" + +# Check to determine whether we're on a windows or linux/os-x host, +# later on we use this to launch ansible in the supported way +# source: https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby +def which(cmd) + exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] + ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| + exts.each { |ext| + exe = File.join(path, "#{cmd}#{ext}") + return exe if File.executable? exe + } + end + return nil +end +Vagrant.configure("2") do |config| + + config.vm.provider :virtualbox do |v| + v.name = "design-patterns" + v.customize [ + "modifyvm", :id, + "--name", "design-patterns", + "--memory", 512, + "--natdnshostresolver1", "on", + "--cpus", 1, + ] + end + + config.vm.box = "ubuntu/trusty64" + + config.vm.network :private_network, ip: "192.168.11.2" + config.ssh.forward_agent = true + + ############################################################# + # Ansible provisioning (you need to have ansible installed) + ############################################################# + + + if which('ansible-playbook') + config.vm.provision "ansible" do |ansible| + ansible.playbook = "ansible/playbook.yml" + ansible.inventory_path = "ansible/inventories/dev" + ansible.limit = 'all' + end + else + config.vm.provision :shell, path: "ansible/windows.sh", args: ["default"] + end + + + config.vm.synced_folder "./", "/vagrant", type: "nfs" +end diff --git a/ansible/inventories/dev b/ansible/inventories/dev new file mode 100755 index 0000000..86d8f3b --- /dev/null +++ b/ansible/inventories/dev @@ -0,0 +1,2 @@ +[phansible-web] +192.168.11.2 diff --git a/ansible/playbook.yml b/ansible/playbook.yml new file mode 100755 index 0000000..33e3fda --- /dev/null +++ b/ansible/playbook.yml @@ -0,0 +1,11 @@ +--- +- hosts: all + sudo: true + vars_files: + - vars/all.yml + roles: + - server + - vagrant_local + - php + - xdebug + - app diff --git a/ansible/roles/app/tasks/main.yml b/ansible/roles/app/tasks/main.yml new file mode 100755 index 0000000..c330e48 --- /dev/null +++ b/ansible/roles/app/tasks/main.yml @@ -0,0 +1,5 @@ +--- +# application tasks to be customized and to run after the main provision +- name: update file db + sudo: yes + shell: updatedb diff --git a/ansible/roles/php/handlers/main.yml b/ansible/roles/php/handlers/main.yml new file mode 100755 index 0000000..915cc8a --- /dev/null +++ b/ansible/roles/php/handlers/main.yml @@ -0,0 +1,3 @@ +--- +- name: restart php5-fpm + service: name=php5-fpm enabled=yes state=restarted diff --git a/ansible/roles/php/tasks/configure.yml b/ansible/roles/php/tasks/configure.yml new file mode 100755 index 0000000..c334a60 --- /dev/null +++ b/ansible/roles/php/tasks/configure.yml @@ -0,0 +1,9 @@ +--- +#- stat: path=/etc/php5/fpm/php.ini +# register: phpfpm + +- stat: path=/etc/php5/cli/php.ini + register: phpcli + +- include: php-cli.yml + when: phpcli.stat.exists diff --git a/ansible/roles/php/tasks/main.yml b/ansible/roles/php/tasks/main.yml new file mode 100755 index 0000000..b554426 --- /dev/null +++ b/ansible/roles/php/tasks/main.yml @@ -0,0 +1,25 @@ +--- +- name: Add ppa Repository + sudo: yes + apt_repository: repo=ppa:ondrej/{{ php.ppa }} + +- name: Update apt + sudo: yes + apt: update_cache=yes + +- name: Install php5 + sudo: yes + apt: pkg=php5 state=latest + +- name: Install PHP Packages + sudo: yes + apt: pkg={{ item }} state=latest + with_items: php.packages + when: php.packages is defined + +- name: Install pear + sudo: yes + apt: pkg=php-pear state=latest + +- include: configure.yml +- include: pecl.yml diff --git a/ansible/roles/php/tasks/pecl.yml b/ansible/roles/php/tasks/pecl.yml new file mode 100755 index 0000000..399219f --- /dev/null +++ b/ansible/roles/php/tasks/pecl.yml @@ -0,0 +1,26 @@ +- name: Install + apt: pkg="php5-dev" state=present + when: php.pecl_packages is defined + +- name: Install Package + shell: echo "\n\n\n\n\n\n\n\n\n" | pecl install {{ item }} + register: pecl_result + changed_when: "'already installed' not in pecl_result.stdout" + failed_when: "pecl_result.stderr or ('ERROR' in pecl_result.stdout)" + with_items: php.pecl_packages + when: php.pecl_packages is defined + +- name: Create extension .ini file + template: > + src="extension.tpl" + dest="/etc/php5/mods-available/{{ item }}.ini" + owner="root" + group="root" + mode=0644 + with_items: php.pecl_packages + when: php.pecl_packages is defined + +- name: Enable extension + shell: php5enmod {{ item }} + with_items: php.pecl_packages + when: php.pecl_packages is defined diff --git a/ansible/roles/php/tasks/php-cli.yml b/ansible/roles/php/tasks/php-cli.yml new file mode 100755 index 0000000..e1cfffa --- /dev/null +++ b/ansible/roles/php/tasks/php-cli.yml @@ -0,0 +1,10 @@ +--- +- name: ensure timezone is set in cli php.ini + lineinfile: dest=/etc/php5/cli/php.ini + regexp='date.timezone =' + line='date.timezone = {{ server.timezone }}' + +- name: enabling opcache cli + lineinfile: dest=/etc/php5/cli/php.ini + regexp=';opcache.enable_cli=0' + line='opcache.enable_cli=1' diff --git a/ansible/roles/php/templates/extension.tpl b/ansible/roles/php/templates/extension.tpl new file mode 100755 index 0000000..1b13534 --- /dev/null +++ b/ansible/roles/php/templates/extension.tpl @@ -0,0 +1,2 @@ +; Configuration for php PECL {{ item }} extension +extension={{ item }}.so diff --git a/ansible/roles/server/tasks/main.yml b/ansible/roles/server/tasks/main.yml new file mode 100755 index 0000000..f1ffc08 --- /dev/null +++ b/ansible/roles/server/tasks/main.yml @@ -0,0 +1,31 @@ +--- +- name: Update apt + sudo: yes + apt: update_cache=yes + +- name: Install System Packages + sudo: yes + apt: pkg={{ item }} state=latest + with_items: + - curl + - wget + - python-software-properties + +- name: Install Extra Packages + sudo: yes + apt: pkg={{ item }} state=latest + with_items: server.packages + when: server.packages is defined + +- name: Configure the timezone + sudo: yes + template: src=timezone.tpl dest=/etc/timezone + +- name: More Configure the timezone + sudo: yes + file: src=/usr/share/zoneinfo/{{server.timezone}} dest=/etc/localtime state=link force=yes backup=yes + +- name: Set default system language pack + shell: locale-gen {{server.locale}} + sudo: yes + diff --git a/ansible/roles/server/templates/timezone.tpl b/ansible/roles/server/templates/timezone.tpl new file mode 100755 index 0000000..cca2365 --- /dev/null +++ b/ansible/roles/server/templates/timezone.tpl @@ -0,0 +1 @@ +{{server.timezone}} diff --git a/ansible/roles/vagrant_local/tasks/main.yml b/ansible/roles/vagrant_local/tasks/main.yml new file mode 100755 index 0000000..cd53609 --- /dev/null +++ b/ansible/roles/vagrant_local/tasks/main.yml @@ -0,0 +1,11 @@ +--- +- name: Set the hostname in /etc/hostname + shell: echo {{ vagrant_local.vm.hostname }} > /etc/hostname + when: vagrant_local.vm.hostname is defined + +- name: Set the hostname + shell: hostname {{ vagrant_local.vm.hostname }} + when: vagrant_local.vm.hostname is defined + +- name: Update /etc/hosts + lineinfile: dest=/etc/hosts regexp='^127\.0\.0\.1' line='127.0.0.1 localhost {{ vagrant_local.vm.hostname }}' owner=root group=root mode=0644 diff --git a/ansible/roles/xdebug/defaults/main.yml b/ansible/roles/xdebug/defaults/main.yml new file mode 100755 index 0000000..f2d917e --- /dev/null +++ b/ansible/roles/xdebug/defaults/main.yml @@ -0,0 +1,7 @@ +--- +xdebug: + settings: + - xdebug.remote_enable=1 + - xdebug.idekey=PHPSTORM + - xdebug.remote_connect_back=1 + - xdebug.remote_port=9000 diff --git a/ansible/roles/xdebug/tasks/main.yml b/ansible/roles/xdebug/tasks/main.yml new file mode 100755 index 0000000..e38815d --- /dev/null +++ b/ansible/roles/xdebug/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- name: Install xDebug + sudo: yes + apt: pkg=php5-xdebug state=latest diff --git a/ansible/vars/all.yml b/ansible/vars/all.yml new file mode 100755 index 0000000..b5559e6 --- /dev/null +++ b/ansible/vars/all.yml @@ -0,0 +1,15 @@ +--- +server: + install: '1' + packages: [vim, htop, iotop, bwm-ng] + timezone: UTC + locale: en_US.UTF-8 +vagrant_local: + install: '1' + vm: { base_box: trusty64, hostname: design-patterns, ip: 192.168.11.2, sharedfolder: ./, enableWindows: '1', useVagrantCloud: '1', syncType: nfs } +php: + install: '1' + ppa: php5-5.6 + packages: [php5-cli, php5-intl, php5-mcrypt, php5-mysql, php5-curl, php5-json] +xdebug: + install: '1' diff --git a/ansible/windows.sh b/ansible/windows.sh new file mode 100755 index 0000000..eab5d9a --- /dev/null +++ b/ansible/windows.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# Update Repositories +sudo apt-get update + +# Determine Ubuntu Version +. /etc/lsb-release + +# Decide on package to install for `add-apt-repository` command +# +# USE_COMMON=1 when using a distribution over 12.04 +# USE_COMMON=0 when using a distribution at 12.04 or older +USE_COMMON=$(echo "$DISTRIB_RELEASE > 12.04" | bc) + +if [ "$USE_COMMON" -eq "1" ]; +then + sudo apt-get install -y software-properties-common +else + sudo apt-get install -y python-software-properties +fi + +# Add Ansible Repository & Install Ansible +sudo add-apt-repository -y ppa:ansible/ansible +sudo apt-get update +sudo apt-get install -y ansible + +# Setup Ansible for Local Use and Run +cp /vagrant/ansible/inventories/dev /etc/ansible/hosts -f +chmod 666 /etc/ansible/hosts +cat /vagrant/ansible/files/authorized_keys >> /home/vagrant/.ssh/authorized_keys +sudo ansible-playbook /vagrant/ansible/playbook.yml -e hostname=$1 --connection=local \ No newline at end of file From 60a93e228365abe6f5f65232f751b0a22b8223e6 Mon Sep 17 00:00:00 2001 From: Eddie Abou-Jaoude Date: Sat, 15 Aug 2015 12:22:19 +0100 Subject: [PATCH 17/69] Link to vagrant docs added to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f941f1b..5158b3f 100755 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ If you wish to use a ready made VM environment, you can easily create one with V $ vagrant up ``` +More information on [vagrant](https://www.vagrantup.com) + ### Install dependencies ```bash From f158b2c70173e23491e61949619eec8ba0fc9597 Mon Sep 17 00:00:00 2001 From: Eddie Abou-Jaoude Date: Sat, 15 Aug 2015 12:35:14 +0100 Subject: [PATCH 18/69] project path in VM added to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5158b3f..a38ff89 100755 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ If you wish to use a ready made VM environment, you can easily create one with V $ vagrant up ``` +Then `vagrant ssh` and `cd /vagrant` + More information on [vagrant](https://www.vagrantup.com) ### Install dependencies From faaf99a7ea9bff0c90abbd28e4609b916b21b0b7 Mon Sep 17 00:00:00 2001 From: Eddie Abou-Jaoude Date: Tue, 18 Aug 2015 12:40:49 +0100 Subject: [PATCH 19/69] Removed phpunit output from README --- README.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/README.md b/README.md index a38ff89..65d71d7 100755 --- a/README.md +++ b/README.md @@ -39,22 +39,6 @@ Read more about how to install and use `Composer` on your local machine [here](h $ ./vendor/bin/phpunit ``` -Output example - -```bash -vagrant@design-patterns:/vagrant$ ./vendor/bin/phpunit -PHPUnit 4.6.10 by Sebastian Bergmann and contributors. - -Configuration read from /vagrant/phpunit.xml - -................................................................. 65 / 71 ( 91%) -...... - -Time: 554 ms, Memory: 5.75Mb - -OK (71 tests, 128 assertions) -``` - ## Patterns The patterns can be structured in roughly three different categories. Please click on the [:notebook:](http://en.wikipedia.org/wiki/Software_design_pattern) for a full explanation of the pattern on Wikipedia. From 7a1f4eb456933f9bb0d3148038bc4b36ed196058 Mon Sep 17 00:00:00 2001 From: Eddie Abou-Jaoude Date: Tue, 18 Aug 2015 12:41:18 +0100 Subject: [PATCH 20/69] Removed php5-fpm ansible handler --- ansible/roles/php/handlers/main.yml | 3 --- 1 file changed, 3 deletions(-) delete mode 100755 ansible/roles/php/handlers/main.yml diff --git a/ansible/roles/php/handlers/main.yml b/ansible/roles/php/handlers/main.yml deleted file mode 100755 index 915cc8a..0000000 --- a/ansible/roles/php/handlers/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- name: restart php5-fpm - service: name=php5-fpm enabled=yes state=restarted From 7a90725128f76183a84a7ade5d6861b4bcb1afe5 Mon Sep 17 00:00:00 2001 From: Eddie Abou-Jaoude Date: Tue, 18 Aug 2015 12:41:42 +0100 Subject: [PATCH 21/69] Removed commented out code for php5-fpm --- ansible/roles/php/tasks/configure.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/ansible/roles/php/tasks/configure.yml b/ansible/roles/php/tasks/configure.yml index c334a60..1b093e7 100755 --- a/ansible/roles/php/tasks/configure.yml +++ b/ansible/roles/php/tasks/configure.yml @@ -1,7 +1,4 @@ --- -#- stat: path=/etc/php5/fpm/php.ini -# register: phpfpm - - stat: path=/etc/php5/cli/php.ini register: phpcli From 87cb4e9ca6bbf18e0423f63ad6c350df96cf589c Mon Sep 17 00:00:00 2001 From: Eddie Abou-Jaoude Date: Tue, 18 Aug 2015 12:42:41 +0100 Subject: [PATCH 22/69] Removed Pear & Pecl from Ansible scripts --- ansible/roles/php/tasks/main.yml | 5 ----- ansible/roles/php/tasks/pecl.yml | 26 ----------------------- ansible/roles/php/templates/extension.tpl | 2 -- 3 files changed, 33 deletions(-) delete mode 100755 ansible/roles/php/tasks/pecl.yml delete mode 100755 ansible/roles/php/templates/extension.tpl diff --git a/ansible/roles/php/tasks/main.yml b/ansible/roles/php/tasks/main.yml index b554426..38f2f78 100755 --- a/ansible/roles/php/tasks/main.yml +++ b/ansible/roles/php/tasks/main.yml @@ -17,9 +17,4 @@ with_items: php.packages when: php.packages is defined -- name: Install pear - sudo: yes - apt: pkg=php-pear state=latest - - include: configure.yml -- include: pecl.yml diff --git a/ansible/roles/php/tasks/pecl.yml b/ansible/roles/php/tasks/pecl.yml deleted file mode 100755 index 399219f..0000000 --- a/ansible/roles/php/tasks/pecl.yml +++ /dev/null @@ -1,26 +0,0 @@ -- name: Install - apt: pkg="php5-dev" state=present - when: php.pecl_packages is defined - -- name: Install Package - shell: echo "\n\n\n\n\n\n\n\n\n" | pecl install {{ item }} - register: pecl_result - changed_when: "'already installed' not in pecl_result.stdout" - failed_when: "pecl_result.stderr or ('ERROR' in pecl_result.stdout)" - with_items: php.pecl_packages - when: php.pecl_packages is defined - -- name: Create extension .ini file - template: > - src="extension.tpl" - dest="/etc/php5/mods-available/{{ item }}.ini" - owner="root" - group="root" - mode=0644 - with_items: php.pecl_packages - when: php.pecl_packages is defined - -- name: Enable extension - shell: php5enmod {{ item }} - with_items: php.pecl_packages - when: php.pecl_packages is defined diff --git a/ansible/roles/php/templates/extension.tpl b/ansible/roles/php/templates/extension.tpl deleted file mode 100755 index 1b13534..0000000 --- a/ansible/roles/php/templates/extension.tpl +++ /dev/null @@ -1,2 +0,0 @@ -; Configuration for php PECL {{ item }} extension -extension={{ item }}.so From a4defb21123f583b67c0373f60b3085c8d44c730 Mon Sep 17 00:00:00 2001 From: victor Date: Wed, 19 Aug 2015 15:52:10 +0300 Subject: [PATCH 23/69] Add unit tests and usage example to README --- More/EAV/Attribute.php | 6 +- More/EAV/Entity.php | 6 +- More/EAV/README.rst | 87 +++++++++++++++++++- More/EAV/Tests/AttributeTest.php | 66 ++++++++++++++++ More/EAV/Tests/EntityTest.php | 132 +++++++++++++++++++++++++++++++ More/EAV/Tests/ValueTest.php | 59 ++++++++++++++ More/EAV/Value.php | 10 +++ More/EAV/ValueInterface.php | 5 ++ 8 files changed, 365 insertions(+), 6 deletions(-) create mode 100644 More/EAV/Tests/AttributeTest.php create mode 100644 More/EAV/Tests/EntityTest.php create mode 100644 More/EAV/Tests/ValueTest.php diff --git a/More/EAV/Attribute.php b/More/EAV/Attribute.php index f7af581..7103af9 100644 --- a/More/EAV/Attribute.php +++ b/More/EAV/Attribute.php @@ -43,8 +43,10 @@ class Attribute implements ValueAccessInterface */ public function removeValue(ValueInterface $value) { - if ($key = array_search($value, $this->values, true)) { - unset($this->values[$key]); + $index = array_search($value, $this->values, true); + + if (false !== $index) { + unset($this->values[$index]); } return $this; diff --git a/More/EAV/Entity.php b/More/EAV/Entity.php index 4da304a..5dd7ed1 100644 --- a/More/EAV/Entity.php +++ b/More/EAV/Entity.php @@ -43,8 +43,10 @@ class Entity implements ValueAccessInterface */ public function removeValue(ValueInterface $value) { - if ($key = array_search($value, $this->values, true)) { - unset($this->values[$key]); + $index = array_search($value, $this->values, true); + + if (false !== $index) { + unset($this->values[$index]); } return $this; diff --git a/More/EAV/README.rst b/More/EAV/README.rst index 8aab2f1..0a03ad7 100644 --- a/More/EAV/README.rst +++ b/More/EAV/README.rst @@ -9,7 +9,74 @@ Purpose Examples -------- -... +``` +use DesignPatterns\More\EAV\Entity; +use DesignPatterns\More\EAV\Attribute; +use DesignPatterns\More\EAV\Value; + +// color attribute +$color = (new Attribute())->setName('Color'); +// color values +$colorSilver = (new Value($color))->setName('Silver'); +$colorGold = (new Value($color))->setName('Gold'); +$colorSpaceGrey = (new Value($color))->setName('Space Grey'); + +// memory attribute +$memory = (new Attribute())->setName('Memory'); +// memory values +$memory4Gb = (new Value($memory))->setName('4GB'); +$memory8Gb = (new Value($memory))->setName('8GB'); +$memory16Gb = (new Value($memory))->setName('16GB'); + +// storage attribute +$storage = (new Attribute())->setName('Storage'); +// 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'); + +// entities +$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 ----------- @@ -24,7 +91,23 @@ You can also find these code on `GitHub`_ Test ---- -... +Tests/EntityTest.php + +.. literalinclude:: Tests/EntityTest.php + :language: php + :linenos: + +Tests/AttributeTest.php + +.. literalinclude:: Tests/AttributeTest.php + :language: php + :linenos: + +Tests/ValueTest.php + +.. literalinclude:: Tests/ValueTest.php + :language: php + :linenos: .. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/More/EAV diff --git a/More/EAV/Tests/AttributeTest.php b/More/EAV/Tests/AttributeTest.php new file mode 100644 index 0000000..7a086d3 --- /dev/null +++ b/More/EAV/Tests/AttributeTest.php @@ -0,0 +1,66 @@ +assertInstanceOf('\DesignPatterns\More\EAV\Attribute', $attribute); + } + + /** + * @depends testCreationSuccess + */ + public function testSetGetName() + { + $attribute = new Attribute(); + $attribute->setName('Color'); + + $this->assertEquals('Color', $attribute->getName()); + } + + /** + * @depends testCreationSuccess + */ + public function testAddValue() + { + $attribute = new Attribute(); + $attribute->setName('Color'); + + $values[] = (new Value($attribute))->setName('Silver'); + $values[] = (new Value($attribute))->setName('Gold'); + $values[] = (new Value($attribute))->setName('Space Grey'); + + $this->assertEquals($values, $attribute->getValues()); + } + + /** + * @depends testAddValue + */ + public function testRemoveValue() + { + $values = []; + + $attribute = new Attribute(); + $attribute->setName('Color'); + + $values[] = (new Value($attribute))->setName('Silver'); + $values[] = (new Value($attribute))->setName('Gold'); + $values[] = (new Value($attribute))->setName('Space Grey'); + + $randomIndex = array_rand($values); + $attribute->removeValue($values[$randomIndex]); + unset($values[$randomIndex]); + + $this->assertEquals($values, $attribute->getValues()); + } +} diff --git a/More/EAV/Tests/EntityTest.php b/More/EAV/Tests/EntityTest.php new file mode 100644 index 0000000..5fa47cc --- /dev/null +++ b/More/EAV/Tests/EntityTest.php @@ -0,0 +1,132 @@ +setName($name); + + $this->assertEquals($name, $macBook->getName()); + } + + /** + * @dataProvider valueProvider + * + * @var string $name + * @var array|Value[] $values + */ + public function testAddValue($name, array $values) + { + $macBook = new Entity(); + $macBook->setName($name); + + foreach ($values as $value) { + $macBook->addValue($value); + } + + $this->assertEquals($values, $macBook->getValues()); + } + + /** + * @depends testAddValue + * @dataProvider valueProvider + * + * @var string $name + * @var array|Value[] $values + */ + public function testRemoveValue($name, array $values) + { + $macBook = new Entity(); + $macBook->setName($name); + + foreach ($values as $value) { + $macBook->addValue($value); + } + + $randomIndex = array_rand($values); + $macBook->removeValue($values[$randomIndex]); + unset($values[$randomIndex]); + + $this->assertEquals($values, $macBook->getValues()); + } + + /** + * @return array + */ + public function valueProvider() + { + // color attribute + $color = (new Attribute())->setName('Color'); + // color values + $colorSilver = (new Value($color))->setName('Silver'); + $colorGold = (new Value($color))->setName('Gold'); + $colorSpaceGrey = (new Value($color))->setName('Space Grey'); + + // memory attribute + $memory = (new Attribute())->setName('Memory'); + // memory values + $memory4Gb = (new Value($memory))->setName('4GB'); + $memory8Gb = (new Value($memory))->setName('8GB'); + $memory16Gb = (new Value($memory))->setName('16GB'); + + // storage attribute + $storage = (new Attribute())->setName('Storage'); + // 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'); + + return [ + [ + 'MacBook', + [ + $colorSilver, + $colorGold, + $colorSpaceGrey, + $memory8Gb, + $storage256Gb, + $storage512Gb, + ], + ], + [ + 'MacBook Air', + [ + $colorSilver, + $memory4Gb, + $memory8Gb, + $storage128Gb, + $storage256Gb, + $storage512Gb, + ], + ], + [ + 'MacBook Pro', + [ + $colorSilver, + $memory8Gb, + $memory16Gb, + $storage128Gb, + $storage256Gb, + $storage512Gb, + $storage1Tb, + ], + ], + ]; + } +} diff --git a/More/EAV/Tests/ValueTest.php b/More/EAV/Tests/ValueTest.php new file mode 100644 index 0000000..0d817ce --- /dev/null +++ b/More/EAV/Tests/ValueTest.php @@ -0,0 +1,59 @@ +assertTrue($isFailure); + } + + public function testCreationSuccessWithAttribute() + { + $attribute = new Attribute(); + $attribute->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 9f1d3ae..617afdc 100644 --- a/More/EAV/Value.php +++ b/More/EAV/Value.php @@ -26,6 +26,16 @@ class Value implements ValueInterface $this->attribute = $attribute; } + /** + * @param Attribute $attribute + */ + 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 Attribute */ diff --git a/More/EAV/ValueInterface.php b/More/EAV/ValueInterface.php index fee9865..c041835 100644 --- a/More/EAV/ValueInterface.php +++ b/More/EAV/ValueInterface.php @@ -12,6 +12,11 @@ interface ValueInterface */ public function __construct(Attribute $attribute); + /** + * @param Attribute $attribute + */ + public function setAttribute(Attribute $attribute); + /** * @return Attribute */ From eda331e48325715f841cbae15c45a7b72e18a758 Mon Sep 17 00:00:00 2001 From: victor Date: Wed, 19 Aug 2015 17:13:45 +0300 Subject: [PATCH 24/69] Fix tests for PHP 5.3 --- More/EAV/Attribute.php | 2 +- More/EAV/Entity.php | 2 +- More/EAV/Tests/AttributeTest.php | 26 +++++++++---- More/EAV/Tests/EntityTest.php | 67 +++++++++++++++++++------------- 4 files changed, 61 insertions(+), 36 deletions(-) diff --git a/More/EAV/Attribute.php b/More/EAV/Attribute.php index 7103af9..42e9f02 100644 --- a/More/EAV/Attribute.php +++ b/More/EAV/Attribute.php @@ -10,7 +10,7 @@ class Attribute implements ValueAccessInterface /** * @var array|Value[]|ValueInterface[] */ - private $values = []; + private $values = array(); /** * @var string diff --git a/More/EAV/Entity.php b/More/EAV/Entity.php index 5dd7ed1..fc3dc9e 100644 --- a/More/EAV/Entity.php +++ b/More/EAV/Entity.php @@ -10,7 +10,7 @@ class Entity implements ValueAccessInterface /** * @var array|Value[]|ValueInterface[] */ - private $values = []; + private $values = array(); /** * @var string diff --git a/More/EAV/Tests/AttributeTest.php b/More/EAV/Tests/AttributeTest.php index 7a086d3..1561acd 100644 --- a/More/EAV/Tests/AttributeTest.php +++ b/More/EAV/Tests/AttributeTest.php @@ -36,9 +36,15 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $attribute = new Attribute(); $attribute->setName('Color'); - $values[] = (new Value($attribute))->setName('Silver'); - $values[] = (new Value($attribute))->setName('Gold'); - $values[] = (new Value($attribute))->setName('Space Grey'); + $colorSilver = new Value($attribute); + $colorSilver->setName('Silver'); + $values[] = $colorSilver; + $colorGold = new Value($attribute); + $colorGold->setName('Gold'); + $values[] = $colorGold; + $colorSpaceGrey = new Value($attribute); + $colorSpaceGrey->setName('Space Grey'); + $values[] = $colorSpaceGrey; $this->assertEquals($values, $attribute->getValues()); } @@ -48,14 +54,20 @@ class AttributeTest extends \PHPUnit_Framework_TestCase */ public function testRemoveValue() { - $values = []; + $values = array(); $attribute = new Attribute(); $attribute->setName('Color'); - $values[] = (new Value($attribute))->setName('Silver'); - $values[] = (new Value($attribute))->setName('Gold'); - $values[] = (new Value($attribute))->setName('Space Grey'); + $colorSilver = new Value($attribute); + $colorSilver->setName('Silver'); + $values[] = $colorSilver; + $colorGold = new Value($attribute); + $colorGold->setName('Gold'); + $values[] = $colorGold; + $colorSpaceGrey = new Value($attribute); + $colorSpaceGrey->setName('Space Grey'); + $values[] = $colorSpaceGrey; $randomIndex = array_rand($values); $attribute->removeValue($values[$randomIndex]); diff --git a/More/EAV/Tests/EntityTest.php b/More/EAV/Tests/EntityTest.php index 5fa47cc..2e8e58f 100644 --- a/More/EAV/Tests/EntityTest.php +++ b/More/EAV/Tests/EntityTest.php @@ -71,53 +71,66 @@ class EntityTest extends \PHPUnit_Framework_TestCase public function valueProvider() { // color attribute - $color = (new Attribute())->setName('Color'); + $color = new Attribute(); + $color->setName('Color'); // color values - $colorSilver = (new Value($color))->setName('Silver'); - $colorGold = (new Value($color))->setName('Gold'); - $colorSpaceGrey = (new Value($color))->setName('Space Grey'); + $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())->setName('Memory'); + $memory = new Attribute(); + $memory->setName('Memory'); // memory values - $memory4Gb = (new Value($memory))->setName('4GB'); - $memory8Gb = (new Value($memory))->setName('8GB'); - $memory16Gb = (new Value($memory))->setName('16GB'); + $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())->setName('Storage'); + $storage = new Attribute(); + $storage->setName('Storage'); // 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'); + $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 [ - [ + 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, @@ -125,8 +138,8 @@ class EntityTest extends \PHPUnit_Framework_TestCase $storage256Gb, $storage512Gb, $storage1Tb, - ], - ], - ]; + ), + ), + ); } } From 4d3b024c71c4b85789d60345c200969a2f057cf1 Mon Sep 17 00:00:00 2001 From: victor Date: Fri, 21 Aug 2015 12:26:43 +0300 Subject: [PATCH 25/69] Add UNL diagram --- More/EAV/uml/EAV.uml | 43 +++ More/EAV/uml/uml.png | Bin 0 -> 28941 bytes More/EAV/uml/uml.svg | 668 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 711 insertions(+) create mode 100644 More/EAV/uml/EAV.uml create mode 100644 More/EAV/uml/uml.png create mode 100644 More/EAV/uml/uml.svg diff --git a/More/EAV/uml/EAV.uml b/More/EAV/uml/EAV.uml new file mode 100644 index 0000000..1b08466 --- /dev/null +++ b/More/EAV/uml/EAV.uml @@ -0,0 +1,43 @@ + + + PHP + \DesignPatterns\More\Delegation\JuniorDeveloper + + \DesignPatterns\More\EAV\Entity + \DesignPatterns\More\EAV\Value + \DesignPatterns\More\EAV\Attribute + \DesignPatterns\More\EAV\ValueAccessInterface + \DesignPatterns\More\EAV\ValueInterface + + + + + + + + + + + + + + + + + + + + + + + \DesignPatterns\More\EAV\ValueAccessInterface + + + Fields + Constants + Constructors + Methods + + private + + diff --git a/More/EAV/uml/uml.png b/More/EAV/uml/uml.png new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6BE#{Vd z+9mnhI&ZjT9QC-Cy>GrqE5SKnNxMkc~dwSGeBiHo)amyS@E}huk_73f|Th<@jVPA9htGlBlN^!evif zu6D3077;L$f)0D*N3W&WU${V-ys63gKARG_PF!npT0yr^O-&vBmrqN*PrGT&9MTuE zP5`5_J_Z=dU84h3?=`_5NBQ{X3Te(=>ju6E@UhZrgrsT!)zBI}*%0VnyCC<};K18< zWzqe&=WK<5R{^vDO#>v%l$A0S)hh5yb)2GP{`VUXZN|tGpn^#LKD`XeM^ta$zm==- HFyOxcH6K%v literal 0 HcmV?d00001 diff --git a/More/EAV/uml/uml.svg b/More/EAV/uml/uml.svg new file mode 100644 index 0000000..26ff3cc --- /dev/null +++ b/More/EAV/uml/uml.svg @@ -0,0 +1,668 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + getValues() + + + + + + + + + + addValue(value) + + + + + + + + + + removeValue(value) + + + + + + + + + + + + + ValueAccessInterface + + + ValueAccessInterface + + + + + + + + + + + + + + + + + + + values + + + + + + + + + + name + + + + + + + + + + + + + getValues() + + + + + + + + + + addValue(value) + + + + + + + + + + removeValue(value) + + + + + + + + + + getName() + + + + + + + + + + setName(name) + + + + + + + + + + + + + Attribute + + + Attribute + + + + + + + + + + + + + + + + + + + values + + + + + + + + + + name + + + + + + + + + + + + + getValues() + + + + + + + + + + addValue(value) + + + + + + + + + + removeValue(value) + + + + + + + + + + getName() + + + + + + + + + + setName(name) + + + + + + + + + + + + + Entity + + + Entity + + + + + + + + + + + + + + + + + + + __construct(attribute) + + + + + + + + + + + + + setAttribute(attribute) + + + + + + + + + + getAttribute() + + + + + + + + + + + + + ValueInterface + + + ValueInterface + + + + + + + + + + + + + + + + + + + attribute + + + + + + + + + + name + + + + + + + + + + + + + __construct(attribute) + + + + + + + + + + + + + setAttribute(attribute) + + + + + + + + + + getAttribute() + + + + + + + + + + getName() + + + + + + + + + + setName(name) + + + + + + + + + + + + + Value + + + Value + + + + + + + + + + + + + From 905da079bee9683207b512825a6f9752d17fce12 Mon Sep 17 00:00:00 2001 From: victor Date: Fri, 21 Aug 2015 12:34:29 +0300 Subject: [PATCH 26/69] Add missing sections to README file --- More/EAV/README.rst | 139 +++++++++++++++++++++++-------------------- More/EAV/example.php | 14 ++--- 2 files changed, 82 insertions(+), 71 deletions(-) diff --git a/More/EAV/README.rst b/More/EAV/README.rst index 0a03ad7..b8a8fbe 100644 --- a/More/EAV/README.rst +++ b/More/EAV/README.rst @@ -1,87 +1,97 @@ `Entity-Attribute-Value (EAV)`__ ================================ +The Entity–attribute–value (EAV) pattern in order to implement EAV model with PHP. + Purpose ------- -... +The Entity–attribute–value (EAV) model is a data model to describe entities +where the number of attributes (properties, parameters) that can be used +to describe them is potentially vast, but the number that will actually apply +to a given entity is relatively modest. Examples -------- -``` -use DesignPatterns\More\EAV\Entity; -use DesignPatterns\More\EAV\Attribute; -use DesignPatterns\More\EAV\Value; +Check full work example in `example.php`_ file. -// color attribute -$color = (new Attribute())->setName('Color'); -// color values -$colorSilver = (new Value($color))->setName('Silver'); -$colorGold = (new Value($color))->setName('Gold'); -$colorSpaceGrey = (new Value($color))->setName('Space Grey'); +.. code-block:: php -// memory attribute -$memory = (new Attribute())->setName('Memory'); -// memory values -$memory4Gb = (new Value($memory))->setName('4GB'); -$memory8Gb = (new Value($memory))->setName('8GB'); -$memory16Gb = (new Value($memory))->setName('16GB'); + use DesignPatterns\More\EAV\Entity; + use DesignPatterns\More\EAV\Attribute; + use DesignPatterns\More\EAV\Value; -// storage attribute -$storage = (new Attribute())->setName('Storage'); -// 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 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'); -// entities -$mac = (new Entity()) - ->setName('MacBook') - // colors - ->addValue($colorSilver) - ->addValue($colorGold) - ->addValue($colorSpaceGrey) - // memories - ->addValue($memory8Gb) - // storages - ->addValue($storage256Gb) - ->addValue($storage512Gb) -; + // 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'); -$macAir = (new Entity()) - ->setName('MacBook Air') - // colors - ->addValue($colorSilver) - // memories - ->addValue($memory4Gb) - ->addValue($memory8Gb) - // storages - ->addValue($storage128Gb) - ->addValue($storage256Gb) - ->addValue($storage512Gb) -; + // 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) + ; -$macPro = (new Entity()) - ->setName('MacBook Pro') - // colors - ->addValue($colorSilver) - // memories - ->addValue($memory8Gb) - ->addValue($memory16Gb) - // storages - ->addValue($storage128Gb) - ->addValue($storage256Gb) - ->addValue($storage512Gb) - ->addValue($storage1Tb) -; -``` UML Diagram ----------- -... +.. image:: uml/uml.png + :alt: EAV UML Diagram + :align: center Code ---- @@ -110,5 +120,6 @@ Tests/ValueTest.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/example.php b/More/EAV/example.php index c69342e..c5bb5c4 100644 --- a/More/EAV/example.php +++ b/More/EAV/example.php @@ -6,29 +6,29 @@ use DesignPatterns\More\EAV\Entity; use DesignPatterns\More\EAV\Attribute; use DesignPatterns\More\EAV\Value; -// color attribute +// Create color attribute $color = (new Attribute())->setName('Color'); -// color values +// Create color values $colorSilver = (new Value($color))->setName('Silver'); $colorGold = (new Value($color))->setName('Gold'); $colorSpaceGrey = (new Value($color))->setName('Space Grey'); -// memory attribute +// Create memory attribute $memory = (new Attribute())->setName('Memory'); -// memory values +// Create memory values $memory4Gb = (new Value($memory))->setName('4GB'); $memory8Gb = (new Value($memory))->setName('8GB'); $memory16Gb = (new Value($memory))->setName('16GB'); -// storage attribute +// Create storage attribute $storage = (new Attribute())->setName('Storage'); -// storage values +// 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'); -// entities +// Create entities with specific values $mac = (new Entity()) ->setName('MacBook') // colors From fb8432d5ac26d2cccda45c6bdfe3bc24bdbfc0de Mon Sep 17 00:00:00 2001 From: victor Date: Fri, 21 Aug 2015 12:55:55 +0300 Subject: [PATCH 27/69] Fix PHP 7 tests --- More/EAV/Tests/ValueTest.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/More/EAV/Tests/ValueTest.php b/More/EAV/Tests/ValueTest.php index 0d817ce..1b96521 100644 --- a/More/EAV/Tests/ValueTest.php +++ b/More/EAV/Tests/ValueTest.php @@ -10,19 +10,6 @@ use DesignPatterns\More\EAV\Value; */ class ValueTest extends \PHPUnit_Framework_TestCase { - public function testCreationFailureWithoutAttribute() - { - $isFailure = false; - - try { - new Value(); - } catch (\Exception $e) { - $isFailure = true; - } - - $this->assertTrue($isFailure); - } - public function testCreationSuccessWithAttribute() { $attribute = new Attribute(); From c61f84c49fac3f1248db218e6a342460bcca3734 Mon Sep 17 00:00:00 2001 From: Victor Date: Sun, 23 Aug 2015 00:55:42 +0300 Subject: [PATCH 28/69] Fix annotation multiple types --- More/EAV/Attribute.php | 8 ++++---- More/EAV/Entity.php | 8 ++++---- More/EAV/ValueAccessInterface.php | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/More/EAV/Attribute.php b/More/EAV/Attribute.php index 42e9f02..a136c22 100644 --- a/More/EAV/Attribute.php +++ b/More/EAV/Attribute.php @@ -8,7 +8,7 @@ namespace DesignPatterns\More\EAV; class Attribute implements ValueAccessInterface { /** - * @var array|Value[]|ValueInterface[] + * @var ValueInterface[] */ private $values = array(); @@ -18,7 +18,7 @@ class Attribute implements ValueAccessInterface private $name; /** - * @return array|Value[]|ValueInterface[] + * @return ValueInterface[] */ public function getValues() { @@ -26,7 +26,7 @@ class Attribute implements ValueAccessInterface } /** - * @param Value|ValueInterface $value + * @param ValueInterface $value * @return $this */ public function addValue(ValueInterface $value) @@ -38,7 +38,7 @@ class Attribute implements ValueAccessInterface } /** - * @param Value|ValueInterface $value + * @param ValueInterface $value * @return $this */ public function removeValue(ValueInterface $value) diff --git a/More/EAV/Entity.php b/More/EAV/Entity.php index fc3dc9e..58a88e5 100644 --- a/More/EAV/Entity.php +++ b/More/EAV/Entity.php @@ -8,7 +8,7 @@ namespace DesignPatterns\More\EAV; class Entity implements ValueAccessInterface { /** - * @var array|Value[]|ValueInterface[] + * @var ValueInterface[] */ private $values = array(); @@ -18,7 +18,7 @@ class Entity implements ValueAccessInterface private $name; /** - * @return array|Value[]|ValueInterface[] + * @return ValueInterface[] */ public function getValues() { @@ -26,7 +26,7 @@ class Entity implements ValueAccessInterface } /** - * @param Value|ValueInterface $value + * @param ValueInterface $value * @return $this */ public function addValue(ValueInterface $value) @@ -38,7 +38,7 @@ class Entity implements ValueAccessInterface } /** - * @param Value|ValueInterface $value + * @param ValueInterface $value * @return $this */ public function removeValue(ValueInterface $value) diff --git a/More/EAV/ValueAccessInterface.php b/More/EAV/ValueAccessInterface.php index ccb4725..46b7f9f 100644 --- a/More/EAV/ValueAccessInterface.php +++ b/More/EAV/ValueAccessInterface.php @@ -8,17 +8,17 @@ namespace DesignPatterns\More\EAV; interface ValueAccessInterface { /** - * @return Value[]|ValueInterface[]|array + * @return ValueInterface[] */ public function getValues(); /** - * @param Value|ValueInterface $value + * @param ValueInterface $value */ public function addValue(ValueInterface $value); /** - * @param Value|ValueInterface $value + * @param ValueInterface $value */ public function removeValue(ValueInterface $value); } From cf0a0b353b6500867ba5f9bdc6f4be9e67621714 Mon Sep 17 00:00:00 2001 From: Victor Date: Sun, 23 Aug 2015 01:03:00 +0300 Subject: [PATCH 29/69] Fix annotation multiple types for tests --- More/EAV/Tests/EntityTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/More/EAV/Tests/EntityTest.php b/More/EAV/Tests/EntityTest.php index 2e8e58f..ecbd3a2 100644 --- a/More/EAV/Tests/EntityTest.php +++ b/More/EAV/Tests/EntityTest.php @@ -28,7 +28,7 @@ class EntityTest extends \PHPUnit_Framework_TestCase * @dataProvider valueProvider * * @var string $name - * @var array|Value[] $values + * @var Value[] $values */ public function testAddValue($name, array $values) { @@ -47,7 +47,7 @@ class EntityTest extends \PHPUnit_Framework_TestCase * @dataProvider valueProvider * * @var string $name - * @var array|Value[] $values + * @var Value[] $values */ public function testRemoveValue($name, array $values) { From 47c323d36ba0693e870c6f43c384cffec9453baf Mon Sep 17 00:00:00 2001 From: victor Date: Tue, 25 Aug 2015 10:08:49 +0300 Subject: [PATCH 30/69] Simplify tests: Avoid to remove random value --- More/EAV/Tests/AttributeTest.php | 11 ++--------- More/EAV/Tests/EntityTest.php | 5 ++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/More/EAV/Tests/AttributeTest.php b/More/EAV/Tests/AttributeTest.php index 1561acd..c95cdad 100644 --- a/More/EAV/Tests/AttributeTest.php +++ b/More/EAV/Tests/AttributeTest.php @@ -42,9 +42,6 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $colorGold = new Value($attribute); $colorGold->setName('Gold'); $values[] = $colorGold; - $colorSpaceGrey = new Value($attribute); - $colorSpaceGrey->setName('Space Grey'); - $values[] = $colorSpaceGrey; $this->assertEquals($values, $attribute->getValues()); } @@ -65,13 +62,9 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $colorGold = new Value($attribute); $colorGold->setName('Gold'); $values[] = $colorGold; - $colorSpaceGrey = new Value($attribute); - $colorSpaceGrey->setName('Space Grey'); - $values[] = $colorSpaceGrey; - $randomIndex = array_rand($values); - $attribute->removeValue($values[$randomIndex]); - unset($values[$randomIndex]); + $attribute->removeValue($values[0]); + unset($values[0]); $this->assertEquals($values, $attribute->getValues()); } diff --git a/More/EAV/Tests/EntityTest.php b/More/EAV/Tests/EntityTest.php index ecbd3a2..bb88c0f 100644 --- a/More/EAV/Tests/EntityTest.php +++ b/More/EAV/Tests/EntityTest.php @@ -58,9 +58,8 @@ class EntityTest extends \PHPUnit_Framework_TestCase $macBook->addValue($value); } - $randomIndex = array_rand($values); - $macBook->removeValue($values[$randomIndex]); - unset($values[$randomIndex]); + $macBook->removeValue($values[0]); + unset($values[0]); $this->assertEquals($values, $macBook->getValues()); } From a2d372d4bbf35932f29f8a719254ad83393d838b Mon Sep 17 00:00:00 2001 From: victor Date: Tue, 25 Aug 2015 10:32:12 +0300 Subject: [PATCH 31/69] Refactor with SplObjectStorage --- More/EAV/Attribute.php | 24 +++++++++++++++--------- More/EAV/Entity.php | 24 +++++++++++++++--------- More/EAV/Tests/AttributeTest.php | 15 +++++---------- More/EAV/Tests/EntityTest.php | 9 +++++---- More/EAV/ValueAccessInterface.php | 2 +- 5 files changed, 41 insertions(+), 33 deletions(-) diff --git a/More/EAV/Attribute.php b/More/EAV/Attribute.php index a136c22..7a1a88e 100644 --- a/More/EAV/Attribute.php +++ b/More/EAV/Attribute.php @@ -2,23 +2,30 @@ namespace DesignPatterns\More\EAV; +use SplObjectStorage; + /** * Class Attribute */ class Attribute implements ValueAccessInterface { /** - * @var ValueInterface[] + * @var SplObjectStorage */ - private $values = array(); + private $values; /** * @var string */ private $name; + public function __construct() + { + $this->values = new SplObjectStorage(); + } + /** - * @return ValueInterface[] + * @return SplObjectStorage */ public function getValues() { @@ -31,8 +38,9 @@ class Attribute implements ValueAccessInterface */ public function addValue(ValueInterface $value) { - // @TODO I think the $value should be checked for uniqueness first to avoid duplication in array. - $this->values[] = $value; + if (!$this->values->contains($value)) { + $this->values->attach($value); + } return $this; } @@ -43,10 +51,8 @@ class Attribute implements ValueAccessInterface */ public function removeValue(ValueInterface $value) { - $index = array_search($value, $this->values, true); - - if (false !== $index) { - unset($this->values[$index]); + if ($this->values->contains($value)) { + $this->values->detach($value); } return $this; diff --git a/More/EAV/Entity.php b/More/EAV/Entity.php index 58a88e5..e92444e 100644 --- a/More/EAV/Entity.php +++ b/More/EAV/Entity.php @@ -2,23 +2,30 @@ namespace DesignPatterns\More\EAV; +use SplObjectStorage; + /** * Class Entity */ class Entity implements ValueAccessInterface { /** - * @var ValueInterface[] + * @var SplObjectStorage */ - private $values = array(); + private $values; /** * @var string */ private $name; + public function __construct() + { + $this->values = new SplObjectStorage(); + } + /** - * @return ValueInterface[] + * @return SplObjectStorage */ public function getValues() { @@ -31,8 +38,9 @@ class Entity implements ValueAccessInterface */ public function addValue(ValueInterface $value) { - // @TODO I think the $value should be checked for uniqueness first to avoid duplication in array. - $this->values[] = $value; + if (!$this->values->contains($value)) { + $this->values->attach($value); + } return $this; } @@ -43,10 +51,8 @@ class Entity implements ValueAccessInterface */ public function removeValue(ValueInterface $value) { - $index = array_search($value, $this->values, true); - - if (false !== $index) { - unset($this->values[$index]); + if ($this->values->contains($value)) { + $this->values->detach($value); } return $this; diff --git a/More/EAV/Tests/AttributeTest.php b/More/EAV/Tests/AttributeTest.php index c95cdad..7e7efec 100644 --- a/More/EAV/Tests/AttributeTest.php +++ b/More/EAV/Tests/AttributeTest.php @@ -38,12 +38,11 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $colorSilver = new Value($attribute); $colorSilver->setName('Silver'); - $values[] = $colorSilver; $colorGold = new Value($attribute); $colorGold->setName('Gold'); - $values[] = $colorGold; - $this->assertEquals($values, $attribute->getValues()); + $this->assertTrue($attribute->getValues()->contains($colorSilver)); + $this->assertTrue($attribute->getValues()->contains($colorGold)); } /** @@ -51,21 +50,17 @@ class AttributeTest extends \PHPUnit_Framework_TestCase */ public function testRemoveValue() { - $values = array(); - $attribute = new Attribute(); $attribute->setName('Color'); $colorSilver = new Value($attribute); $colorSilver->setName('Silver'); - $values[] = $colorSilver; $colorGold = new Value($attribute); $colorGold->setName('Gold'); - $values[] = $colorGold; - $attribute->removeValue($values[0]); - unset($values[0]); + $attribute->removeValue($colorSilver); - $this->assertEquals($values, $attribute->getValues()); + $this->assertFalse($attribute->getValues()->contains($colorSilver)); + $this->assertTrue($attribute->getValues()->contains($colorGold)); } } diff --git a/More/EAV/Tests/EntityTest.php b/More/EAV/Tests/EntityTest.php index bb88c0f..42c10f3 100644 --- a/More/EAV/Tests/EntityTest.php +++ b/More/EAV/Tests/EntityTest.php @@ -37,9 +37,10 @@ class EntityTest extends \PHPUnit_Framework_TestCase foreach ($values as $value) { $macBook->addValue($value); + $this->assertTrue($macBook->getValues()->contains($value)); } - $this->assertEquals($values, $macBook->getValues()); + $this->assertCount(count($values), $macBook->getValues()); } /** @@ -57,11 +58,11 @@ class EntityTest extends \PHPUnit_Framework_TestCase foreach ($values as $value) { $macBook->addValue($value); } - $macBook->removeValue($values[0]); - unset($values[0]); - $this->assertEquals($values, $macBook->getValues()); + $this->assertFalse($macBook->getValues()->contains($values[0])); + unset($values[0]); + $this->assertCount(count($values), $macBook->getValues()); } /** diff --git a/More/EAV/ValueAccessInterface.php b/More/EAV/ValueAccessInterface.php index 46b7f9f..27820a8 100644 --- a/More/EAV/ValueAccessInterface.php +++ b/More/EAV/ValueAccessInterface.php @@ -8,7 +8,7 @@ namespace DesignPatterns\More\EAV; interface ValueAccessInterface { /** - * @return ValueInterface[] + * @return \SplObjectStorage */ public function getValues(); From 4babc672ae1b21e3464c989afe1919aef89fe6ed Mon Sep 17 00:00:00 2001 From: victor Date: Thu, 27 Aug 2015 13:19:48 +0300 Subject: [PATCH 32/69] Update PHPUnit with dependencies --- composer.json | 2 +- composer.lock | 143 +++++++++++++++++++++++++------------------------- 2 files changed, 73 insertions(+), 72 deletions(-) diff --git a/composer.json b/composer.json index a754501..230ea33 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ ], "minimum-stability": "stable", "require-dev": { - "phpunit/phpunit": "4.6.*", + "phpunit/phpunit": "~4.6", "squizlabs/php_codesniffer": "1.5.*" }, "autoload": { diff --git a/composer.lock b/composer.lock index a9fa4ad..aac9505 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "fd9fc5e6da0104ab5a4bd03fcf53f73a", + "hash": "b2d8b0e179e33882664013cfe68f65f8", "packages": [], "packages-dev": [ { @@ -112,16 +112,16 @@ }, { "name": "phpspec/prophecy", - "version": "v1.4.1", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373" + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373", - "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", "shasum": "" }, "require": { @@ -168,20 +168,20 @@ "spy", "stub" ], - "time": "2015-04-27 22:15:08" + "time": "2015-08-13 10:07:40" }, { "name": "phpunit/php-code-coverage", - "version": "2.1.8", + "version": "2.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6044546998c7627ab997501a3d0db972b3db9790" + "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6044546998c7627ab997501a3d0db972b3db9790", - "reference": "6044546998c7627ab997501a3d0db972b3db9790", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c", + "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c", "shasum": "" }, "require": { @@ -189,7 +189,7 @@ "phpunit/php-file-iterator": "~1.3", "phpunit/php-text-template": "~1.2", "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "~1.0", + "sebastian/environment": "^1.3.2", "sebastian/version": "~1.0" }, "require-dev": { @@ -204,7 +204,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -230,20 +230,20 @@ "testing", "xunit" ], - "time": "2015-07-13 11:25:58" + "time": "2015-08-04 03:42:39" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb" + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", "shasum": "" }, "require": { @@ -277,7 +277,7 @@ "filesystem", "iterator" ], - "time": "2015-04-02 05:19:05" + "time": "2015-06-21 13:08:43" }, { "name": "phpunit/php-text-template", @@ -322,16 +322,16 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.6", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d" + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/83fe1bdc5d47658b727595c14da140da92b3d66d", - "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "shasum": "" }, "require": { @@ -359,20 +359,20 @@ "keywords": [ "timer" ], - "time": "2015-06-13 07:35:30" + "time": "2015-06-21 08:01:12" }, { "name": "phpunit/php-token-stream", - "version": "1.4.3", + "version": "1.4.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9" + "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/7a9b0969488c3c54fd62b4d504b3ec758fd005d9", - "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b", + "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b", "shasum": "" }, "require": { @@ -408,20 +408,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-06-19 03:43:16" + "time": "2015-08-16 08:51:00" }, { "name": "phpunit/phpunit", - "version": "4.6.10", + "version": "4.8.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "7b5fe98b28302a8b25693b2298bca74463336975" + "reference": "2246830f4a1a551c67933e4171bf2126dc29d357" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b5fe98b28302a8b25693b2298bca74463336975", - "reference": "7b5fe98b28302a8b25693b2298bca74463336975", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2246830f4a1a551c67933e4171bf2126dc29d357", + "reference": "2246830f4a1a551c67933e4171bf2126dc29d357", "shasum": "" }, "require": { @@ -431,15 +431,15 @@ "ext-reflection": "*", "ext-spl": "*", "php": ">=5.3.3", - "phpspec/prophecy": "~1.3,>=1.3.1", - "phpunit/php-code-coverage": "~2.0,>=2.0.11", + "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", + "phpunit/php-timer": ">=1.0.6", "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.1", "sebastian/diff": "~1.2", - "sebastian/environment": "~1.2", + "sebastian/environment": "~1.3", "sebastian/exporter": "~1.2", "sebastian/global-state": "~1.0", "sebastian/version": "~1.0", @@ -454,7 +454,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.6.x-dev" + "dev-master": "4.8.x-dev" } }, "autoload": { @@ -480,26 +480,27 @@ "testing", "xunit" ], - "time": "2015-06-03 05:03:30" + "time": "2015-08-24 04:09:38" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.5", + "version": "2.3.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "1c330b1b6e1ea8fd15f2fbea46770576e366855c" + "reference": "5e2645ad49d196e020b85598d7c97e482725786a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/1c330b1b6e1ea8fd15f2fbea46770576e366855c", - "reference": "1c330b1b6e1ea8fd15f2fbea46770576e366855c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a", + "reference": "5e2645ad49d196e020b85598d7c97e482725786a", "shasum": "" }, "require": { - "doctrine/instantiator": "~1.0,>=1.0.2", + "doctrine/instantiator": "^1.0.2", "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2" + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -535,20 +536,20 @@ "mock", "xunit" ], - "time": "2015-07-04 05:41:32" + "time": "2015-08-19 09:14:08" }, { "name": "sebastian/comparator", - "version": "1.1.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", "shasum": "" }, "require": { @@ -562,7 +563,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -599,7 +600,7 @@ "compare", "equality" ], - "time": "2015-01-29 16:28:08" + "time": "2015-07-26 15:48:44" }, { "name": "sebastian/diff", @@ -655,16 +656,16 @@ }, { "name": "sebastian/environment", - "version": "1.2.2", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e" + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e", - "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", "shasum": "" }, "require": { @@ -701,20 +702,20 @@ "environment", "hhvm" ], - "time": "2015-01-01 10:01:08" + "time": "2015-08-03 06:14:51" }, { "name": "sebastian/exporter", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "84839970d05254c73cde183a721c7af13aede943" + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", - "reference": "84839970d05254c73cde183a721c7af13aede943", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", "shasum": "" }, "require": { @@ -767,7 +768,7 @@ "export", "exporter" ], - "time": "2015-01-27 07:23:06" + "time": "2015-06-21 07:55:53" }, { "name": "sebastian/global-state", @@ -822,16 +823,16 @@ }, { "name": "sebastian/recursion-context", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252" + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", "shasum": "" }, "require": { @@ -871,7 +872,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-01-24 09:48:32" + "time": "2015-06-21 08:04:50" }, { "name": "sebastian/version", @@ -985,16 +986,16 @@ }, { "name": "symfony/yaml", - "version": "v2.7.2", + "version": "v2.7.3", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "4bfbe0ed3909bfddd75b70c094391ec1f142f860" + "reference": "71340e996171474a53f3d29111d046be4ad8a0ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/4bfbe0ed3909bfddd75b70c094391ec1f142f860", - "reference": "4bfbe0ed3909bfddd75b70c094391ec1f142f860", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff", + "reference": "71340e996171474a53f3d29111d046be4ad8a0ff", "shasum": "" }, "require": { @@ -1030,7 +1031,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-07-01 11:25:50" + "time": "2015-07-28 14:07:07" } ], "aliases": [], From df621eeeea66021d8855da0f8e1c27700ab6aa3e Mon Sep 17 00:00:00 2001 From: victor Date: Thu, 27 Aug 2015 14:51:46 +0300 Subject: [PATCH 33/69] Fix expected exception test for PHP-7 --- Structural/Decorator/Tests/DecoratorTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Structural/Decorator/Tests/DecoratorTest.php b/Structural/Decorator/Tests/DecoratorTest.php index 1789870..437f068 100644 --- a/Structural/Decorator/Tests/DecoratorTest.php +++ b/Structural/Decorator/Tests/DecoratorTest.php @@ -50,6 +50,21 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase * @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())); } From c6f9dccff1dc1dab3ffb018882932efcaef020d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20R=C3=BCckmann?= Date: Mon, 7 Sep 2015 02:17:17 +0200 Subject: [PATCH 34/69] Changes to take care of unwanted (negative) indices --- Behavioral/Iterator/BookList.php | 2 +- Behavioral/Iterator/BookListIterator.php | 2 +- Behavioral/Iterator/BookListReverseIterator.php | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Behavioral/Iterator/BookList.php b/Behavioral/Iterator/BookList.php index 6fcf265..9c0b9d4 100644 --- a/Behavioral/Iterator/BookList.php +++ b/Behavioral/Iterator/BookList.php @@ -9,7 +9,7 @@ class BookList implements \Countable public function getBook($bookNumberToGet) { - if ((int)$bookNumberToGet <= $this->count()) { + if (isset($this->books[$bookNumberToGet])) { return $this->books[$bookNumberToGet]; } diff --git a/Behavioral/Iterator/BookListIterator.php b/Behavioral/Iterator/BookListIterator.php index bc15ffb..aff7e46 100644 --- a/Behavioral/Iterator/BookListIterator.php +++ b/Behavioral/Iterator/BookListIterator.php @@ -61,7 +61,7 @@ class BookListIterator implements \Iterator */ public function valid() { - return $this->currentBook < $this->bookList->count(); + return null !== $this->bookList->getBook($this->currentBook); } /** diff --git a/Behavioral/Iterator/BookListReverseIterator.php b/Behavioral/Iterator/BookListReverseIterator.php index 973bd0b..5ab2be9 100644 --- a/Behavioral/Iterator/BookListReverseIterator.php +++ b/Behavioral/Iterator/BookListReverseIterator.php @@ -11,13 +11,14 @@ class BookListReverseIterator extends BookListIterator $this->currentBook = $this->bookList->count() - 1; } + /** + * (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--; } - - public function valid() - { - return 0 <= $this->currentBook; - } } From 94381601a4e2a78ca7d6b3fd5a4338b105b39fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cervi=C3=B1o?= Date: Mon, 7 Sep 2015 16:58:23 +0200 Subject: [PATCH 35/69] spanish translation --- locale/es/LC_MESSAGES/README.po | 41 +++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/locale/es/LC_MESSAGES/README.po b/locale/es/LC_MESSAGES/README.po index 3a26db2..52828ee 100644 --- a/locale/es/LC_MESSAGES/README.po +++ b/locale/es/LC_MESSAGES/README.po @@ -21,28 +21,33 @@ msgid "" " 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 "" +msgstr "Esta es una colleción de los conocidos como `patrones de diseño`_ y algunos ejemplos de codigo sobre como " +" implementarlos en PHP. Cada patron tiene una pequeña lista de ejemplos ( la mayoría de " +" ellos de Zend Framework, Symfony2 o Doctrine2 ya que estoy más familiarizado con ellos )" #: ../../README.rst:16 msgid "" "I think the problem with patterns is that often people do know them but " "don't know when to apply which." -msgstr "" +msgstr "Yo creo que el problema con los patrones es que con frecuencia la gente los conoce, pero" +"no saben cuando aplicar cada uno" #: ../../README.rst:20 msgid "Patterns" -msgstr "" +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 "" +msgstr "Los patrones pueden agruparse en aproximadamente tres categorías diferentes. Por favor " +" pincha en **el título de cada pagina de patrón** para ver la explicación completa " +" del patron en la wikipedia." #: ../../README.rst:35 msgid "Contribute" -msgstr "" +msgstr "Contribuir" #: ../../README.rst:37 msgid "" @@ -51,19 +56,22 @@ msgid "" "quality, please check your code using `PHP CodeSniffer`_ against `PSR2 " "standard`_ using ``./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor " ".``." -msgstr "" +msgstr "Por favor tomate la libertad de copiar y extender o añadir tus propios ejemplos y" +"enviar peticiones para añadir tus cambios al repositorio principal. Para establecer una calidad de código " +" consistente, por favor revisa que tu codigo usa `PHP CodeSniffer` con el `PSR2 standard`_ " +"utilizando ``./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor " #: ../../README.rst:44 msgid "License" -msgstr "" +msgstr "Licencia" #: ../../README.rst:46 msgid "(The MIT License)" -msgstr "" +msgstr "(La licencia MIT)" #: ../../README.rst:48 msgid "Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_" -msgstr "" +msgstr "Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_" #: ../../README.rst:50 msgid "" @@ -74,12 +82,20 @@ msgid "" "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 "" @@ -91,3 +107,10 @@ msgid "" "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." From 5d11bc5a87c45e4b211d2420eda7b18e457ea624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=93=D0=BB?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B2?= Date: Sat, 30 May 2015 00:04:55 +0300 Subject: [PATCH 36/69] Memento. Note: not equals to English version! --- Behavioral/Memento/README.rst | 6 +- .../LC_MESSAGES/Behavioral/Memento/README.po | 62 ++++++++++++++----- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/Behavioral/Memento/README.rst b/Behavioral/Memento/README.rst index 2cbc555..911e30e 100644 --- a/Behavioral/Memento/README.rst +++ b/Behavioral/Memento/README.rst @@ -4,9 +4,9 @@ Purpose ------- -It provides the ability to restore an object to its previous state (undo +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 -its implementation (ie, the object is not required to have a functional +it's implementation (i.e., the object is not required to have a functional for return the current state). The memento pattern is implemented with three objects: the Originator, a @@ -14,7 +14,7 @@ Caretaker and a Memento. Memento – an object that *contains a concrete unique snapshot of state* of any object or resource: string, number, array, an instance of class and so on. -The uniqueness in this case not imply the prohibition existence of similar +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 diff --git a/locale/ru/LC_MESSAGES/Behavioral/Memento/README.po b/locale/ru/LC_MESSAGES/Behavioral/Memento/README.po index 913069a..146f4f5 100644 --- a/locale/ru/LC_MESSAGES/Behavioral/Memento/README.po +++ b/locale/ru/LC_MESSAGES/Behavioral/Memento/README.po @@ -1,29 +1,32 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-29 12:18+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2015-05-30 01:42+0300\n" +"Last-Translator: Eugene Glotov \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" #: ../../Behavioral/Memento/README.rst:2 msgid "`Memento`__" -msgstr "" +msgstr "`Хранитель`__" #: ../../Behavioral/Memento/README.rst:5 msgid "Purpose" -msgstr "" +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 "" @@ -39,47 +42,74 @@ msgid "" "other objects or resources - the memento pattern operates on a single " "object." msgstr "" +"Паттерн «Хранитель» реализуется тремя объектами: Создатель, Опекун и " +"Хранитель.\n" +"\n" +"Хранитель — объект, который *хранит конкретный уникальный слепок состояния* " +"любого объекта или ресурса: строка, число, массив, экземпляр класса и так " +"далее. Уникальность в данном случае подразумевает не запрет существования " +"одинаковых состояний в слепках, а то, что состояние можно извлечь в виде " +"независимого клона. Это значит, объект, сохраняемый в Хранитель, должен *быть " +"полной копией исходного объекта а не ссылкой* на исходный объект. Сам объект " +"Хранитель является «непрозрачным объектом» (тот, который никто не может и не " +"должен изменять).\n" +"\n" +"Создатель — это объект, который *содержит в себе актуальное состояние внешнего " +"объекта строго заданного типа* и умеет создать уникальную копию этого " +"состояния, возвращая её обёрнутую в Хранитель. Создатель не знает истории " +"изменений. Создателю можно принудительно установить конкретное состояние " +"извне, которое будет считаться актуальным. Создатель должен позаботиться, " +"чтобы это состояние соответствовало типу объекта, с которым ему разрешено " +"работать. Создатель может (но не обязан) иметь любые методы, но они *не могут " +"менять сохранённое состояние объекта*.\n" +"\n" +"Опекун *управляет историей слепков состояний*. Он может вносить изменения в " +"объект, принимать решение о сохранении состояния внешнего объекта в Создателе, " +"требовать от Создателя слепок текущего состояния, или привести состояние " +"Создателя в соответствие состоянию какого-то слепка из истории." #: ../../Behavioral/Memento/README.rst:23 msgid "Examples" -msgstr "" +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 "" +msgstr "Состояние конечного автомата" #: ../../Behavioral/Memento/README.rst:29 msgid "UML Diagram" -msgstr "" +msgstr "UML Диаграмма" #: ../../Behavioral/Memento/README.rst:36 msgid "Code" -msgstr "" +msgstr "Код" #: ../../Behavioral/Memento/README.rst:38 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Behavioral/Memento/README.rst:40 msgid "Memento.php" -msgstr "" +msgstr "Memento.php" #: ../../Behavioral/Memento/README.rst:46 msgid "Originator.php" -msgstr "" +msgstr "Originator.php" #: ../../Behavioral/Memento/README.rst:52 msgid "Caretaker.php" -msgstr "" +msgstr "Caretaker.php" #: ../../Behavioral/Memento/README.rst:59 msgid "Test" -msgstr "" +msgstr "Тест" #: ../../Behavioral/Memento/README.rst:61 msgid "Tests/MementoTest.php" -msgstr "" +msgstr "Tests/MementoTest.php" From 274d7b2d7a5a76671ff7f257cd330dd3c377a18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20R=C3=BCckmann?= Date: Tue, 8 Sep 2015 23:55:13 +0200 Subject: [PATCH 37/69] Refactor DesignPatterns\Behavioral\Iterator --- Behavioral/Iterator/BookListIterator.php | 2 +- .../Iterator/BookListReverseIterator.php | 56 ++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/Behavioral/Iterator/BookListIterator.php b/Behavioral/Iterator/BookListIterator.php index aff7e46..93df6d7 100644 --- a/Behavioral/Iterator/BookListIterator.php +++ b/Behavioral/Iterator/BookListIterator.php @@ -8,7 +8,7 @@ class BookListIterator implements \Iterator /** * @var BookList */ - protected $bookList; + private $bookList; /** * @var int diff --git a/Behavioral/Iterator/BookListReverseIterator.php b/Behavioral/Iterator/BookListReverseIterator.php index 5ab2be9..d7ec49a 100644 --- a/Behavioral/Iterator/BookListReverseIterator.php +++ b/Behavioral/Iterator/BookListReverseIterator.php @@ -2,15 +2,35 @@ namespace DesignPatterns\Behavioral\Iterator; -class BookListReverseIterator extends BookListIterator +class BookListReverseIterator implements \Iterator { + /** + * @var BookList + */ + private $bookList; + + /** + * @var int + */ + protected $currentBook = 0; + public function __construct(BookList $bookList) { $this->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 @@ -21,4 +41,38 @@ class BookListReverseIterator extends BookListIterator { $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 boolean 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; + } } From 3dc77168693018b45d5e6f7c0cb6e710bd37f037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cervi=C3=B1o?= Date: Thu, 10 Sep 2015 10:16:04 +0200 Subject: [PATCH 38/69] [spanish translation] - wip - creational patterns --- .../Creational/AbstractFactory/README.po | 25 ++++--- .../LC_MESSAGES/Creational/Builder/README.po | 31 ++++++--- .../Creational/FactoryMethod/README.po | 12 ++-- .../LC_MESSAGES/Creational/Multiton/README.po | 12 ++-- .../es/LC_MESSAGES/Creational/Pool/README.po | 45 +++++++----- .../Creational/Prototype/README.po | 36 ++++++---- locale/es/LC_MESSAGES/Creational/README.po | 25 ++++--- .../Creational/SimpleFactory/README.po | 2 +- .../Creational/Singleton/README.po | 45 +++++++----- .../Creational/StaticFactory/README.po | 45 +++++++----- locale/es/LC_MESSAGES/README.po | 69 ++++++++++--------- 11 files changed, 210 insertions(+), 137 deletions(-) diff --git a/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po index 04a383e..3325520 100644 --- a/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po +++ b/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po @@ -1,23 +1,25 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-29 12:18+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: es\n" +"PO-Revision-Date: \n" +"Last-Translator: Daniel González \n" +"Language-Team: \n" +"X-Generator: Poedit 1.5.4\n" #: ../../Creational/AbstractFactory/README.rst:2 msgid "`Abstract Factory`__" -msgstr "" +msgstr "`Factoria Abstracta`__" #: ../../Creational/AbstractFactory/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "Proposito" #: ../../Creational/AbstractFactory/README.rst:7 msgid "" @@ -26,18 +28,23 @@ msgid "" "interface. The client of the abstract factory does not care about how these " "objects are created, he just knows how they go together." msgstr "" +"Para crear una serie de objetos relacionados o dependientes sin especificar " +"a que clase concreta pertenecen. Normalmente las clases creadas implementan " +"las mismas interfaces. El cliente de la factoría abstracta no necesita " +"preocupase por como estos objetos son creados, el solo sabe que tiene que " +"hacer con ellos." #: ../../Creational/AbstractFactory/README.rst:13 msgid "UML Diagram" -msgstr "" +msgstr "Diagrama UML" #: ../../Creational/AbstractFactory/README.rst:20 msgid "Code" -msgstr "" +msgstr "Código" #: ../../Creational/AbstractFactory/README.rst:22 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/AbstractFactory/README.rst:24 msgid "AbstractFactory.php" diff --git a/locale/es/LC_MESSAGES/Creational/Builder/README.po b/locale/es/LC_MESSAGES/Creational/Builder/README.po index 79d4fe3..69824fb 100644 --- a/locale/es/LC_MESSAGES/Creational/Builder/README.po +++ b/locale/es/LC_MESSAGES/Creational/Builder/README.po @@ -1,49 +1,60 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-29 12:18+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2015-09-10 10:12+0100\n" +"Last-Translator: Daniel González \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Language: es\n" +"Language-Team: \n" +"X-Generator: Poedit 1.5.4\n" #: ../../Creational/Builder/README.rst:2 msgid "`Builder`__" -msgstr "" +msgstr "`Constructor`__" #: ../../Creational/Builder/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "Proposito" #: ../../Creational/Builder/README.rst:7 msgid "Builder is an interface that build parts of a complex object." msgstr "" +"El constructor es una interfaz que construye parte de un objeto complejo." #: ../../Creational/Builder/README.rst:9 msgid "" "Sometimes, if the builder has a better knowledge of what it builds, this " "interface could be an abstract class with default methods (aka adapter)." msgstr "" +"A veces, si el constructor conoce bien lo que está construyendo, esta " +"interfaz podría ser una clase abstracta con métodos por defecto ( también " +"conocido como Adaptador )" #: ../../Creational/Builder/README.rst:12 msgid "" "If you have a complex inheritance tree for objects, it is logical to have a " "complex inheritance tree for builders too." msgstr "" +"Si tienes una herencia compleja de tu árbol de objetos, es lógico tener " +"también una herencia compleja en el árbol de constructores." #: ../../Creational/Builder/README.rst:15 msgid "" "Note: Builders have often a fluent interface, see the mock builder of " "PHPUnit for example." msgstr "" +"Nota: Los constructores suelen tener una interfaz fluida, fíjate en el mock " +"builder de PHPUnit por ejemplo." #: ../../Creational/Builder/README.rst:19 msgid "Examples" -msgstr "" +msgstr "Ejemplos" #: ../../Creational/Builder/README.rst:21 msgid "PHPUnit: Mock Builder" @@ -51,15 +62,15 @@ msgstr "" #: ../../Creational/Builder/README.rst:24 msgid "UML Diagram" -msgstr "" +msgstr "Diagrama UML" #: ../../Creational/Builder/README.rst:31 msgid "Code" -msgstr "" +msgstr "Código" #: ../../Creational/Builder/README.rst:33 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/Builder/README.rst:35 msgid "Director.php" diff --git a/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po index b65c56b..4ccb9a1 100644 --- a/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po +++ b/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po @@ -1,15 +1,17 @@ -# +# 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" +"PO-Revision-Date: 2015-09-10 10:02+0100\n" +"Last-Translator: Daniel González \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: es\n" +"Language-Team: \n" +"X-Generator: Poedit 1.5.4\n" #: ../../Creational/FactoryMethod/README.rst:2 msgid "`Factory Method`__" @@ -51,7 +53,7 @@ msgstr "" #: ../../Creational/FactoryMethod/README.rst:29 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/FactoryMethod/README.rst:31 msgid "FactoryMethod.php" diff --git a/locale/es/LC_MESSAGES/Creational/Multiton/README.po b/locale/es/LC_MESSAGES/Creational/Multiton/README.po index 702271d..d465309 100644 --- a/locale/es/LC_MESSAGES/Creational/Multiton/README.po +++ b/locale/es/LC_MESSAGES/Creational/Multiton/README.po @@ -1,15 +1,17 @@ -# +# 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" +"PO-Revision-Date: 2015-09-10 10:02+0100\n" +"Last-Translator: Daniel González \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: es\n" +"Language-Team: \n" +"X-Generator: Poedit 1.5.4\n" #: ../../Creational/Multiton/README.rst:2 msgid "Multiton" @@ -53,7 +55,7 @@ msgstr "" #: ../../Creational/Multiton/README.rst:29 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/Multiton/README.rst:31 msgid "Multiton.php" diff --git a/locale/es/LC_MESSAGES/Creational/Pool/README.po b/locale/es/LC_MESSAGES/Creational/Pool/README.po index 8defedd..99fbef8 100644 --- a/locale/es/LC_MESSAGES/Creational/Pool/README.po +++ b/locale/es/LC_MESSAGES/Creational/Pool/README.po @@ -1,19 +1,21 @@ -# +# 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" +"PO-Revision-Date: 2015-09-10 10:03+0100\n" +"Last-Translator: Daniel González \n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"MIME-Version: 1.0\n" +"Language: es\n" +"Language-Team: \n" +"X-Generator: Poedit 1.5.4\n" #: ../../Creational/Pool/README.rst:2 msgid "`Pool`__" -msgstr "" +msgstr "`Pila`__" #: ../../Creational/Pool/README.rst:4 msgid "" @@ -24,16 +26,27 @@ msgid "" "object. When the client has finished, it returns the object, which is a " "specific type of factory object, to the pool rather than destroying it." msgstr "" +"El **Patrón Pila** es un patrón de diseño creacional que utiliza un conjunto " +"de objetos inicializados y los mantiene listos para usar el la \"pila\" en " +"lugar de crearlos y destruirlos bajo demanda. Un cliente puede pedirle a la " +"pila un objeto, realizar las operaciones necesarias sobre el. Cuando el " +"cliente ha terminado devuelve el objeto a la pila en lugar de destruirlo." #: ../../Creational/Pool/README.rst:11 msgid "" -"Object pooling can offer a significant performance boost in situations where" -" the cost of initializing a class instance is high, the rate of " -"instantiation of a class is high, and the number of instances in use at any " -"one time is low. The pooled object is obtained in predictable time when " -"creation of the new objects (especially over network) may take variable " -"time." +"Object pooling can offer a significant performance boost in situations where " +"the cost of initializing a class instance is high, the rate of instantiation " +"of a class is high, and the number of instances in use at any one time is " +"low. The pooled object is obtained in predictable time when creation of the " +"new objects (especially over network) may take variable time." msgstr "" +"Mantener los objetos en una pila puede ofrecer mejoras significativas de " +"rendimiento en aquellas situaciones donde el coste de inicializar las " +"instancias es alto, el volumen de veces que se instancia la clase es alto y " +"el número de instancias que se mantienen en uso a la vez es bajo. El objeto " +"puede recuperase de la pila en una cantidad de tiempo predecible, cuando la " +"creación de nuevos objetos ( especialmente cuando se realiza a través de una " +"red ) puede variar." #: ../../Creational/Pool/README.rst:18 msgid "" @@ -42,19 +55,19 @@ msgid "" "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 "" +msgstr "Sin embargo estos beneficios " #: ../../Creational/Pool/README.rst:25 msgid "UML Diagram" -msgstr "" +msgstr "Diagrama UML" #: ../../Creational/Pool/README.rst:32 msgid "Code" -msgstr "" +msgstr "Código" #: ../../Creational/Pool/README.rst:34 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/Pool/README.rst:36 msgid "Pool.php" diff --git a/locale/es/LC_MESSAGES/Creational/Prototype/README.po b/locale/es/LC_MESSAGES/Creational/Prototype/README.po index fac09ef..dfd8b5e 100644 --- a/locale/es/LC_MESSAGES/Creational/Prototype/README.po +++ b/locale/es/LC_MESSAGES/Creational/Prototype/README.po @@ -1,68 +1,74 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-29 12:18+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2015-09-09 16:26+0100\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: es\n" +"Last-Translator: Daniel González \n" +"Language-Team: \n" +"X-Generator: Poedit 1.5.4\n" #: ../../Creational/Prototype/README.rst:2 msgid "`Prototype`__" -msgstr "" +msgstr "`Prototype`__" #: ../../Creational/Prototype/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "Proposito" #: ../../Creational/Prototype/README.rst:7 msgid "" "To avoid the cost of creating objects the standard way (new Foo()) and " "instead create a prototype and clone it." msgstr "" +"Evitar el cote de crear objetos de la forma estandar (new Foo()). En su " +"lugar crear una instancia y clonarla." #: ../../Creational/Prototype/README.rst:11 msgid "Examples" -msgstr "" +msgstr "Ejemplos" #: ../../Creational/Prototype/README.rst:13 msgid "" "Large amounts of data (e.g. create 1,000,000 rows in a database at once via " "a ORM)." msgstr "" +"Grandes cantidades de datos ( ej. crear 1.000.000 de registros en la base de " +"datos a través del ORM )." #: ../../Creational/Prototype/README.rst:17 msgid "UML Diagram" -msgstr "" +msgstr "Diagrama UML" #: ../../Creational/Prototype/README.rst:24 msgid "Code" -msgstr "" +msgstr "Código" #: ../../Creational/Prototype/README.rst:26 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/Prototype/README.rst:28 msgid "index.php" -msgstr "" +msgstr "index.php" #: ../../Creational/Prototype/README.rst:34 msgid "BookPrototype.php" -msgstr "" +msgstr "BookPrototype.php" #: ../../Creational/Prototype/README.rst:40 msgid "BarBookPrototype.php" -msgstr "" +msgstr "BarBookPrototype.php" #: ../../Creational/Prototype/README.rst:46 msgid "FooBookPrototype.php" -msgstr "" +msgstr "FooBookPrototype.php" #: ../../Creational/Prototype/README.rst:53 msgid "Test" -msgstr "" +msgstr "Test" diff --git a/locale/es/LC_MESSAGES/Creational/README.po b/locale/es/LC_MESSAGES/Creational/README.po index 72f543b..7a5db3c 100644 --- a/locale/es/LC_MESSAGES/Creational/README.po +++ b/locale/es/LC_MESSAGES/Creational/README.po @@ -1,25 +1,32 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-29 12:18+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2015-09-08 17:17+0100\n" +"Last-Translator: Daniel González \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.4\n" +"Language: es\n" #: ../../Creational/README.rst:2 msgid "`Creational`__" -msgstr "" +msgstr "`Creacionales`__" #: ../../Creational/README.rst:4 msgid "" -"In software engineering, creational design patterns are design patterns that" -" deal with object creation mechanisms, trying to create objects in a manner " -"suitable to the situation. The basic form of object creation could result in" -" design problems or added complexity to the design. Creational design " +"In software engineering, creational design patterns are design patterns that " +"deal with object creation mechanisms, trying to create objects in a manner " +"suitable to the situation. The basic form of object creation could result in " +"design problems or added complexity to the design. Creational design " "patterns solve this problem by somehow controlling this object creation." msgstr "" +"En ingeniería del software, los patrones de diseño creacionales son patrones " +"que se encargan del los mecanismos de creación de los objetos, intentando " +"crear objetos de una manera adecuada a cada situación. La forma básica de " +"creación de objetos podría generar un problemas de diseño o añadir " +"complejidad al diseño. Los patrones de diseño creacionales resuelven este " +"problema controlando de alguna forma la creación de objetos." diff --git a/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po index d011ad6..a56e3b4 100644 --- a/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po +++ b/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -6,10 +6,10 @@ msgstr "" "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" +"Language: es\n" #: ../../Creational/SimpleFactory/README.rst:2 msgid "Simple Factory" diff --git a/locale/es/LC_MESSAGES/Creational/Singleton/README.po b/locale/es/LC_MESSAGES/Creational/Singleton/README.po index 5d108ca..0bb78f3 100644 --- a/locale/es/LC_MESSAGES/Creational/Singleton/README.po +++ b/locale/es/LC_MESSAGES/Creational/Singleton/README.po @@ -1,75 +1,84 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-29 12:18+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2015-09-08 17:34+0100\n" +"Last-Translator: Daniel González \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.4\n" +"Language: es\n" +"Language-Team: \n" #: ../../Creational/Singleton/README.rst:2 msgid "`Singleton`__" -msgstr "" +msgstr "`Singleton`__" #: ../../Creational/Singleton/README.rst:4 msgid "" "**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND " "MAINTAINABILITY USE DEPENDENCY INJECTION!**" msgstr "" +"**ESTO ES CONSIDERADO UN ANTI-PATRÓN. PARA MEJOR TESTEABILIDAD Y " +"MANTENIBILIDAD USA INYECCIÓN DE DEPENDENCIAS**" #: ../../Creational/Singleton/README.rst:8 msgid "Purpose" -msgstr "" +msgstr "Proposito" #: ../../Creational/Singleton/README.rst:10 msgid "" -"To have only one instance of this object in the application that will handle" -" all calls." +"To have only one instance of this object in the application that will handle " +"all calls." msgstr "" +"Tener una única instancia de este objeto en la aplicación que pueda " +"encargarse de todas las llamadas." #: ../../Creational/Singleton/README.rst:14 msgid "Examples" -msgstr "" +msgstr "Ejemplos" #: ../../Creational/Singleton/README.rst:16 msgid "DB Connector" -msgstr "" +msgstr "Conexión a la base de datos" #: ../../Creational/Singleton/README.rst:17 msgid "" "Logger (may also be a Multiton if there are many log files for several " "purposes)" msgstr "" +"Logger ( también podría ser un Multiton si hay varios ficheros de log para " +"diferentes propósitos )" #: ../../Creational/Singleton/README.rst:19 -msgid "" -"Lock file for the application (there is only one in the filesystem ...)" +msgid "Lock file for the application (there is only one in the filesystem ...)" msgstr "" +"Bloqueo de ficheros para la aplicación ( Solo hay uno en el sistema de " +"ficheros )" #: ../../Creational/Singleton/README.rst:23 msgid "UML Diagram" -msgstr "" +msgstr "Diagrama UML" #: ../../Creational/Singleton/README.rst:30 msgid "Code" -msgstr "" +msgstr "Código" #: ../../Creational/Singleton/README.rst:32 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "Puedes ver este código en `GitHub`_" #: ../../Creational/Singleton/README.rst:34 msgid "Singleton.php" -msgstr "" +msgstr "Singleton.php" #: ../../Creational/Singleton/README.rst:41 msgid "Test" -msgstr "" +msgstr "Test" #: ../../Creational/Singleton/README.rst:43 msgid "Tests/SingletonTest.php" -msgstr "" +msgstr "Tests/SingletonTest.php" diff --git a/locale/es/LC_MESSAGES/Creational/StaticFactory/README.po b/locale/es/LC_MESSAGES/Creational/StaticFactory/README.po index 4a6f64e..7005abb 100644 --- a/locale/es/LC_MESSAGES/Creational/StaticFactory/README.po +++ b/locale/es/LC_MESSAGES/Creational/StaticFactory/README.po @@ -1,23 +1,25 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-29 12:18+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2015-09-08 17:47+0100\n" +"Last-Translator: Daniel González \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: es\n" +"Language-Team: \n" +"X-Generator: Poedit 1.5.4\n" #: ../../Creational/StaticFactory/README.rst:2 msgid "Static Factory" -msgstr "" +msgstr "Static Factory" #: ../../Creational/StaticFactory/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "Proposito" #: ../../Creational/StaticFactory/README.rst:7 msgid "" @@ -27,49 +29,56 @@ msgid "" "method to create all types of objects it can create. It is usually named " "``factory`` or ``build``." msgstr "" +"Parecido a AbstractFactory, este patrón es usado para crear conjuntos de " +"objetos relacionados o dependientes. La diferencia entre este y la factoría " +"abstracta es que el patrón factoría estática usa un sólo método estático " +"para crear todos los tipos de objetos que puede crear. Este método " +"normalmente se llama ``factory`` or ``build``." #: ../../Creational/StaticFactory/README.rst:14 msgid "Examples" -msgstr "" +msgstr "Ejemplos" #: ../../Creational/StaticFactory/README.rst:16 msgid "" -"Zend Framework: ``Zend_Cache_Backend`` or ``_Frontend`` use a factory method" -" create cache backends or frontends" +"Zend Framework: ``Zend_Cache_Backend`` or ``_Frontend`` use a factory method " +"create cache backends or frontends" msgstr "" +"Zend Framework: ``Zend_Cache_Backend`` or ``_Frontend`` usa un método " +"factoría para crear la cache de las aplicaciones." #: ../../Creational/StaticFactory/README.rst:20 msgid "UML Diagram" -msgstr "" +msgstr "Diagrama UML" #: ../../Creational/StaticFactory/README.rst:27 msgid "Code" -msgstr "" +msgstr "Código" #: ../../Creational/StaticFactory/README.rst:29 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/StaticFactory/README.rst:31 msgid "StaticFactory.php" -msgstr "" +msgstr "StaticFactory.php" #: ../../Creational/StaticFactory/README.rst:37 msgid "FormatterInterface.php" -msgstr "" +msgstr "FormatterInterface.php" #: ../../Creational/StaticFactory/README.rst:43 msgid "FormatString.php" -msgstr "" +msgstr "FormatString.php" #: ../../Creational/StaticFactory/README.rst:49 msgid "FormatNumber.php" -msgstr "" +msgstr "FormatNumber.php" #: ../../Creational/StaticFactory/README.rst:56 msgid "Test" -msgstr "" +msgstr "Test" #: ../../Creational/StaticFactory/README.rst:58 msgid "Tests/StaticFactoryTest.php" -msgstr "" +msgstr "Tests/StaticFactoryTest.php" diff --git a/locale/es/LC_MESSAGES/README.po b/locale/es/LC_MESSAGES/README.po index 52828ee..ddebaed 100644 --- a/locale/es/LC_MESSAGES/README.po +++ b/locale/es/LC_MESSAGES/README.po @@ -1,15 +1,17 @@ -# +# 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" +"PO-Revision-Date: 2015-09-08 17:14+0100\n" +"Last-Translator: Daniel González \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.4\n" +"Language: es\n" +"Language-Team: \n" #: ../../README.rst:5 msgid "DesignPatternsPHP" @@ -17,20 +19,23 @@ 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 " +"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 colleción de los conocidos como `patrones de diseño`_ y algunos ejemplos de codigo sobre como " -" implementarlos en PHP. Cada patron tiene una pequeña lista de ejemplos ( la mayoría de " -" ellos de Zend Framework, Symfony2 o Doctrine2 ya que estoy más familiarizado con ellos )" +msgstr "" +"Esto es un recopilatorio de los conocidos como `patrones de diseño`_ junto " +"con algunos ejemplos de código sobre como implementarlos en PHP. Cada patrón " +"tiene una pequeña lista de ejemplos ( la mayoría de ellos de Zend " +"Framework, Symfony2 o Doctrine2 ya que estoy más familiarizado con ellos )." #: ../../README.rst:16 msgid "" "I think the problem with patterns is that often people do know them but " "don't know when to apply which." -msgstr "Yo creo que el problema con los patrones es que con frecuencia la gente los conoce, pero" -"no saben cuando aplicar cada uno" +msgstr "" +"El problema con los patrones es que la mayoría de la gente los conoce, pero " +"no saben cuando aplicarlos." #: ../../README.rst:20 msgid "Patterns" @@ -38,12 +43,13 @@ msgstr "Patrones" #: ../../README.rst:22 msgid "" -"The patterns can be structured in roughly three different categories. Please" -" click on **the title of every pattern's page** for a full explanation of " -"the pattern on Wikipedia." -msgstr "Los patrones pueden agruparse en aproximadamente tres categorías diferentes. Por favor " -" pincha en **el título de cada pagina de patrón** para ver la explicación completa " -" del patron en la wikipedia." +"The patterns can be structured in roughly three different categories. Please " +"click on **the title of every pattern's page** for a full explanation of the " +"pattern on Wikipedia." +msgstr "" +"Los patrones pueden clasificarse en tres categorías diferentes. Por favor " +"pincha en **el título de cada pagina de patrón** para ver la explicación " +"completa del patrón en la Wikipedia." #: ../../README.rst:35 msgid "Contribute" @@ -54,12 +60,13 @@ msgid "" "Please feel free to fork and extend existing or add your own examples and " "send a pull request with your changes! To establish a consistent code " "quality, please check your code using `PHP CodeSniffer`_ against `PSR2 " -"standard`_ using ``./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor " -".``." -msgstr "Por favor tomate la libertad de copiar y extender o añadir tus propios ejemplos y" -"enviar peticiones para añadir tus cambios al repositorio principal. Para establecer una calidad de código " -" consistente, por favor revisa que tu codigo usa `PHP CodeSniffer` con el `PSR2 standard`_ " -"utilizando ``./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor " +"standard`_ using ``./vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor .``." +msgstr "" +"Por favor tomate la libertad de copiar, extender y añadir tus propios " +"ejemplos y enviar una solicitud para añadir tus cambios al repositorio " +"principal. Para establecer una calidad de código consistente revisa que tu " +"código usa `PHP CodeSniffer` con el `PSR2 standard`_ utilizando ``./vendor/" +"bin/phpcs -p --standard=PSR2 --ignore=vendor " #: ../../README.rst:44 msgid "License" @@ -75,15 +82,15 @@ msgstr "Copyright (c) 2014 `Dominik Liebler`_ and `contributors`_" #: ../../README.rst:50 msgid "" -"Permission is hereby granted, free of charge, to any person obtaining a copy" -" of this software and associated documentation files (the 'Software'), to " +"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 " +"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 " @@ -104,13 +111,13 @@ msgid "" "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." +"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." +"FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS " +"IN THE SOFTWARE." From 98aa292e234fdd66c2043cfa5cbe62d4eb6a22ec Mon Sep 17 00:00:00 2001 From: yplam Date: Fri, 11 Sep 2015 18:31:07 +0800 Subject: [PATCH 39/69] translate some Structural patterns --- .../LC_MESSAGES/Behavioral/Memento/README.po | 116 +++++++++++++----- .../LC_MESSAGES/Creational/Multiton/README.po | 10 +- .../LC_MESSAGES/More/Delegation/README.po | 25 +++- .../LC_MESSAGES/Structural/Adapter/README.po | 20 +-- .../LC_MESSAGES/Structural/Bridge/README.po | 15 +-- .../Structural/Composite/README.po | 22 ++-- .../Structural/DataMapper/README.po | 24 ++-- .../Structural/DependencyInjection/README.po | 2 +- .../LC_MESSAGES/Structural/Registry/README.po | 19 +-- 9 files changed, 170 insertions(+), 83 deletions(-) diff --git a/locale/zh_CN/LC_MESSAGES/Behavioral/Memento/README.po b/locale/zh_CN/LC_MESSAGES/Behavioral/Memento/README.po index 913069a..fa2378c 100644 --- a/locale/zh_CN/LC_MESSAGES/Behavioral/Memento/README.po +++ b/locale/zh_CN/LC_MESSAGES/Behavioral/Memento/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -19,67 +19,117 @@ msgstr "" 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 +#: ../../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:46 msgid "UML Diagram" msgstr "" -#: ../../Behavioral/Memento/README.rst:36 +#: ../../Behavioral/Memento/README.rst:53 msgid "Code" msgstr "" -#: ../../Behavioral/Memento/README.rst:38 +#: ../../Behavioral/Memento/README.rst:55 msgid "You can also find these code on `GitHub`_" msgstr "" -#: ../../Behavioral/Memento/README.rst:40 +#: ../../Behavioral/Memento/README.rst:57 msgid "Memento.php" msgstr "" -#: ../../Behavioral/Memento/README.rst:46 +#: ../../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 "" + +#: ../../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/Creational/Multiton/README.po b/locale/zh_CN/LC_MESSAGES/Creational/Multiton/README.po index 7ce7048..d187f1b 100644 --- a/locale/zh_CN/LC_MESSAGES/Creational/Multiton/README.po +++ b/locale/zh_CN/LC_MESSAGES/Creational/Multiton/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -19,8 +19,7 @@ msgstr "多例" msgid "" "**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND " "MAINTAINABILITY USE DEPENDENCY INJECTION!**" -msgstr "" -"**多例模式已经被考虑列入到反模式中!请使用依赖注入获得更好的代码可测试性和可控性!**" +msgstr "**多例模式已经被考虑列入到反模式中!请使用依赖注入获得更好的代码可测试性和可控性!**" #: ../../Creational/Multiton/README.rst:8 msgid "Purpose" @@ -61,5 +60,6 @@ msgid "Multiton.php" msgstr "" #: ../../Creational/Multiton/README.rst:38 -msgid "测试" -msgstr "" +msgid "Test" +msgstr "测试" + diff --git a/locale/zh_CN/LC_MESSAGES/More/Delegation/README.po b/locale/zh_CN/LC_MESSAGES/More/Delegation/README.po index 169e8fd..0b52512 100644 --- a/locale/zh_CN/LC_MESSAGES/More/Delegation/README.po +++ b/locale/zh_CN/LC_MESSAGES/More/Delegation/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -19,10 +19,6 @@ msgstr "" msgid "Purpose" msgstr "" -#: ../../More/Delegation/README.rst:7 ../../More/Delegation/README.rst:12 -msgid "..." -msgstr "" - #: ../../More/Delegation/README.rst:10 msgid "Examples" msgstr "" @@ -58,3 +54,22 @@ msgstr "" #: ../../More/Delegation/README.rst:47 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/Structural/Adapter/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Adapter/README.po index b351fc9..99ac6ec 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Adapter/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Adapter/README.po @@ -13,11 +13,11 @@ msgstr "" #: ../../Structural/Adapter/README.rst:2 msgid "`Adapter / Wrapper`__" -msgstr "" +msgstr "`适配器模式`__" #: ../../Structural/Adapter/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "目的" #: ../../Structural/Adapter/README.rst:7 msgid "" @@ -26,32 +26,36 @@ msgid "" "incompatible interfaces by providing it's interface to clients while using " "the original interface." msgstr "" +"将某个类的接口转换成与另一个接口兼容。适配器通过将原始接口进行转换,给用户" +"提供一个兼容接口,使得原来因为接口不同而无法一起使用的类可以得到兼容。" #: ../../Structural/Adapter/README.rst:13 msgid "Examples" -msgstr "" +msgstr "例子" #: ../../Structural/Adapter/README.rst:15 msgid "DB Client libraries adapter" -msgstr "" +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 "" +"使用不同的webservices,通过适配器来标准化输出数据,从而保证不同webservice输出的" +"数据是一致的" #: ../../Structural/Adapter/README.rst:20 msgid "UML Diagram" -msgstr "" +msgstr "UML 图" #: ../../Structural/Adapter/README.rst:27 msgid "Code" -msgstr "" +msgstr "代码" #: ../../Structural/Adapter/README.rst:29 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Adapter/README.rst:31 msgid "PaperBookInterface.php" @@ -75,7 +79,7 @@ msgstr "" #: ../../Structural/Adapter/README.rst:62 msgid "Test" -msgstr "" +msgstr "测试" #: ../../Structural/Adapter/README.rst:64 msgid "Tests/AdapterTest.php" diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Bridge/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Bridge/README.po index a27619b..54266dc 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Bridge/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Bridge/README.po @@ -13,21 +13,22 @@ msgstr "" #: ../../Structural/Bridge/README.rst:2 msgid "`Bridge`__" -msgstr "" +msgstr "`桥接模式`__" #: ../../Structural/Bridge/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "目的" #: ../../Structural/Bridge/README.rst:7 msgid "" "Decouple an abstraction from its implementation so that the two can vary " "independently." msgstr "" +"解耦一个对象的实现与抽象,这样两者可以独立地变化。" #: ../../Structural/Bridge/README.rst:11 msgid "Sample:" -msgstr "" +msgstr "例子" #: ../../Structural/Bridge/README.rst:13 msgid "`Symfony DoctrineBridge `__" @@ -35,15 +36,15 @@ msgstr "" #: ../../Structural/Bridge/README.rst:17 msgid "UML Diagram" -msgstr "" +msgstr "UML 图" #: ../../Structural/Bridge/README.rst:24 msgid "Code" -msgstr "" +msgstr "代码" #: ../../Structural/Bridge/README.rst:26 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Bridge/README.rst:28 msgid "Workshop.php" @@ -71,7 +72,7 @@ msgstr "" #: ../../Structural/Bridge/README.rst:65 msgid "Test" -msgstr "" +msgstr "测试" #: ../../Structural/Bridge/README.rst:67 msgid "Tests/BridgeTest.php" diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Composite/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Composite/README.po index 90ddd21..8c615d0 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Composite/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Composite/README.po @@ -13,45 +13,49 @@ msgstr "" #: ../../Structural/Composite/README.rst:2 msgid "`Composite`__" -msgstr "" +msgstr "`组合模式`__" #: ../../Structural/Composite/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "目的" #: ../../Structural/Composite/README.rst:7 msgid "" "To treat a group of objects the same way as a single instance of the object." -msgstr "" +msgstr "以单个对象的方式来对待一组对象" #: ../../Structural/Composite/README.rst:11 msgid "Examples" -msgstr "" +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 "" +msgstr "" +"form类的实例包含多个子元素,而它也像单个子元素那样响应render()请求,当" +"调用``render()``方法时,它会历遍所有的子元素,调用``render()``方法" #: ../../Structural/Composite/README.rst:16 msgid "" "``Zend_Config``: a tree of configuration options, each one is a " "``Zend_Config`` object itself" msgstr "" +"``Zend_Config``: 配置选项树, 其每一个分支都是 " +"``Zend_Config`` 对象" #: ../../Structural/Composite/README.rst:20 msgid "UML Diagram" -msgstr "" +msgstr "UML 图" #: ../../Structural/Composite/README.rst:27 msgid "Code" -msgstr "" +msgstr "代码" #: ../../Structural/Composite/README.rst:29 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Composite/README.rst:31 msgid "FormElement.php" @@ -71,7 +75,7 @@ msgstr "" #: ../../Structural/Composite/README.rst:56 msgid "Test" -msgstr "" +msgstr "测试" #: ../../Structural/Composite/README.rst:58 msgid "Tests/CompositeTest.php" diff --git a/locale/zh_CN/LC_MESSAGES/Structural/DataMapper/README.po b/locale/zh_CN/LC_MESSAGES/Structural/DataMapper/README.po index 5ccd9a3..1dca56f 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/DataMapper/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/DataMapper/README.po @@ -13,11 +13,11 @@ msgstr "" #: ../../Structural/DataMapper/README.rst:2 msgid "`Data Mapper`__" -msgstr "" +msgstr "`数据映射器`__" #: ../../Structural/DataMapper/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "目的" #: ../../Structural/DataMapper/README.rst:7 msgid "" @@ -31,34 +31,42 @@ msgid "" "many different domain entity types, dedicated mappers will handle one or a " "few." msgstr "" +"数据映射器是一个数据访问层,用于将数据在持久性数据存储(通常是一个关系数据库)" +"和内存中的数据表示(领域层)之间进行相互转换。其目的是为了将数据的内存表示、持久存储、" +"数据访问进行分离。该层由一个或者多个映射器组成(或者数据访问对象),并且进行数据的转换。" +"映射器的实现在范围上有所不同。通用映射器将处理许多不同领域的实体类型," +"而专用映射器将处理一个或几个。" #: ../../Structural/DataMapper/README.rst:17 msgid "" "The key point of this pattern is, unlike Active Record pattern, the data " "model follows Single Responsibility Principle." msgstr "" +"此模式的主要特点是,与Active Record不同,其数据模式遵循单一职责原则" +"(Single Responsibility Principle)。" #: ../../Structural/DataMapper/README.rst:21 msgid "Examples" -msgstr "" +msgstr "例子" #: ../../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\" 作为DAO" #: ../../Structural/DataMapper/README.rst:27 msgid "UML Diagram" -msgstr "" +msgstr "UML 图" #: ../../Structural/DataMapper/README.rst:34 msgid "Code" -msgstr "" +msgstr "代码" #: ../../Structural/DataMapper/README.rst:36 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/DataMapper/README.rst:38 msgid "User.php" @@ -70,7 +78,7 @@ msgstr "" #: ../../Structural/DataMapper/README.rst:51 msgid "Test" -msgstr "" +msgstr "测试" #: ../../Structural/DataMapper/README.rst:53 msgid "Tests/DataMapperTest.php" diff --git a/locale/zh_CN/LC_MESSAGES/Structural/DependencyInjection/README.po b/locale/zh_CN/LC_MESSAGES/Structural/DependencyInjection/README.po index 5111f59..426e487 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/DependencyInjection/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/DependencyInjection/README.po @@ -13,7 +13,7 @@ msgstr "" #: ../../Structural/DependencyInjection/README.rst:2 msgid "`Dependency Injection`__" -msgstr "`依赖注入`__" +msgstr "`依赖注入`" #: ../../Structural/DependencyInjection/README.rst:5 msgid "Purpose" diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po index 843138c..636207b 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po @@ -1,4 +1,4 @@ -# +# msgid "" msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" @@ -30,12 +30,6 @@ msgstr "" msgid "Examples" msgstr "" -#: ../../Structural/Registry/README.rst:14 -msgid "" -"Zend Framework: ``Zend_Registry`` holds the application's logger object, " -"front controller etc." -msgstr "" - #: ../../Structural/Registry/README.rst:16 msgid "" "Yii Framework: ``CWebApplication`` holds all the application components, " @@ -65,3 +59,14 @@ msgstr "" #: ../../Structural/Registry/README.rst:40 msgid "Tests/RegistryTest.php" msgstr "" + +#: ../../Structural/Registry/README.rst:14 +msgid "" +"Zend Framework 1: ``Zend_Registry`` holds the application's logger object, " +"front controller etc." +msgstr "" + +#~ msgid "" +#~ "Zend Framework: ``Zend_Registry`` holds the application's logger object, " +#~ "front controller etc." +#~ msgstr "" From af694a71b99d95797761127b094ee78ca0a9186a Mon Sep 17 00:00:00 2001 From: yplam Date: Mon, 14 Sep 2015 19:02:34 +0800 Subject: [PATCH 40/69] Translate Structural part to zh_CN. --- .../Structural/Decorator/README.po | 19 +++++++-------- .../LC_MESSAGES/Structural/Facade/README.po | 23 ++++++++++++------- .../Structural/FluentInterface/README.po | 21 +++++++++-------- .../LC_MESSAGES/Structural/Proxy/README.po | 18 ++++++++------- .../LC_MESSAGES/Structural/Registry/README.po | 19 +++++++++------ 5 files changed, 58 insertions(+), 42 deletions(-) diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Decorator/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Decorator/README.po index 0ecf351..e0c38b1 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Decorator/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Decorator/README.po @@ -13,41 +13,42 @@ msgstr "" #: ../../Structural/Decorator/README.rst:2 msgid "`Decorator`__" -msgstr "" +msgstr "`装饰器`__" #: ../../Structural/Decorator/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "目的" #: ../../Structural/Decorator/README.rst:7 msgid "To dynamically add new functionality to class instances." -msgstr "" +msgstr "动态地为类的实例添加功能" #: ../../Structural/Decorator/README.rst:10 msgid "Examples" -msgstr "" +msgstr "例子" #: ../../Structural/Decorator/README.rst:12 msgid "Zend Framework: decorators for ``Zend_Form_Element`` instances" -msgstr "" +msgstr "Zend Framework: ``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 "" +"Web Service层:REST服务的JSON与XML装饰器(当然,在此只能使用其中的一种)" #: ../../Structural/Decorator/README.rst:17 msgid "UML Diagram" -msgstr "" +msgstr "UML 图" #: ../../Structural/Decorator/README.rst:24 msgid "Code" -msgstr "" +msgstr "代码" #: ../../Structural/Decorator/README.rst:26 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Decorator/README.rst:28 msgid "RendererInterface.php" @@ -71,7 +72,7 @@ msgstr "" #: ../../Structural/Decorator/README.rst:59 msgid "Test" -msgstr "" +msgstr "测试" #: ../../Structural/Decorator/README.rst:61 msgid "Tests/DecoratorTest.php" diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Facade/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Facade/README.po index 1d78bf4..110cc58 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Facade/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Facade/README.po @@ -13,11 +13,11 @@ msgstr "" #: ../../Structural/Facade/README.rst:2 msgid "`Facade`__" -msgstr "" +msgstr "`外观模式`__" #: ../../Structural/Facade/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "目的" #: ../../Structural/Facade/README.rst:7 msgid "" @@ -25,20 +25,23 @@ msgid "" "of a complex API. It's only a side-effect. The first goal is to reduce " "coupling and follow the Law of Demeter." msgstr "" +"外观模式的目的不是为了让你避免阅读烦人的API文档(当然,它有这样的作用)," +"它的主要目的是为了减少耦合并且遵循得墨忒耳定律(Law of 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 "" +"Facade通过嵌入多个(当然,有时只有一个)接口来解耦访客与子系统,当然也降低复杂度。" #: ../../Structural/Facade/README.rst:15 msgid "A facade does not forbid you the access to the sub-system" -msgstr "" +msgstr "Facade 不会禁止你访问子系统" #: ../../Structural/Facade/README.rst:16 msgid "You can (you should) have multiple facades for one sub-system" -msgstr "" +msgstr "你可以(应该)为一个子系统提供多个 Facade" #: ../../Structural/Facade/README.rst:18 msgid "" @@ -46,6 +49,8 @@ msgid "" "creations for each method, it is not a Facade, it's a Builder or a " "[Abstract\\|Static\\|Simple] Factory [Method]." msgstr "" +"因此一个好的 Facade 里面不会有 ``new`` 。如果每个方法里都要构造多个对象,那么它就" +"不是 Facade,而是生成器或者[抽象\\|静态\\|简单] 工厂 [方法]。" #: ../../Structural/Facade/README.rst:22 msgid "" @@ -53,18 +58,20 @@ msgid "" "parameters. If you need creation of new instances, use a Factory as " "argument." msgstr "" +"优秀的 Facade 不会有 ``new``,并且构造函数参数是接口类型的。如果你需要创建一个新" +"实例,则在参数中传入一个工厂对象。" #: ../../Structural/Facade/README.rst:27 msgid "UML Diagram" -msgstr "" +msgstr "UML 图" #: ../../Structural/Facade/README.rst:34 msgid "Code" -msgstr "" +msgstr "代码" #: ../../Structural/Facade/README.rst:36 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Facade/README.rst:38 msgid "Facade.php" @@ -80,7 +87,7 @@ msgstr "" #: ../../Structural/Facade/README.rst:57 msgid "Test" -msgstr "" +msgstr "测试" #: ../../Structural/Facade/README.rst:59 msgid "Tests/FacadeTest.php" diff --git a/locale/zh_CN/LC_MESSAGES/Structural/FluentInterface/README.po b/locale/zh_CN/LC_MESSAGES/Structural/FluentInterface/README.po index 0e58551..f0cc8d8 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/FluentInterface/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/FluentInterface/README.po @@ -13,45 +13,46 @@ msgstr "" #: ../../Structural/FluentInterface/README.rst:2 msgid "`Fluent Interface`__" -msgstr "" +msgstr "`连贯接口`__" #: ../../Structural/FluentInterface/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "目的" #: ../../Structural/FluentInterface/README.rst:7 msgid "" "To write code that is easy readable just like sentences in a natural " "language (like English)." msgstr "" +"用来编写易于阅读的代码,就像自然语言一样(如英语)" #: ../../Structural/FluentInterface/README.rst:11 msgid "Examples" -msgstr "" +msgstr "例子" #: ../../Structural/FluentInterface/README.rst:13 msgid "Doctrine2's QueryBuilder works something like that example class below" -msgstr "" +msgstr "Doctrine2 的 QueryBuilder,就像下面例子中类似" #: ../../Structural/FluentInterface/README.rst:15 msgid "PHPUnit uses fluent interfaces to build mock objects" -msgstr "" +msgstr "PHPUnit 使用连贯接口来创建 mock 对象" #: ../../Structural/FluentInterface/README.rst:16 msgid "Yii Framework: CDbCommand and CActiveRecord use this pattern, too" -msgstr "" +msgstr "Yii 框架:CDbCommand 与 CActiveRecord 也使用此模式" #: ../../Structural/FluentInterface/README.rst:19 msgid "UML Diagram" -msgstr "" +msgstr "UML 图" #: ../../Structural/FluentInterface/README.rst:26 msgid "Code" -msgstr "" +msgstr "代码" #: ../../Structural/FluentInterface/README.rst:28 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/FluentInterface/README.rst:30 msgid "Sql.php" @@ -59,7 +60,7 @@ msgstr "" #: ../../Structural/FluentInterface/README.rst:37 msgid "Test" -msgstr "" +msgstr "测试" #: ../../Structural/FluentInterface/README.rst:39 msgid "Tests/FluentInterfaceTest.php" diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Proxy/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Proxy/README.po index 290eacc..5df1caf 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Proxy/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Proxy/README.po @@ -13,19 +13,19 @@ msgstr "" #: ../../Structural/Proxy/README.rst:2 msgid "`Proxy`__" -msgstr "" +msgstr "`代理模式`__" #: ../../Structural/Proxy/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "目的" #: ../../Structural/Proxy/README.rst:7 msgid "To interface to anything that is expensive or impossible to duplicate." -msgstr "" +msgstr "为昂贵或者无法复制的资源提供接口。" #: ../../Structural/Proxy/README.rst:10 msgid "Examples" -msgstr "" +msgstr "例子" #: ../../Structural/Proxy/README.rst:12 msgid "" @@ -33,18 +33,20 @@ msgid "" "initialization) in them, while the user still works with his own entity " "classes and will never use nor touch the proxies" msgstr "" +"Doctrine2 使用代理来实现框架特性(如延迟初始化),同时用户还是使用自己的实体类" +"并且不会使用或者接触到代理" #: ../../Structural/Proxy/README.rst:17 msgid "UML Diagram" -msgstr "" +msgstr "UML 图" #: ../../Structural/Proxy/README.rst:24 msgid "Code" -msgstr "" +msgstr "代码" #: ../../Structural/Proxy/README.rst:26 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Proxy/README.rst:28 msgid "Record.php" @@ -56,4 +58,4 @@ msgstr "" #: ../../Structural/Proxy/README.rst:41 msgid "Test" -msgstr "" +msgstr "测试" diff --git a/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po b/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po index 636207b..f01d956 100644 --- a/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po +++ b/locale/zh_CN/LC_MESSAGES/Structural/Registry/README.po @@ -13,11 +13,11 @@ msgstr "" #: ../../Structural/Registry/README.rst:2 msgid "`Registry`__" -msgstr "" +msgstr "`注册模式`__" #: ../../Structural/Registry/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "目的" #: ../../Structural/Registry/README.rst:7 msgid "" @@ -25,28 +25,32 @@ msgid "" "application, is typically implemented using an abstract class with only " "static methods (or using the Singleton pattern)" msgstr "" +"为应用中常用的对象实现一个中央存储,通常用一个只有静态方法的抽象类来实现" +"(或者使用单例模式)" #: ../../Structural/Registry/README.rst:12 msgid "Examples" -msgstr "" +msgstr "例子" #: ../../Structural/Registry/README.rst:16 msgid "" "Yii Framework: ``CWebApplication`` holds all the application components, " "such as ``CWebUser``, ``CUrlManager``, etc." msgstr "" +"Yii 框架: ``CWebApplication`` 持有所有的应用组件," +"如 ``CWebUser``, ``CUrlManager``, 等。" #: ../../Structural/Registry/README.rst:20 msgid "UML Diagram" -msgstr "" +msgstr "UML 图" #: ../../Structural/Registry/README.rst:27 msgid "Code" -msgstr "" +msgstr "代码" #: ../../Structural/Registry/README.rst:29 msgid "You can also find these code on `GitHub`_" -msgstr "" +msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Structural/Registry/README.rst:31 msgid "Registry.php" @@ -54,7 +58,7 @@ msgstr "" #: ../../Structural/Registry/README.rst:38 msgid "Test" -msgstr "" +msgstr "测试" #: ../../Structural/Registry/README.rst:40 msgid "Tests/RegistryTest.php" @@ -65,6 +69,7 @@ msgid "" "Zend Framework 1: ``Zend_Registry`` holds the application's logger object, " "front controller etc." msgstr "" +"Zend Framework 1: ``Zend_Registry`` 持有应用的logger对象,前端控制器等。" #~ msgid "" #~ "Zend Framework: ``Zend_Registry`` holds the application's logger object, " From d703a87fe8f864b8fdb4967161572ed965ddc95a Mon Sep 17 00:00:00 2001 From: Brett Santore Date: Mon, 14 Sep 2015 11:00:03 -0400 Subject: [PATCH 41/69] Add assertions to AdapterTest --- Structural/Adapter/Tests/AdapterTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Structural/Adapter/Tests/AdapterTest.php b/Structural/Adapter/Tests/AdapterTest.php index 258e755..ecbc9e2 100644 --- a/Structural/Adapter/Tests/AdapterTest.php +++ b/Structural/Adapter/Tests/AdapterTest.php @@ -35,7 +35,7 @@ class AdapterTest extends \PHPUnit_Framework_TestCase */ public function testIAmAnOldClient(PaperBookInterface $book) { - $book->open(); - $book->turnPage(); + $this->assertTrue(method_exists($book, 'open')); + $this->assertTrue(method_exists($book, 'turnPage')); } } From bb469bd4494bf7a819b86be14fcceb09c34326ec Mon Sep 17 00:00:00 2001 From: Brett Santore Date: Mon, 14 Sep 2015 11:13:28 -0400 Subject: [PATCH 42/69] move comments to line above --- Behavioral/Memento/Tests/MementoTest.php | 60 ++++++++++++++++-------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/Behavioral/Memento/Tests/MementoTest.php b/Behavioral/Memento/Tests/MementoTest.php index ccc2097..3ea82b1 100644 --- a/Behavioral/Memento/Tests/MementoTest.php +++ b/Behavioral/Memento/Tests/MementoTest.php @@ -18,29 +18,45 @@ class MementoTest extends \PHPUnit_Framework_TestCase $caretaker = new Caretaker(); $character = new \stdClass(); - $character->name = "Gandalf"; // new object - $originator->setState($character); // connect Originator to character object + // new object + $character->name = "Gandalf"; + // connect Originator to character object + $originator->setState($character); - $character->name = "Gandalf the Grey"; // work on the object - $character->race = "Maia"; // still change something - $snapshot = $originator->getStateAsMemento(); // time to save state - $caretaker->saveToHistory($snapshot); // put state to log + // 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); - $character->name = "Sauron"; // change something - $character->race = "Ainur"; // and again - $this->assertAttributeEquals($character, "state", $originator); // state inside the Originator was equally changed + // change something + $character->name = "Sauron"; + // and again + $character->race = "Ainur"; + // state inside the Originator was equally changed + $this->assertAttributeEquals($character, "state", $originator); - $snapshot = $originator->getStateAsMemento(); // time to save another state - $caretaker->saveToHistory($snapshot); // put state to log + // time to save another state + $snapshot = $originator->getStateAsMemento(); + // put state to log + $caretaker->saveToHistory($snapshot); $rollback = $caretaker->getFromHistory(0); - $originator->restoreFromMemento($rollback); // return to first state - $character = $rollback->getState(); // use character from old state + // return to first state + $originator->restoreFromMemento($rollback); + // use character from old state + $character = $rollback->getState(); - $this->assertEquals("Gandalf the Grey", $character->name); // yes, that what we need - $character->name = "Gandalf the White"; // make new changes + // yes, that what we need + $this->assertEquals("Gandalf the Grey", $character->name); + // make new changes + $character->name = "Gandalf the White"; - $this->assertAttributeEquals($character, "state", $originator); // and Originator linked to actual object again + // and Originator linked to actual object again + $this->assertAttributeEquals($character, "state", $originator); } public function testStringState() @@ -88,14 +104,18 @@ class MementoTest extends \PHPUnit_Framework_TestCase $snapshot = $originator->getStateAsMemento(); $second_state = $snapshot->getState(); - $first_state->first_property = 1; // still actual - $second_state->second_property = 2; // just history + // 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); - $first_state->first_property = 11; // now it lost state - $second_state->second_property = 22; // must be actual + // 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); } From 139c2c157c644b2b58a0dc57c1b7c31ee7016c5c Mon Sep 17 00:00:00 2001 From: Brett Santore Date: Mon, 14 Sep 2015 11:14:09 -0400 Subject: [PATCH 43/69] move closing brace to line after body --- Behavioral/Memento/Caretaker.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Behavioral/Memento/Caretaker.php b/Behavioral/Memento/Caretaker.php index 3a16fcd..72530fb 100644 --- a/Behavioral/Memento/Caretaker.php +++ b/Behavioral/Memento/Caretaker.php @@ -46,5 +46,4 @@ class Caretaker return $originator->getStateAsMemento()->getState(); } - } From ac7cca74cda96a8b3dbdb9ab62d09c07befead80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cervi=C3=B1o?= Date: Tue, 15 Sep 2015 18:03:36 +0200 Subject: [PATCH 44/69] [spanish translation] - wip - creational patterns --- .../Creational/AbstractFactory/README.po | 24 +++++++------- .../LC_MESSAGES/Creational/Builder/README.po | 30 ++++++++--------- .../Creational/FactoryMethod/README.po | 33 +++++++++++-------- .../LC_MESSAGES/Creational/Multiton/README.po | 23 ++++++++----- 4 files changed, 60 insertions(+), 50 deletions(-) diff --git a/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po index 3325520..821c5b5 100644 --- a/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po +++ b/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po @@ -48,48 +48,48 @@ msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/AbstractFactory/README.rst:24 msgid "AbstractFactory.php" -msgstr "" +msgstr "AbstractFactory.php" #: ../../Creational/AbstractFactory/README.rst:30 msgid "JsonFactory.php" -msgstr "" +msgstr "JsonFactory.php" #: ../../Creational/AbstractFactory/README.rst:36 msgid "HtmlFactory.php" -msgstr "" +msgstr "HtmlFactory.php" #: ../../Creational/AbstractFactory/README.rst:42 msgid "MediaInterface.php" -msgstr "" +msgstr "MediaInterface.php" #: ../../Creational/AbstractFactory/README.rst:48 msgid "Picture.php" -msgstr "" +msgstr "Picture.php" #: ../../Creational/AbstractFactory/README.rst:54 msgid "Text.php" -msgstr "" +msgstr "Text.php" #: ../../Creational/AbstractFactory/README.rst:60 msgid "Json/Picture.php" -msgstr "" +msgstr "Json/Picture.php" #: ../../Creational/AbstractFactory/README.rst:66 msgid "Json/Text.php" -msgstr "" +msgstr "Json/Text.php" #: ../../Creational/AbstractFactory/README.rst:72 msgid "Html/Picture.php" -msgstr "" +msgstr "Html/Picture.php" #: ../../Creational/AbstractFactory/README.rst:78 msgid "Html/Text.php" -msgstr "" +msgstr "Html/Text.php" #: ../../Creational/AbstractFactory/README.rst:85 msgid "Test" -msgstr "" +msgstr "Test" #: ../../Creational/AbstractFactory/README.rst:87 msgid "Tests/AbstractFactoryTest.php" -msgstr "" +msgstr "Tests/AbstractFactoryTest.php" diff --git a/locale/es/LC_MESSAGES/Creational/Builder/README.po b/locale/es/LC_MESSAGES/Creational/Builder/README.po index 69824fb..0cbdd58 100644 --- a/locale/es/LC_MESSAGES/Creational/Builder/README.po +++ b/locale/es/LC_MESSAGES/Creational/Builder/README.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-29 12:18+0200\n" -"PO-Revision-Date: 2015-09-10 10:12+0100\n" +"PO-Revision-Date: 2015-09-11 11:42+0100\n" "Last-Translator: Daniel González \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -20,7 +20,7 @@ msgstr "`Constructor`__" #: ../../Creational/Builder/README.rst:5 msgid "Purpose" -msgstr "Proposito" +msgstr "Propósito" #: ../../Creational/Builder/README.rst:7 msgid "Builder is an interface that build parts of a complex object." @@ -58,7 +58,7 @@ msgstr "Ejemplos" #: ../../Creational/Builder/README.rst:21 msgid "PHPUnit: Mock Builder" -msgstr "" +msgstr "PHPUnit: Mock Builder" #: ../../Creational/Builder/README.rst:24 msgid "UML Diagram" @@ -74,48 +74,48 @@ msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/Builder/README.rst:35 msgid "Director.php" -msgstr "" +msgstr "Director.php" #: ../../Creational/Builder/README.rst:41 msgid "BuilderInterface.php" -msgstr "" +msgstr "BuilderInterface.php" #: ../../Creational/Builder/README.rst:47 msgid "BikeBuilder.php" -msgstr "" +msgstr "BikeBuilder.php" #: ../../Creational/Builder/README.rst:53 msgid "CarBuilder.php" -msgstr "" +msgstr "CarBuilder.php" #: ../../Creational/Builder/README.rst:59 msgid "Parts/Vehicle.php" -msgstr "" +msgstr "Parts/Vehicle.php" #: ../../Creational/Builder/README.rst:65 msgid "Parts/Bike.php" -msgstr "" +msgstr "Parts/Bike.php" #: ../../Creational/Builder/README.rst:71 msgid "Parts/Car.php" -msgstr "" +msgstr "Parts/Car.php" #: ../../Creational/Builder/README.rst:77 msgid "Parts/Engine.php" -msgstr "" +msgstr "Parts/Engine.php" #: ../../Creational/Builder/README.rst:83 msgid "Parts/Wheel.php" -msgstr "" +msgstr "Parts/Wheel.php" #: ../../Creational/Builder/README.rst:89 msgid "Parts/Door.php" -msgstr "" +msgstr "Parts/Door.php" #: ../../Creational/Builder/README.rst:96 msgid "Test" -msgstr "" +msgstr "Test" #: ../../Creational/Builder/README.rst:98 msgid "Tests/DirectorTest.php" -msgstr "" +msgstr "Tests/DirectorTest.php" diff --git a/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po b/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po index 4ccb9a1..550573a 100644 --- a/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po +++ b/locale/es/LC_MESSAGES/Creational/FactoryMethod/README.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-29 12:18+0200\n" -"PO-Revision-Date: 2015-09-10 10:02+0100\n" +"PO-Revision-Date: 2015-09-15 17:15+0100\n" "Last-Translator: Daniel González \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -15,17 +15,19 @@ msgstr "" #: ../../Creational/FactoryMethod/README.rst:2 msgid "`Factory Method`__" -msgstr "" +msgstr "`Factory Method`__" #: ../../Creational/FactoryMethod/README.rst:5 msgid "Purpose" -msgstr "" +msgstr "Proposito" #: ../../Creational/FactoryMethod/README.rst:7 msgid "" "The good point over the SimpleFactory is you can subclass it to implement " "different ways to create objects" msgstr "" +"La principal ventaja de SimpleFactory es que puedes extender la clase para " +"implementar diferentes formas" #: ../../Creational/FactoryMethod/README.rst:10 msgid "For simple case, this abstract class could be just an interface" @@ -42,14 +44,17 @@ msgid "" "It means the FactoryMethod class depends on abstractions, not concrete " "classes. This is the real trick compared to SimpleFactory or StaticFactory." msgstr "" +"Esto significa que la clase FactoryMethod depende de abstraciones, no de " +"clases concretas. Esto es el truco con respecto a SimpleFactory o " +"StaticFactory" #: ../../Creational/FactoryMethod/README.rst:20 msgid "UML Diagram" -msgstr "" +msgstr "Diagrama UML" #: ../../Creational/FactoryMethod/README.rst:27 msgid "Code" -msgstr "" +msgstr "Código" #: ../../Creational/FactoryMethod/README.rst:29 msgid "You can also find these code on `GitHub`_" @@ -57,36 +62,36 @@ msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/FactoryMethod/README.rst:31 msgid "FactoryMethod.php" -msgstr "" +msgstr "FactoryMethod.php" #: ../../Creational/FactoryMethod/README.rst:37 msgid "ItalianFactory.php" -msgstr "" +msgstr "ItalianFactory.php" #: ../../Creational/FactoryMethod/README.rst:43 msgid "GermanFactory.php" -msgstr "" +msgstr "GermanFactory.php" #: ../../Creational/FactoryMethod/README.rst:49 msgid "VehicleInterface.php" -msgstr "" +msgstr "VehicleInterface.php" #: ../../Creational/FactoryMethod/README.rst:55 msgid "Porsche.php" -msgstr "" +msgstr "Porsche.php" #: ../../Creational/FactoryMethod/README.rst:61 msgid "Bicycle.php" -msgstr "" +msgstr "Bicycle.php" #: ../../Creational/FactoryMethod/README.rst:67 msgid "Ferrari.php" -msgstr "" +msgstr "Ferrari.php" #: ../../Creational/FactoryMethod/README.rst:74 msgid "Test" -msgstr "" +msgstr "Test" #: ../../Creational/FactoryMethod/README.rst:76 msgid "Tests/FactoryMethodTest.php" -msgstr "" +msgstr "Tests/FactoryMethodTest.php" diff --git a/locale/es/LC_MESSAGES/Creational/Multiton/README.po b/locale/es/LC_MESSAGES/Creational/Multiton/README.po index d465309..c32fbaa 100644 --- a/locale/es/LC_MESSAGES/Creational/Multiton/README.po +++ b/locale/es/LC_MESSAGES/Creational/Multiton/README.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: DesignPatternsPHP 1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-05-29 12:18+0200\n" -"PO-Revision-Date: 2015-09-10 10:02+0100\n" +"PO-Revision-Date: 2015-09-11 11:31+0100\n" "Last-Translator: Daniel González \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -15,43 +15,48 @@ msgstr "" #: ../../Creational/Multiton/README.rst:2 msgid "Multiton" -msgstr "" +msgstr "Multiton" #: ../../Creational/Multiton/README.rst:4 msgid "" "**THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND " "MAINTAINABILITY USE DEPENDENCY INJECTION!**" msgstr "" +"**ESTO ES CONSIDERADO UN ANTI-PATRÓN. PARA MEJOR TESTEABILIDAD Y " +"MANTENIBILIDAD USA INYECCIÓN DE DEPENDENCIAS**" #: ../../Creational/Multiton/README.rst:8 msgid "Purpose" -msgstr "" +msgstr "Propósito" #: ../../Creational/Multiton/README.rst:10 msgid "" "To have only a list of named instances that are used, like a singleton but " "with n instances." msgstr "" +"Tener una única lista de los nombres de las instancias que has usando, como " +"en el singleton pero con varias instancias." #: ../../Creational/Multiton/README.rst:14 msgid "Examples" -msgstr "" +msgstr "Ejemplos" #: ../../Creational/Multiton/README.rst:16 msgid "2 DB Connectors, e.g. one for MySQL, the other for SQLite" -msgstr "" +msgstr "2 Conectores de base de datos, Ej. uno para MySQL el otro para SQLite." #: ../../Creational/Multiton/README.rst:17 msgid "multiple Loggers (one for debug messages, one for errors)" msgstr "" +"Múltiples sistemas de log ( no para mensajes de debug, uno para errores )." #: ../../Creational/Multiton/README.rst:20 msgid "UML Diagram" -msgstr "" +msgstr "Diagrama UML" #: ../../Creational/Multiton/README.rst:27 msgid "Code" -msgstr "" +msgstr "Código" #: ../../Creational/Multiton/README.rst:29 msgid "You can also find these code on `GitHub`_" @@ -59,8 +64,8 @@ msgstr "Puedes encontrar el código en `GitHub`_" #: ../../Creational/Multiton/README.rst:31 msgid "Multiton.php" -msgstr "" +msgstr "Multiton.php" #: ../../Creational/Multiton/README.rst:38 msgid "Test" -msgstr "" +msgstr "Test" From ac30d388a4e6af3a4b4667eecf02353b1597bfc9 Mon Sep 17 00:00:00 2001 From: SHANG Guokan Date: Fri, 2 Oct 2015 15:43:40 +0200 Subject: [PATCH 45/69] Update README.po --- locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po | 1 - 1 file changed, 1 deletion(-) diff --git a/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po b/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po index 821c5b5..8c9340b 100644 --- a/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po +++ b/locale/es/LC_MESSAGES/Creational/AbstractFactory/README.po @@ -8,7 +8,6 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: es\n" -"PO-Revision-Date: \n" "Last-Translator: Daniel González \n" "Language-Team: \n" "X-Generator: Poedit 1.5.4\n" From 326da7c6c013a42461e29357c79f41321afaa0cc Mon Sep 17 00:00:00 2001 From: brslv Date: Tue, 13 Oct 2015 11:14:50 +0300 Subject: [PATCH 46/69] fix link in behavioral readme file. --- Behavioral/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Behavioral/README.md b/Behavioral/README.md index bdf7316..b98202b 100644 --- a/Behavioral/README.md +++ b/Behavioral/README.md @@ -9,7 +9,7 @@ communication. * [Command](Command) [:notebook:](http://en.wikipedia.org/wiki/Command_pattern) * [Iterator](Iterator) [:notebook:](http://en.wikipedia.org/wiki/Iterator_pattern) * [Mediator](Mediator) [:notebook:](http://en.wikipedia.org/wiki/Mediator_pattern) -* [Memento](Behavioral/Memento) [:notebook:](http://en.wikipedia.org/wiki/Memento_pattern) +* [Memento](Memento) [:notebook:](http://en.wikipedia.org/wiki/Memento_pattern) * [NullObject](NullObject) [:notebook:](http://en.wikipedia.org/wiki/Null_Object_pattern) * [Observer](Observer) [:notebook:](http://en.wikipedia.org/wiki/Observer_pattern) * [Specification](Specification) [:notebook:](http://en.wikipedia.org/wiki/Specification_pattern) From 3cb0f4bd8b52a32dc498c13659a0931535cb8f61 Mon Sep 17 00:00:00 2001 From: 3kthor3adward <3kthor3adward@gmail.com> Date: Tue, 20 Oct 2015 16:58:37 -0500 Subject: [PATCH 47/69] Fix typo --- Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php b/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php index bf21088..127b7fc 100644 --- a/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php +++ b/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php @@ -10,7 +10,7 @@ use DesignPatterns\Behavioral\ChainOfResponsibilities\Request; * * One important fact about CoR: each item in the chain MUST NOT assume its position * in the chain. A CoR is not responsible if the request is not handled UNLESS - * you make an "ExceptionHandler" which throws execption if the request goes there. + * you make an "ExceptionHandler" which throws exception if the request goes there. * * To be really extendable, each handler doesn't know if there is something after it. * From 97eecc59a501536abc8004762fa224eefe43ce7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=AB=E3=82=AB=E3=82=B9?= Date: Mon, 19 Oct 2015 22:04:57 -0200 Subject: [PATCH 48/69] Add EAV pattern to readme.md file --- More/README.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/More/README.md b/More/README.md index 7667a62..599ae03 100644 --- a/More/README.md +++ b/More/README.md @@ -3,3 +3,4 @@ * [Delegation](Delegation) [:notebook:](http://en.wikipedia.org/wiki/Delegation_pattern) * [ServiceLocator](ServiceLocator) [:notebook:](http://en.wikipedia.org/wiki/Service_locator_pattern) * [Repository](Repository) +* [EAV](More/EAV) [:notebook:](https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model) diff --git a/README.md b/README.md index 65d71d7..440185f 100755 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ The patterns can be structured in roughly three different categories. Please cli * [Delegation](More/Delegation) [:notebook:](http://en.wikipedia.org/wiki/Delegation_pattern) * [ServiceLocator](More/ServiceLocator) [:notebook:](http://en.wikipedia.org/wiki/Service_locator_pattern) * [Repository](More/Repository) +* [EAV](More/EAV) [:notebook:](https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model) ## Contribute From fc1544707c574a8da809f3fe8c957331b406efc0 Mon Sep 17 00:00:00 2001 From: Jon Gotlin Date: Tue, 3 Nov 2015 07:28:45 +0100 Subject: [PATCH 49/69] Corrected copy-and-pasted comment --- Structural/Decorator/Tests/DecoratorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Structural/Decorator/Tests/DecoratorTest.php b/Structural/Decorator/Tests/DecoratorTest.php index 437f068..c50181f 100644 --- a/Structural/Decorator/Tests/DecoratorTest.php +++ b/Structural/Decorator/Tests/DecoratorTest.php @@ -27,7 +27,7 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase public function testXmlDecorator() { - // Wrap service with a JSON decorator for renderers + // Wrap service with a XML decorator for renderers $service = new Decorator\RenderInXml($this->service); // Our Renderer will now output XML instead of an array $xml = 'bar'; From 115dd3bdb327751b615015f2384b32ccb78f7328 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Mon, 16 Nov 2015 13:52:07 +0800 Subject: [PATCH 50/69] [EAV] Value::setAttribute add return this --- More/EAV/Tests/ValueTest.php | 3 +-- More/EAV/Value.php | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/More/EAV/Tests/ValueTest.php b/More/EAV/Tests/ValueTest.php index 1b96521..cecf600 100644 --- a/More/EAV/Tests/ValueTest.php +++ b/More/EAV/Tests/ValueTest.php @@ -40,7 +40,6 @@ class ValueTest extends \PHPUnit_Framework_TestCase $value->setName('Silver'); $this->assertSame($attribute, $value->getAttribute()); - $value->setAttribute($attribute); - $this->assertSame($attribute, $value->getAttribute()); + $this->assertSame($attribute, $value->setAttribute($attribute)->getAttribute()); } } diff --git a/More/EAV/Value.php b/More/EAV/Value.php index 617afdc..127f8ce 100644 --- a/More/EAV/Value.php +++ b/More/EAV/Value.php @@ -28,12 +28,15 @@ class Value implements ValueInterface /** * @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; } /** From ba63419d83289698d9ca1158916d3ae097c015b2 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Mon, 16 Nov 2015 22:36:46 +0800 Subject: [PATCH 51/69] [EAV] keep unit test code consistency --- More/EAV/Tests/ValueTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/More/EAV/Tests/ValueTest.php b/More/EAV/Tests/ValueTest.php index cecf600..1b96521 100644 --- a/More/EAV/Tests/ValueTest.php +++ b/More/EAV/Tests/ValueTest.php @@ -40,6 +40,7 @@ class ValueTest extends \PHPUnit_Framework_TestCase $value->setName('Silver'); $this->assertSame($attribute, $value->getAttribute()); - $this->assertSame($attribute, $value->setAttribute($attribute)->getAttribute()); + $value->setAttribute($attribute); + $this->assertSame($attribute, $value->getAttribute()); } } From 620c9040a89fb2d5a58744f5c186872d9528a769 Mon Sep 17 00:00:00 2001 From: Dominik Liebler Date: Wed, 18 Nov 2015 08:14:13 +0100 Subject: [PATCH 52/69] updated phpunit to 4.8.18 which also works with php <= 5.3.3 --- composer.json | 2 +- composer.lock | 68 +++++++++++++++++++++++++-------------------------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/composer.json b/composer.json index 230ea33..71610e4 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ ], "minimum-stability": "stable", "require-dev": { - "phpunit/phpunit": "~4.6", + "phpunit/phpunit": "^4.6", "squizlabs/php_codesniffer": "1.5.*" }, "autoload": { diff --git a/composer.lock b/composer.lock index aac9505..202b73e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "b2d8b0e179e33882664013cfe68f65f8", + "hash": "ccc9bc820717ca4dc310248ad4a69f21", + "content-hash": "f9ca7d34db86fa55e8dc649f84d8b4c7", "packages": [], "packages-dev": [ { @@ -172,16 +173,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.2.2", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c" + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c", - "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", "shasum": "" }, "require": { @@ -230,7 +231,7 @@ "testing", "xunit" ], - "time": "2015-08-04 03:42:39" + "time": "2015-10-06 15:47:00" }, { "name": "phpunit/php-file-iterator", @@ -363,16 +364,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.6", + "version": "1.4.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b" + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b", - "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", "shasum": "" }, "require": { @@ -408,20 +409,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-08-16 08:51:00" + "time": "2015-09-15 10:49:45" }, { "name": "phpunit/phpunit", - "version": "4.8.6", + "version": "4.8.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2246830f4a1a551c67933e4171bf2126dc29d357" + "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2246830f4a1a551c67933e4171bf2126dc29d357", - "reference": "2246830f4a1a551c67933e4171bf2126dc29d357", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa33d4ad96481b91df343d83e8c8aabed6b1dfd3", + "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3", "shasum": "" }, "require": { @@ -480,20 +481,20 @@ "testing", "xunit" ], - "time": "2015-08-24 04:09:38" + "time": "2015-11-11 11:32:49" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.7", + "version": "2.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "5e2645ad49d196e020b85598d7c97e482725786a" + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a", - "reference": "5e2645ad49d196e020b85598d7c97e482725786a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", "shasum": "" }, "require": { @@ -536,7 +537,7 @@ "mock", "xunit" ], - "time": "2015-08-19 09:14:08" + "time": "2015-10-02 06:51:40" }, { "name": "sebastian/comparator", @@ -772,16 +773,16 @@ }, { "name": "sebastian/global-state", - "version": "1.0.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", "shasum": "" }, "require": { @@ -819,7 +820,7 @@ "keywords": [ "global state" ], - "time": "2014-10-06 09:23:50" + "time": "2015-10-12 03:26:01" }, { "name": "sebastian/recursion-context", @@ -986,24 +987,21 @@ }, { "name": "symfony/yaml", - "version": "v2.7.3", + "version": "v2.7.6", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "71340e996171474a53f3d29111d046be4ad8a0ff" + "url": "https://github.com/symfony/yaml.git", + "reference": "eca9019c88fbe250164affd107bc8057771f3f4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff", - "reference": "71340e996171474a53f3d29111d046be4ad8a0ff", + "url": "https://api.github.com/repos/symfony/yaml/zipball/eca9019c88fbe250164affd107bc8057771f3f4d", + "reference": "eca9019c88fbe250164affd107bc8057771f3f4d", "shasum": "" }, "require": { "php": ">=5.3.9" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -1031,7 +1029,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-07-28 14:07:07" + "time": "2015-10-11 09:39:48" } ], "aliases": [], From 1f21cc5d027732d2deaaa40bd4a19ad813e35e8b Mon Sep 17 00:00:00 2001 From: Pete Houston Date: Wed, 25 Nov 2015 10:36:30 +0700 Subject: [PATCH 53/69] Correct the EAV link --- More/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/More/README.md b/More/README.md index 599ae03..cba33e7 100644 --- a/More/README.md +++ b/More/README.md @@ -3,4 +3,4 @@ * [Delegation](Delegation) [:notebook:](http://en.wikipedia.org/wiki/Delegation_pattern) * [ServiceLocator](ServiceLocator) [:notebook:](http://en.wikipedia.org/wiki/Service_locator_pattern) * [Repository](Repository) -* [EAV](More/EAV) [:notebook:](https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model) +* [EAV](EAV) [:notebook:](https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model) From 0e774e3961e9ea08d11dd50a917b5fe612c27a1c Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Wed, 9 Dec 2015 18:01:17 +0800 Subject: [PATCH 54/69] [Repository] fix namespace --- More/Repository/MemoryStorage.php | 4 ++- More/Repository/Post.php | 2 +- More/Repository/PostRepository.php | 4 ++- More/Repository/Storage.php | 2 +- More/Repository/uml/Repository.uml | 56 +++++++++++++++--------------- 5 files changed, 36 insertions(+), 32 deletions(-) diff --git a/More/Repository/MemoryStorage.php b/More/Repository/MemoryStorage.php index 3021e96..1da09bc 100644 --- a/More/Repository/MemoryStorage.php +++ b/More/Repository/MemoryStorage.php @@ -1,6 +1,8 @@ - - PHP - \DesignPatterns\Repository\PostRepository - - \DesignPatterns\Repository\Storage - \DesignPatterns\Repository\MemoryStorage - \DesignPatterns\Repository\Post - \DesignPatterns\Repository\PostRepository - - - - - - - - - - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\More\Repository\PostRepository + + \DesignPatterns\More\Repository\Storage + \DesignPatterns\More\Repository\MemoryStorage + \DesignPatterns\More\Repository\Post + \DesignPatterns\More\Repository\PostRepository + + + + + + + + + + + + Fields + Constants + Constructors + Methods + + private + + From 5533d8560ae4b6805e1f8544d3cb0bbb2e426ce5 Mon Sep 17 00:00:00 2001 From: Ju Date: Thu, 10 Dec 2015 00:13:07 +0100 Subject: [PATCH 55/69] Added usage example on Creational/SimpleFactory --- Creational/SimpleFactory/README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Creational/SimpleFactory/README.rst b/Creational/SimpleFactory/README.rst index 364947f..0525667 100644 --- a/Creational/SimpleFactory/README.rst +++ b/Creational/SimpleFactory/README.rst @@ -48,6 +48,15 @@ Scooter.php :language: php :linenos: +Usage +----- + +.. code:: php + + $factory = new ConcreteFactory(); + $bicycle = $factory->createVehicle('bicycle'); + $bicycle->driveTo('Paris'); + Test ---- From df060dab978cac3a0bcd6b002fe11d83f29fbf28 Mon Sep 17 00:00:00 2001 From: Marius Bogdan Date: Sat, 12 Dec 2015 22:44:19 +0100 Subject: [PATCH 56/69] Fixed wrong implementation of Singleton Pattern --- Creational/Singleton/Singleton.php | 12 +++++++---- .../SingletonPatternViolationException.php | 8 +++++++ Creational/Singleton/Tests/SingletonTest.php | 21 +++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 Creational/Singleton/SingletonPatternViolationException.php diff --git a/Creational/Singleton/Singleton.php b/Creational/Singleton/Singleton.php index 41a4569..94f7a0a 100644 --- a/Creational/Singleton/Singleton.php +++ b/Creational/Singleton/Singleton.php @@ -2,6 +2,8 @@ namespace DesignPatterns\Creational\Singleton; +use DesignPatterns\Creational\Singleton\SingletonPatternViolationException; + /** * class Singleton */ @@ -36,19 +38,21 @@ class Singleton /** * prevent the instance from being cloned - * + * @throws SingletonPatternViolationException * @return void */ - private function __clone() + public final function __clone() { + throw new SingletonPatternViolationException('This is a Singleton. Clone is forbidden'); } /** * prevent from being unserialized - * + * @throws SingletonPatternViolationException * @return void */ - private function __wakeup() + public final function __wakeup() { + throw new SingletonPatternViolationException('This is a Singleton. __wakeup usage is forbidden'); } } diff --git a/Creational/Singleton/SingletonPatternViolationException.php b/Creational/Singleton/SingletonPatternViolationException.php new file mode 100644 index 0000000..38be5e6 --- /dev/null +++ b/Creational/Singleton/SingletonPatternViolationException.php @@ -0,0 +1,8 @@ +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); + } } From 400db2fa9c5dc0343db02737b320fca1514b3d1c Mon Sep 17 00:00:00 2001 From: DreamAndDead Date: Wed, 16 Dec 2015 23:45:26 +0800 Subject: [PATCH 57/69] a little fix to the .po file --- locale/zh_CN/LC_MESSAGES/README.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/zh_CN/LC_MESSAGES/README.po b/locale/zh_CN/LC_MESSAGES/README.po index 468f5ca..b2d9e60 100644 --- a/locale/zh_CN/LC_MESSAGES/README.po +++ b/locale/zh_CN/LC_MESSAGES/README.po @@ -32,7 +32,7 @@ msgstr "" msgid "" "I think the problem with patterns is that often people do know them but " "don't know when to apply which." -msgstr “” +msgstr "" "我认为人们对于设计模式抱有的问题在于大家都了解它们却不知道该如何在实际中使用它们。" #: ../../README.rst:20 From b024acd0e19a382ef8c861fbd86c3fcf0737c42b Mon Sep 17 00:00:00 2001 From: Hassan Althaf Date: Fri, 18 Dec 2015 14:28:27 +0530 Subject: [PATCH 58/69] Improved grammar in HelloCommand.php Simple grammar fixes. :) --- Behavioral/Command/HelloCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Behavioral/Command/HelloCommand.php b/Behavioral/Command/HelloCommand.php index eb630ed..831c299 100644 --- a/Behavioral/Command/HelloCommand.php +++ b/Behavioral/Command/HelloCommand.php @@ -4,7 +4,7 @@ namespace DesignPatterns\Behavioral\Command; /** * This concrete command calls "print" on the Receiver, but an external - * invoker just know he can call "execute" + * invoker just knows that it can call "execute" */ class HelloCommand implements CommandInterface { @@ -14,8 +14,8 @@ class HelloCommand implements CommandInterface protected $output; /** - * Each concrete command is builded with different receivers. - * Can be one, many, none or even other Command in parameters + * Each concrete command is built with different receivers. + * There can be one, many or completely no receivers, but there can be other commands in the parameters. * * @param Receiver $console */ From 593d9bb1a487821c2fbe15eb419260160bfd407c Mon Sep 17 00:00:00 2001 From: Hassan Althaf Date: Fri, 18 Dec 2015 14:39:31 +0530 Subject: [PATCH 59/69] Removed returns on `addBook` and `removeBook` --- Behavioral/Iterator/BookList.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Behavioral/Iterator/BookList.php b/Behavioral/Iterator/BookList.php index 9c0b9d4..6773f9b 100644 --- a/Behavioral/Iterator/BookList.php +++ b/Behavioral/Iterator/BookList.php @@ -19,8 +19,6 @@ class BookList implements \Countable public function addBook(Book $book) { $this->books[] = $book; - - return $this->count(); } public function removeBook(Book $bookToRemove) @@ -31,8 +29,6 @@ class BookList implements \Countable unset($this->books[$key]); } } - - return $this->count(); } public function count() From fe1f144ec3ce1d09452e67bce12e3a58f0f8657e Mon Sep 17 00:00:00 2001 From: Dominik Liebler Date: Mon, 21 Dec 2015 07:28:20 -0500 Subject: [PATCH 60/69] Applied fixes from StyleCI --- .../ChainOfResponsibilities/Handler.php | 6 +- .../Responsible/FastStorage.php | 2 +- .../Responsible/SlowStorage.php | 3 +- .../Tests/ChainTest.php | 7 +- Behavioral/Command/CommandInterface.php | 2 +- Behavioral/Command/HelloCommand.php | 4 +- Behavioral/Command/Invoker.php | 4 +- Behavioral/Command/Receiver.php | 2 +- Behavioral/Command/Tests/CommandTest.php | 5 +- Behavioral/Iterator/Book.php | 3 +- Behavioral/Iterator/BookList.php | 3 +- Behavioral/Iterator/BookListIterator.php | 25 +++++-- .../Iterator/BookListReverseIterator.php | 25 +++++-- Behavioral/Iterator/Tests/IteratorTest.php | 7 +- Behavioral/Mediator/Colleague.php | 5 +- Behavioral/Mediator/Mediator.php | 10 +-- Behavioral/Mediator/MediatorInterface.php | 8 +- Behavioral/Mediator/Subsystem/Client.php | 6 +- Behavioral/Mediator/Subsystem/Database.php | 4 +- Behavioral/Mediator/Subsystem/Server.php | 4 +- Behavioral/Mediator/Tests/MediatorTest.php | 5 +- Behavioral/Memento/Caretaker.php | 8 +- Behavioral/Memento/Tests/MementoTest.php | 74 +++++++++---------- Behavioral/NullObject/LoggerInterface.php | 2 +- Behavioral/NullObject/PrintLogger.php | 2 +- Behavioral/NullObject/Service.php | 6 +- Behavioral/NullObject/Tests/LoggerTest.php | 5 +- Behavioral/Observer/Tests/ObserverTest.php | 11 ++- Behavioral/Observer/User.php | 17 ++--- Behavioral/Observer/UserObserver.php | 6 +- .../Specification/AbstractSpecification.php | 11 +-- Behavioral/Specification/Either.php | 8 +- Behavioral/Specification/Item.php | 7 +- Behavioral/Specification/Not.php | 8 +- Behavioral/Specification/Plus.php | 8 +- .../Specification/PriceSpecification.php | 9 ++- .../Specification/SpecificationInterface.php | 11 +-- .../Specification/Tests/SpecificationTest.php | 4 +- Behavioral/State/CreateOrder.php | 5 +- Behavioral/State/OrderController.php | 2 +- Behavioral/State/OrderFactory.php | 5 +- Behavioral/State/OrderInterface.php | 2 +- Behavioral/State/ShippingOrder.php | 5 +- Behavioral/Strategy/ComparatorInterface.php | 2 +- Behavioral/Strategy/DateComparator.php | 2 +- Behavioral/Strategy/IdComparator.php | 2 +- Behavioral/Strategy/ObjectCollection.php | 4 +- Behavioral/Strategy/Tests/StrategyTest.php | 11 ++- Behavioral/TemplateMethod/BeachJourney.php | 4 +- Behavioral/TemplateMethod/CityJourney.php | 4 +- Behavioral/TemplateMethod/Journey.php | 6 +- .../TemplateMethod/Tests/JourneyTest.php | 5 +- Behavioral/Visitor/Group.php | 4 +- Behavioral/Visitor/Role.php | 8 +- Behavioral/Visitor/RolePrintVisitor.php | 6 +- Behavioral/Visitor/RoleVisitorInterface.php | 6 +- Behavioral/Visitor/Tests/VisitorTest.php | 7 +- Behavioral/Visitor/User.php | 4 +- .../AbstractFactory/AbstractFactory.php | 6 +- Creational/AbstractFactory/Html/Picture.php | 4 +- Creational/AbstractFactory/Html/Text.php | 6 +- Creational/AbstractFactory/HtmlFactory.php | 6 +- Creational/AbstractFactory/Json/Picture.php | 4 +- Creational/AbstractFactory/Json/Text.php | 4 +- Creational/AbstractFactory/JsonFactory.php | 7 +- Creational/AbstractFactory/MediaInterface.php | 5 +- Creational/AbstractFactory/Picture.php | 3 +- .../Tests/AbstractFactoryTest.php | 6 +- Creational/AbstractFactory/Text.php | 2 +- Creational/Builder/BikeBuilder.php | 2 +- Creational/Builder/CarBuilder.php | 2 +- Creational/Builder/Director.php | 3 +- Creational/Builder/Parts/Bike.php | 2 +- Creational/Builder/Parts/Car.php | 2 +- Creational/Builder/Parts/Door.php | 2 +- Creational/Builder/Parts/Engine.php | 2 +- Creational/Builder/Parts/Vehicle.php | 2 +- Creational/Builder/Parts/Wheel.php | 2 +- Creational/Builder/Tests/DirectorTest.php | 9 +-- Creational/FactoryMethod/Bicycle.php | 4 +- Creational/FactoryMethod/FactoryMethod.php | 9 +-- Creational/FactoryMethod/Ferrari.php | 2 +- Creational/FactoryMethod/GermanFactory.php | 2 +- Creational/FactoryMethod/ItalianFactory.php | 2 +- Creational/FactoryMethod/Porsche.php | 2 +- .../FactoryMethod/Tests/FactoryMethodTest.php | 7 +- Creational/FactoryMethod/VehicleInterface.php | 4 +- Creational/Multiton/Multiton.php | 17 ++--- Creational/Pool/Pool.php | 1 - Creational/Pool/Processor.php | 3 +- Creational/Pool/Worker.php | 1 - Creational/Prototype/BarBookPrototype.php | 4 +- Creational/Prototype/BookPrototype.php | 3 +- Creational/Prototype/FooBookPrototype.php | 4 +- Creational/Prototype/index.php | 4 +- Creational/SimpleFactory/Bicycle.php | 2 +- Creational/SimpleFactory/ConcreteFactory.php | 11 +-- Creational/SimpleFactory/Scooter.php | 2 +- .../SimpleFactory/Tests/SimpleFactoryTest.php | 5 +- Creational/SimpleFactory/VehicleInterface.php | 2 +- Creational/Singleton/Singleton.php | 23 +++--- .../SingletonPatternViolationException.php | 1 - Creational/Singleton/Tests/SingletonTest.php | 5 +- Creational/StaticFactory/FormatNumber.php | 2 +- Creational/StaticFactory/FormatString.php | 2 +- .../StaticFactory/FormatterInterface.php | 2 +- Creational/StaticFactory/StaticFactory.php | 7 +- .../StaticFactory/Tests/StaticFactoryTest.php | 8 +- More/Delegation/JuniorDeveloper.php | 5 +- More/Delegation/TeamLead.php | 10 +-- More/Delegation/Tests/DelegationTest.php | 2 +- More/EAV/Attribute.php | 5 +- More/EAV/Entity.php | 5 +- More/EAV/Tests/AttributeTest.php | 2 +- More/EAV/Tests/EntityTest.php | 10 +-- More/EAV/Tests/ValueTest.php | 2 +- More/EAV/Value.php | 4 +- More/EAV/ValueAccessInterface.php | 2 +- More/EAV/ValueInterface.php | 2 +- More/EAV/example.php | 31 ++++---- More/Repository/MemoryStorage.php | 7 +- More/Repository/Post.php | 3 +- More/Repository/PostRepository.php | 19 ++--- More/Repository/Storage.php | 13 ++-- More/ServiceLocator/ServiceLocator.php | 15 ++-- .../Tests/ServiceLocatorTest.php | 6 +- Structural/Adapter/Book.php | 2 +- Structural/Adapter/EBookAdapter.php | 8 +- Structural/Adapter/EBookInterface.php | 6 +- Structural/Adapter/Kindle.php | 2 +- Structural/Adapter/PaperBookInterface.php | 6 +- Structural/Adapter/Tests/AdapterTest.php | 8 +- Structural/Bridge/Assemble.php | 3 +- Structural/Bridge/Car.php | 5 +- Structural/Bridge/Motorcycle.php | 5 +- Structural/Bridge/Produce.php | 5 +- Structural/Bridge/Tests/BridgeTest.php | 1 - Structural/Bridge/Vehicle.php | 3 +- Structural/Bridge/Workshop.php | 3 +- Structural/Composite/Form.php | 4 +- Structural/Composite/FormElement.php | 4 +- Structural/Composite/InputElement.php | 6 +- Structural/Composite/Tests/CompositeTest.php | 5 +- Structural/Composite/TextElement.php | 6 +- .../DataMapper/Tests/DataMapperTest.php | 8 +- Structural/DataMapper/User.php | 3 +- Structural/DataMapper/UserMapper.php | 19 ++--- Structural/Decorator/Decorator.php | 2 +- Structural/Decorator/RenderInJson.php | 4 +- Structural/Decorator/RenderInXml.php | 4 +- Structural/Decorator/RendererInterface.php | 4 +- Structural/Decorator/Tests/DecoratorTest.php | 11 ++- Structural/Decorator/Webservice.php | 2 +- .../DependencyInjection/AbstractConfig.php | 2 +- .../DependencyInjection/ArrayConfig.php | 12 +-- Structural/DependencyInjection/Connection.php | 5 +- Structural/DependencyInjection/Parameters.php | 6 +- Structural/Facade/BiosInterface.php | 10 +-- Structural/Facade/Facade.php | 7 +- Structural/Facade/OsInterface.php | 4 +- Structural/Facade/Tests/FacadeTest.php | 4 +- Structural/FluentInterface/Sql.php | 18 ++--- .../Tests/FluentInterfaceTest.php | 3 +- Structural/Proxy/Record.php | 8 +- Structural/Proxy/RecordProxy.php | 4 +- Structural/Registry/Registry.php | 8 +- Structural/Registry/Tests/RegistryTest.php | 1 - 167 files changed, 510 insertions(+), 517 deletions(-) diff --git a/Behavioral/ChainOfResponsibilities/Handler.php b/Behavioral/ChainOfResponsibilities/Handler.php index f080e23..679734e 100644 --- a/Behavioral/ChainOfResponsibilities/Handler.php +++ b/Behavioral/ChainOfResponsibilities/Handler.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Behavioral\ChainOfResponsibilities; /** - * Handler is a generic handler in the chain of responsibilities + * Handler is a generic handler in the chain of responsibilities. * * Yes you could have a lighter CoR with a simpler handler but if you want your CoR * to be extendable and decoupled, it's a better idea to do things like that in real @@ -18,7 +18,7 @@ abstract class Handler private $successor = null; /** - * Append a responsibility to the end of chain + * Append a responsibility to the end of chain. * * A prepend method could be done with the same spirit * @@ -68,7 +68,7 @@ abstract class Handler } /** - * Each concrete handler has to implement the processing of the request + * Each concrete handler has to implement the processing of the request. * * @param Request $req * diff --git a/Behavioral/ChainOfResponsibilities/Responsible/FastStorage.php b/Behavioral/ChainOfResponsibilities/Responsible/FastStorage.php index 4a74642..8acaad1 100644 --- a/Behavioral/ChainOfResponsibilities/Responsible/FastStorage.php +++ b/Behavioral/ChainOfResponsibilities/Responsible/FastStorage.php @@ -6,7 +6,7 @@ use DesignPatterns\Behavioral\ChainOfResponsibilities\Handler; use DesignPatterns\Behavioral\ChainOfResponsibilities\Request; /** - * Class FastStorage + * Class FastStorage. */ class FastStorage extends Handler { diff --git a/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php b/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php index 127b7fc..bd3f825 100644 --- a/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php +++ b/Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php @@ -6,14 +6,13 @@ use DesignPatterns\Behavioral\ChainOfResponsibilities\Handler; use DesignPatterns\Behavioral\ChainOfResponsibilities\Request; /** - * This is mostly the same code as FastStorage but in fact, it may greatly differs + * This is mostly the same code as FastStorage but in fact, it may greatly differs. * * One important fact about CoR: each item in the chain MUST NOT assume its position * in the chain. A CoR is not responsible if the request is not handled UNLESS * you make an "ExceptionHandler" which throws exception if the request goes there. * * To be really extendable, each handler doesn't know if there is something after it. - * */ class SlowStorage extends Handler { diff --git a/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php b/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php index 0e8357c..62d1172 100644 --- a/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php +++ b/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php @@ -3,16 +3,15 @@ namespace DesignPatterns\Behavioral\ChainOfResponsibilities\Tests; use DesignPatterns\Behavioral\ChainOfResponsibilities\Request; +use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible; use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\FastStorage; use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage; -use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible; /** - * ChainTest tests the CoR + * ChainTest tests the CoR. */ class ChainTest extends \PHPUnit_Framework_TestCase { - /** * @var FastStorage */ @@ -30,7 +29,7 @@ class ChainTest extends \PHPUnit_Framework_TestCase $request->verb = 'get'; return array( - array($request) + array($request), ); } diff --git a/Behavioral/Command/CommandInterface.php b/Behavioral/Command/CommandInterface.php index ad9117b..cd9d9c6 100644 --- a/Behavioral/Command/CommandInterface.php +++ b/Behavioral/Command/CommandInterface.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Behavioral\Command; /** - * class CommandInterface + * class CommandInterface. */ interface CommandInterface { diff --git a/Behavioral/Command/HelloCommand.php b/Behavioral/Command/HelloCommand.php index 831c299..94d4723 100644 --- a/Behavioral/Command/HelloCommand.php +++ b/Behavioral/Command/HelloCommand.php @@ -4,7 +4,7 @@ namespace DesignPatterns\Behavioral\Command; /** * This concrete command calls "print" on the Receiver, but an external - * invoker just knows that it can call "execute" + * invoker just knows that it can call "execute". */ class HelloCommand implements CommandInterface { @@ -25,7 +25,7 @@ class HelloCommand implements CommandInterface } /** - * execute and output "Hello World" + * execute and output "Hello World". */ public function execute() { diff --git a/Behavioral/Command/Invoker.php b/Behavioral/Command/Invoker.php index 4461ee2..7942adb 100644 --- a/Behavioral/Command/Invoker.php +++ b/Behavioral/Command/Invoker.php @@ -4,7 +4,7 @@ namespace DesignPatterns\Behavioral\Command; /** * Invoker is using the command given to it. - * Example : an Application in SF2 + * Example : an Application in SF2. */ class Invoker { @@ -25,7 +25,7 @@ class Invoker } /** - * executes the command + * executes the command. */ public function run() { diff --git a/Behavioral/Command/Receiver.php b/Behavioral/Command/Receiver.php index 9289369..ccf910b 100644 --- a/Behavioral/Command/Receiver.php +++ b/Behavioral/Command/Receiver.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Behavioral\Command; /** - * Receiver is specific service with its own contract and can be only concrete + * Receiver is specific service with its own contract and can be only concrete. */ class Receiver { diff --git a/Behavioral/Command/Tests/CommandTest.php b/Behavioral/Command/Tests/CommandTest.php index abf7317..9d9aa51 100644 --- a/Behavioral/Command/Tests/CommandTest.php +++ b/Behavioral/Command/Tests/CommandTest.php @@ -2,16 +2,15 @@ namespace DesignPatterns\Behavioral\Command\Tests; +use DesignPatterns\Behavioral\Command\HelloCommand; use DesignPatterns\Behavioral\Command\Invoker; use DesignPatterns\Behavioral\Command\Receiver; -use DesignPatterns\Behavioral\Command\HelloCommand; /** - * CommandTest has the role of the Client in the Command Pattern + * CommandTest has the role of the Client in the Command Pattern. */ class CommandTest extends \PHPUnit_Framework_TestCase { - /** * @var Invoker */ diff --git a/Behavioral/Iterator/Book.php b/Behavioral/Iterator/Book.php index a0d1114..b1adf7f 100644 --- a/Behavioral/Iterator/Book.php +++ b/Behavioral/Iterator/Book.php @@ -4,7 +4,6 @@ namespace DesignPatterns\Behavioral\Iterator; class Book { - private $author; private $title; @@ -27,6 +26,6 @@ class Book public function getAuthorAndTitle() { - return $this->getTitle() . ' by ' . $this->getAuthor(); + return $this->getTitle().' by '.$this->getAuthor(); } } diff --git a/Behavioral/Iterator/BookList.php b/Behavioral/Iterator/BookList.php index 6773f9b..6cc5e5e 100644 --- a/Behavioral/Iterator/BookList.php +++ b/Behavioral/Iterator/BookList.php @@ -4,7 +4,6 @@ namespace DesignPatterns\Behavioral\Iterator; class BookList implements \Countable { - private $books; public function getBook($bookNumberToGet) @@ -13,7 +12,7 @@ class BookList implements \Countable return $this->books[$bookNumberToGet]; } - return null; + return; } public function addBook(Book $book) diff --git a/Behavioral/Iterator/BookListIterator.php b/Behavioral/Iterator/BookListIterator.php index 93df6d7..ecedba6 100644 --- a/Behavioral/Iterator/BookListIterator.php +++ b/Behavioral/Iterator/BookListIterator.php @@ -4,7 +4,6 @@ namespace DesignPatterns\Behavioral\Iterator; class BookListIterator implements \Iterator { - /** * @var BookList */ @@ -21,8 +20,10 @@ class BookListIterator implements \Iterator } /** - * Return the current book + * Return the current book. + * * @link http://php.net/manual/en/iterator.current.php + * * @return Book Can return any type. */ public function current() @@ -32,8 +33,10 @@ class BookListIterator implements \Iterator /** * (PHP 5 >= 5.0.0)
- * Move forward to next element + * Move forward to next element. + * * @link http://php.net/manual/en/iterator.next.php + * * @return void Any returned value is ignored. */ public function next() @@ -43,8 +46,10 @@ class BookListIterator implements \Iterator /** * (PHP 5 >= 5.0.0)
- * Return the key of the current element + * Return the key of the current element. + * * @link http://php.net/manual/en/iterator.key.php + * * @return mixed scalar on success, or null on failure. */ public function key() @@ -54,10 +59,12 @@ class BookListIterator implements \Iterator /** * (PHP 5 >= 5.0.0)
- * Checks if current position is valid + * Checks if current position is valid. + * * @link http://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. - * Returns true on success or false on failure. + * + * @return bool The return value will be casted to boolean and then evaluated. + * Returns true on success or false on failure. */ public function valid() { @@ -66,8 +73,10 @@ class BookListIterator implements \Iterator /** * (PHP 5 >= 5.0.0)
- * Rewind the Iterator to the first element + * Rewind the Iterator to the first element. + * * @link http://php.net/manual/en/iterator.rewind.php + * * @return void Any returned value is ignored. */ public function rewind() diff --git a/Behavioral/Iterator/BookListReverseIterator.php b/Behavioral/Iterator/BookListReverseIterator.php index d7ec49a..94f34d9 100644 --- a/Behavioral/Iterator/BookListReverseIterator.php +++ b/Behavioral/Iterator/BookListReverseIterator.php @@ -4,7 +4,6 @@ namespace DesignPatterns\Behavioral\Iterator; class BookListReverseIterator implements \Iterator { - /** * @var BookList */ @@ -22,8 +21,10 @@ class BookListReverseIterator implements \Iterator } /** - * Return the current book + * Return the current book. + * * @link http://php.net/manual/en/iterator.current.php + * * @return Book Can return any type. */ public function current() @@ -33,8 +34,10 @@ class BookListReverseIterator implements \Iterator /** * (PHP 5 >= 5.0.0)
- * Move forward to next element + * Move forward to next element. + * * @link http://php.net/manual/en/iterator.next.php + * * @return void Any returned value is ignored. */ public function next() @@ -44,8 +47,10 @@ class BookListReverseIterator implements \Iterator /** * (PHP 5 >= 5.0.0)
- * Return the key of the current element + * Return the key of the current element. + * * @link http://php.net/manual/en/iterator.key.php + * * @return mixed scalar on success, or null on failure. */ public function key() @@ -55,10 +60,12 @@ class BookListReverseIterator implements \Iterator /** * (PHP 5 >= 5.0.0)
- * Checks if current position is valid + * Checks if current position is valid. + * * @link http://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. - * Returns true on success or false on failure. + * + * @return bool The return value will be casted to boolean and then evaluated. + * Returns true on success or false on failure. */ public function valid() { @@ -67,8 +74,10 @@ class BookListReverseIterator implements \Iterator /** * (PHP 5 >= 5.0.0)
- * Rewind the Iterator to the first element + * Rewind the Iterator to the first element. + * * @link http://php.net/manual/en/iterator.rewind.php + * * @return void Any returned value is ignored. */ public function rewind() diff --git a/Behavioral/Iterator/Tests/IteratorTest.php b/Behavioral/Iterator/Tests/IteratorTest.php index 2c5acd9..db386f0 100644 --- a/Behavioral/Iterator/Tests/IteratorTest.php +++ b/Behavioral/Iterator/Tests/IteratorTest.php @@ -9,7 +9,6 @@ use DesignPatterns\Behavioral\Iterator\BookListReverseIterator; class IteratorTest extends \PHPUnit_Framework_TestCase { - /** * @var BookList */ @@ -30,8 +29,8 @@ class IteratorTest extends \PHPUnit_Framework_TestCase array( 'Learning PHP Design Patterns by William Sanders', 'Professional Php Design Patterns by Aaron Saray', - 'Clean Code by Robert C. Martin' - ) + 'Clean Code by Robert C. Martin', + ), ), ); } @@ -65,7 +64,7 @@ class IteratorTest extends \PHPUnit_Framework_TestCase } /** - * Test BookList Remove + * Test BookList Remove. */ public function testBookRemove() { diff --git a/Behavioral/Mediator/Colleague.php b/Behavioral/Mediator/Colleague.php index c0ff248..c74dee5 100644 --- a/Behavioral/Mediator/Colleague.php +++ b/Behavioral/Mediator/Colleague.php @@ -9,12 +9,12 @@ namespace DesignPatterns\Behavioral\Mediator; abstract class Colleague { /** - * this ensures no change in subclasses + * this ensures no change in subclasses. * * @var MediatorInterface */ private $mediator; - + /** * @param MediatorInterface $medium */ @@ -25,6 +25,7 @@ abstract class Colleague } // for subclasses + protected function getMediator() { return $this->mediator; diff --git a/Behavioral/Mediator/Mediator.php b/Behavioral/Mediator/Mediator.php index ba1407e..98a7890 100644 --- a/Behavioral/Mediator/Mediator.php +++ b/Behavioral/Mediator/Mediator.php @@ -2,15 +2,12 @@ namespace DesignPatterns\Behavioral\Mediator; -use DesignPatterns\Behavioral\Mediator\Subsystem; - /** * Mediator is the concrete Mediator for this design pattern. * In this example, I have made a "Hello World" with the Mediator Pattern. */ class Mediator implements MediatorInterface { - /** * @var Subsystem\Server */ @@ -39,7 +36,7 @@ class Mediator implements MediatorInterface } /** - * make request + * make request. */ public function makeRequest() { @@ -47,7 +44,8 @@ class Mediator implements MediatorInterface } /** - * query db + * query db. + * * @return mixed */ public function queryDb() @@ -56,7 +54,7 @@ class Mediator implements MediatorInterface } /** - * send response + * send response. * * @param string $content */ diff --git a/Behavioral/Mediator/MediatorInterface.php b/Behavioral/Mediator/MediatorInterface.php index b289cea..dbdd489 100644 --- a/Behavioral/Mediator/MediatorInterface.php +++ b/Behavioral/Mediator/MediatorInterface.php @@ -4,24 +4,24 @@ namespace DesignPatterns\Behavioral\Mediator; /** * MediatorInterface is a contract for the Mediator - * This interface is not mandatory but it is better for LSP concerns + * This interface is not mandatory but it is better for LSP concerns. */ interface MediatorInterface { /** - * sends the response + * sends the response. * * @param string $content */ public function sendResponse($content); /** - * makes a request + * makes a request. */ public function makeRequest(); /** - * queries the DB + * queries the DB. */ public function queryDb(); } diff --git a/Behavioral/Mediator/Subsystem/Client.php b/Behavioral/Mediator/Subsystem/Client.php index cb4b020..f7a21c9 100644 --- a/Behavioral/Mediator/Subsystem/Client.php +++ b/Behavioral/Mediator/Subsystem/Client.php @@ -5,12 +5,12 @@ namespace DesignPatterns\Behavioral\Mediator\Subsystem; use DesignPatterns\Behavioral\Mediator\Colleague; /** - * Client is a client that make request et get response + * Client is a client that make request et get response. */ class Client extends Colleague { /** - * request + * request. */ public function request() { @@ -18,7 +18,7 @@ class Client extends Colleague } /** - * output content + * output content. * * @param string $content */ diff --git a/Behavioral/Mediator/Subsystem/Database.php b/Behavioral/Mediator/Subsystem/Database.php index 7cc9bc4..69ad6cf 100644 --- a/Behavioral/Mediator/Subsystem/Database.php +++ b/Behavioral/Mediator/Subsystem/Database.php @@ -5,7 +5,7 @@ namespace DesignPatterns\Behavioral\Mediator\Subsystem; use DesignPatterns\Behavioral\Mediator\Colleague; /** - * Database is a database service + * Database is a database service. */ class Database extends Colleague { @@ -14,6 +14,6 @@ class Database extends Colleague */ public function getData() { - return "World"; + return 'World'; } } diff --git a/Behavioral/Mediator/Subsystem/Server.php b/Behavioral/Mediator/Subsystem/Server.php index 1638301..1602bcb 100644 --- a/Behavioral/Mediator/Subsystem/Server.php +++ b/Behavioral/Mediator/Subsystem/Server.php @@ -5,12 +5,12 @@ namespace DesignPatterns\Behavioral\Mediator\Subsystem; use DesignPatterns\Behavioral\Mediator\Colleague; /** - * Server serves responses + * Server serves responses. */ class Server extends Colleague { /** - * process on server + * process on server. */ public function process() { diff --git a/Behavioral/Mediator/Tests/MediatorTest.php b/Behavioral/Mediator/Tests/MediatorTest.php index 13abe48..2bce947 100644 --- a/Behavioral/Mediator/Tests/MediatorTest.php +++ b/Behavioral/Mediator/Tests/MediatorTest.php @@ -3,16 +3,15 @@ namespace DesignPatterns\Tests\Mediator\Tests; use DesignPatterns\Behavioral\Mediator\Mediator; -use DesignPatterns\Behavioral\Mediator\Subsystem\Database; use DesignPatterns\Behavioral\Mediator\Subsystem\Client; +use DesignPatterns\Behavioral\Mediator\Subsystem\Database; use DesignPatterns\Behavioral\Mediator\Subsystem\Server; /** - * MediatorTest tests hello world + * MediatorTest tests hello world. */ class MediatorTest extends \PHPUnit_Framework_TestCase { - protected $client; protected function setUp() diff --git a/Behavioral/Memento/Caretaker.php b/Behavioral/Memento/Caretaker.php index 72530fb..d80454a 100644 --- a/Behavioral/Memento/Caretaker.php +++ b/Behavioral/Memento/Caretaker.php @@ -27,19 +27,19 @@ class Caretaker $originator = new Originator(); //Setting state to State1 - $originator->setState("State1"); + $originator->setState('State1'); //Setting state to State2 - $originator->setState("State2"); + $originator->setState('State2'); //Saving State2 to Memento $this->saveToHistory($originator->getStateAsMemento()); //Setting state to State3 - $originator->setState("State3"); + $originator->setState('State3'); // We can request multiple mementos, and choose which one to roll back to. // Saving State3 to Memento $this->saveToHistory($originator->getStateAsMemento()); //Setting state to State4 - $originator->setState("State4"); + $originator->setState('State4'); $originator->restoreFromMemento($this->getFromHistory(1)); //State after restoring from Memento: State3 diff --git a/Behavioral/Memento/Tests/MementoTest.php b/Behavioral/Memento/Tests/MementoTest.php index 3ea82b1..722dbfa 100644 --- a/Behavioral/Memento/Tests/MementoTest.php +++ b/Behavioral/Memento/Tests/MementoTest.php @@ -7,11 +7,10 @@ use DesignPatterns\Behavioral\Memento\Memento; use DesignPatterns\Behavioral\Memento\Originator; /** - * MementoTest tests the memento pattern + * MementoTest tests the memento pattern. */ class MementoTest extends \PHPUnit_Framework_TestCase { - public function testUsageExample() { $originator = new Originator(); @@ -19,25 +18,25 @@ class MementoTest extends \PHPUnit_Framework_TestCase $character = new \stdClass(); // new object - $character->name = "Gandalf"; + $character->name = 'Gandalf'; // connect Originator to character object $originator->setState($character); // work on the object - $character->name = "Gandalf the Grey"; + $character->name = 'Gandalf the Grey'; // still change something - $character->race = "Maia"; + $character->race = 'Maia'; // time to save state $snapshot = $originator->getStateAsMemento(); // put state to log $caretaker->saveToHistory($snapshot); // change something - $character->name = "Sauron"; + $character->name = 'Sauron'; // and again - $character->race = "Ainur"; + $character->race = 'Ainur'; // state inside the Originator was equally changed - $this->assertAttributeEquals($character, "state", $originator); + $this->assertAttributeEquals($character, 'state', $originator); // time to save another state $snapshot = $originator->getStateAsMemento(); @@ -51,32 +50,32 @@ class MementoTest extends \PHPUnit_Framework_TestCase $character = $rollback->getState(); // yes, that what we need - $this->assertEquals("Gandalf the Grey", $character->name); + $this->assertEquals('Gandalf the Grey', $character->name); // make new changes - $character->name = "Gandalf the White"; + $character->name = 'Gandalf the White'; // and Originator linked to actual object again - $this->assertAttributeEquals($character, "state", $originator); + $this->assertAttributeEquals($character, 'state', $originator); } public function testStringState() { $originator = new Originator(); - $originator->setState("State1"); + $originator->setState('State1'); - $this->assertAttributeEquals("State1", "state", $originator); + $this->assertAttributeEquals('State1', 'state', $originator); - $originator->setState("State2"); - $this->assertAttributeEquals("State2", "state", $originator); + $originator->setState('State2'); + $this->assertAttributeEquals('State2', 'state', $originator); $snapshot = $originator->getStateAsMemento(); - $this->assertAttributeEquals("State2", "state", $snapshot); + $this->assertAttributeEquals('State2', 'state', $snapshot); - $originator->setState("State3"); - $this->assertAttributeEquals("State3", "state", $originator); + $originator->setState('State3'); + $this->assertAttributeEquals('State3', 'state', $originator); $originator->restoreFromMemento($snapshot); - $this->assertAttributeEquals("State2", "state", $originator); + $this->assertAttributeEquals('State2', 'state', $originator); } public function testSnapshotIsClone() @@ -88,11 +87,11 @@ class MementoTest extends \PHPUnit_Framework_TestCase $snapshot = $originator->getStateAsMemento(); $object->new_property = 1; - $this->assertAttributeEquals($object, "state", $originator); - $this->assertAttributeNotEquals($object, "state", $snapshot); + $this->assertAttributeEquals($object, 'state', $originator); + $this->assertAttributeNotEquals($object, 'state', $snapshot); $originator->restoreFromMemento($snapshot); - $this->assertAttributeNotEquals($object, "state", $originator); + $this->assertAttributeNotEquals($object, 'state', $originator); } public function testCanChangeActualState() @@ -108,16 +107,16 @@ class MementoTest extends \PHPUnit_Framework_TestCase $first_state->first_property = 1; // just history $second_state->second_property = 2; - $this->assertAttributeEquals($first_state, "state", $originator); - $this->assertAttributeNotEquals($second_state, "state", $originator); + $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); + $this->assertAttributeEquals($second_state, 'state', $originator); + $this->assertAttributeNotEquals($first_state, 'state', $originator); } public function testStateWithDifferentObjects() @@ -125,40 +124,39 @@ class MementoTest extends \PHPUnit_Framework_TestCase $originator = new Originator(); $first = new \stdClass(); - $first->data = "foo"; + $first->data = 'foo'; $originator->setState($first); - $this->assertAttributeEquals($first, "state", $originator); + $this->assertAttributeEquals($first, 'state', $originator); $first_snapshot = $originator->getStateAsMemento(); - $this->assertAttributeEquals($first, "state", $first_snapshot); + $this->assertAttributeEquals($first, 'state', $first_snapshot); - $second = new \stdClass(); - $second->data = "bar"; + $second = new \stdClass(); + $second->data = 'bar'; $originator->setState($second); - $this->assertAttributeEquals($second, "state", $originator); + $this->assertAttributeEquals($second, 'state', $originator); $originator->restoreFromMemento($first_snapshot); - $this->assertAttributeEquals($first, "state", $originator); + $this->assertAttributeEquals($first, 'state', $originator); } public function testCaretaker() { $caretaker = new Caretaker(); - $memento1 = new Memento("foo"); - $memento2 = new Memento("bar"); + $memento1 = new Memento('foo'); + $memento2 = new Memento('bar'); $caretaker->saveToHistory($memento1); $caretaker->saveToHistory($memento2); - $this->assertAttributeEquals(array($memento1, $memento2), "history", $caretaker); + $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('State3', $result); } } diff --git a/Behavioral/NullObject/LoggerInterface.php b/Behavioral/NullObject/LoggerInterface.php index 216d838..99a28c7 100644 --- a/Behavioral/NullObject/LoggerInterface.php +++ b/Behavioral/NullObject/LoggerInterface.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Behavioral\NullObject; /** - * LoggerInterface is a contract for logging something + * LoggerInterface is a contract for logging something. * * Key feature: NullLogger MUST inherit from this interface like any other Loggers */ diff --git a/Behavioral/NullObject/PrintLogger.php b/Behavioral/NullObject/PrintLogger.php index a088145..371c1ab 100644 --- a/Behavioral/NullObject/PrintLogger.php +++ b/Behavioral/NullObject/PrintLogger.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Behavioral\NullObject; /** - * PrintLogger is a logger that prints the log entry to standard output + * PrintLogger is a logger that prints the log entry to standard output. */ class PrintLogger implements LoggerInterface { diff --git a/Behavioral/NullObject/Service.php b/Behavioral/NullObject/Service.php index ae6d96d..56a3847 100644 --- a/Behavioral/NullObject/Service.php +++ b/Behavioral/NullObject/Service.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Behavioral\NullObject; /** - * Service is dummy service that uses a logger + * Service is dummy service that uses a logger. */ class Service { @@ -13,7 +13,7 @@ class Service protected $logger; /** - * we inject the logger in ctor and it is mandatory + * we inject the logger in ctor and it is mandatory. * * @param LoggerInterface $log */ @@ -28,7 +28,7 @@ class Service public function doSomething() { // no more check "if (!is_null($this->logger))..." with the NullObject pattern - $this->logger->log('We are in ' . __METHOD__); + $this->logger->log('We are in '.__METHOD__); // something to do... } } diff --git a/Behavioral/NullObject/Tests/LoggerTest.php b/Behavioral/NullObject/Tests/LoggerTest.php index a8e7bf5..034b577 100644 --- a/Behavioral/NullObject/Tests/LoggerTest.php +++ b/Behavioral/NullObject/Tests/LoggerTest.php @@ -3,15 +3,14 @@ namespace DesignPatterns\Behavioral\NullObject\Tests; use DesignPatterns\Behavioral\NullObject\NullLogger; -use DesignPatterns\Behavioral\NullObject\Service; use DesignPatterns\Behavioral\NullObject\PrintLogger; +use DesignPatterns\Behavioral\NullObject\Service; /** - * LoggerTest tests for different loggers + * LoggerTest tests for different loggers. */ class LoggerTest extends \PHPUnit_Framework_TestCase { - public function testNullObject() { // one can use a singleton for NullObjet : I don't think it's a good idea diff --git a/Behavioral/Observer/Tests/ObserverTest.php b/Behavioral/Observer/Tests/ObserverTest.php index 75490cc..d9dacec 100644 --- a/Behavioral/Observer/Tests/ObserverTest.php +++ b/Behavioral/Observer/Tests/ObserverTest.php @@ -2,15 +2,14 @@ namespace DesignPatterns\Behavioral\Observer\Tests; -use DesignPatterns\Behavioral\Observer\UserObserver; use DesignPatterns\Behavioral\Observer\User; +use DesignPatterns\Behavioral\Observer\UserObserver; /** - * ObserverTest tests the Observer pattern + * ObserverTest tests the Observer pattern. */ class ObserverTest extends \PHPUnit_Framework_TestCase { - protected $observer; protected function setUp() @@ -19,7 +18,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase } /** - * Tests the notification + * Tests the notification. */ public function testNotify() { @@ -31,7 +30,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase } /** - * Tests the subscribing + * Tests the subscribing. */ public function testAttachDetach() { @@ -53,7 +52,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase } /** - * Tests the update() invocation on a mockup + * Tests the update() invocation on a mockup. */ public function testUpdateCalling() { diff --git a/Behavioral/Observer/User.php b/Behavioral/Observer/User.php index 213f229..0d2a817 100644 --- a/Behavioral/Observer/User.php +++ b/Behavioral/Observer/User.php @@ -3,34 +3,33 @@ namespace DesignPatterns\Behavioral\Observer; /** - * Observer pattern : The observed object (the subject) + * Observer pattern : The observed object (the subject). * * The subject maintains a list of Observers and sends notifications. - * */ class User implements \SplSubject { /** - * user data + * user data. * * @var array */ protected $data = array(); /** - * observers + * observers. * * @var \SplObjectStorage */ protected $observers; - + public function __construct() { $this->observers = new \SplObjectStorage(); } /** - * attach a new observer + * attach a new observer. * * @param \SplObserver $observer * @@ -42,7 +41,7 @@ class User implements \SplSubject } /** - * detach an observer + * detach an observer. * * @param \SplObserver $observer * @@ -54,7 +53,7 @@ class User implements \SplSubject } /** - * notify observers + * notify observers. * * @return void */ @@ -68,7 +67,7 @@ class User implements \SplSubject /** * Ideally one would better write setter/getter for all valid attributes and only call notify() - * on attributes that matter when changed + * on attributes that matter when changed. * * @param string $name * @param mixed $value diff --git a/Behavioral/Observer/UserObserver.php b/Behavioral/Observer/UserObserver.php index f444604..f2673ba 100644 --- a/Behavioral/Observer/UserObserver.php +++ b/Behavioral/Observer/UserObserver.php @@ -3,18 +3,18 @@ namespace DesignPatterns\Behavioral\Observer; /** - * class UserObserver + * class UserObserver. */ class UserObserver implements \SplObserver { /** * This is the only method to implement as an observer. - * It is called by the Subject (usually by SplSubject::notify() ) + * It is called by the Subject (usually by SplSubject::notify() ). * * @param \SplSubject $subject */ public function update(\SplSubject $subject) { - echo get_class($subject) . ' has been updated'; + echo get_class($subject).' has been updated'; } } diff --git a/Behavioral/Specification/AbstractSpecification.php b/Behavioral/Specification/AbstractSpecification.php index f297539..66d61b8 100644 --- a/Behavioral/Specification/AbstractSpecification.php +++ b/Behavioral/Specification/AbstractSpecification.php @@ -1,13 +1,14 @@ comparator) { - throw new \LogicException("Comparator is not set"); + throw new \LogicException('Comparator is not set'); } $callback = array($this->comparator, 'compare'); diff --git a/Behavioral/Strategy/Tests/StrategyTest.php b/Behavioral/Strategy/Tests/StrategyTest.php index 4831b18..1911ba4 100644 --- a/Behavioral/Strategy/Tests/StrategyTest.php +++ b/Behavioral/Strategy/Tests/StrategyTest.php @@ -8,21 +8,20 @@ use DesignPatterns\Behavioral\Strategy\ObjectCollection; use DesignPatterns\Behavioral\Strategy\Strategy; /** - * Tests for Strategy pattern + * Tests for Strategy pattern. */ class StrategyTest extends \PHPUnit_Framework_TestCase { - public function getIdCollection() { return array( array( array(array('id' => 2), array('id' => 1), array('id' => 3)), - array('id' => 1) + array('id' => 1), ), array( array(array('id' => 3), array('id' => 2), array('id' => 1)), - array('id' => 1) + array('id' => 1), ), ); } @@ -32,11 +31,11 @@ class StrategyTest extends \PHPUnit_Framework_TestCase return array( array( array(array('date' => '2014-03-03'), array('date' => '2015-03-02'), array('date' => '2013-03-01')), - array('date' => '2013-03-01') + array('date' => '2013-03-01'), ), array( array(array('date' => '2014-02-03'), array('date' => '2013-02-01'), array('date' => '2015-02-02')), - array('date' => '2013-02-01') + array('date' => '2013-02-01'), ), ); } diff --git a/Behavioral/TemplateMethod/BeachJourney.php b/Behavioral/TemplateMethod/BeachJourney.php index 94018f3..d19845c 100644 --- a/Behavioral/TemplateMethod/BeachJourney.php +++ b/Behavioral/TemplateMethod/BeachJourney.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Behavioral\TemplateMethod; /** - * BeachJourney is vacation at the beach + * BeachJourney is vacation at the beach. */ class BeachJourney extends Journey { /** - * prints what to do to enjoy your vacation + * prints what to do to enjoy your vacation. */ protected function enjoyVacation() { diff --git a/Behavioral/TemplateMethod/CityJourney.php b/Behavioral/TemplateMethod/CityJourney.php index 89c2ef0..3f36b61 100644 --- a/Behavioral/TemplateMethod/CityJourney.php +++ b/Behavioral/TemplateMethod/CityJourney.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Behavioral\TemplateMethod; /** - * CityJourney is a journey in a city + * CityJourney is a journey in a city. */ class CityJourney extends Journey { /** - * prints what to do in your journey to enjoy vacation + * prints what to do in your journey to enjoy vacation. */ protected function enjoyVacation() { diff --git a/Behavioral/TemplateMethod/Journey.php b/Behavioral/TemplateMethod/Journey.php index cec9a7d..6309e7f 100644 --- a/Behavioral/TemplateMethod/Journey.php +++ b/Behavioral/TemplateMethod/Journey.php @@ -23,7 +23,7 @@ abstract class Journey } /** - * This method must be implemented, this is the key-feature of this pattern + * This method must be implemented, this is the key-feature of this pattern. */ abstract protected function enjoyVacation(); @@ -37,7 +37,7 @@ abstract class Journey } /** - * This method will be unknown by subclasses (better) + * This method will be unknown by subclasses (better). */ private function buyAFlight() { @@ -46,7 +46,7 @@ abstract class Journey /** * Subclasses will get access to this method but cannot override it and - * compromise this algorithm (warning : cause of cyclic dependencies) + * compromise this algorithm (warning : cause of cyclic dependencies). */ final protected function takePlane() { diff --git a/Behavioral/TemplateMethod/Tests/JourneyTest.php b/Behavioral/TemplateMethod/Tests/JourneyTest.php index d0b134c..82acef3 100644 --- a/Behavioral/TemplateMethod/Tests/JourneyTest.php +++ b/Behavioral/TemplateMethod/Tests/JourneyTest.php @@ -5,11 +5,10 @@ namespace DesignPatterns\Behavioral\TemplateMethod\Tests; use DesignPatterns\Behavioral\TemplateMethod; /** - * JourneyTest tests all journeys + * JourneyTest tests all journeys. */ class JourneyTest extends \PHPUnit_Framework_TestCase { - public function testBeach() { $journey = new TemplateMethod\BeachJourney(); @@ -25,7 +24,7 @@ class JourneyTest extends \PHPUnit_Framework_TestCase } /** - * How to test an abstract template method with PHPUnit + * How to test an abstract template method with PHPUnit. */ public function testLasVegas() { diff --git a/Behavioral/Visitor/Group.php b/Behavioral/Visitor/Group.php index 3990f9c..b2c9d90 100644 --- a/Behavioral/Visitor/Group.php +++ b/Behavioral/Visitor/Group.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Behavioral\Visitor; /** - * An example of a Visitor: Group + * An example of a Visitor: Group. */ class Group extends Role { @@ -25,6 +25,6 @@ class Group extends Role */ public function getName() { - return "Group: " . $this->name; + return 'Group: '.$this->name; } } diff --git a/Behavioral/Visitor/Role.php b/Behavioral/Visitor/Role.php index fd0d0a4..011a0fb 100644 --- a/Behavioral/Visitor/Role.php +++ b/Behavioral/Visitor/Role.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Behavioral\Visitor; /** - * class Role + * class Role. */ abstract class Role { /** - * This method handles a double dispatch based on the short name of the Visitor + * This method handles a double dispatch based on the short name of the Visitor. * * Feel free to override it if your object must call another visiting behavior * @@ -21,10 +21,10 @@ abstract class Role // this trick to simulate double-dispatch based on type-hinting $klass = get_called_class(); preg_match('#([^\\\\]+)$#', $klass, $extract); - $visitingMethod = 'visit' . $extract[1]; + $visitingMethod = 'visit'.$extract[1]; // this ensures strong typing with visitor interface, not some visitor objects - if (!method_exists(__NAMESPACE__ . '\RoleVisitorInterface', $visitingMethod)) { + if (!method_exists(__NAMESPACE__.'\RoleVisitorInterface', $visitingMethod)) { throw new \InvalidArgumentException("The visitor you provide cannot visit a $klass instance"); } diff --git a/Behavioral/Visitor/RolePrintVisitor.php b/Behavioral/Visitor/RolePrintVisitor.php index 5f07d5c..49777cf 100644 --- a/Behavioral/Visitor/RolePrintVisitor.php +++ b/Behavioral/Visitor/RolePrintVisitor.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Behavioral\Visitor; /** - * Visitor Pattern + * Visitor Pattern. * * An implementation of a concrete Visitor */ @@ -14,7 +14,7 @@ class RolePrintVisitor implements RoleVisitorInterface */ public function visitGroup(Group $role) { - echo "Role: " . $role->getName(); + echo 'Role: '.$role->getName(); } /** @@ -22,6 +22,6 @@ class RolePrintVisitor implements RoleVisitorInterface */ public function visitUser(User $role) { - echo "Role: " . $role->getName(); + echo 'Role: '.$role->getName(); } } diff --git a/Behavioral/Visitor/RoleVisitorInterface.php b/Behavioral/Visitor/RoleVisitorInterface.php index b007b13..1a72d7e 100644 --- a/Behavioral/Visitor/RoleVisitorInterface.php +++ b/Behavioral/Visitor/RoleVisitorInterface.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Behavioral\Visitor; /** - * Visitor Pattern + * Visitor Pattern. * * The contract for the visitor. * @@ -16,14 +16,14 @@ namespace DesignPatterns\Behavioral\Visitor; interface RoleVisitorInterface { /** - * Visit a User object + * Visit a User object. * * @param \DesignPatterns\Behavioral\Visitor\User $role */ public function visitUser(User $role); /** - * Visit a Group object + * Visit a Group object. * * @param \DesignPatterns\Behavioral\Visitor\Group $role */ diff --git a/Behavioral/Visitor/Tests/VisitorTest.php b/Behavioral/Visitor/Tests/VisitorTest.php index 6d71658..f3b5bc7 100644 --- a/Behavioral/Visitor/Tests/VisitorTest.php +++ b/Behavioral/Visitor/Tests/VisitorTest.php @@ -5,11 +5,10 @@ namespace DesignPatterns\Tests\Visitor\Tests; use DesignPatterns\Behavioral\Visitor; /** - * VisitorTest tests the visitor pattern + * VisitorTest tests the visitor pattern. */ class VisitorTest extends \PHPUnit_Framework_TestCase { - protected $visitor; protected function setUp() @@ -20,8 +19,8 @@ class VisitorTest extends \PHPUnit_Framework_TestCase public function getRole() { return array( - array(new Visitor\User("Dominik"), 'Role: User Dominik'), - array(new Visitor\Group("Administrators"), 'Role: Group: Administrators') + array(new Visitor\User('Dominik'), 'Role: User Dominik'), + array(new Visitor\Group('Administrators'), 'Role: Group: Administrators'), ); } diff --git a/Behavioral/Visitor/User.php b/Behavioral/Visitor/User.php index e0cc4c7..5a95fbe 100644 --- a/Behavioral/Visitor/User.php +++ b/Behavioral/Visitor/User.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Behavioral\Visitor; /** - * Visitor Pattern + * Visitor Pattern. * * One example for a visitee. Each visitee has to extends Role */ @@ -27,6 +27,6 @@ class User extends Role */ public function getName() { - return "User " . $this->name; + return 'User '.$this->name; } } diff --git a/Creational/AbstractFactory/AbstractFactory.php b/Creational/AbstractFactory/AbstractFactory.php index 49982e5..6529ff6 100644 --- a/Creational/AbstractFactory/AbstractFactory.php +++ b/Creational/AbstractFactory/AbstractFactory.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\AbstractFactory; /** - * class AbstractFactory + * class AbstractFactory. * * Sometimes also known as "Kit" in a GUI libraries. * @@ -20,7 +20,7 @@ namespace DesignPatterns\Creational\AbstractFactory; abstract class AbstractFactory { /** - * Creates a text component + * Creates a text component. * * @param string $content * @@ -29,7 +29,7 @@ abstract class AbstractFactory abstract public function createText($content); /** - * Creates a picture component + * Creates a picture component. * * @param string $path * @param string $name diff --git a/Creational/AbstractFactory/Html/Picture.php b/Creational/AbstractFactory/Html/Picture.php index 9d7f440..3abacb4 100644 --- a/Creational/AbstractFactory/Html/Picture.php +++ b/Creational/AbstractFactory/Html/Picture.php @@ -5,14 +5,14 @@ namespace DesignPatterns\Creational\AbstractFactory\Html; use DesignPatterns\Creational\AbstractFactory\Picture as BasePicture; /** - * Class Picture + * Class Picture. * * Picture is a concrete image for HTML rendering */ class Picture extends BasePicture { /** - * some crude rendering from HTML output + * some crude rendering from HTML output. * * @return string */ diff --git a/Creational/AbstractFactory/Html/Text.php b/Creational/AbstractFactory/Html/Text.php index 120c043..8c33da6 100644 --- a/Creational/AbstractFactory/Html/Text.php +++ b/Creational/AbstractFactory/Html/Text.php @@ -5,19 +5,19 @@ namespace DesignPatterns\Creational\AbstractFactory\Html; use DesignPatterns\Creational\AbstractFactory\Text as BaseText; /** - * Class Text + * Class Text. * * Text is a concrete text for HTML rendering */ class Text extends BaseText { /** - * some crude rendering from HTML output + * some crude rendering from HTML output. * * @return string */ public function render() { - return '

' . htmlspecialchars($this->text) . '
'; + return '
'.htmlspecialchars($this->text).'
'; } } diff --git a/Creational/AbstractFactory/HtmlFactory.php b/Creational/AbstractFactory/HtmlFactory.php index 7982a24..5c22859 100644 --- a/Creational/AbstractFactory/HtmlFactory.php +++ b/Creational/AbstractFactory/HtmlFactory.php @@ -3,14 +3,14 @@ namespace DesignPatterns\Creational\AbstractFactory; /** - * Class HtmlFactory + * Class HtmlFactory. * * HtmlFactory is a concrete factory for HTML component */ class HtmlFactory extends AbstractFactory { /** - * Creates a picture component + * Creates a picture component. * * @param string $path * @param string $name @@ -23,7 +23,7 @@ class HtmlFactory extends AbstractFactory } /** - * Creates a text component + * Creates a text component. * * @param string $content * diff --git a/Creational/AbstractFactory/Json/Picture.php b/Creational/AbstractFactory/Json/Picture.php index 13d191b..77bb150 100644 --- a/Creational/AbstractFactory/Json/Picture.php +++ b/Creational/AbstractFactory/Json/Picture.php @@ -5,14 +5,14 @@ namespace DesignPatterns\Creational\AbstractFactory\Json; use DesignPatterns\Creational\AbstractFactory\Picture as BasePicture; /** - * Class Picture + * Class Picture. * * Picture is a concrete image for JSON rendering */ class Picture extends BasePicture { /** - * some crude rendering from JSON output + * some crude rendering from JSON output. * * @return string */ diff --git a/Creational/AbstractFactory/Json/Text.php b/Creational/AbstractFactory/Json/Text.php index 699fff3..4c51785 100644 --- a/Creational/AbstractFactory/Json/Text.php +++ b/Creational/AbstractFactory/Json/Text.php @@ -5,14 +5,14 @@ namespace DesignPatterns\Creational\AbstractFactory\Json; use DesignPatterns\Creational\AbstractFactory\Text as BaseText; /** - * Class Text + * Class Text. * * Text is a text component with a JSON rendering */ class Text extends BaseText { /** - * some crude rendering from JSON output + * some crude rendering from JSON output. * * @return string */ diff --git a/Creational/AbstractFactory/JsonFactory.php b/Creational/AbstractFactory/JsonFactory.php index ab2bb6f..63a9979 100644 --- a/Creational/AbstractFactory/JsonFactory.php +++ b/Creational/AbstractFactory/JsonFactory.php @@ -3,16 +3,15 @@ namespace DesignPatterns\Creational\AbstractFactory; /** - * Class JsonFactory + * Class JsonFactory. * * JsonFactory is a factory for creating a family of JSON component * (example for ajax) */ class JsonFactory extends AbstractFactory { - /** - * Creates a picture component + * Creates a picture component. * * @param string $path * @param string $name @@ -25,7 +24,7 @@ class JsonFactory extends AbstractFactory } /** - * Creates a text component + * Creates a text component. * * @param string $content * diff --git a/Creational/AbstractFactory/MediaInterface.php b/Creational/AbstractFactory/MediaInterface.php index 6bb5d3a..aa73f1b 100644 --- a/Creational/AbstractFactory/MediaInterface.php +++ b/Creational/AbstractFactory/MediaInterface.php @@ -3,16 +3,15 @@ namespace DesignPatterns\Creational\AbstractFactory; /** - * Interface MediaInterface + * Interface MediaInterface. * * This contract is not part of the pattern, in general case, each component * are not related */ interface MediaInterface { - /** - * some crude rendering from JSON or html output (depended on concrete class) + * some crude rendering from JSON or html output (depended on concrete class). * * @return string */ diff --git a/Creational/AbstractFactory/Picture.php b/Creational/AbstractFactory/Picture.php index 8a4f720..89fd66f 100644 --- a/Creational/AbstractFactory/Picture.php +++ b/Creational/AbstractFactory/Picture.php @@ -3,11 +3,10 @@ namespace DesignPatterns\Creational\AbstractFactory; /** - * Class Picture + * Class Picture. */ abstract class Picture implements MediaInterface { - /** * @var string */ diff --git a/Creational/AbstractFactory/Tests/AbstractFactoryTest.php b/Creational/AbstractFactory/Tests/AbstractFactoryTest.php index b51394a..97f4417 100644 --- a/Creational/AbstractFactory/Tests/AbstractFactoryTest.php +++ b/Creational/AbstractFactory/Tests/AbstractFactoryTest.php @@ -7,7 +7,7 @@ use DesignPatterns\Creational\AbstractFactory\HtmlFactory; use DesignPatterns\Creational\AbstractFactory\JsonFactory; /** - * AbstractFactoryTest tests concrete factories + * AbstractFactoryTest tests concrete factories. */ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase { @@ -15,7 +15,7 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase { return array( array(new JsonFactory()), - array(new HtmlFactory()) + array(new HtmlFactory()), ); } @@ -31,7 +31,7 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase $article = array( $factory->createText('Lorem Ipsum'), $factory->createPicture('/image.jpg', 'caption'), - $factory->createText('footnotes') + $factory->createText('footnotes'), ); $this->assertContainsOnly('DesignPatterns\Creational\AbstractFactory\MediaInterface', $article); diff --git a/Creational/AbstractFactory/Text.php b/Creational/AbstractFactory/Text.php index 5d2da89..30984f3 100644 --- a/Creational/AbstractFactory/Text.php +++ b/Creational/AbstractFactory/Text.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\AbstractFactory; /** - * Class Text + * Class Text. */ abstract class Text implements MediaInterface { diff --git a/Creational/Builder/BikeBuilder.php b/Creational/Builder/BikeBuilder.php index 53d53d3..f83c5db 100644 --- a/Creational/Builder/BikeBuilder.php +++ b/Creational/Builder/BikeBuilder.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\Builder; /** - * BikeBuilder builds bike + * BikeBuilder builds bike. */ class BikeBuilder implements BuilderInterface { diff --git a/Creational/Builder/CarBuilder.php b/Creational/Builder/CarBuilder.php index 7725176..a0693d0 100644 --- a/Creational/Builder/CarBuilder.php +++ b/Creational/Builder/CarBuilder.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\Builder; /** - * CarBuilder builds car + * CarBuilder builds car. */ class CarBuilder implements BuilderInterface { diff --git a/Creational/Builder/Director.php b/Creational/Builder/Director.php index 3d125d9..642cd1b 100644 --- a/Creational/Builder/Director.php +++ b/Creational/Builder/Director.php @@ -10,9 +10,8 @@ namespace DesignPatterns\Creational\Builder; */ class Director { - /** - * The director don't know about concrete part + * The director don't know about concrete part. * * @param BuilderInterface $builder * diff --git a/Creational/Builder/Parts/Bike.php b/Creational/Builder/Parts/Bike.php index 6efefe9..e5adbba 100644 --- a/Creational/Builder/Parts/Bike.php +++ b/Creational/Builder/Parts/Bike.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\Builder\Parts; /** - * Bike is a bike + * Bike is a bike. */ class Bike extends Vehicle { diff --git a/Creational/Builder/Parts/Car.php b/Creational/Builder/Parts/Car.php index 1d4496c..e345ea9 100644 --- a/Creational/Builder/Parts/Car.php +++ b/Creational/Builder/Parts/Car.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\Builder\Parts; /** - * Car is a car + * Car is a car. */ class Car extends Vehicle { diff --git a/Creational/Builder/Parts/Door.php b/Creational/Builder/Parts/Door.php index 526d41b..fc12608 100644 --- a/Creational/Builder/Parts/Door.php +++ b/Creational/Builder/Parts/Door.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\Builder\Parts; /** - * Class Door + * Class Door. */ class Door { diff --git a/Creational/Builder/Parts/Engine.php b/Creational/Builder/Parts/Engine.php index 0b2fad0..5232ab3 100644 --- a/Creational/Builder/Parts/Engine.php +++ b/Creational/Builder/Parts/Engine.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\Builder\Parts; /** - * Class Engine + * Class Engine. */ class Engine { diff --git a/Creational/Builder/Parts/Vehicle.php b/Creational/Builder/Parts/Vehicle.php index 492eade..487be57 100644 --- a/Creational/Builder/Parts/Vehicle.php +++ b/Creational/Builder/Parts/Vehicle.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\Builder\Parts; /** - * VehicleInterface is a contract for a vehicle + * VehicleInterface is a contract for a vehicle. */ abstract class Vehicle { diff --git a/Creational/Builder/Parts/Wheel.php b/Creational/Builder/Parts/Wheel.php index 7fb60fd..0a1afbd 100644 --- a/Creational/Builder/Parts/Wheel.php +++ b/Creational/Builder/Parts/Wheel.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\Builder\Parts; /** - * Class Wheel + * Class Wheel. */ class Wheel { diff --git a/Creational/Builder/Tests/DirectorTest.php b/Creational/Builder/Tests/DirectorTest.php index 0520bfe..9f07b83 100644 --- a/Creational/Builder/Tests/DirectorTest.php +++ b/Creational/Builder/Tests/DirectorTest.php @@ -2,17 +2,16 @@ namespace DesignPatterns\Creational\Builder\Tests; -use DesignPatterns\Creational\Builder\Director; -use DesignPatterns\Creational\Builder\CarBuilder; use DesignPatterns\Creational\Builder\BikeBuilder; use DesignPatterns\Creational\Builder\BuilderInterface; +use DesignPatterns\Creational\Builder\CarBuilder; +use DesignPatterns\Creational\Builder\Director; /** - * DirectorTest tests the builder pattern + * DirectorTest tests the builder pattern. */ class DirectorTest extends \PHPUnit_Framework_TestCase { - protected $director; protected function setUp() @@ -24,7 +23,7 @@ class DirectorTest extends \PHPUnit_Framework_TestCase { return array( array(new CarBuilder()), - array(new BikeBuilder()) + array(new BikeBuilder()), ); } diff --git a/Creational/FactoryMethod/Bicycle.php b/Creational/FactoryMethod/Bicycle.php index 01fa8a0..8e41f88 100644 --- a/Creational/FactoryMethod/Bicycle.php +++ b/Creational/FactoryMethod/Bicycle.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\FactoryMethod; /** - * Bicycle is a bicycle + * Bicycle is a bicycle. */ class Bicycle implements VehicleInterface { @@ -13,7 +13,7 @@ class Bicycle implements VehicleInterface protected $color; /** - * sets the color of the bicycle + * sets the color of the bicycle. * * @param string $rgb */ diff --git a/Creational/FactoryMethod/FactoryMethod.php b/Creational/FactoryMethod/FactoryMethod.php index dd24b15..fa3d4a3 100644 --- a/Creational/FactoryMethod/FactoryMethod.php +++ b/Creational/FactoryMethod/FactoryMethod.php @@ -3,16 +3,15 @@ namespace DesignPatterns\Creational\FactoryMethod; /** - * class FactoryMethod + * class FactoryMethod. */ abstract class FactoryMethod { - const CHEAP = 1; const FAST = 2; /** - * The children of the class must implement this method + * The children of the class must implement this method. * * Sometimes this method can be public to get "raw" object * @@ -23,7 +22,7 @@ abstract class FactoryMethod abstract protected function createVehicle($type); /** - * Creates a new vehicle + * Creates a new vehicle. * * @param int $type * @@ -32,7 +31,7 @@ abstract class FactoryMethod public function create($type) { $obj = $this->createVehicle($type); - $obj->setColor("#f00"); + $obj->setColor('#f00'); return $obj; } diff --git a/Creational/FactoryMethod/Ferrari.php b/Creational/FactoryMethod/Ferrari.php index c905f91..9434e3d 100644 --- a/Creational/FactoryMethod/Ferrari.php +++ b/Creational/FactoryMethod/Ferrari.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\FactoryMethod; /** - * Ferrari is a italian car + * Ferrari is a italian car. */ class Ferrari implements VehicleInterface { diff --git a/Creational/FactoryMethod/GermanFactory.php b/Creational/FactoryMethod/GermanFactory.php index 67306e9..1f65eb4 100644 --- a/Creational/FactoryMethod/GermanFactory.php +++ b/Creational/FactoryMethod/GermanFactory.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\FactoryMethod; /** - * GermanFactory is a vehicle factory in Germany + * GermanFactory is a vehicle factory in Germany. */ class GermanFactory extends FactoryMethod { diff --git a/Creational/FactoryMethod/ItalianFactory.php b/Creational/FactoryMethod/ItalianFactory.php index c7010e0..25eeaf1 100644 --- a/Creational/FactoryMethod/ItalianFactory.php +++ b/Creational/FactoryMethod/ItalianFactory.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\FactoryMethod; /** - * ItalianFactory is vehicle factory in Italy + * ItalianFactory is vehicle factory in Italy. */ class ItalianFactory extends FactoryMethod { diff --git a/Creational/FactoryMethod/Porsche.php b/Creational/FactoryMethod/Porsche.php index cba25ce..bdabb87 100644 --- a/Creational/FactoryMethod/Porsche.php +++ b/Creational/FactoryMethod/Porsche.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\FactoryMethod; /** - * Porsche is a german car + * Porsche is a german car. */ class Porsche implements VehicleInterface { diff --git a/Creational/FactoryMethod/Tests/FactoryMethodTest.php b/Creational/FactoryMethod/Tests/FactoryMethodTest.php index acbe0c6..6b1c4d2 100644 --- a/Creational/FactoryMethod/Tests/FactoryMethodTest.php +++ b/Creational/FactoryMethod/Tests/FactoryMethodTest.php @@ -7,21 +7,20 @@ use DesignPatterns\Creational\FactoryMethod\GermanFactory; use DesignPatterns\Creational\FactoryMethod\ItalianFactory; /** - * FactoryMethodTest tests the factory method pattern + * FactoryMethodTest tests the factory method pattern. */ class FactoryMethodTest extends \PHPUnit_Framework_TestCase { - protected $type = array( FactoryMethod::CHEAP, - FactoryMethod::FAST + FactoryMethod::FAST, ); public function getShop() { return array( array(new GermanFactory()), - array(new ItalianFactory()) + array(new ItalianFactory()), ); } diff --git a/Creational/FactoryMethod/VehicleInterface.php b/Creational/FactoryMethod/VehicleInterface.php index a734b61..ccb05ee 100644 --- a/Creational/FactoryMethod/VehicleInterface.php +++ b/Creational/FactoryMethod/VehicleInterface.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Creational\FactoryMethod; /** - * VehicleInterface is a contract for a vehicle + * VehicleInterface is a contract for a vehicle. */ interface VehicleInterface { /** - * sets the color of the vehicle + * sets the color of the vehicle. * * @param string $rgb */ diff --git a/Creational/Multiton/Multiton.php b/Creational/Multiton/Multiton.php index 44f1ef0..5338e62 100644 --- a/Creational/Multiton/Multiton.php +++ b/Creational/Multiton/Multiton.php @@ -3,24 +3,22 @@ namespace DesignPatterns\Creational\Multiton; /** - * class Multiton + * class Multiton. */ class Multiton { /** - * - * the first instance + * the first instance. */ const INSTANCE_1 = '1'; /** - * - * the second instance + * the second instance. */ const INSTANCE_2 = '2'; /** - * holds the named instances + * holds the named instances. * * @var array */ @@ -28,7 +26,6 @@ class Multiton /** * should not be called from outside: private! - * */ private function __construct() { @@ -36,7 +33,7 @@ class Multiton /** * gets the instance with the given name, e.g. Multiton::INSTANCE_1 - * uses lazy initialization + * uses lazy initialization. * * @param string $instanceName * @@ -52,7 +49,7 @@ class Multiton } /** - * prevent instance from being cloned + * prevent instance from being cloned. * * @return void */ @@ -61,7 +58,7 @@ class Multiton } /** - * prevent instance from being unserialized + * prevent instance from being unserialized. * * @return void */ diff --git a/Creational/Pool/Pool.php b/Creational/Pool/Pool.php index e3a809b..7dcc6e3 100644 --- a/Creational/Pool/Pool.php +++ b/Creational/Pool/Pool.php @@ -4,7 +4,6 @@ namespace DesignPatterns\Creational\Pool; class Pool { - private $instances = array(); private $class; diff --git a/Creational/Pool/Processor.php b/Creational/Pool/Processor.php index 957e91f..89179b9 100644 --- a/Creational/Pool/Processor.php +++ b/Creational/Pool/Processor.php @@ -4,11 +4,10 @@ namespace DesignPatterns\Creational\Pool; class Processor { - private $pool; private $processing = 0; private $maxProcesses = 3; - private $waitingQueue = []; + private $waitingQueue = array(); public function __construct(Pool $pool) { diff --git a/Creational/Pool/Worker.php b/Creational/Pool/Worker.php index acdc1ba..08d76b8 100644 --- a/Creational/Pool/Worker.php +++ b/Creational/Pool/Worker.php @@ -4,7 +4,6 @@ namespace DesignPatterns\Creational\Pool; class Worker { - public function __construct() { // let's say that constuctor does really expensive work... diff --git a/Creational/Prototype/BarBookPrototype.php b/Creational/Prototype/BarBookPrototype.php index 4354a60..7c9b72b 100644 --- a/Creational/Prototype/BarBookPrototype.php +++ b/Creational/Prototype/BarBookPrototype.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\Prototype; /** - * Class BarBookPrototype + * Class BarBookPrototype. */ class BarBookPrototype extends BookPrototype { @@ -13,7 +13,7 @@ class BarBookPrototype extends BookPrototype protected $category = 'Bar'; /** - * empty clone + * empty clone. */ public function __clone() { diff --git a/Creational/Prototype/BookPrototype.php b/Creational/Prototype/BookPrototype.php index 18d4871..e0fafa6 100644 --- a/Creational/Prototype/BookPrototype.php +++ b/Creational/Prototype/BookPrototype.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\Prototype; /** - * class BookPrototype + * class BookPrototype. */ abstract class BookPrototype { @@ -19,6 +19,7 @@ abstract class BookPrototype /** * @abstract + * * @return void */ abstract public function __clone(); diff --git a/Creational/Prototype/FooBookPrototype.php b/Creational/Prototype/FooBookPrototype.php index 9707bfd..95ea9e6 100644 --- a/Creational/Prototype/FooBookPrototype.php +++ b/Creational/Prototype/FooBookPrototype.php @@ -3,14 +3,14 @@ namespace DesignPatterns\Creational\Prototype; /** - * Class FooBookPrototype + * Class FooBookPrototype. */ class FooBookPrototype extends BookPrototype { protected $category = 'Foo'; /** - * empty clone + * empty clone. */ public function __clone() { diff --git a/Creational/Prototype/index.php b/Creational/Prototype/index.php index f268e5c..d0f6e94 100644 --- a/Creational/Prototype/index.php +++ b/Creational/Prototype/index.php @@ -8,10 +8,10 @@ $barPrototype = new BarBookPrototype(); // now lets say we need 10,000 books of foo and 5,000 of bar ... for ($i = 0; $i < 10000; $i++) { $book = clone $fooPrototype; - $book->setTitle('Foo Book No ' . $i); + $book->setTitle('Foo Book No '.$i); } for ($i = 0; $i < 5000; $i++) { $book = clone $barPrototype; - $book->setTitle('Bar Book No ' . $i); + $book->setTitle('Bar Book No '.$i); } diff --git a/Creational/SimpleFactory/Bicycle.php b/Creational/SimpleFactory/Bicycle.php index 67215f1..defa801 100644 --- a/Creational/SimpleFactory/Bicycle.php +++ b/Creational/SimpleFactory/Bicycle.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\SimpleFactory; /** - * Bicycle is a bicycle + * Bicycle is a bicycle. */ class Bicycle implements VehicleInterface { diff --git a/Creational/SimpleFactory/ConcreteFactory.php b/Creational/SimpleFactory/ConcreteFactory.php index dd8acf8..5f4cd2d 100644 --- a/Creational/SimpleFactory/ConcreteFactory.php +++ b/Creational/SimpleFactory/ConcreteFactory.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\SimpleFactory; /** - * class ConcreteFactory + * class ConcreteFactory. */ class ConcreteFactory { @@ -19,18 +19,19 @@ class ConcreteFactory public function __construct() { $this->typeList = array( - 'bicycle' => __NAMESPACE__ . '\Bicycle', - 'other' => __NAMESPACE__ . '\Scooter' + 'bicycle' => __NAMESPACE__.'\Bicycle', + 'other' => __NAMESPACE__.'\Scooter', ); } /** - * Creates a vehicle + * Creates a vehicle. * * @param string $type a known type key * - * @return VehicleInterface a new instance of VehicleInterface * @throws \InvalidArgumentException + * + * @return VehicleInterface a new instance of VehicleInterface */ public function createVehicle($type) { diff --git a/Creational/SimpleFactory/Scooter.php b/Creational/SimpleFactory/Scooter.php index 81fa505..e1db734 100644 --- a/Creational/SimpleFactory/Scooter.php +++ b/Creational/SimpleFactory/Scooter.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\SimpleFactory; /** - * Scooter is a Scooter + * Scooter is a Scooter. */ class Scooter implements VehicleInterface { diff --git a/Creational/SimpleFactory/Tests/SimpleFactoryTest.php b/Creational/SimpleFactory/Tests/SimpleFactoryTest.php index 1fffda3..c913d96 100644 --- a/Creational/SimpleFactory/Tests/SimpleFactoryTest.php +++ b/Creational/SimpleFactory/Tests/SimpleFactoryTest.php @@ -5,11 +5,10 @@ namespace DesignPatterns\Creational\SimpleFactory\Tests; use DesignPatterns\Creational\SimpleFactory\ConcreteFactory; /** - * SimpleFactoryTest tests the Simple Factory pattern + * SimpleFactoryTest tests the Simple Factory pattern. */ class SimpleFactoryTest extends \PHPUnit_Framework_TestCase { - protected $factory; protected function setUp() @@ -21,7 +20,7 @@ class SimpleFactoryTest extends \PHPUnit_Framework_TestCase { return array( array('bicycle'), - array('other') + array('other'), ); } diff --git a/Creational/SimpleFactory/VehicleInterface.php b/Creational/SimpleFactory/VehicleInterface.php index eb13a66..f2c8d3f 100644 --- a/Creational/SimpleFactory/VehicleInterface.php +++ b/Creational/SimpleFactory/VehicleInterface.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\SimpleFactory; /** - * VehicleInterface is a contract for a vehicle + * VehicleInterface is a contract for a vehicle. */ interface VehicleInterface { diff --git a/Creational/Singleton/Singleton.php b/Creational/Singleton/Singleton.php index 94f7a0a..650810e 100644 --- a/Creational/Singleton/Singleton.php +++ b/Creational/Singleton/Singleton.php @@ -2,10 +2,8 @@ namespace DesignPatterns\Creational\Singleton; -use DesignPatterns\Creational\Singleton\SingletonPatternViolationException; - /** - * class Singleton + * class Singleton. */ class Singleton { @@ -13,16 +11,16 @@ class Singleton * @var Singleton reference to singleton instance */ private static $instance; - + /** - * gets the instance via lazy initialization (created on first usage) + * gets the instance via lazy initialization (created on first usage). * * @return self */ public static function getInstance() { if (null === static::$instance) { - static::$instance = new static; + static::$instance = new static(); } return static::$instance; @@ -30,28 +28,31 @@ class Singleton /** * is not allowed to call from outside: private! - * */ private function __construct() { } /** - * prevent the instance from being cloned + * prevent the instance from being cloned. + * * @throws SingletonPatternViolationException + * * @return void */ - public final function __clone() + final public function __clone() { throw new SingletonPatternViolationException('This is a Singleton. Clone is forbidden'); } /** - * prevent from being unserialized + * prevent from being unserialized. + * * @throws SingletonPatternViolationException + * * @return void */ - public final function __wakeup() + final public function __wakeup() { throw new SingletonPatternViolationException('This is a Singleton. __wakeup usage is forbidden'); } diff --git a/Creational/Singleton/SingletonPatternViolationException.php b/Creational/Singleton/SingletonPatternViolationException.php index 38be5e6..b025b4a 100644 --- a/Creational/Singleton/SingletonPatternViolationException.php +++ b/Creational/Singleton/SingletonPatternViolationException.php @@ -4,5 +4,4 @@ namespace DesignPatterns\Creational\Singleton; class SingletonPatternViolationException extends \Exception { - } diff --git a/Creational/Singleton/Tests/SingletonTest.php b/Creational/Singleton/Tests/SingletonTest.php index 122d4dc..6b72285 100644 --- a/Creational/Singleton/Tests/SingletonTest.php +++ b/Creational/Singleton/Tests/SingletonTest.php @@ -5,11 +5,10 @@ namespace DesignPatterns\Creational\Singleton\Tests; use DesignPatterns\Creational\Singleton\Singleton; /** - * SingletonTest tests the singleton pattern + * SingletonTest tests the singleton pattern. */ class SingletonTest extends \PHPUnit_Framework_TestCase { - public function testUniqueness() { $firstCall = Singleton::getInstance(); @@ -29,6 +28,7 @@ class SingletonTest extends \PHPUnit_Framework_TestCase /** * @expectedException \DesignPatterns\Creational\Singleton\SingletonPatternViolationException + * * @return void */ public function testNoCloneAllowed() @@ -39,6 +39,7 @@ class SingletonTest extends \PHPUnit_Framework_TestCase /** * @expectedException \DesignPatterns\Creational\Singleton\SingletonPatternViolationException + * * @return void */ public function testNoSerializationAllowed() diff --git a/Creational/StaticFactory/FormatNumber.php b/Creational/StaticFactory/FormatNumber.php index 8f382f7..e577ab2 100644 --- a/Creational/StaticFactory/FormatNumber.php +++ b/Creational/StaticFactory/FormatNumber.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\StaticFactory; /** - * Class FormatNumber + * Class FormatNumber. */ class FormatNumber implements FormatterInterface { diff --git a/Creational/StaticFactory/FormatString.php b/Creational/StaticFactory/FormatString.php index a0d174d..5cb9e28 100644 --- a/Creational/StaticFactory/FormatString.php +++ b/Creational/StaticFactory/FormatString.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\StaticFactory; /** - * Class FormatString + * Class FormatString. */ class FormatString implements FormatterInterface { diff --git a/Creational/StaticFactory/FormatterInterface.php b/Creational/StaticFactory/FormatterInterface.php index 81b9149..349f8b6 100644 --- a/Creational/StaticFactory/FormatterInterface.php +++ b/Creational/StaticFactory/FormatterInterface.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\StaticFactory; /** - * Class FormatterInterface + * Class FormatterInterface. */ interface FormatterInterface { diff --git a/Creational/StaticFactory/StaticFactory.php b/Creational/StaticFactory/StaticFactory.php index e4f2f96..e4c4f4b 100644 --- a/Creational/StaticFactory/StaticFactory.php +++ b/Creational/StaticFactory/StaticFactory.php @@ -4,23 +4,24 @@ namespace DesignPatterns\Creational\StaticFactory; /** * Note1: Remember, static => global => evil - * Note2: Cannot be subclassed or mock-upped or have multiple different instances + * Note2: Cannot be subclassed or mock-upped or have multiple different instances. */ class StaticFactory { /** - * the parametrized function to get create an instance + * the parametrized function to get create an instance. * * @param string $type * * @static * * @throws \InvalidArgumentException + * * @return FormatterInterface */ public static function factory($type) { - $className = __NAMESPACE__ . '\Format' . ucfirst($type); + $className = __NAMESPACE__.'\Format'.ucfirst($type); if (!class_exists($className)) { throw new \InvalidArgumentException('Missing format class.'); diff --git a/Creational/StaticFactory/Tests/StaticFactoryTest.php b/Creational/StaticFactory/Tests/StaticFactoryTest.php index f0304ca..61f65af 100644 --- a/Creational/StaticFactory/Tests/StaticFactoryTest.php +++ b/Creational/StaticFactory/Tests/StaticFactoryTest.php @@ -5,17 +5,15 @@ namespace DesignPatterns\Creational\StaticFactory\Tests; use DesignPatterns\Creational\StaticFactory\StaticFactory; /** - * Tests for Static Factory pattern - * + * Tests for Static Factory pattern. */ class StaticFactoryTest extends \PHPUnit_Framework_TestCase { - public function getTypeList() { return array( array('string'), - array('number') + array('number'), ); } @@ -33,6 +31,6 @@ class StaticFactoryTest extends \PHPUnit_Framework_TestCase */ public function testException() { - StaticFactory::factory(""); + StaticFactory::factory(''); } } diff --git a/More/Delegation/JuniorDeveloper.php b/More/Delegation/JuniorDeveloper.php index 7506181..0946dad 100644 --- a/More/Delegation/JuniorDeveloper.php +++ b/More/Delegation/JuniorDeveloper.php @@ -3,13 +3,12 @@ namespace DesignPatterns\More\Delegation; /** - * Class JuniorDeveloper - * @package DesignPatterns\Delegation + * Class JuniorDeveloper. */ class JuniorDeveloper { public function writeBadCode() { - return "Some junior developer generated code..."; + return 'Some junior developer generated code...'; } } diff --git a/More/Delegation/TeamLead.php b/More/Delegation/TeamLead.php index 315bd3b..9b75190 100644 --- a/More/Delegation/TeamLead.php +++ b/More/Delegation/TeamLead.php @@ -3,9 +3,7 @@ namespace DesignPatterns\More\Delegation; /** - * Class TeamLead - * @package DesignPatterns\Delegation - * The `TeamLead` class, he delegate work to `JuniorDeveloper` + * Class TeamLead. */ class TeamLead { @@ -13,7 +11,8 @@ class TeamLead protected $slave; /** - * Give junior developer into teamlead submission + * Give junior developer into teamlead submission. + * * @param JuniorDeveloper $junior */ public function __construct(JuniorDeveloper $junior) @@ -22,7 +21,8 @@ class TeamLead } /** - * TeamLead drink coffee, junior work + * TeamLead drink coffee, junior work. + * * @return mixed */ public function writeCode() diff --git a/More/Delegation/Tests/DelegationTest.php b/More/Delegation/Tests/DelegationTest.php index b19f871..7d0a33b 100644 --- a/More/Delegation/Tests/DelegationTest.php +++ b/More/Delegation/Tests/DelegationTest.php @@ -5,7 +5,7 @@ namespace DesignPatterns\More\Delegation\Tests; use DesignPatterns\More\Delegation; /** - * DelegationTest tests the delegation pattern + * DelegationTest tests the delegation pattern. */ class DelegationTest extends \PHPUnit_Framework_TestCase { diff --git a/More/EAV/Attribute.php b/More/EAV/Attribute.php index 7a1a88e..3874360 100644 --- a/More/EAV/Attribute.php +++ b/More/EAV/Attribute.php @@ -5,7 +5,7 @@ namespace DesignPatterns\More\EAV; use SplObjectStorage; /** - * Class Attribute + * Class Attribute. */ class Attribute implements ValueAccessInterface { @@ -34,6 +34,7 @@ class Attribute implements ValueAccessInterface /** * @param ValueInterface $value + * * @return $this */ public function addValue(ValueInterface $value) @@ -47,6 +48,7 @@ class Attribute implements ValueAccessInterface /** * @param ValueInterface $value + * * @return $this */ public function removeValue(ValueInterface $value) @@ -68,6 +70,7 @@ class Attribute implements ValueAccessInterface /** * @param string $name + * * @return $this */ public function setName($name) diff --git a/More/EAV/Entity.php b/More/EAV/Entity.php index e92444e..ff26589 100644 --- a/More/EAV/Entity.php +++ b/More/EAV/Entity.php @@ -5,7 +5,7 @@ namespace DesignPatterns\More\EAV; use SplObjectStorage; /** - * Class Entity + * Class Entity. */ class Entity implements ValueAccessInterface { @@ -34,6 +34,7 @@ class Entity implements ValueAccessInterface /** * @param ValueInterface $value + * * @return $this */ public function addValue(ValueInterface $value) @@ -47,6 +48,7 @@ class Entity implements ValueAccessInterface /** * @param ValueInterface $value + * * @return $this */ public function removeValue(ValueInterface $value) @@ -68,6 +70,7 @@ class Entity implements ValueAccessInterface /** * @param string $name + * * @return $this */ public function setName($name) diff --git a/More/EAV/Tests/AttributeTest.php b/More/EAV/Tests/AttributeTest.php index 7e7efec..4affe41 100644 --- a/More/EAV/Tests/AttributeTest.php +++ b/More/EAV/Tests/AttributeTest.php @@ -6,7 +6,7 @@ use DesignPatterns\More\EAV\Attribute; use DesignPatterns\More\EAV\Value; /** - * AttributeTest tests the Attribute model of EAV pattern + * AttributeTest tests the Attribute model of EAV pattern. */ class AttributeTest extends \PHPUnit_Framework_TestCase { diff --git a/More/EAV/Tests/EntityTest.php b/More/EAV/Tests/EntityTest.php index 42c10f3..ecd6c40 100644 --- a/More/EAV/Tests/EntityTest.php +++ b/More/EAV/Tests/EntityTest.php @@ -2,19 +2,19 @@ namespace DesignPatterns\More\EAV\Tests; -use DesignPatterns\More\EAV\Entity; use DesignPatterns\More\EAV\Attribute; +use DesignPatterns\More\EAV\Entity; use DesignPatterns\More\EAV\Value; /** - * EntityTest tests the Entity model of EAV pattern + * EntityTest tests the Entity model of EAV pattern. */ class EntityTest extends \PHPUnit_Framework_TestCase { /** * @dataProvider valueProvider * - * @var string $name + * @var string */ public function testSetGetName($name) { @@ -27,7 +27,7 @@ class EntityTest extends \PHPUnit_Framework_TestCase /** * @dataProvider valueProvider * - * @var string $name + * @var string * @var Value[] $values */ public function testAddValue($name, array $values) @@ -47,7 +47,7 @@ class EntityTest extends \PHPUnit_Framework_TestCase * @depends testAddValue * @dataProvider valueProvider * - * @var string $name + * @var string * @var Value[] $values */ public function testRemoveValue($name, array $values) diff --git a/More/EAV/Tests/ValueTest.php b/More/EAV/Tests/ValueTest.php index 1b96521..f80f070 100644 --- a/More/EAV/Tests/ValueTest.php +++ b/More/EAV/Tests/ValueTest.php @@ -6,7 +6,7 @@ use DesignPatterns\More\EAV\Attribute; use DesignPatterns\More\EAV\Value; /** - * ValueTest tests the Value model of EAV pattern + * ValueTest tests the Value model of EAV pattern. */ class ValueTest extends \PHPUnit_Framework_TestCase { diff --git a/More/EAV/Value.php b/More/EAV/Value.php index 127f8ce..2c156a9 100644 --- a/More/EAV/Value.php +++ b/More/EAV/Value.php @@ -3,7 +3,7 @@ namespace DesignPatterns\More\EAV; /** - * Class Value + * Class Value. */ class Value implements ValueInterface { @@ -28,6 +28,7 @@ class Value implements ValueInterface /** * @param Attribute $attribute + * * @return $this */ public function setAttribute(Attribute $attribute) @@ -57,6 +58,7 @@ class Value implements ValueInterface /** * @param string $name + * * @return $this */ public function setName($name) diff --git a/More/EAV/ValueAccessInterface.php b/More/EAV/ValueAccessInterface.php index 27820a8..dde67b2 100644 --- a/More/EAV/ValueAccessInterface.php +++ b/More/EAV/ValueAccessInterface.php @@ -3,7 +3,7 @@ namespace DesignPatterns\More\EAV; /** - * Interface ValueAccessInterface + * Interface ValueAccessInterface. */ interface ValueAccessInterface { diff --git a/More/EAV/ValueInterface.php b/More/EAV/ValueInterface.php index c041835..3737f67 100644 --- a/More/EAV/ValueInterface.php +++ b/More/EAV/ValueInterface.php @@ -3,7 +3,7 @@ namespace DesignPatterns\More\EAV; /** - * Interface ValueInterface + * Interface ValueInterface. */ interface ValueInterface { diff --git a/More/EAV/example.php b/More/EAV/example.php index c5bb5c4..32ba5de 100644 --- a/More/EAV/example.php +++ b/More/EAV/example.php @@ -2,31 +2,31 @@ require '../../vendor/autoload.php'; -use DesignPatterns\More\EAV\Entity; use DesignPatterns\More\EAV\Attribute; +use DesignPatterns\More\EAV\Entity; 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'); +$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'); +$memory = (new Attribute())->setName('Memory'); // Create memory values -$memory4Gb = (new Value($memory))->setName('4GB'); -$memory8Gb = (new Value($memory))->setName('8GB'); +$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'); +$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'); +$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()) @@ -39,8 +39,7 @@ $mac = (new Entity()) ->addValue($memory8Gb) // storages ->addValue($storage256Gb) - ->addValue($storage512Gb) -; + ->addValue($storage512Gb); $macAir = (new Entity()) ->setName('MacBook Air') @@ -52,8 +51,7 @@ $macAir = (new Entity()) // storages ->addValue($storage128Gb) ->addValue($storage256Gb) - ->addValue($storage512Gb) -; + ->addValue($storage512Gb); $macPro = (new Entity()) ->setName('MacBook Pro') @@ -66,5 +64,4 @@ $macPro = (new Entity()) ->addValue($storage128Gb) ->addValue($storage256Gb) ->addValue($storage512Gb) - ->addValue($storage1Tb) -; + ->addValue($storage1Tb); diff --git a/More/Repository/MemoryStorage.php b/More/Repository/MemoryStorage.php index 1da09bc..44276d5 100644 --- a/More/Repository/MemoryStorage.php +++ b/More/Repository/MemoryStorage.php @@ -2,15 +2,11 @@ namespace DesignPatterns\More\Repository; -use DesignPatterns\More\Repository\Storage; - /** - * Class MemoryStorage - * @package DesignPatterns\Repository + * Class MemoryStorage. */ class MemoryStorage implements Storage { - private $data; private $lastId; @@ -26,6 +22,7 @@ class MemoryStorage implements Storage public function persist($data) { $this->data[++$this->lastId] = $data; + return $this->lastId; } diff --git a/More/Repository/Post.php b/More/Repository/Post.php index 9435d2e..e9990b4 100644 --- a/More/Repository/Post.php +++ b/More/Repository/Post.php @@ -3,10 +3,9 @@ namespace DesignPatterns\More\Repository; /** - * Post represents entity for some post that user left on the site + * Post represents entity for some post that user left on the site. * * Class Post - * @package DesignPatterns\Repository */ class Post { diff --git a/More/Repository/PostRepository.php b/More/Repository/PostRepository.php index 8b0ddac..e7687f3 100644 --- a/More/Repository/PostRepository.php +++ b/More/Repository/PostRepository.php @@ -2,11 +2,9 @@ namespace DesignPatterns\More\Repository; -use DesignPatterns\More\Repository\Storage; - /** * Repository for class Post - * This class is between Entity layer(class Post) and access object layer(interface Storage) + * This class is between Entity layer(class Post) and access object layer(interface Storage). * * 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 @@ -15,7 +13,6 @@ use DesignPatterns\More\Repository\Storage; * between the domain and data mapping layers * * Class PostRepository - * @package DesignPatterns\Repository */ class PostRepository { @@ -27,16 +24,17 @@ class PostRepository } /** - * Returns Post object by specified id + * Returns Post object by specified id. * * @param int $id + * * @return Post|null */ public function getById($id) { $arrayData = $this->persistence->retrieve($id); if (is_null($arrayData)) { - return null; + return; } $post = new Post(); @@ -50,9 +48,10 @@ class PostRepository } /** - * Save post object and populate it with id + * Save post object and populate it with id. * * @param Post $post + * * @return Post */ public function save(Post $post) @@ -61,17 +60,19 @@ class PostRepository 'author' => $post->getAuthor(), 'created' => $post->getCreated(), 'text' => $post->getText(), - 'title' => $post->getTitle() + 'title' => $post->getTitle(), )); $post->setId($id); + return $post; } /** - * Deletes specified Post object + * Deletes specified Post object. * * @param Post $post + * * @return bool */ public function delete(Post $post) diff --git a/More/Repository/Storage.php b/More/Repository/Storage.php index 4d528b4..a730f09 100644 --- a/More/Repository/Storage.php +++ b/More/Repository/Storage.php @@ -3,38 +3,39 @@ namespace DesignPatterns\More\Repository; /** - * Interface Storage + * Interface Storage. * * This interface describes methods for accessing storage. * Concrete realization could be whatever we want - in memory, relational database, NoSQL database and etc - * - * @package DesignPatterns\Repository */ interface Storage { /** * Method to persist data - * Returns new id for just persisted data + * Returns new id for just persisted data. * * @param array() $data + * * @return int */ public function persist($data); /** * Returns data by specified id. - * If there is no such data null is returned + * If there is no such data null is returned. * * @param int $id + * * @return array|null */ public function retrieve($id); /** * Delete data specified by id - * If there is no such data - false returns, if data has been successfully deleted - true returns + * If there is no such data - false returns, if data has been successfully deleted - true returns. * * @param int $id + * * @return bool */ public function delete($id); diff --git a/More/ServiceLocator/ServiceLocator.php b/More/ServiceLocator/ServiceLocator.php index 6699eca..b631479 100644 --- a/More/ServiceLocator/ServiceLocator.php +++ b/More/ServiceLocator/ServiceLocator.php @@ -27,21 +27,21 @@ class ServiceLocator implements ServiceLocatorInterface public function __construct() { - $this->services = array(); + $this->services = array(); $this->instantiated = array(); - $this->shared = array(); + $this->shared = array(); } /** * Registers a service with specific interface. * - * @param string $interface + * @param string $interface * @param string|object $service - * @param bool $share + * @param bool $share */ public function add($interface, $service, $share = true) { - /** + /* * When you add a service, you should register it * with its interface or with a string that you can use * in the future even if you will change the service implementation. @@ -51,7 +51,7 @@ class ServiceLocator implements ServiceLocatorInterface $this->instantiated[$interface] = $service; } $this->services[$interface] = (is_object($service) ? get_class($service) : $service); - $this->shared[$interface] = $share; + $this->shared[$interface] = $share; } /** @@ -63,7 +63,7 @@ class ServiceLocator implements ServiceLocatorInterface */ public function has($interface) { - return (isset($this->services[$interface]) || isset($this->instantiated[$interface])); + return isset($this->services[$interface]) || isset($this->instantiated[$interface]); } /** @@ -101,6 +101,7 @@ class ServiceLocator implements ServiceLocatorInterface if ($this->shared[$interface]) { $this->instantiated[$interface] = $object; } + return $object; } } diff --git a/More/ServiceLocator/Tests/ServiceLocatorTest.php b/More/ServiceLocator/Tests/ServiceLocatorTest.php index d6b7ef6..72f8607 100644 --- a/More/ServiceLocator/Tests/ServiceLocatorTest.php +++ b/More/ServiceLocator/Tests/ServiceLocatorTest.php @@ -5,7 +5,7 @@ namespace DesignPatterns\More\ServiceLocator\Tests; use DesignPatterns\More\ServiceLocator\DatabaseService; use DesignPatterns\More\ServiceLocator\LogService; use DesignPatterns\More\ServiceLocator\ServiceLocator; -use \PHPUnit_Framework_TestCase as TestCase; +use PHPUnit_Framework_TestCase as TestCase; class ServiceLocatorTest extends TestCase { @@ -26,8 +26,8 @@ class ServiceLocatorTest extends TestCase public function setUp() { - $this->serviceLocator = new ServiceLocator(); - $this->logService = new LogService(); + $this->serviceLocator = new ServiceLocator(); + $this->logService = new LogService(); $this->databaseService = new DatabaseService(); } diff --git a/Structural/Adapter/Book.php b/Structural/Adapter/Book.php index ae3c6dc..6458beb 100644 --- a/Structural/Adapter/Book.php +++ b/Structural/Adapter/Book.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\Adapter; /** - * Book is a concrete and standard paper book + * Book is a concrete and standard paper book. */ class Book implements PaperBookInterface { diff --git a/Structural/Adapter/EBookAdapter.php b/Structural/Adapter/EBookAdapter.php index a6c6476..3e4564a 100644 --- a/Structural/Adapter/EBookAdapter.php +++ b/Structural/Adapter/EBookAdapter.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\Adapter; /** - * EBookAdapter is an adapter to fit an e-book like a paper book + * EBookAdapter is an adapter to fit an e-book like a paper book. * * This is the adapter here. Notice it implements PaperBookInterface, * therefore you don't have to change the code of the client which using paper book. @@ -16,7 +16,7 @@ class EBookAdapter implements PaperBookInterface protected $eBook; /** - * Notice the constructor, it "wraps" an electronic book + * Notice the constructor, it "wraps" an electronic book. * * @param EBookInterface $ebook */ @@ -26,7 +26,7 @@ class EBookAdapter implements PaperBookInterface } /** - * This class makes the proper translation from one interface to another + * This class makes the proper translation from one interface to another. */ public function open() { @@ -34,7 +34,7 @@ class EBookAdapter implements PaperBookInterface } /** - * turns pages + * turns pages. */ public function turnPage() { diff --git a/Structural/Adapter/EBookInterface.php b/Structural/Adapter/EBookInterface.php index 15e0222..bd3dc26 100644 --- a/Structural/Adapter/EBookInterface.php +++ b/Structural/Adapter/EBookInterface.php @@ -3,19 +3,19 @@ namespace DesignPatterns\Structural\Adapter; /** - * EBookInterface is a contract for an electronic book + * EBookInterface is a contract for an electronic book. */ interface EBookInterface { /** - * go to next page + * go to next page. * * @return mixed */ public function pressNext(); /** - * start the book + * start the book. * * @return mixed */ diff --git a/Structural/Adapter/Kindle.php b/Structural/Adapter/Kindle.php index 14dc485..06d4489 100644 --- a/Structural/Adapter/Kindle.php +++ b/Structural/Adapter/Kindle.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\Adapter; /** - * Kindle is a concrete electronic book + * Kindle is a concrete electronic book. */ class Kindle implements EBookInterface { diff --git a/Structural/Adapter/PaperBookInterface.php b/Structural/Adapter/PaperBookInterface.php index 12f3103..4b62149 100644 --- a/Structural/Adapter/PaperBookInterface.php +++ b/Structural/Adapter/PaperBookInterface.php @@ -3,19 +3,19 @@ namespace DesignPatterns\Structural\Adapter; /** - * PaperBookInterface is a contract for a book + * PaperBookInterface is a contract for a book. */ interface PaperBookInterface { /** - * method to turn pages + * method to turn pages. * * @return mixed */ public function turnPage(); /** - * method to open the book + * method to open the book. * * @return mixed */ diff --git a/Structural/Adapter/Tests/AdapterTest.php b/Structural/Adapter/Tests/AdapterTest.php index ecbc9e2..fd7713b 100644 --- a/Structural/Adapter/Tests/AdapterTest.php +++ b/Structural/Adapter/Tests/AdapterTest.php @@ -2,14 +2,14 @@ namespace DesignPatterns\Structural\Adapter\Tests; +use DesignPatterns\Structural\Adapter\Book; use DesignPatterns\Structural\Adapter\EBookAdapter; use DesignPatterns\Structural\Adapter\Kindle; use DesignPatterns\Structural\Adapter\PaperBookInterface; -use DesignPatterns\Structural\Adapter\Book; /** * AdapterTest shows the use of an adapted e-book that behave like a book - * You don't have to change the code of your client + * You don't have to change the code of your client. */ class AdapterTest extends \PHPUnit_Framework_TestCase { @@ -21,13 +21,13 @@ class AdapterTest extends \PHPUnit_Framework_TestCase return array( array(new Book()), // we build a "wrapped" electronic book in the adapter - array(new EBookAdapter(new Kindle())) + array(new EBookAdapter(new Kindle())), ); } /** * This client only knows paper book but surprise, surprise, the second book - * is in fact an electronic book, but both work the same way + * is in fact an electronic book, but both work the same way. * * @param PaperBookInterface $book * diff --git a/Structural/Bridge/Assemble.php b/Structural/Bridge/Assemble.php index 2b60889..9b9d114 100644 --- a/Structural/Bridge/Assemble.php +++ b/Structural/Bridge/Assemble.php @@ -4,9 +4,8 @@ namespace DesignPatterns\Structural\Bridge; class Assemble implements Workshop { - public function work() { - print 'Assembled'; + echo 'Assembled'; } } diff --git a/Structural/Bridge/Car.php b/Structural/Bridge/Car.php index 2754199..89be431 100644 --- a/Structural/Bridge/Car.php +++ b/Structural/Bridge/Car.php @@ -3,11 +3,10 @@ namespace DesignPatterns\Structural\Bridge; /** - * Refined Abstraction + * Refined Abstraction. */ class Car extends Vehicle { - public function __construct(Workshop $workShop1, Workshop $workShop2) { parent::__construct($workShop1, $workShop2); @@ -15,7 +14,7 @@ class Car extends Vehicle public function manufacture() { - print 'Car '; + echo 'Car '; $this->workShop1->work(); $this->workShop2->work(); } diff --git a/Structural/Bridge/Motorcycle.php b/Structural/Bridge/Motorcycle.php index b021ce6..f008785 100644 --- a/Structural/Bridge/Motorcycle.php +++ b/Structural/Bridge/Motorcycle.php @@ -3,11 +3,10 @@ namespace DesignPatterns\Structural\Bridge; /** - * Refined Abstraction + * Refined Abstraction. */ class Motorcycle extends Vehicle { - public function __construct(Workshop $workShop1, Workshop $workShop2) { parent::__construct($workShop1, $workShop2); @@ -15,7 +14,7 @@ class Motorcycle extends Vehicle public function manufacture() { - print 'Motorcycle '; + echo 'Motorcycle '; $this->workShop1->work(); $this->workShop2->work(); } diff --git a/Structural/Bridge/Produce.php b/Structural/Bridge/Produce.php index b2b0505..a382f2d 100644 --- a/Structural/Bridge/Produce.php +++ b/Structural/Bridge/Produce.php @@ -3,13 +3,12 @@ namespace DesignPatterns\Structural\Bridge; /** - * Concrete Implementation + * Concrete Implementation. */ class Produce implements Workshop { - public function work() { - print 'Produced '; + echo 'Produced '; } } diff --git a/Structural/Bridge/Tests/BridgeTest.php b/Structural/Bridge/Tests/BridgeTest.php index e07afe9..0a89a86 100644 --- a/Structural/Bridge/Tests/BridgeTest.php +++ b/Structural/Bridge/Tests/BridgeTest.php @@ -9,7 +9,6 @@ use DesignPatterns\Structural\Bridge\Produce; class BridgeTest extends \PHPUnit_Framework_TestCase { - public function testCar() { $vehicle = new Car(new Produce(), new Assemble()); diff --git a/Structural/Bridge/Vehicle.php b/Structural/Bridge/Vehicle.php index 10b0d03..f519d70 100644 --- a/Structural/Bridge/Vehicle.php +++ b/Structural/Bridge/Vehicle.php @@ -3,11 +3,10 @@ namespace DesignPatterns\Structural\Bridge; /** - * Abstraction + * Abstraction. */ abstract class Vehicle { - protected $workShop1; protected $workShop2; diff --git a/Structural/Bridge/Workshop.php b/Structural/Bridge/Workshop.php index dc62886..9cb26c5 100644 --- a/Structural/Bridge/Workshop.php +++ b/Structural/Bridge/Workshop.php @@ -3,10 +3,9 @@ namespace DesignPatterns\Structural\Bridge; /** - * Implementer + * Implementer. */ interface Workshop { - public function work(); } diff --git a/Structural/Composite/Form.php b/Structural/Composite/Form.php index fbf3b50..42f1bc1 100644 --- a/Structural/Composite/Form.php +++ b/Structural/Composite/Form.php @@ -15,7 +15,7 @@ class Form extends FormElement /** * runs through all elements and calls render() on them, then returns the complete representation - * of the form + * of the form. * * from the outside, one will not see this and the form will act like a single object instance * @@ -28,7 +28,7 @@ class Form extends FormElement $formCode = ''; foreach ($this->elements as $element) { - $formCode .= $element->render($indent + 1) . PHP_EOL; + $formCode .= $element->render($indent + 1).PHP_EOL; } return $formCode; diff --git a/Structural/Composite/FormElement.php b/Structural/Composite/FormElement.php index 8063c89..0055aee 100644 --- a/Structural/Composite/FormElement.php +++ b/Structural/Composite/FormElement.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Structural\Composite; /** - * Class FormElement + * Class FormElement. */ abstract class FormElement { /** - * renders the elements' code + * renders the elements' code. * * @param int $indent * diff --git a/Structural/Composite/InputElement.php b/Structural/Composite/InputElement.php index 30d8615..19786d5 100644 --- a/Structural/Composite/InputElement.php +++ b/Structural/Composite/InputElement.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Structural\Composite; /** - * Class InputElement + * Class InputElement. */ class InputElement extends FormElement { /** - * renders the input element HTML + * renders the input element HTML. * * @param int $indent * @@ -16,6 +16,6 @@ class InputElement extends FormElement */ public function render($indent = 0) { - return str_repeat(' ', $indent) . ''; + return str_repeat(' ', $indent).''; } } diff --git a/Structural/Composite/Tests/CompositeTest.php b/Structural/Composite/Tests/CompositeTest.php index f3ee1d1..510a06b 100644 --- a/Structural/Composite/Tests/CompositeTest.php +++ b/Structural/Composite/Tests/CompositeTest.php @@ -5,11 +5,10 @@ namespace DesignPatterns\Structural\Composite\Tests; use DesignPatterns\Structural\Composite; /** - * FormTest tests the composite pattern on Form + * FormTest tests the composite pattern on Form. */ class CompositeTest extends \PHPUnit_Framework_TestCase { - public function testRender() { $form = new Composite\Form(); @@ -25,7 +24,7 @@ class CompositeTest extends \PHPUnit_Framework_TestCase /** * The all point of this pattern, a Composite must inherit from the node - * if you want to builld trees + * if you want to builld trees. */ public function testFormImplementsFormEelement() { diff --git a/Structural/Composite/TextElement.php b/Structural/Composite/TextElement.php index ed50294..48b33ba 100644 --- a/Structural/Composite/TextElement.php +++ b/Structural/Composite/TextElement.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Structural\Composite; /** - * Class TextElement + * Class TextElement. */ class TextElement extends FormElement { /** - * renders the text element + * renders the text element. * * @param int $indent * @@ -16,6 +16,6 @@ class TextElement extends FormElement */ public function render($indent = 0) { - return str_repeat(' ', $indent) . 'this is a text element'; + return str_repeat(' ', $indent).'this is a text element'; } } diff --git a/Structural/DataMapper/Tests/DataMapperTest.php b/Structural/DataMapper/Tests/DataMapperTest.php index fb531e9..551c11e 100644 --- a/Structural/DataMapper/Tests/DataMapperTest.php +++ b/Structural/DataMapper/Tests/DataMapperTest.php @@ -2,11 +2,11 @@ namespace DesignPatterns\Structural\DataMapper\Tests; -use DesignPatterns\Structural\DataMapper\UserMapper; use DesignPatterns\Structural\DataMapper\User; +use DesignPatterns\Structural\DataMapper\UserMapper; /** - * UserMapperTest tests the datamapper pattern + * UserMapperTest tests the datamapper pattern. */ class DataMapperTest extends \PHPUnit_Framework_TestCase { @@ -66,9 +66,9 @@ class DataMapperTest extends \PHPUnit_Framework_TestCase public function testRestoreOne(User $existing) { $row = array( - 'userid' => 1, + 'userid' => 1, 'username' => 'Odysseus', - 'email' => 'Odysseus@ithaca.gr' + 'email' => 'Odysseus@ithaca.gr', ); $rows = new \ArrayIterator(array($row)); $this->dbal->expects($this->once()) diff --git a/Structural/DataMapper/User.php b/Structural/DataMapper/User.php index 78e60a8..8d8d2b2 100644 --- a/Structural/DataMapper/User.php +++ b/Structural/DataMapper/User.php @@ -3,12 +3,11 @@ namespace DesignPatterns\Structural\DataMapper; /** - * DataMapper pattern + * DataMapper pattern. * * This is our representation of a DataBase record in the memory (Entity) * * Validation would also go in this object - * */ class User { diff --git a/Structural/DataMapper/UserMapper.php b/Structural/DataMapper/UserMapper.php index 0ee5352..f147063 100644 --- a/Structural/DataMapper/UserMapper.php +++ b/Structural/DataMapper/UserMapper.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\DataMapper; /** - * class UserMapper + * class UserMapper. */ class UserMapper { @@ -21,19 +21,19 @@ class UserMapper } /** - * saves a user object from memory to Database + * saves a user object from memory to Database. * * @param User $user * - * @return boolean + * @return bool */ public function save(User $user) { /* $data keys should correspond to valid Table columns on the Database */ $data = array( - 'userid' => $user->getUserId(), + 'userid' => $user->getUserId(), 'username' => $user->getUsername(), - 'email' => $user->getEmail(), + 'email' => $user->getEmail(), ); /* if no ID specified create new user else update the one in the Database */ @@ -51,11 +51,12 @@ class UserMapper /** * finds a user from Database based on ID and returns a User object located - * in memory + * in memory. * * @param int $id * * @throws \InvalidArgumentException + * * @return User */ public function findById($id) @@ -72,14 +73,14 @@ class UserMapper /** * fetches an array from Database and returns an array of User objects - * located in memory + * located in memory. * * @return array */ public function findAll() { $resultSet = $this->adapter->findAll(); - $entries = array(); + $entries = array(); foreach ($resultSet as $row) { $entries[] = $this->mapObject($row); @@ -89,7 +90,7 @@ class UserMapper } /** - * Maps a table row to an object + * Maps a table row to an object. * * @param array $row * diff --git a/Structural/Decorator/Decorator.php b/Structural/Decorator/Decorator.php index 182c07a..0b8fde3 100644 --- a/Structural/Decorator/Decorator.php +++ b/Structural/Decorator/Decorator.php @@ -9,7 +9,7 @@ namespace DesignPatterns\Structural\Decorator; */ /** - * class Decorator + * class Decorator. */ abstract class Decorator implements RendererInterface { diff --git a/Structural/Decorator/RenderInJson.php b/Structural/Decorator/RenderInJson.php index ebcc577..71943bd 100644 --- a/Structural/Decorator/RenderInJson.php +++ b/Structural/Decorator/RenderInJson.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Structural\Decorator; /** - * Class RenderInJson + * Class RenderInJson. */ class RenderInJson extends Decorator { /** - * render data as JSON + * render data as JSON. * * @return mixed|string */ diff --git a/Structural/Decorator/RenderInXml.php b/Structural/Decorator/RenderInXml.php index f8e92a0..2eab7ca 100644 --- a/Structural/Decorator/RenderInXml.php +++ b/Structural/Decorator/RenderInXml.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Structural\Decorator; /** - * Class RenderInXml + * Class RenderInXml. */ class RenderInXml extends Decorator { /** - * render data as XML + * render data as XML. * * @return mixed|string */ diff --git a/Structural/Decorator/RendererInterface.php b/Structural/Decorator/RendererInterface.php index 2957970..92b00ef 100644 --- a/Structural/Decorator/RendererInterface.php +++ b/Structural/Decorator/RendererInterface.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Structural\Decorator; /** - * Class RendererInterface + * Class RendererInterface. */ interface RendererInterface { /** - * render data + * render data. * * @return mixed */ diff --git a/Structural/Decorator/Tests/DecoratorTest.php b/Structural/Decorator/Tests/DecoratorTest.php index c50181f..689caf2 100644 --- a/Structural/Decorator/Tests/DecoratorTest.php +++ b/Structural/Decorator/Tests/DecoratorTest.php @@ -5,11 +5,10 @@ namespace DesignPatterns\Structural\Decorator\Tests; use DesignPatterns\Structural\Decorator; /** - * DecoratorTest tests the decorator pattern + * DecoratorTest tests the decorator pattern. */ class DecoratorTest extends \PHPUnit_Framework_TestCase { - protected $service; protected function setUp() @@ -35,7 +34,7 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase } /** - * The first key-point of this pattern : + * The first key-point of this pattern :. */ public function testDecoratorMustImplementsRenderer() { @@ -45,7 +44,7 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase } /** - * Second key-point of this pattern : the decorator is type-hinted + * Second key-point of this pattern : the decorator is type-hinted. * * @expectedException \PHPUnit_Framework_Error */ @@ -59,7 +58,7 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase } /** - * Second key-point of this pattern : the decorator is type-hinted + * Second key-point of this pattern : the decorator is type-hinted. * * @requires PHP 7 * @expectedException TypeError @@ -70,7 +69,7 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase } /** - * The decorator implements and wraps the same interface + * The decorator implements and wraps the same interface. */ public function testDecoratorOnlyAcceptRenderer() { diff --git a/Structural/Decorator/Webservice.php b/Structural/Decorator/Webservice.php index e6bf306..e2bcc69 100644 --- a/Structural/Decorator/Webservice.php +++ b/Structural/Decorator/Webservice.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\Decorator; /** - * Class Webservice + * Class Webservice. */ class Webservice implements RendererInterface { diff --git a/Structural/DependencyInjection/AbstractConfig.php b/Structural/DependencyInjection/AbstractConfig.php index 85e5245..f2da4dc 100644 --- a/Structural/DependencyInjection/AbstractConfig.php +++ b/Structural/DependencyInjection/AbstractConfig.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\DependencyInjection; /** - * class AbstractConfig + * class AbstractConfig. */ abstract class AbstractConfig { diff --git a/Structural/DependencyInjection/ArrayConfig.php b/Structural/DependencyInjection/ArrayConfig.php index 91bca33..f26c089 100644 --- a/Structural/DependencyInjection/ArrayConfig.php +++ b/Structural/DependencyInjection/ArrayConfig.php @@ -3,17 +3,18 @@ namespace DesignPatterns\Structural\DependencyInjection; /** - * class ArrayConfig + * class ArrayConfig. * * uses array as data source */ class ArrayConfig extends AbstractConfig implements Parameters { /** - * Get parameter + * Get parameter. * * @param string|int $key - * @param null $default + * @param null $default + * * @return mixed */ public function get($key, $default = null) @@ -21,14 +22,15 @@ class ArrayConfig extends AbstractConfig implements Parameters if (isset($this->storage[$key])) { return $this->storage[$key]; } + return $default; } /** - * Set parameter + * Set parameter. * * @param string|int $key - * @param mixed $value + * @param mixed $value */ public function set($key, $value) { diff --git a/Structural/DependencyInjection/Connection.php b/Structural/DependencyInjection/Connection.php index 9e131c2..d389089 100644 --- a/Structural/DependencyInjection/Connection.php +++ b/Structural/DependencyInjection/Connection.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\DependencyInjection; /** - * Class Connection + * Class Connection. */ class Connection { @@ -26,7 +26,7 @@ class Connection } /** - * connection using the injected config + * connection using the injected config. */ public function connect() { @@ -42,6 +42,7 @@ class Connection * * @return string */ + public function getHost() { return $this->host; diff --git a/Structural/DependencyInjection/Parameters.php b/Structural/DependencyInjection/Parameters.php index dabe895..c49f4c7 100644 --- a/Structural/DependencyInjection/Parameters.php +++ b/Structural/DependencyInjection/Parameters.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Structural\DependencyInjection; /** - * Parameters interface + * Parameters interface. */ interface Parameters { /** - * Get parameter + * Get parameter. * * @param string|int $key * @@ -17,7 +17,7 @@ interface Parameters public function get($key); /** - * Set parameter + * Set parameter. * * @param string|int $key * @param mixed $value diff --git a/Structural/Facade/BiosInterface.php b/Structural/Facade/BiosInterface.php index 869dcd9..823af04 100644 --- a/Structural/Facade/BiosInterface.php +++ b/Structural/Facade/BiosInterface.php @@ -3,29 +3,29 @@ namespace DesignPatterns\Structural\Facade; /** - * Class BiosInterface + * Class BiosInterface. */ interface BiosInterface { /** - * execute the BIOS + * execute the BIOS. */ public function execute(); /** - * wait for halt + * wait for halt. */ public function waitForKeyPress(); /** - * launches the OS + * launches the OS. * * @param OsInterface $os */ public function launch(OsInterface $os); /** - * power down BIOS + * power down BIOS. */ public function powerDown(); } diff --git a/Structural/Facade/Facade.php b/Structural/Facade/Facade.php index c0048b4..50c665d 100644 --- a/Structural/Facade/Facade.php +++ b/Structural/Facade/Facade.php @@ -3,7 +3,6 @@ namespace DesignPatterns\Structural\Facade; /** - * * */ class Facade @@ -20,7 +19,7 @@ class Facade /** * This is the perfect time to use a dependency injection container - * to create an instance of this class + * to create an instance of this class. * * @param BiosInterface $bios * @param OsInterface $os @@ -32,7 +31,7 @@ class Facade } /** - * turn on the system + * turn on the system. */ public function turnOn() { @@ -42,7 +41,7 @@ class Facade } /** - * turn off the system + * turn off the system. */ public function turnOff() { diff --git a/Structural/Facade/OsInterface.php b/Structural/Facade/OsInterface.php index 3b09eb1..8394fd4 100644 --- a/Structural/Facade/OsInterface.php +++ b/Structural/Facade/OsInterface.php @@ -3,12 +3,12 @@ namespace DesignPatterns\Structural\Facade; /** - * Class OsInterface + * Class OsInterface. */ interface OsInterface { /** - * halt the OS + * halt the OS. */ public function halt(); } diff --git a/Structural/Facade/Tests/FacadeTest.php b/Structural/Facade/Tests/FacadeTest.php index 18133e9..e6038a0 100644 --- a/Structural/Facade/Tests/FacadeTest.php +++ b/Structural/Facade/Tests/FacadeTest.php @@ -6,11 +6,10 @@ use DesignPatterns\Structural\Facade\Facade as Computer; use DesignPatterns\Structural\Facade\OsInterface; /** - * FacadeTest shows example of facades + * FacadeTest shows example of facades. */ class FacadeTest extends \PHPUnit_Framework_TestCase { - public function getComputer() { $bios = $this->getMockBuilder('DesignPatterns\Structural\Facade\BiosInterface') @@ -30,6 +29,7 @@ class FacadeTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue('Linux')); $facade = new Computer($bios, $operatingSys); + return array(array($facade, $operatingSys)); } diff --git a/Structural/FluentInterface/Sql.php b/Structural/FluentInterface/Sql.php index 35af3ef..58ba491 100644 --- a/Structural/FluentInterface/Sql.php +++ b/Structural/FluentInterface/Sql.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\FluentInterface; /** - * class SQL + * class SQL. */ class Sql { @@ -23,7 +23,7 @@ class Sql protected $where = array(); /** - * adds select fields + * adds select fields. * * @param array $fields * @@ -37,7 +37,7 @@ class Sql } /** - * adds a FROM clause + * adds a FROM clause. * * @param string $table * @param string $alias @@ -46,13 +46,13 @@ class Sql */ public function from($table, $alias) { - $this->from[] = $table . ' AS ' . $alias; + $this->from[] = $table.' AS '.$alias; return $this; } /** - * adds a WHERE condition + * adds a WHERE condition. * * @param string $condition * @@ -67,14 +67,14 @@ class Sql /** * Gets the query, just an example of building a query, - * no check on consistency + * no check on consistency. * * @return string */ public function getQuery() { - return 'SELECT ' . implode(',', $this->fields) - . ' FROM ' . implode(',', $this->from) - . ' WHERE ' . implode(' AND ', $this->where); + return 'SELECT '.implode(',', $this->fields) + .' FROM '.implode(',', $this->from) + .' WHERE '.implode(' AND ', $this->where); } } diff --git a/Structural/FluentInterface/Tests/FluentInterfaceTest.php b/Structural/FluentInterface/Tests/FluentInterfaceTest.php index 98ea99d..ae4e656 100644 --- a/Structural/FluentInterface/Tests/FluentInterfaceTest.php +++ b/Structural/FluentInterface/Tests/FluentInterfaceTest.php @@ -5,11 +5,10 @@ namespace DesignPatterns\Structural\FluentInterface\Tests; use DesignPatterns\Structural\FluentInterface\Sql; /** - * FluentInterfaceTest tests the fluent interface SQL + * FluentInterfaceTest tests the fluent interface SQL. */ class FluentInterfaceTest extends \PHPUnit_Framework_TestCase { - public function testBuildSQL() { $instance = new Sql(); diff --git a/Structural/Proxy/Record.php b/Structural/Proxy/Record.php index 38481aa..7ae4a3c 100644 --- a/Structural/Proxy/Record.php +++ b/Structural/Proxy/Record.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\Proxy; /** - * class Record + * class Record. */ class Record { @@ -21,7 +21,7 @@ class Record } /** - * magic setter + * magic setter. * * @param string $name * @param mixed $value @@ -34,7 +34,7 @@ class Record } /** - * magic getter + * magic getter. * * @param string $name * @@ -45,7 +45,7 @@ class Record if (array_key_exists($name, $this->data)) { return $this->data[(string) $name]; } else { - return null; + return; } } } diff --git a/Structural/Proxy/RecordProxy.php b/Structural/Proxy/RecordProxy.php index 1f68cff..f8c78a8 100644 --- a/Structural/Proxy/RecordProxy.php +++ b/Structural/Proxy/RecordProxy.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\Proxy; /** - * Class RecordProxy + * Class RecordProxy. */ class RecordProxy extends Record { @@ -35,7 +35,7 @@ class RecordProxy extends Record } /** - * magic setter + * magic setter. * * @param string $name * @param mixed $value diff --git a/Structural/Registry/Registry.php b/Structural/Registry/Registry.php index d1c6b13..e40d0c3 100644 --- a/Structural/Registry/Registry.php +++ b/Structural/Registry/Registry.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\Registry; /** - * class Registry + * class Registry. */ abstract class Registry { @@ -15,12 +15,13 @@ abstract class Registry protected static $storedValues = array(); /** - * sets a value + * sets a value. * * @param string $key * @param mixed $value * * @static + * * @return void */ public static function set($key, $value) @@ -29,11 +30,12 @@ abstract class Registry } /** - * gets a value from the registry + * gets a value from the registry. * * @param string $key * * @static + * * @return mixed */ public static function get($key) diff --git a/Structural/Registry/Tests/RegistryTest.php b/Structural/Registry/Tests/RegistryTest.php index 64685d4..e889976 100644 --- a/Structural/Registry/Tests/RegistryTest.php +++ b/Structural/Registry/Tests/RegistryTest.php @@ -6,7 +6,6 @@ use DesignPatterns\Structural\Registry\Registry; class RegistryTest extends \PHPUnit_Framework_TestCase { - public function testSetAndGetLogger() { Registry::set(Registry::LOGGER, new \StdClass()); From e83e37cc1c1ce83e41aaba35499926cf46e9f863 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Sat, 16 Jan 2016 16:29:07 +0300 Subject: [PATCH 61/69] 181 - Updated doc for Vehicle class in Builder pattern --- Creational/Builder/Parts/Vehicle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Creational/Builder/Parts/Vehicle.php b/Creational/Builder/Parts/Vehicle.php index 487be57..18c47ba 100644 --- a/Creational/Builder/Parts/Vehicle.php +++ b/Creational/Builder/Parts/Vehicle.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Creational\Builder\Parts; /** - * VehicleInterface is a contract for a vehicle. + * Vehicle class is an abstraction for a vehicle. */ abstract class Vehicle { From dddfdf65fc55b06088c268c88384df41ccb63811 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Sat, 16 Jan 2016 17:06:43 +0300 Subject: [PATCH 62/69] 88 - Added undo example for command pattern --- Behavioral/Command/AddMessageDateCommand.php | 46 +++++++++++++++++ Behavioral/Command/Receiver.php | 31 +++++++++++- Behavioral/Command/Tests/CommandTest.php | 2 +- .../Command/Tests/UndoableCommandTest.php | 49 +++++++++++++++++++ .../Command/UndoableCommandInterface.php | 15 ++++++ 5 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 Behavioral/Command/AddMessageDateCommand.php create mode 100644 Behavioral/Command/Tests/UndoableCommandTest.php create mode 100644 Behavioral/Command/UndoableCommandInterface.php diff --git a/Behavioral/Command/AddMessageDateCommand.php b/Behavioral/Command/AddMessageDateCommand.php new file mode 100644 index 0000000..9543bda --- /dev/null +++ b/Behavioral/Command/AddMessageDateCommand.php @@ -0,0 +1,46 @@ +output = $console; + } + + /** + * Execute and make receiver to enable displaying messages date. + */ + public function execute() + { + // sometimes, there is no receiver and this is the command which + // does all the work + $this->output->enableDate(); + } + + /** + * Undo the command and make receiver to disable displaying messages date. + */ + public function undo() + { + // sometimes, there is no receiver and this is the command which + // does all the work + $this->output->disableDate(); + } +} diff --git a/Behavioral/Command/Receiver.php b/Behavioral/Command/Receiver.php index ccf910b..956ce74 100644 --- a/Behavioral/Command/Receiver.php +++ b/Behavioral/Command/Receiver.php @@ -7,11 +7,40 @@ namespace DesignPatterns\Behavioral\Command; */ class Receiver { + private $enableDate = false; + + private $output = array(); + /** * @param string $str */ public function write($str) { - echo $str; + if ($this->enableDate) { + $str .= ' ['.date('Y-m-d').']'; + } + + $this->output[] = $str; + } + + public function getOutput() + { + return implode("\n", $this->output); + } + + /** + * Enable receiver to display message date. + */ + public function enableDate() + { + $this->enableDate = true; + } + + /** + * Disable receiver to display message date. + */ + public function disableDate() + { + $this->enableDate = false; } } diff --git a/Behavioral/Command/Tests/CommandTest.php b/Behavioral/Command/Tests/CommandTest.php index 9d9aa51..3852495 100644 --- a/Behavioral/Command/Tests/CommandTest.php +++ b/Behavioral/Command/Tests/CommandTest.php @@ -30,7 +30,7 @@ class CommandTest extends \PHPUnit_Framework_TestCase public function testInvocation() { $this->invoker->setCommand(new HelloCommand($this->receiver)); - $this->expectOutputString('Hello World'); $this->invoker->run(); + $this->assertEquals($this->receiver->getOutput(), 'Hello World'); } } diff --git a/Behavioral/Command/Tests/UndoableCommandTest.php b/Behavioral/Command/Tests/UndoableCommandTest.php new file mode 100644 index 0000000..5302a7b --- /dev/null +++ b/Behavioral/Command/Tests/UndoableCommandTest.php @@ -0,0 +1,49 @@ +invoker = new Invoker(); + $this->receiver = new Receiver(); + } + + public function testInvocation() + { + $this->invoker->setCommand(new HelloCommand($this->receiver)); + $this->invoker->run(); + $this->assertEquals($this->receiver->getOutput(), 'Hello World'); + + $messageDateCommand = new AddMessageDateCommand($this->receiver); + $messageDateCommand->execute(); + + $this->invoker->run(); + $this->assertEquals($this->receiver->getOutput(), "Hello World\nHello World [".date('Y-m-d').']'); + + $messageDateCommand->undo(); + + $this->invoker->run(); + $this->assertEquals($this->receiver->getOutput(), "Hello World\nHello World [".date('Y-m-d')."]\nHello World"); + } +} diff --git a/Behavioral/Command/UndoableCommandInterface.php b/Behavioral/Command/UndoableCommandInterface.php new file mode 100644 index 0000000..0fd101c --- /dev/null +++ b/Behavioral/Command/UndoableCommandInterface.php @@ -0,0 +1,15 @@ + Date: Sat, 16 Jan 2016 17:20:13 +0300 Subject: [PATCH 63/69] 89 - ConcreteFactory changed to SimpleFactory --- Creational/SimpleFactory/README.rst | 8 ++++---- .../{ConcreteFactory.php => SimpleFactory.php} | 4 ++-- Creational/SimpleFactory/Tests/SimpleFactoryTest.php | 4 ++-- Creational/SimpleFactory/uml/SimpleFactory.uml | 4 ++-- Creational/SimpleFactory/uml/uml.svg | 4 ++-- locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po | 4 ++-- locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po | 4 ++-- .../pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po | 4 ++-- locale/ru/LC_MESSAGES/Creational/SimpleFactory/README.po | 8 ++++---- .../zh_CN/LC_MESSAGES/Creational/SimpleFactory/README.po | 4 ++-- 10 files changed, 24 insertions(+), 24 deletions(-) rename Creational/SimpleFactory/{ConcreteFactory.php => SimpleFactory.php} (95%) diff --git a/Creational/SimpleFactory/README.rst b/Creational/SimpleFactory/README.rst index 0525667..8f6ce81 100644 --- a/Creational/SimpleFactory/README.rst +++ b/Creational/SimpleFactory/README.rst @@ -4,7 +4,7 @@ Simple Factory Purpose ------- -ConcreteFactory is a simple factory pattern. +SimpleFactory is a simple factory pattern. It differs from the static factory because it is NOT static and as you know: static => global => evil! @@ -24,9 +24,9 @@ Code You can also find these code on `GitHub`_ -ConcreteFactory.php +SimpleFactory.php -.. literalinclude:: ConcreteFactory.php +.. literalinclude:: SimpleFactory.php :language: php :linenos: @@ -53,7 +53,7 @@ Usage .. code:: php - $factory = new ConcreteFactory(); + $factory = new SimpleFactory(); $bicycle = $factory->createVehicle('bicycle'); $bicycle->driveTo('Paris'); diff --git a/Creational/SimpleFactory/ConcreteFactory.php b/Creational/SimpleFactory/SimpleFactory.php similarity index 95% rename from Creational/SimpleFactory/ConcreteFactory.php rename to Creational/SimpleFactory/SimpleFactory.php index 5f4cd2d..7de17a1 100644 --- a/Creational/SimpleFactory/ConcreteFactory.php +++ b/Creational/SimpleFactory/SimpleFactory.php @@ -3,9 +3,9 @@ namespace DesignPatterns\Creational\SimpleFactory; /** - * class ConcreteFactory. + * class SimpleFactory. */ -class ConcreteFactory +class SimpleFactory { /** * @var array diff --git a/Creational/SimpleFactory/Tests/SimpleFactoryTest.php b/Creational/SimpleFactory/Tests/SimpleFactoryTest.php index c913d96..c2f5379 100644 --- a/Creational/SimpleFactory/Tests/SimpleFactoryTest.php +++ b/Creational/SimpleFactory/Tests/SimpleFactoryTest.php @@ -2,7 +2,7 @@ namespace DesignPatterns\Creational\SimpleFactory\Tests; -use DesignPatterns\Creational\SimpleFactory\ConcreteFactory; +use DesignPatterns\Creational\SimpleFactory\SimpleFactory; /** * SimpleFactoryTest tests the Simple Factory pattern. @@ -13,7 +13,7 @@ class SimpleFactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->factory = new ConcreteFactory(); + $this->factory = new SimpleFactory(); } public function getType() diff --git a/Creational/SimpleFactory/uml/SimpleFactory.uml b/Creational/SimpleFactory/uml/SimpleFactory.uml index f51ce6c..5a586a5 100644 --- a/Creational/SimpleFactory/uml/SimpleFactory.uml +++ b/Creational/SimpleFactory/uml/SimpleFactory.uml @@ -1,10 +1,10 @@ PHP - \DesignPatterns\Creational\SimpleFactory\ConcreteFactory + \DesignPatterns\Creational\SimpleFactory\SimpleFactory \DesignPatterns\Creational\SimpleFactory\Scooter - \DesignPatterns\Creational\SimpleFactory\ConcreteFactory + \DesignPatterns\Creational\SimpleFactory\SimpleFactory \DesignPatterns\Creational\SimpleFactory\VehicleInterface \DesignPatterns\Creational\SimpleFactory\Bicycle diff --git a/Creational/SimpleFactory/uml/uml.svg b/Creational/SimpleFactory/uml/uml.svg index 7c966c2..7da8077 100644 --- a/Creational/SimpleFactory/uml/uml.svg +++ b/Creational/SimpleFactory/uml/uml.svg @@ -201,10 +201,10 @@ - ConcreteFactory + SimpleFactory - ConcreteFactory + SimpleFactory diff --git a/locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po index d011ad6..74e85d4 100644 --- a/locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po +++ b/locale/ca/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -20,7 +20,7 @@ msgid "Purpose" msgstr "" #: ../../Creational/SimpleFactory/README.rst:7 -msgid "ConcreteFactory is a simple factory pattern." +msgid "SimpleFactory is a simple factory pattern." msgstr "" #: ../../Creational/SimpleFactory/README.rst:9 @@ -48,7 +48,7 @@ msgid "You can also find these code on `GitHub`_" msgstr "" #: ../../Creational/SimpleFactory/README.rst:27 -msgid "ConcreteFactory.php" +msgid "SimpleFactory.php" msgstr "" #: ../../Creational/SimpleFactory/README.rst:33 diff --git a/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po index a56e3b4..0b517cd 100644 --- a/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po +++ b/locale/es/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -20,7 +20,7 @@ msgid "Purpose" msgstr "" #: ../../Creational/SimpleFactory/README.rst:7 -msgid "ConcreteFactory is a simple factory pattern." +msgid "SimpleFactory is a simple factory pattern." msgstr "" #: ../../Creational/SimpleFactory/README.rst:9 @@ -48,7 +48,7 @@ msgid "You can also find these code on `GitHub`_" msgstr "" #: ../../Creational/SimpleFactory/README.rst:27 -msgid "ConcreteFactory.php" +msgid "SimpleFactory.php" msgstr "" #: ../../Creational/SimpleFactory/README.rst:33 diff --git a/locale/pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po index d011ad6..74e85d4 100644 --- a/locale/pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po +++ b/locale/pt_BR/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -20,7 +20,7 @@ msgid "Purpose" msgstr "" #: ../../Creational/SimpleFactory/README.rst:7 -msgid "ConcreteFactory is a simple factory pattern." +msgid "SimpleFactory is a simple factory pattern." msgstr "" #: ../../Creational/SimpleFactory/README.rst:9 @@ -48,7 +48,7 @@ msgid "You can also find these code on `GitHub`_" msgstr "" #: ../../Creational/SimpleFactory/README.rst:27 -msgid "ConcreteFactory.php" +msgid "SimpleFactory.php" msgstr "" #: ../../Creational/SimpleFactory/README.rst:33 diff --git a/locale/ru/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/ru/LC_MESSAGES/Creational/SimpleFactory/README.po index fdec3c4..4d50b56 100644 --- a/locale/ru/LC_MESSAGES/Creational/SimpleFactory/README.po +++ b/locale/ru/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -20,8 +20,8 @@ msgid "Purpose" msgstr "Назначение" #: ../../Creational/SimpleFactory/README.rst:7 -msgid "ConcreteFactory is a simple factory pattern." -msgstr "ConcreteFactory в примере ниже, это паттерн «Простая Фабрика»." +msgid "SimpleFactory is a simple factory pattern." +msgstr "SimpleFactory в примере ниже, это паттерн «Простая Фабрика»." #: ../../Creational/SimpleFactory/README.rst:9 msgid "" @@ -53,8 +53,8 @@ msgid "You can also find these code on `GitHub`_" msgstr "Вы можете найти этот код на `GitHub`_" #: ../../Creational/SimpleFactory/README.rst:27 -msgid "ConcreteFactory.php" -msgstr "ConcreteFactory.php" +msgid "SimpleFactory.php" +msgstr "SimpleFactory.php" #: ../../Creational/SimpleFactory/README.rst:33 msgid "VehicleInterface.php" diff --git a/locale/zh_CN/LC_MESSAGES/Creational/SimpleFactory/README.po b/locale/zh_CN/LC_MESSAGES/Creational/SimpleFactory/README.po index 56221d8..d8eb51c 100644 --- a/locale/zh_CN/LC_MESSAGES/Creational/SimpleFactory/README.po +++ b/locale/zh_CN/LC_MESSAGES/Creational/SimpleFactory/README.po @@ -20,7 +20,7 @@ msgid "Purpose" msgstr "目的" #: ../../Creational/SimpleFactory/README.rst:7 -msgid "ConcreteFactory is a simple factory pattern." +msgid "SimpleFactory is a simple factory pattern." msgstr "简单的创建对象型工厂模式" #: ../../Creational/SimpleFactory/README.rst:9 @@ -52,7 +52,7 @@ msgid "You can also find these code on `GitHub`_" msgstr "你可以在 `GitHub`_ 上找到这些代码" #: ../../Creational/SimpleFactory/README.rst:27 -msgid "ConcreteFactory.php" +msgid "SimpleFactory.php" msgstr "" #: ../../Creational/SimpleFactory/README.rst:33 From 8a9872a6f5ce1f972bde719d1de85d95054c65db Mon Sep 17 00:00:00 2001 From: Ihor Burlachenko Date: Thu, 21 Jan 2016 22:46:28 +0100 Subject: [PATCH 64/69] Extended UndoableCommandInterface from CommandInterface --- Behavioral/Command/AddMessageDateCommand.php | 2 +- Behavioral/Command/UndoableCommandInterface.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Behavioral/Command/AddMessageDateCommand.php b/Behavioral/Command/AddMessageDateCommand.php index 9543bda..11bb9af 100644 --- a/Behavioral/Command/AddMessageDateCommand.php +++ b/Behavioral/Command/AddMessageDateCommand.php @@ -6,7 +6,7 @@ namespace DesignPatterns\Behavioral\Command; * This concrete command tweaks receiver to add current date to messages * invoker just knows that it can call "execute". */ -class AddMessageDateCommand implements CommandInterface, UndoableCommandInterface +class AddMessageDateCommand implements UndoableCommandInterface { /** * @var Receiver diff --git a/Behavioral/Command/UndoableCommandInterface.php b/Behavioral/Command/UndoableCommandInterface.php index 0fd101c..f9234ab 100644 --- a/Behavioral/Command/UndoableCommandInterface.php +++ b/Behavioral/Command/UndoableCommandInterface.php @@ -5,7 +5,7 @@ namespace DesignPatterns\Behavioral\Command; /** * Interface UndoableCommandInterface. */ -interface UndoableCommandInterface +interface UndoableCommandInterface extends CommandInterface { /** * This method is used to undo change made by command execution From d37937488258803f73c87f3e13cf046d15917c84 Mon Sep 17 00:00:00 2001 From: fitzel Date: Mon, 25 Jan 2016 12:55:19 +0100 Subject: [PATCH 65/69] Update README.rst --- Behavioral/Mediator/README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Behavioral/Mediator/README.rst b/Behavioral/Mediator/README.rst index 1a596d7..bc9485a 100644 --- a/Behavioral/Mediator/README.rst +++ b/Behavioral/Mediator/README.rst @@ -4,8 +4,8 @@ Purpose ------- -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). All components (called Colleague) are only coupled to the @@ -70,4 +70,4 @@ Tests/MediatorTest.php :linenos: .. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Mediator -.. __: http://en.wikipedia.org/wiki/Mediator_pattern \ No newline at end of file +.. __: http://en.wikipedia.org/wiki/Mediator_pattern From f5f192a61693d58f05d24d2f4134907471ef6074 Mon Sep 17 00:00:00 2001 From: Artem Ostretsov Date: Thu, 28 Jan 2016 09:53:00 +0300 Subject: [PATCH 66/69] Update RoleVisitorInterface.php --- Behavioral/Visitor/RoleVisitorInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Behavioral/Visitor/RoleVisitorInterface.php b/Behavioral/Visitor/RoleVisitorInterface.php index 1a72d7e..e8ba0ec 100644 --- a/Behavioral/Visitor/RoleVisitorInterface.php +++ b/Behavioral/Visitor/RoleVisitorInterface.php @@ -7,7 +7,7 @@ namespace DesignPatterns\Behavioral\Visitor; * * The contract for the visitor. * - * Note 1 : in C++ or java, with method polymorphism based on type-hint, there are many + * Note 1 : in C++ or Java, with method polymorphism based on type-hint, there are many * methods visit() with different type for the 'role' parameter. * * Note 2 : the visitor must not choose itself which method to From 3f1bd03aa46aa0192cb135571d2787fcfbf37f15 Mon Sep 17 00:00:00 2001 From: flobee Date: Sat, 6 Feb 2016 19:58:03 +0100 Subject: [PATCH 67/69] Some more tests, the constant confuses a bit --- Structural/Registry/Tests/RegistryTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Structural/Registry/Tests/RegistryTest.php b/Structural/Registry/Tests/RegistryTest.php index e889976..eee6f8d 100644 --- a/Structural/Registry/Tests/RegistryTest.php +++ b/Structural/Registry/Tests/RegistryTest.php @@ -6,6 +6,19 @@ use DesignPatterns\Structural\Registry\Registry; class RegistryTest extends \PHPUnit_Framework_TestCase { + public function testSimpleGetSet() + { + $key = 'myIdentifier'; + $object = new \StdClass(); + $object->props = array('a' => 1, 'b' => 2); + + Registry::set($key, $object); + $actual = Registry::get($key); + + $this->assertEquals($object, $actual); + $this->assertInstanceOf('StdClass', $actual); + } + public function testSetAndGetLogger() { Registry::set(Registry::LOGGER, new \StdClass()); From 1679894b1dc39a0523b1afe2a075b264001c6d25 Mon Sep 17 00:00:00 2001 From: Dominik Liebler Date: Sun, 14 Feb 2016 18:54:17 +0100 Subject: [PATCH 68/69] refactored Registry test: merged SimpleGetSet and SetAndGetLogger into one --- Structural/Registry/Tests/RegistryTest.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Structural/Registry/Tests/RegistryTest.php b/Structural/Registry/Tests/RegistryTest.php index eee6f8d..636f09e 100644 --- a/Structural/Registry/Tests/RegistryTest.php +++ b/Structural/Registry/Tests/RegistryTest.php @@ -6,11 +6,10 @@ use DesignPatterns\Structural\Registry\Registry; class RegistryTest extends \PHPUnit_Framework_TestCase { - public function testSimpleGetSet() + public function testSetAndGetLogger() { - $key = 'myIdentifier'; + $key = Registry::LOGGER; $object = new \StdClass(); - $object->props = array('a' => 1, 'b' => 2); Registry::set($key, $object); $actual = Registry::get($key); @@ -18,12 +17,4 @@ class RegistryTest extends \PHPUnit_Framework_TestCase $this->assertEquals($object, $actual); $this->assertInstanceOf('StdClass', $actual); } - - public function testSetAndGetLogger() - { - Registry::set(Registry::LOGGER, new \StdClass()); - - $logger = Registry::get(Registry::LOGGER); - $this->assertInstanceOf('StdClass', $logger); - } } From eef2b2944eced2f54466f1163bf84017e11a0979 Mon Sep 17 00:00:00 2001 From: Dominik Liebler Date: Sun, 14 Feb 2016 18:57:02 +0100 Subject: [PATCH 69/69] fixed coding style issues --- Structural/Registry/Tests/RegistryTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Structural/Registry/Tests/RegistryTest.php b/Structural/Registry/Tests/RegistryTest.php index 636f09e..9561abe 100644 --- a/Structural/Registry/Tests/RegistryTest.php +++ b/Structural/Registry/Tests/RegistryTest.php @@ -10,10 +10,10 @@ class RegistryTest extends \PHPUnit_Framework_TestCase { $key = Registry::LOGGER; $object = new \StdClass(); - + Registry::set($key, $object); $actual = Registry::get($key); - + $this->assertEquals($object, $actual); $this->assertInstanceOf('StdClass', $actual); }