improved Flyweight

This commit is contained in:
Dominik Liebler
2019-08-19 17:47:02 +02:00
parent c00800f572
commit 2afed49abd
8 changed files with 94 additions and 46 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace DesignPatterns\Structural\Flyweight;
class Word implements Text
{
/**
* @var string
*/
private $name;
public function __construct(string $name)
{
$this->name = $name;
}
public function render(string $font): string
{
return sprintf('Word %s with font %s', $this->name, $font);
}
}