src/Domain/Entity/Invoice.php line 9

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Domain\Entity;
  4. use ApiPlatform\Metadata\ApiProperty;
  5. class Invoice
  6. {
  7.     #[ApiProperty(identifiertrue)]
  8.     public ?int $id null;
  9.     public function __construct(
  10.         public string $name,
  11.         public int $number,
  12.     ) {
  13.     }
  14.     public function getLabel(): string
  15.     {
  16.         $number str_pad("$this->number"6'0'STR_PAD_LEFT);
  17.         return "$this->name-$number";
  18.     }
  19. }