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

41 lines
642 B
PHP

<?php
namespace DesignPatterns\More\EAV;
class Attribute
{
/**
* @var \SplObjectStorage
*/
private $values;
/**
* @var string
*/
private $name;
public function __construct(string $name)
{
$this->values = new \SplObjectStorage();
$this->name = $name;
}
public function addValue(Value $value)
{
$this->values->attach($value);
}
/**
* @return \SplObjectStorage
*/
public function getValues(): \SplObjectStorage
{
return $this->values;
}
public function __toString(): string
{
return $this->name;
}
}