diff --git a/Behavioral/Iterator/BookList.php b/Behavioral/Iterator/BookList.php index 6cc5e5e..784c594 100644 --- a/Behavioral/Iterator/BookList.php +++ b/Behavioral/Iterator/BookList.php @@ -11,8 +11,6 @@ class BookList implements \Countable if (isset($this->books[$bookNumberToGet])) { return $this->books[$bookNumberToGet]; } - - return; } public function addBook(Book $book) diff --git a/Behavioral/TemplateMethod/Journey.php b/Behavioral/TemplateMethod/Journey.php index 6309e7f..c7a6809 100644 --- a/Behavioral/TemplateMethod/Journey.php +++ b/Behavioral/TemplateMethod/Journey.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Behavioral\TemplateMethod; -/** - * - */ abstract class Journey { /** diff --git a/Creational/Builder/BuilderInterface.php b/Creational/Builder/BuilderInterface.php index f682656..563162f 100644 --- a/Creational/Builder/BuilderInterface.php +++ b/Creational/Builder/BuilderInterface.php @@ -2,9 +2,6 @@ namespace DesignPatterns\Creational\Builder; -/** - * - */ interface BuilderInterface { /** diff --git a/Structural/Facade/Tests/FacadeTest.php b/Structural/Facade/Tests/FacadeTest.php index 0f1ea10..0247aaf 100644 --- a/Structural/Facade/Tests/FacadeTest.php +++ b/Structural/Facade/Tests/FacadeTest.php @@ -34,7 +34,7 @@ class FacadeTest extends \PHPUnit_Framework_TestCase } /** - * @param Computer $facade + * @param Computer $facade * @param OsInterface $os * @dataProvider getComputer */ diff --git a/Structural/Flyweight/CharacterFlyweight.php b/Structural/Flyweight/CharacterFlyweight.php index d0c6399..02657c1 100644 --- a/Structural/Flyweight/CharacterFlyweight.php +++ b/Structural/Flyweight/CharacterFlyweight.php @@ -11,6 +11,7 @@ class CharacterFlyweight implements FlyweightInterface /** * Any state stored by the concrete flyweight must be independent of its context. * For flyweights representing characters, this is usually the corresponding character code. + * * @var string */ private $name; @@ -25,7 +26,7 @@ class CharacterFlyweight implements FlyweightInterface /** * Clients supply the context-dependent information that the flyweight needs to draw itself - * For flyweights representing characters, extrinsic state usually contains e.g. the font + * For flyweights representing characters, extrinsic state usually contains e.g. the font. * * @param string $font */ diff --git a/Structural/Flyweight/FlyweightFactory.php b/Structural/Flyweight/FlyweightFactory.php index c709363..10a0d4d 100644 --- a/Structural/Flyweight/FlyweightFactory.php +++ b/Structural/Flyweight/FlyweightFactory.php @@ -2,8 +2,6 @@ namespace DesignPatterns\Structural\Flyweight; -use DesignPatterns\Structural\Flyweight\CharacterFlyweight; - /** * A factory manages shared flyweights. Clients shouldn't instaniate them directly, * but let the factory take care of returning existing objects or creating new ones. @@ -11,16 +9,17 @@ use DesignPatterns\Structural\Flyweight\CharacterFlyweight; class FlyweightFactory { /** - * Associative store for flyweight objects + * Associative store for flyweight objects. * - * @var Array + * @var array */ private $pool = array(); /** - * Magic getter + * Magic getter. * * @param string $name + * * @return Flyweight */ public function __get($name) @@ -28,7 +27,7 @@ class FlyweightFactory if (!array_key_exists($name, $this->pool)) { $this->pool[$name] = new CharacterFlyweight($name); } - + return $this->pool[$name]; } diff --git a/Structural/Flyweight/FlyweightInterface.php b/Structural/Flyweight/FlyweightInterface.php index 023419c..b12290d 100644 --- a/Structural/Flyweight/FlyweightInterface.php +++ b/Structural/Flyweight/FlyweightInterface.php @@ -3,7 +3,7 @@ namespace DesignPatterns\Structural\Flyweight; /** - * An interface through which flyweights can receive and act on extrinsic state + * An interface through which flyweights can receive and act on extrinsic state. */ interface FlyweightInterface { diff --git a/Structural/Flyweight/Tests/FlyweightTest.php b/Structural/Flyweight/Tests/FlyweightTest.php index 90c3f3a..997c3df 100644 --- a/Structural/Flyweight/Tests/FlyweightTest.php +++ b/Structural/Flyweight/Tests/FlyweightTest.php @@ -6,12 +6,12 @@ use DesignPatterns\Structural\Flyweight\FlyweightFactory; /** * FlyweightTest demonstrates how a client would use the flyweight structure - * You don't have to change the code of your client + * You don't have to change the code of your client. */ class FlyweightTest extends \PHPUnit_Framework_TestCase { private $characters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', - 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); + 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ); private $fonts = array('Arial', 'Times New Roman', 'Verdana', 'Helvetica'); // This is about the number of characters in a book of average length @@ -31,6 +31,6 @@ class FlyweightTest extends \PHPUnit_Framework_TestCase // Flyweight pattern ensures that instances are shared // instead of having hundreds of thousands of individual objects - $this->assertLessThanOrEqual($factory->totalNumber(), sizeof($this->characters)); + $this->assertLessThanOrEqual($factory->totalNumber(), count($this->characters)); } }