<commit_before># Mediator Component - Mendo Framework

The Mendo Mediator component allows your application components to communicate with each other by dispatching events and listening to them. It implements the mediator behavioral design pattern.

### Creating the Dispatcher

```php
use Mendo\Mediator\EventDispatcher;

$dispatcher = new EventDispatcher();
```

### Adding Event Subscribers

```php
use Mendo\Mediator\EventSubscriberInterface;

class FooSubscriber implements EventSubscriberInterface
{
    public function onFooEvent()
    {
        // ... do something
    }

    public function getSubscribedEvents()
    {
        return ['fooEvent'];
    }
}

### Adding Event Listeners

Event listeners are similar to event subscribers. 
The only difference is that an event listener doesn't need to implement the *EventSubscriberInterface* interface
and provide the events it listens to. Instead, you specify the events it listens to outside the class.
The equivalent of the sample above using an event listener would be:

```php
class FooListener
{
    public function onFooEvent()
    {
        // ... do something
    }
}

$listener = new FooListener();
$dispatcher->addListener('fooEvent', $listener);
```

### Adding Closures

Adding a closure allows you to lazy load the listener instance.

```php
$dispatcher->addListener('fooEvent', function() {
	return new FooListener();
});
```
<commit_msg>Fix README.md<commit_after># Mediator Component - Mendo Framework

The Mendo Mediator component allows your application components to communicate with each other by dispatching events and listening to them. It implements the mediator behavioral design pattern.

### Creating the Dispatcher

```php
use Mendo\Mediator\EventDispatcher;

$dispatcher = new EventDispatcher();
```

### Adding Event Subscribers

```php
use Mendo\Mediator\EventSubscriberInterface;

class FooSubscriber implements EventSubscriberInterface
{
    public function onFooEvent()
    {
        // ... do something
    }

    public function getSubscribedEvents()
    {
        return ['fooEvent'];
    }
}
```

### Adding Event Listeners

Event listeners are similar to event subscribers. 
The only difference is that an event listener doesn't need to implement the *EventSubscriberInterface* interface
and provide the events it listens to. Instead, you specify the events it listens to outside the class.
The equivalent of the sample above using an event listener would be:

```php
class FooListener
{
    public function onFooEvent()
    {
        // ... do something
    }
}

$listener = new FooListener();
$dispatcher->addListener('fooEvent', $listener);
```

### Adding Closures

Adding a closure allows you to lazy load the listener instance.

```php
$dispatcher->addListener('fooEvent', function() {
	return new FooListener();
});
```

{'fraction_non_alphanumeric': 0.08788093550673282, 'fraction_numerical': 0.0, 'mean_word_length': 4.114130434782608, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2782474', 'n_tokens_mistral': 776, 'n_tokens_neox': 708, 'n_words': 297}