Output format plugin

This is early work. I just wanted you to have a peek to the direction this is turning into.
I really like what you did of maintaining the state in the class property instead of passing stuff around. I'm going to suggest:

```php
  protected function addHateoas(array &$data) {
    if (!$this->handler) {
      return;
    }
    $original_request = $this->handler->getRequest();

    $data['_links'] = array();
    $page = !empty($original_request['page']) ? $original_request['page'] : 1;

    if ($page > 1) {
      $request = $original_request;
      $request['page'] = $page - 1;
      // Set the modified request with the updated page so getUrl returns the
      // correct value.
      $this->handler->setRequest($request);
      $data['_links']['previous'] = $this->handler->getUrl();
    }

    // We know that there are more pages if the total count is bigger than the
    // number of items of the current request plus the number of items in
    // previous pages.
    $items_per_page = $this->handler->getRange();
    $previous_items = ($page - 1) * $items_per_page;
    if ($data['count'] > count($data['data']) + $previous_items) {
      $request = $original_request;
      $request['page'] = $page + 1;
      // Set the modified request with the updated page so getUrl returns the
      // correct value.
      $this->handler->setRequest($request);
      $data['_links']['next'] = $this->handler->getUrl();
    }
    // Put the original request back.
    $this->handler->setRequest($original_request);
  }
```