mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-10-15 00:06:46 +00:00
:octocat: +QROptionsTrait::$fpdfMeasureUnit
This commit is contained in:
+21
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace chillerlan\QRCode;
|
||||
|
||||
use function array_values, count, is_numeric, max, min, sprintf;
|
||||
use function array_values, count, in_array, is_numeric, max, min, sprintf, strtolower;
|
||||
|
||||
/**
|
||||
* The QRCode plug-in settings & setter functionality
|
||||
@@ -197,6 +197,13 @@ trait QROptionsTrait{
|
||||
*/
|
||||
protected ?string $imagickBG = null;
|
||||
|
||||
/**
|
||||
* Measurement unit for FPDF output: pt, mm, cm, in (defaults to "pt")
|
||||
*
|
||||
* @see \FPDF::__construct()
|
||||
*/
|
||||
protected string $fpdfMeasureUnit = 'pt';
|
||||
|
||||
/**
|
||||
* Module values map
|
||||
*
|
||||
@@ -299,4 +306,17 @@ trait QROptionsTrait{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the FPDF measurement unit
|
||||
*/
|
||||
protected function set_fpdfMeasureUnit(string $unit):void{
|
||||
$unit = strtolower($unit);
|
||||
|
||||
if(in_array($unit, ['cm', 'in', 'mm', 'pt'], true)){
|
||||
$this->fpdfMeasureUnit = $unit;
|
||||
}
|
||||
|
||||
// @todo throw or ignore silently?
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user