mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-02-24 09:42:24 +01:00
41 lines
642 B
PHP
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;
|
|
}
|
|
}
|