add(...), $algorithms); } public function add(AlgorithmInterface $algorithm): self { $id = $algorithm->getSigner()->algorithmId(); Assert::keyNotExists($this->algorithms, $id, 'passed algorithm is already exists'); $this->algorithms[$id] = $algorithm; return $this; } /** * @param string $algorithmId * * @return AlgorithmInterface * @throws AlgorithmIsNotDefinedException */ public function get(string $algorithmId): AlgorithmInterface { if (!isset($this->algorithms[$algorithmId])) { throw new AlgorithmIsNotDefinedException($algorithmId); } return $this->algorithms[$algorithmId]; } }