diff --git a/Structural/Flyweight/CharacterFlyweight.php b/Structural/Flyweight/CharacterFlyweight.php index d10cd03..d0c6399 100644 --- a/Structural/Flyweight/CharacterFlyweight.php +++ b/Structural/Flyweight/CharacterFlyweight.php @@ -16,7 +16,6 @@ class CharacterFlyweight implements FlyweightInterface private $name; /** - * Constructor. * @param string $name */ public function __construct($name) @@ -27,6 +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 + * * @param string $font */ public function draw($font) diff --git a/Structural/Flyweight/FlyweightFactory.php b/Structural/Flyweight/FlyweightFactory.php index a15a07b..c709363 100644 --- a/Structural/Flyweight/FlyweightFactory.php +++ b/Structural/Flyweight/FlyweightFactory.php @@ -12,7 +12,7 @@ class FlyweightFactory { /** * Associative store for flyweight objects - * + * * @var Array */ private $pool = array(); @@ -28,6 +28,7 @@ class FlyweightFactory if (!array_key_exists($name, $this->pool)) { $this->pool[$name] = new CharacterFlyweight($name); } + return $this->pool[$name]; } @@ -36,6 +37,6 @@ class FlyweightFactory */ public function totalNumber() { - return sizeof($this->pool); + return count($this->pool); } } diff --git a/Structural/Flyweight/FlyweightInterface.php b/Structural/Flyweight/FlyweightInterface.php index e48bb8f..023419c 100644 --- a/Structural/Flyweight/FlyweightInterface.php +++ b/Structural/Flyweight/FlyweightInterface.php @@ -7,5 +7,8 @@ namespace DesignPatterns\Structural\Flyweight; */ interface FlyweightInterface { + /** + * @param string $extrinsicState + */ public function draw($extrinsicState); }