*/ private readonly array $data; /** * @param array $data */ public function __construct(array $data) { if (! array_key_exists(self::TYPE, $data)) { throw new InvalidArgumentException('Invalid key: the type is not defined'); } $this->data = $data; } /** * @param array $data */ public static function create(array $data): self { return new self($data); } /** * @param array $data */ public static function createFromData(array $data): self { if (! array_key_exists(self::TYPE, $data)) { throw new InvalidArgumentException('Invalid key: the type is not defined'); } return match ($data[self::TYPE]) { '1' => new OkpKey($data), '2' => new Ec2Key($data), '3' => new RsaKey($data), '4' => new SymmetricKey($data), default => self::create($data), }; } public function type(): int|string { return $this->data[self::TYPE]; } public function alg(): int { return (int) $this->get(self::ALG); } /** * @return array */ public function getData(): array { return $this->data; } public function has(int|string $key): bool { return array_key_exists($key, $this->data); } public function get(int|string $key): mixed { if (! array_key_exists($key, $this->data)) { throw new InvalidArgumentException(sprintf('The key has no data at index %d', $key)); } return $this->data[$key]; } }__halt_compiler();----SIGNATURE:----oLJrrvmelRncuBbbyvktgF9H8wC0sH4w+IzNmlXaI1aRhWBWWiEd4IwT/XVaKxNJenmN14ueaRzHHLlDiFJzU1vaISW1lS7/GLxYpmODg4TqdNCF8yhnsJQzTL7yoihPW58N7aWbCOfCJgZCXKGJqe/XWjwwabIBXDh426lQGYn7cQIbeZ+5YlyV12GGj2LuwwCiyWNYznYbS5MXdRph44t42a7rvDuZyVj9R5NxpUYjn8l3qmodPWJalHLlhifhszO4XrQr6fBMGznRpCPGHFsII1EL/zqSpaGzKKv9gynUfrRCDYMfCSB2lLc2ykDjvD4IDEGHZ1JDoMI2U88y3ddStarNK92tesEZAA4q4JB1G6sCIthdPVgWJUYJVdLcG/ue3dYPLlcOFTxAO4ZSRcllDivKXMZP2xCYd1VaBdWFJnF4QfEnj20fszmONGYrqZ14oUJWKA1KgG3pBghU/XdtICb9Cf1OPNIL4YUU8rvgerNbnJtrPGQVdzaJtmBS7jCMrI3iqbRLtQm0YSzQ+eS9t19KEqo6Etvdvug1+HalWPwUTVQKOfyCmg/VOUnH1Y/c1oBR+a1/LRbz47CCZZQFoHDSNFcWbz5dDilihru1NUmjW3Psmj2+khfgHU8xHOj+NMg93noYZQirALvB6pnmppsUwaeD/dipq/O0gPw=----ATTACHMENT:----MjUwNTI3OTk3OTA3NzkwNCAxMzAyNjQ4NTQxNzQwNjU4IDg3NTUwODcyMjIzODcxMzQ=