<?php
 namespace Firebase\JWT; use InvalidArgumentException; use OpenSSLAsymmetricKey; use OpenSSLCertificate; use TypeError; class Key { public function __construct( private $keyMaterial, private string $algorithm ) { if ( !\is_string($keyMaterial) && !$keyMaterial instanceof OpenSSLAsymmetricKey && !$keyMaterial instanceof OpenSSLCertificate && !\is_resource($keyMaterial) ) { throw new TypeError('Key material must be a string, resource, or OpenSSLAsymmetricKey'); } if (empty($keyMaterial)) { throw new InvalidArgumentException('Key material must not be empty'); } if (empty($algorithm)) { throw new InvalidArgumentException('Algorithm must not be empty'); } } public function getAlgorithm(): string { return $this->algorithm; } public function getKeyMaterial() { return $this->keyMaterial; } } 