ldc-cocotte/app/Cqs/Actions/Shops/UpdateShopInput.php
Jérémy Munsch d0efb0f527
refactor: update namespaces for actions and queries
Refactored the codebase to change the namespaces of various actions and queries from `App\Actions` to `App\Cqs\Actions` and `App\Queries` to `App\Cqs\Queries`. This restructuring improves organization and clarity in the codebase.
2026-11-10 15:13:26 +01:00

41 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Cqs\Actions\Shops;
use App\Contracts\ActionInput;
use App\Models\Shop;
use Domain\Models\ValueObjects\Coordinates;
use Domain\Models\ValueObjects\PhoneNumber;
use Webmozart\Assert\Assert;
final readonly class UpdateShopInput implements ActionInput
{
public function __construct(
public Shop $shop,
public string $name,
public string $address,
public string $postcode,
public string $city,
public ?PhoneNumber $phone,
public ?Coordinates $coordinates,
public bool $default,
) {
$trimmedName = trim($this->name);
Assert::stringNotEmpty($trimmedName, 'Shop name cannot be empty.');
Assert::maxLength($trimmedName, 255, 'Shop name cannot exceed 255 characters.');
$trimmedAddress = trim($this->address);
Assert::stringNotEmpty($trimmedAddress, 'Shop address cannot be empty.');
Assert::maxLength($trimmedAddress, 255, 'Shop address cannot exceed 255 characters.');
$trimmedPostcode = trim($this->postcode);
Assert::stringNotEmpty($trimmedPostcode, 'Shop postcode cannot be empty.');
Assert::maxLength($trimmedPostcode, 255, 'Shop postcode cannot exceed 255 characters.');
$trimmedCity = trim($this->city);
Assert::stringNotEmpty($trimmedCity, 'Shop city cannot be empty.');
Assert::maxLength($trimmedCity, 255, 'Shop city cannot exceed 255 characters.');
}
}