mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 12:10:10 +02:00
Fixed style
This commit is contained in:
@@ -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)
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -7,5 +7,8 @@ namespace DesignPatterns\Structural\Flyweight;
|
||||
*/
|
||||
interface FlyweightInterface
|
||||
{
|
||||
/**
|
||||
* @param string $extrinsicState
|
||||
*/
|
||||
public function draw($extrinsicState);
|
||||
}
|
||||
|
Reference in New Issue
Block a user