protected function valueForKey($key) {
    // Attempt to create the non-existing service.
    $method = 'get_' . $key;
    if (!method_exists($this, $method)) {
      if (isset($this->defaults[$key])) {
        return $this->defaults[$key];
      }
      // Keys are only 'known' if there is a get_ method.
      throw new MiniContainerException(sprintf('Unknown key "%s".', $key));
    }
    return $this->$method();
  }