# Filters

Filters can be used to remove formatted objects from the final result.

Filters are only applied when calling `FormatterInterface::formatMany` or `FormatterInterface::formatTraversable`.

## Usage

```php
$filter = function (array $data) {
    // Expressions returning true remove the formatted object from the result.
    return $data['count'] !== 126;
};

$formatter->addFilter(filter);
```

# Filters

Filters can be used to remove formatted objects from the final result.

Filters are only applied when calling `FormatterInterface::formatMany` or `FormatterInterface::formatTraversable`.

The callable should be an implementation of the `$callback` parameter defined in the [`array_filter`](https://secure.php.net/manual/en/function.array-filter.php) function. Returning `true` if the element should **not** be filtered.

## Usage

```php
$filter = function (array $data) {
    // Expressions returning true remove the formatted object from the result.
    return $data['count'] !== 126;
};

$formatter->addFilter(filter);
```

Update the filter docs with some clarity on return values.
:memo: Update the filter docs with some clarity on return values.

The callable should follow the `$callback` definition of the `array_filter`
function. Which perhaps unintuitively removes elements if the callable
returns `false`.
