mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-09-25 22:09:23 +02:00
23 lines
459 B
PHP
23 lines
459 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\More\EAV;
|
|
|
|
class Value
|
|
{
|
|
private Attribute $attribute;
|
|
private string $name;
|
|
|
|
public function __construct(Attribute $attribute, string $name)
|
|
{
|
|
$this->name = $name;
|
|
$this->attribute = $attribute;
|
|
|
|
$attribute->addValue($this);
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return sprintf('%s: %s', (string) $this->attribute, $this->name);
|
|
}
|
|
}
|