Ported InvalidUserDataException.

This commit is contained in:
Alexey Skobkin 2023-04-01 19:21:53 +03:00
parent b4bdda26e3
commit c151acd30b
No known key found for this signature in database
GPG Key ID: 5D5CEF6F221278E7
3 changed files with 18 additions and 26 deletions

View File

@ -1,25 +0,0 @@
<?php
namespace src\PointToolsBundle\Exception\Factory;
use src\PointToolsBundle\DTO\Api\User as UserDTO;
class InvalidUserDataException extends \Exception
{
/**
* @var UserDTO
*/
private $user;
public function __construct($message = "", UserDTO $user, $code = 0, \Exception $previous = null)
{
$this->user = $user;
parent::__construct($message, $code, $previous);
}
public function getUser(): UserDTO
{
return $this->user;
}
}

View File

@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace App\Exception\Factory;
use App\DTO\Api\User as UserDTO;
class InvalidUserDataException extends \Exception
{
public function __construct(
public readonly UserDTO $user,
$code = 0,
\Exception $previous = null
) {
parent::__construct('Invalid user data', $code, $previous);
}
}

View File

@ -25,7 +25,7 @@ class UserFactory extends AbstractFactory
// @todo LOG
if (!$userData->isValid()) {
throw new InvalidUserDataException('Invalid user data', $userData);
throw new InvalidUserDataException($userData);
}
/** @var User $user */