<?php
namespace Guzzle\Common;
use Symfony\Component\EventDispatcher\Event as SymfonyEvent;
/**
* Default event for Guzzle notifications
*/
class Event extends SymfonyEvent implements \ArrayAccess, \IteratorAggregate {
/**
* @var array
*/
private $context;
/**
* Constructor
*
* @param array $context Contextual information
*/
public function __construct(array $context = array()) {
$this->context = $context;
}
/**
* {@inheritdoc}
*/
public function getIterator() {
return new \ArrayIterator($this->context);
}
/**
* {@inheritdoc}
*/
public function offsetGet($offset) {
return array_key_exists($offset, $this->context) ? $this->context[$offset] : null;
}
/**
* {@inheritdoc}
*/
public function offsetSet($offset, $value) {
$this->context[$offset] = $value;
}
/**
* {@inheritdoc}
*/
public function offsetExists($offset) {
return array_key_exists($offset, $this->context);
}
/**
* {@inheritdoc}
*/
public function offsetUnset($offset) {
unset($this->context[$offset]);
}
}