public function getScore($key) { if (!array_key_exists($key, $this->scores)) { throw new \InvalidArgumentException(sprintf('The recommendation does not contains a score named "%s"', $key)); } return $this->scores[$key]; }