Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
<?php
2
 
3
namespace Guzzle\Common;
4
 
5
use Symfony\Component\EventDispatcher\Event as SymfonyEvent;
6
 
7
/**
8
 * Default event for Guzzle notifications
9
 */
10
class Event extends SymfonyEvent implements ToArrayInterface, \ArrayAccess, \IteratorAggregate
11
{
12
    /** @var array */
13
    private $context;
14
 
15
    /**
16
     * @param array $context Contextual information
17
     */
18
    public function __construct(array $context = array())
19
    {
20
        $this->context = $context;
21
    }
22
 
23
    public function getIterator()
24
    {
25
        return new \ArrayIterator($this->context);
26
    }
27
 
28
    public function offsetGet($offset)
29
    {
30
        return isset($this->context[$offset]) ? $this->context[$offset] : null;
31
    }
32
 
33
    public function offsetSet($offset, $value)
34
    {
35
        $this->context[$offset] = $value;
36
    }
37
 
38
    public function offsetExists($offset)
39
    {
40
        return isset($this->context[$offset]);
41
    }
42
 
43
    public function offsetUnset($offset)
44
    {
45
        unset($this->context[$offset]);
46
    }
47
 
48
    public function toArray()
49
    {
50
        return $this->context;
51
    }
52
}