I think its bloating the code uselessly, but if other libs do the same, lets do it here too. No real harm.

----- Reply message -----
Von: "David de Boer" <notifications@github.com>
An: "ddeboer/FOSHttpCache" <FOSHttpCache@noreply.github.com>
Cc: "David Buchmann" <david@liip.ch>
Betreff: [FOSHttpCache] Throw exceptions (#25)
Datum: Mo., Feb. 24, 2014 21:04
In src/CacheInvalidator.php:
> +            $this->eventDispatcher = new EventDispatcher();
> +        }
> +
> +        return $this->eventDispatcher;
> +    }
> +
> +    /**
> +     * Add subscriber
> +     *
> +     * @param EventSubscriberInterface $subscriber
> +     *
> +     * @return $this
> +     */
> +    public function addSubscriber(EventSubscriberInterface $subscriber)
> +    {
> +        $this->getEventDispatcher()->addSubscriber($subscriber);

Proxying the method makes it easier for users, as they don’t have to instantiate an event dispatcher first. Still, because of the setEventDispatcher method, users can easily integrate with their own event listener (of Symfony’s in the bundle). This approach is also used by Guzzle’s HTTP client.

&mdash;
Reply to this email directly or view it on GitHub.