mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Use enums for LabelOptions
This commit is contained in:
parent
485b35fbd4
commit
71cd4057a7
23 changed files with 329 additions and 157 deletions
|
@ -42,6 +42,7 @@ declare(strict_types=1);
|
|||
namespace App\Services\LabelSystem;
|
||||
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\LabelSystem\LabelSupportedElement;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
|
@ -55,12 +56,12 @@ use ReflectionClass;
|
|||
|
||||
final class LabelExampleElementsGenerator
|
||||
{
|
||||
public function getElement(string $type): object
|
||||
public function getElement(LabelSupportedElement $type): object
|
||||
{
|
||||
return match ($type) {
|
||||
'part' => $this->getExamplePart(),
|
||||
'part_lot' => $this->getExamplePartLot(),
|
||||
'storelocation' => $this->getStorelocation(),
|
||||
LabelSupportedElement::PART => $this->getExamplePart(),
|
||||
LabelSupportedElement::PART_LOT => $this->getExamplePartLot(),
|
||||
LabelSupportedElement::STORELOCATION => $this->getStorelocation(),
|
||||
default => throw new InvalidArgumentException('Unknown $type.'),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue