diff options
author | msquare <msquare@notrademark.de> | 2016-11-18 08:20:17 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2016-11-18 08:20:17 +0100 |
commit | bd54bec595609f3502004163d41c555bfd79672d (patch) | |
tree | a9eb2494a39ef91f07a774f06868c75a72d21ba1 | |
parent | 356cc9e1d0e01bad88cb29f3b143e4ae7156695b (diff) |
add ValidationResult to namespace
-rw-r--r-- | includes/engelsystem_provider.php | 1 | ||||
-rw-r--r-- | includes/model/AngelType_model.php | 1 | ||||
-rw-r--r-- | includes/model/User_model.php | 1 | ||||
-rw-r--r-- | includes/model/ValidationResult.php | 42 | ||||
-rw-r--r-- | includes/sys_page.php | 35 |
5 files changed, 46 insertions, 34 deletions
diff --git a/includes/engelsystem_provider.php b/includes/engelsystem_provider.php index fb3c0f18..595af9f9 100644 --- a/includes/engelsystem_provider.php +++ b/includes/engelsystem_provider.php @@ -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'); diff --git a/includes/model/AngelType_model.php b/includes/model/AngelType_model.php index 86d64504..34da4db7 100644 --- a/includes/model/AngelType_model.php +++ b/includes/model/AngelType_model.php @@ -1,4 +1,5 @@ <?php +use Engelsystem\ValidationResult; /** * Returns an array containing the basic attributes of angeltypes. diff --git a/includes/model/User_model.php b/includes/model/User_model.php index c1376abd..13695821 100644 --- a/includes/model/User_model.php +++ b/includes/model/User_model.php @@ -1,4 +1,5 @@ <?php +use Engelsystem\ValidationResult; /** * User model diff --git a/includes/model/ValidationResult.php b/includes/model/ValidationResult.php new file mode 100644 index 00000000..0fc24161 --- /dev/null +++ b/includes/model/ValidationResult.php @@ -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; + } +} +?>
\ No newline at end of file diff --git a/includes/sys_page.php b/includes/sys_page.php index ad4d15de..8eb32962 100644 --- a/includes/sys_page.php +++ b/includes/sys_page.php @@ -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; - } -} - ?> |