mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-28 02:30:20 +02:00
22 lines
358 B
PHP
22 lines
358 B
PHP
<?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);
|
|
}
|
|
}
|