Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

  • AbstractHasDispatcher
  • Collection
  • Event
  • Version

Interfaces

  • FromConfigInterface
  • HasDispatcherInterface
  • ToArrayInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: 
 3: namespace Guzzle\Common;
 4: 
 5: use Symfony\Component\EventDispatcher\EventDispatcher;
 6: use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 7: use Symfony\Component\EventDispatcher\EventSubscriberInterface;
 8: 
 9: /**
10:  * Class that holds an event dispatcher
11:  */
12: class AbstractHasDispatcher implements HasDispatcherInterface
13: {
14:     /**
15:      * @var EventDispatcherInterface
16:      */
17:     protected $eventDispatcher;
18: 
19:     /**
20:      * {@inheritdoc}
21:      */
22:     public static function getAllEvents()
23:     {
24:         return array();
25:     }
26: 
27:     /**
28:      * {@inheritdoc}
29:      */
30:     public function setEventDispatcher(EventDispatcherInterface $eventDispatcher)
31:     {
32:         $this->eventDispatcher = $eventDispatcher;
33: 
34:         return $this;
35:     }
36: 
37:     /**
38:      * {@inheritdoc}
39:      */
40:     public function getEventDispatcher()
41:     {
42:         if (!$this->eventDispatcher) {
43:             $this->eventDispatcher = new EventDispatcher();
44:         }
45: 
46:         return $this->eventDispatcher;
47:     }
48: 
49:     /**
50:      * {@inheritdoc}
51:      */
52:     public function dispatch($eventName, array $context = array())
53:     {
54:         $this->getEventDispatcher()->dispatch($eventName, new Event($context));
55:     }
56: 
57:     /**
58:      * {@inheritdoc}
59:      */
60:     public function addSubscriber(EventSubscriberInterface $subscriber)
61:     {
62:         $this->getEventDispatcher()->addSubscriber($subscriber);
63: 
64:         return $this;
65:     }
66: }
67: 
php-coveralls API documentation generated by ApiGen 2.8.0