public static function filterKeys(Array $array, Closure $filter) {
    $filtered = array();
    //@TODO maybe something with array_filter as callback is faster here? benchmark?

    foreach ($array as $key => $value) {
      if ($filter($key, $value)) {
        $filtered[$key] = $value;
      }
    }

    return $filtered;
  }