18declare(strict_types=1);
28use BaconQrCode as External;
39 protected int $size_in_px,
46 if (!$from instanceof
URI) {
47 throw new \InvalidArgumentException(
"Argument must be of type " . URI::class);
50 $writer =
new External\Writer(
52 new External\
Renderer\RendererStyle\RendererStyle($this->size_in_px),
53 new External\
Renderer\Image\SvgImageBackEnd(),
57 $raw_svg_string = $writer->writeString(
60 $this->mapErrorCorrectionLevel($this->error_correction_level),
63 return new SVG($raw_svg_string);
68 return match ($level) {
69 ErrorCorrectionLevel::LOW => External\Common\ErrorCorrectionLevel::L(),
70 ErrorCorrectionLevel::MEDIUM => External\Common\ErrorCorrectionLevel::M(),
71 ErrorCorrectionLevel::QUARTILE => External\Common\ErrorCorrectionLevel::Q(),
79 throw new \InvalidArgumentException(
"Number must be greater than zero.");
Data transfer object that carries the raw SVG data as a string, created from trusted sources.
The scope of this class is split ilias-conform URI's into components.
trait DeriveInvokeFromTransform
trait DeriveApplyToFromTransform
An entity that renders components to a string output.
ErrorCorrectionLevel
Error correction levels as defined by ISO/IEC 18004.
@ HIGH
~7% of codewords can be restored.