/** * @param string $type MIMEタイプ。 * @param string $filename エラーメッセージで使用するファイル名。 * @throws \DomainException MIMEタイプが image/png、image/jpeg、image/svg+xml のいずれでもないとき。 */ public function __construct(string $type, string $filename) { parent::__construct(); if (in_array($type, ['image/png', 'image/jpeg', 'image/svg+xml'])) { $this->type = $type; } else { throw new \DomainException(); } $this->filename = $filename; }
/** * @param bool $source image-source、audio-source、video-sourceフィールドの矯正であれば真を指定。 * @param string[] $filenames src属性の検証に使用するファイル名のリスト。 */ public function __construct(bool $source = false, $filenames = []) { parent::__construct(); $this->source = $source; $this->filenames = $filenames; }