You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Application-Web/src/Validation/ValidationFail.php

35 lines
760 B

<?php
namespace App\Validation;
class ValidationFail implements \JsonSerializable {
private string $kind;
private string $message;
/**
* @param string $message
* @param string $kind
*/
public function __construct(string $kind, string $message) {
$this->message = $message;
$this->kind = $kind;
}
public function getMessage(): string {
return $this->message;
}
public function getKind(): string {
return $this->kind;
}
public function jsonSerialize() {
return ["error" => $this->kind, "message" => $this->message];
}
public static function notFound(string $message): ValidationFail {
return new ValidationFail("not found", $message);
}
}