Files
DesignPatternsPHP/More/EAV/Attribute.php
2019-08-19 18:11:49 +02:00

41 lines
667 B
PHP

<?php declare(strict_types=1);
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;
}
}