From 3fcf860cf3ed918a6c2289f7f0c37c27c0dfbeea Mon Sep 17 00:00:00 2001 From: Dominik Liebler Date: Thu, 7 Apr 2016 08:59:31 +0200 Subject: [PATCH] Fixed style --- Structural/Flyweight/CharacterFlyweight.php | 2 +- Structural/Flyweight/FlyweightFactory.php | 5 +++-- Structural/Flyweight/FlyweightInterface.php | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) 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); }