OpenXE/classes/Modules/MandatoryFields/Data/ValidatorResultData.php

52 lines
884 B
PHP
Raw Normal View History

2021-05-21 08:49:41 +02:00
<?php
declare(strict_types=1);
namespace Xentral\Modules\MandatoryFields\Data;
final class ValidatorResultData
{
/** @var bool $isError */
private $isError;
/** @var string $message */
private $message;
/**
* @param bool $isError
* @param string $message
*/
public function __construct(bool $isError, string $message)
{
$this->isError = $isError;
$this->message = $message;
}
/**
* @return bool
*/
public function isError(): bool
{
return $this->isError;
}
/**
* @return string
*/
public function getMessage(): string
{
return $this->message;
}
/**
* @return array
*/
public function toArray(): array
{
return [
'error' => $this->isError,
'message' => $this->message,
];
}
}