-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b4fabe
commit 193075a
Showing
1 changed file
with
1 addition
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,21 +9,14 @@ | |
use ValueValidators\ValueValidator; | ||
|
||
/** | ||
* ValueValidator that holds base validation functions for any type of object. | ||
* | ||
* @since 0.1 | ||
* | ||
* @license GPL-2.0+ | ||
* @author Jeroen De Dauw < [email protected] > | ||
* @internal | ||
*/ | ||
abstract class ValueValidatorBase implements ValueValidator { | ||
|
||
/** | ||
* A list of allowed values. This means the parameters value(s) must be in the list | ||
* during validation. False for no restriction. | ||
* | ||
* @since 0.1 | ||
* | ||
* @var array|false | ||
*/ | ||
protected $allowedValues = false; | ||
|
@@ -32,22 +25,16 @@ abstract class ValueValidatorBase implements ValueValidator { | |
* A list of prohibited values. This means the parameters value(s) must | ||
* not be in the list during validation. False for no restriction. | ||
* | ||
* @since 0.1 | ||
* | ||
* @var array|false | ||
*/ | ||
protected $prohibitedValues = false; | ||
|
||
/** | ||
* @since 0.1 | ||
* | ||
* @var array | ||
*/ | ||
protected $options = []; | ||
|
||
/** | ||
* @since 0.1 | ||
* | ||
* @var Error[] | ||
*/ | ||
protected $errors = []; | ||
|
@@ -78,8 +65,6 @@ final public function validate( $value ) { | |
/** | ||
* Checks the value against the allowed values and prohibited values lists in case they are set. | ||
* | ||
* @since 0.1 | ||
* | ||
* @param mixed $value | ||
*/ | ||
protected function valueIsAllowed( $value ) { | ||
|
@@ -95,8 +80,6 @@ protected function valueIsAllowed( $value ) { | |
/** | ||
* @see ValueValidator::validate | ||
* | ||
* @since 0.1 | ||
* | ||
* @param mixed $value | ||
*/ | ||
abstract public function doValidation( $value ); | ||
|
@@ -124,8 +107,6 @@ public function setOptions( array $param ) { | |
/** | ||
* Registers an error message. | ||
* | ||
* @since 0.1 | ||
* | ||
* @param string $errorMessage | ||
*/ | ||
protected function addErrorMessage( $errorMessage ) { | ||
|
@@ -135,8 +116,6 @@ protected function addErrorMessage( $errorMessage ) { | |
/** | ||
* Registers an error. | ||
* | ||
* @since 0.1 | ||
* | ||
* @param Error $error | ||
*/ | ||
protected function addError( Error $error ) { | ||
|
@@ -146,8 +125,6 @@ protected function addError( Error $error ) { | |
/** | ||
* Registers a list of errors. | ||
* | ||
* @since 0.1 | ||
* | ||
* @param Error[] $errors | ||
*/ | ||
protected function addErrors( array $errors ) { | ||
|
@@ -160,8 +137,6 @@ protected function addErrors( array $errors ) { | |
* the $optionMap parameter in which keys are source names and values are target | ||
* names. | ||
* | ||
* @since 0.1 | ||
* | ||
* @param mixed $value | ||
* @param ValueValidator $validator | ||
* @param string|null $property | ||
|
@@ -196,8 +171,6 @@ protected function runSubValidator( | |
/** | ||
* If the "values" and "excluding" arguments should be held into account. | ||
* | ||
* @since 0.1 | ||
* | ||
* @return bool | ||
*/ | ||
protected function enableWhitelistRestrictions() { | ||
|
@@ -210,8 +183,6 @@ protected function enableWhitelistRestrictions() { | |
* TODO: think about how to access set options in general and if we want to have | ||
* whitelist and baclklist values in the validator objects to begin with. | ||
* | ||
* @since 0.1 | ||
* | ||
* @return array|bool false | ||
*/ | ||
public function getWhitelistedValues() { | ||
|