dep: DTO
This commit is contained in:
1 parent
d75f21035d
commit
290e7ee05e
34 files changed
+1936
-8
No files matched your search
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Spatie\DataTransferObject\Validation;
|
||||
|
||||
use JetBrains\PhpStorm\Immutable;
|
||||
|
||||
class ValidationResult
|
||||
{
|
||||
public function __construct(
|
||||
#[Immutable]
|
||||
public bool $isValid,
|
||||
#[Immutable]
|
||||
public ?string $message = null
|
||||
) {
|
||||
}
|
||||
|
||||
public static function valid(): self
|
||||
{
|
||||
return new self(
|
||||
isValid: true,
|
||||
);
|
||||
}
|
||||
|
||||
public static function invalid(string $message): self
|
||||
{
|
||||
return new self(
|
||||
isValid: false,
|
||||
message: $message,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user