2016-11-18 08:20:17 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Engelsystem;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* BO that represents the result of an entity attribute validation.
|
|
|
|
* It contains the validated value and a bool for validation success.
|
|
|
|
*/
|
2017-01-02 03:57:23 +01:00
|
|
|
class ValidationResult
|
|
|
|
{
|
2017-01-03 03:22:48 +01:00
|
|
|
/** @var bool */
|
2017-01-02 03:57:23 +01:00
|
|
|
private $valid;
|
2016-11-18 08:20:17 +01:00
|
|
|
|
2017-01-03 03:22:48 +01:00
|
|
|
/** @var mixed */
|
2017-01-02 03:57:23 +01:00
|
|
|
private $value;
|
2016-11-18 08:20:17 +01:00
|
|
|
|
2017-01-02 15:43:36 +01:00
|
|
|
/**
|
2017-01-03 03:22:48 +01:00
|
|
|
* @param boolean $valid Is the value valid?
|
|
|
|
* @param mixed $value The validated value
|
2017-01-02 15:43:36 +01:00
|
|
|
*/
|
|
|
|
public function __construct($valid, $value)
|
|
|
|
{
|
|
|
|
$this->valid = $valid;
|
|
|
|
$this->value = $value;
|
|
|
|
}
|
2016-11-18 08:20:17 +01:00
|
|
|
|
2017-01-02 15:43:36 +01:00
|
|
|
/**
|
|
|
|
* Is the value valid?
|
2017-01-03 03:22:48 +01:00
|
|
|
*
|
|
|
|
* @return bool
|
2017-01-02 15:43:36 +01:00
|
|
|
*/
|
|
|
|
public function isValid()
|
|
|
|
{
|
|
|
|
return $this->valid;
|
|
|
|
}
|
2016-11-18 08:20:17 +01:00
|
|
|
|
2017-01-02 15:43:36 +01:00
|
|
|
/**
|
|
|
|
* The parsed/validated value.
|
2017-01-03 03:22:48 +01:00
|
|
|
*
|
|
|
|
* @return mixed
|
2017-01-02 15:43:36 +01:00
|
|
|
*/
|
|
|
|
public function getValue()
|
|
|
|
{
|
|
|
|
return $this->value;
|
|
|
|
}
|
2016-11-18 08:20:17 +01:00
|
|
|
}
|