add ValidationResult to namespace
This commit is contained in:
parent
356cc9e1d0
commit
bd54bec595
|
@ -26,6 +26,7 @@ require_once realpath(__DIR__ . '/../includes/model/UserAngelTypes_model.php');
|
|||
require_once realpath(__DIR__ . '/../includes/model/UserDriverLicenses_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/UserGroups_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/User_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/ValidationResult.php');
|
||||
|
||||
require_once realpath(__DIR__ . '/../includes/view/AngelTypes_view.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/EventConfig_view.php');
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
use Engelsystem\ValidationResult;
|
||||
|
||||
/**
|
||||
* Returns an array containing the basic attributes of angeltypes.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
use Engelsystem\ValidationResult;
|
||||
|
||||
/**
|
||||
* User model
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem;
|
||||
|
||||
/**
|
||||
* BO that represents the result of an entity attribute validation.
|
||||
* It contains the validated value and a bool for validation success.
|
||||
*/
|
||||
class ValidationResult {
|
||||
|
||||
private $valid;
|
||||
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param boolean $valid
|
||||
* Is the value valid?
|
||||
* @param * $value
|
||||
* The validated value
|
||||
*/
|
||||
public function __construct($valid, $value) {
|
||||
$this->valid = $valid;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the value valid?
|
||||
*/
|
||||
public function isValid() {
|
||||
return $this->valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* The parsed/validated value.
|
||||
*/
|
||||
public function getValue() {
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
use Engelsystem\ValidationResult;
|
||||
|
||||
/**
|
||||
* Provide page/request helper functions
|
||||
|
@ -187,38 +188,4 @@ function check_email($email) {
|
|||
return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
|
||||
}
|
||||
|
||||
class ValidationResult {
|
||||
|
||||
private $valid;
|
||||
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param boolean $valid
|
||||
* Is the value valid?
|
||||
* @param * $value
|
||||
* The validated value
|
||||
*/
|
||||
public function ValidationResult($valid, $value) {
|
||||
$this->valid = $valid;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the value valid?
|
||||
*/
|
||||
public function isValid() {
|
||||
return $this->valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* The parsed/validated value.
|
||||
*/
|
||||
public function getValue() {
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue