mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-29 03:00:15 +02:00
30 lines
507 B
PHP
30 lines
507 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\More\EAV;
|
|
|
|
class Value
|
|
{
|
|
/**
|
|
* @var Attribute
|
|
*/
|
|
private $attribute;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
private $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', $this->attribute, $this->name);
|
|
}
|
|
}
|