Implement IteratorAggregate
This commit is contained in:
@@ -10,7 +10,7 @@ use Pcm\MetadataBundle\Interface\MetadataInterface;
|
||||
/**
|
||||
* Store scalar metadata on an entity.
|
||||
*/
|
||||
final class Metadata implements MetadataInterface
|
||||
final class Metadata implements MetadataInterface, \IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* @param array<string, scalar|scalar[]> &$metadata
|
||||
@@ -19,6 +19,11 @@ final class Metadata implements MetadataInterface
|
||||
{
|
||||
}
|
||||
|
||||
public function getIterator(): \Traversable
|
||||
{
|
||||
return new \ArrayIterator($this->metadata);
|
||||
}
|
||||
|
||||
public function get(string $key): mixed
|
||||
{
|
||||
if (!$this->isSet($key)) {
|
||||
|
||||
Reference in New Issue
Block a user