forked from symfony/symfony
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EventDispatcher] Adding IteratorAggregate to GenericEvent
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
* | ||
* @author Drak <[email protected]> | ||
*/ | ||
class GenericEvent extends Event implements \ArrayAccess | ||
class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate | ||
{ | ||
/** | ||
* Observer pattern subject. | ||
|
@@ -177,4 +177,14 @@ public function offsetExists($key) | |
{ | ||
return $this->hasArgument($key); | ||
} | ||
|
||
/** | ||
* IteratorAggregate for iterating over the object like an array | ||
* | ||
* @return \ArrayIterator | ||
*/ | ||
public function getIterator() | ||
{ | ||
return new \ArrayIterator($this->arguments); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters