/** * Constructor. * @param string $algorithm * @throws \DomainException If the specified algorithm is not supported. */ public function __construct($algorithm) { if (!isset(Jwa::getSupportedAlgorithms()[$algorithm])) { throw new \DomainException('Specified algorithm is not supported.'); } else { $this->algorithm = $algorithm; } }