feat: add QRCode definition

This commit is contained in:
Ondrej Vlach 2024-01-16 20:30:15 +01:00
parent 928ff810e6
commit f450e2db43
Signed by: ovlach
GPG Key ID: 4FF1A23B4914DE70
4 changed files with 222 additions and 0 deletions

View File

@ -0,0 +1,98 @@
<?php
declare(strict_types=1);
namespace App\Entity\QRCode;
/**
* QRCode description
*/
class QRCode
{
private ?string $iban;
private ?\DateTime $dueDate;
private ?string $message;
private ?QRCodeMoney $money;
private ?QRCodePaymentIdentification $paymentIdentification;
private readonly QRCodeQROptions $codeQROptions;
/**
* @param QRCodeQROptions $codeQROptions
* @param string|null $iban
* @param string|null $dueDate
* @param string|null $message
* @param QRCodeMoney|null $money
*/
public function __construct(
QRCodeQROptions $codeQROptions,
?string $iban = null,
?string $dueDate = null,
?string $message = null,
?QRCodeMoney $money = null)
{
$this->iban = $iban;
$this->dueDate = $dueDate;
$this->message = $message;
$this->money = $money;
$this->codeQROptions = $codeQROptions;
}
public function getIban(): ?string
{
return $this->iban;
}
public function setIban(?string $iban): void
{
$this->iban = $iban;
}
public function getDueDate(): ?\DateTime
{
return $this->dueDate;
}
public function setDueDate(?\DateTime $dueDate): void
{
$this->dueDate = $dueDate;
}
public function getMessage(): ?string
{
return $this->message;
}
public function setMessage(?string $message): void
{
$this->message = $message;
}
public function getMoney(): ?QRCodeMoney
{
return $this->money;
}
public function setMoney(?QRCodeMoney $money): void
{
$this->money = $money;
}
public function getCodeQROptions(): ?QRCodeQROptions
{
return $this->codeQROptions;
}
public function getPaymentIdentification(): ?QRCodePaymentIdentification
{
return $this->paymentIdentification;
}
public function setPaymentIdentification(?QRCodePaymentIdentification $paymentIdentification): void
{
$this->paymentIdentification = $paymentIdentification;
}
}

View File

@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace App\Entity\QRCode;
/**
* Money type for QR code
*/
class QRCodeMoney
{
private ?string $amount;
private ?string $currency;
/**
* @param string|null $amount
* @param string|null $currency
*/
public function __construct(?string $amount = null, ?string $currency = null)
{
$this->amount = $amount;
$this->currency = $currency;
}
public function getAmount(): ?string
{
return $this->amount;
}
public function setAmount(?string $amount): void
{
$this->amount = $amount;
}
public function getCurrency(): ?string
{
return $this->currency;
}
public function setCurrency(?string $currency): void
{
$this->currency = $currency;
}
}

View File

@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace App\Entity\QRCode;
/**
* Payment identification for QR code
*/
class QRCodePaymentIdentification {
private string $variableSymbol;
private string $specificSymbol;
private string $constantSymbol;
public function getVariableSymbol(): string
{
return $this->variableSymbol;
}
public function setVariableSymbol(string $variableSymbol): void
{
$this->variableSymbol = $variableSymbol;
}
public function getSpecificSymbol(): string
{
return $this->specificSymbol;
}
public function setSpecificSymbol(string $specificSymbol): void
{
$this->specificSymbol = $specificSymbol;
}
public function getConstantSymbol(): string
{
return $this->constantSymbol;
}
public function setConstantSymbol(string $constantSymbol): void
{
$this->constantSymbol = $constantSymbol;
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace App\Entity\QRCode;
/**
* Options for generating QR code
*/
readonly class QRCodeQROptions {
private int $scale;
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;
}
}