Files
DesignPatternsPHP/More/EAV/Value.php
Dominik Liebler 461d612b91 PHP7 More
2016-09-22 15:51:45 +02:00

30 lines
482 B
PHP

<?php
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);
}
}