contao-community-alliance/events-contao-bindings — pull request #4 by dmolineus (2014-10-29 12:33:23+00:00)
Title: Propose an function based api

The current implementation of the event bindings provides a flexible way to manipulate the result of the actual called Contao API. Unfortunately the API get lost, so every call has to dispatch the event for itselves.

Before using another library for that I provide it as a PR. This PR propose an api which hides the event dispatching. So every call could be simplified:

```php

// what to do before
$event = new ContaoCommunityAlliance\Contao\Bindings\Events\Backend\AddToUrlEvent('act=edit');
$dispatcher = $GLOBALS['container']['event-dispatcher'];

$dispatcher->dispatch(ContaoCommunityAlliance\Contao\Bindings\ContaoEvents::BACKEND_ADD_TO_URL, $event);

$url = $event->getUrl();

// Using Contao Events API
$url = ContaoCommunityAlliance\Contao\Bindings\Events\Backend\addToUrl('act=edit');

```

There are also unit tests provided. They test the event dispatching and the correct returning of the value.

The current implementation uses the functional approach. I think it better fits the need. If you general like the idea but not the functional solution we could discuss it.