function listPluginData($discovery_type = NULL) {
    // We may come here several times, so cache this.
    // TODO: look into finer-grained caching higher up.
    static $cache;

    if (isset($cache[$discovery_type])) {
      return $cache[$discovery_type];
    }

    $plugin_data = $this->environment->getStorage()->retrieve('plugins');

    // Filter the plugins by the discovery type.
    if ($discovery_type) {
      $plugin_data = array_filter($plugin_data, function($item) use ($discovery_type) {
        $discovery_pieces = explode('\\', $item['discovery']);
        $discovery_short_name = array_pop($discovery_pieces);

        return ($discovery_short_name == $discovery_type);
      });
    }

    $cache[$discovery_type] = $plugin_data;

    return $plugin_data;
  }