44 lines
		
	
	
		
			999 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			999 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
declare(strict_types=1);
 | 
						|
 | 
						|
namespace App\Entity\QRCode;
 | 
						|
 | 
						|
use Symfony\Component\Validator\Constraints as Assert;
 | 
						|
 | 
						|
/**
 | 
						|
 * Options for generating QR code
 | 
						|
 */
 | 
						|
readonly class QRCodeQROptions {
 | 
						|
    #[Assert\Positive(
 | 
						|
        message: 'messages.scale_must_be_positive',
 | 
						|
    )]
 | 
						|
    #[Assert\NotBlank(message: 'messages.fill_value')]
 | 
						|
    private int $scale;
 | 
						|
    
 | 
						|
    #[Assert\PositiveOrZero(
 | 
						|
        message: 'messages.margin_must_be_positive',
 | 
						|
    )]
 | 
						|
    #[Assert\NotBlank(message: 'messages.fill_value')]
 | 
						|
    private int $margin;
 | 
						|
 | 
						|
    /**
 | 
						|
     * @param int $scale scaling of png image (2 = 1px is mapped onto 2px, 3 = 1px onto 3px etc.)
 | 
						|
     * @param int $margin white borders of png image in pixels
 | 
						|
     */
 | 
						|
    public function __construct(int $scale, int $margin)
 | 
						|
    {
 | 
						|
        $this->scale = $scale;
 | 
						|
        $this->margin = $margin;
 | 
						|
    }
 | 
						|
 | 
						|
    public function getScale(): int
 | 
						|
    {
 | 
						|
        return $this->scale;
 | 
						|
    }
 | 
						|
 | 
						|
    public function getMargin(): int
 | 
						|
    {
 | 
						|
        return $this->margin;
 | 
						|
    }
 | 
						|
}
 |