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;
|
private $name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
public function __construct($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
|
* 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
|
* @param string $font
|
||||||
*/
|
*/
|
||||||
public function draw($font)
|
public function draw($font)
|
||||||
|
@@ -12,7 +12,7 @@ class FlyweightFactory
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Associative store for flyweight objects
|
* Associative store for flyweight objects
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
private $pool = array();
|
private $pool = array();
|
||||||
@@ -28,6 +28,7 @@ class FlyweightFactory
|
|||||||
if (!array_key_exists($name, $this->pool)) {
|
if (!array_key_exists($name, $this->pool)) {
|
||||||
$this->pool[$name] = new CharacterFlyweight($name);
|
$this->pool[$name] = new CharacterFlyweight($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->pool[$name];
|
return $this->pool[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +37,6 @@ class FlyweightFactory
|
|||||||
*/
|
*/
|
||||||
public function totalNumber()
|
public function totalNumber()
|
||||||
{
|
{
|
||||||
return sizeof($this->pool);
|
return count($this->pool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,5 +7,8 @@ namespace DesignPatterns\Structural\Flyweight;
|
|||||||
*/
|
*/
|
||||||
interface FlyweightInterface
|
interface FlyweightInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param string $extrinsicState
|
||||||
|
*/
|
||||||
public function draw($extrinsicState);
|
public function draw($extrinsicState);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user