-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
140 changed files
with
34,808 additions
and
7 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
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
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 |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "0.12.x-dev" | ||
"dev-master": "1.0.x-dev" | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 6b8330517020d0894d0dfc402ed87a1b | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
------------------- | ||
Valdi\\RulesBuilder | ||
------------------- | ||
|
||
.. php:namespace: Valdi | ||
.. php:class:: RulesBuilder | ||
To ease the building of the rules array. | ||
|
||
.. php:attr:: rules | ||
protected | ||
|
||
Holds the rules under construction. | ||
|
||
.. php:method:: create() | ||
Creates and returns an instance. | ||
|
||
:returns: RulesBuilder the new instance | ||
|
||
.. php:method:: __construct() | ||
Constructor. | ||
|
||
.. php:method:: addFieldRule($field, $rule) | ||
Adds a rule for a field to the set. This function takes a variable amount | ||
of parameters in order to cover the rule parameters. Example for a rule | ||
without parameter: | ||
addFieldRule('myField', 'required') | ||
Example for a rule with two parameters: | ||
addFieldRule('myField', 'between', 3, 7) | ||
|
||
:type $field: string | ||
:param $field: the field for the rule | ||
:type $rule: string | ||
:param $rule: the rule to add | ||
:returns: RulesBuilder the instance of the called RulesBuilder in order to chain the rules creation | ||
|
||
.. php:method:: addRule($rule) | ||
Adds a rule to the set. This function takes a variable amount | ||
of parameters in order to cover the rule parameters. Example for a rule | ||
without parameter: | ||
addRule('required') | ||
Example for a rule with two parameters: | ||
addRule('between', 3, 7) | ||
|
||
:type $rule: string | ||
:param $rule: the rule to add | ||
:returns: RulesBuilder the instance of the called RulesBuilder in order to chain the rules creation | ||
|
||
.. php:method:: build() | ||
Gets the created rules. Afterwards, the RulesBuilder is emptied and ready | ||
to be used again. | ||
|
||
:returns: array the created rules |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
-------------------------- | ||
Valdi\\ValidationException | ||
-------------------------- | ||
|
||
.. php:namespace: Valdi | ||
.. php:class:: ValidationException | ||
Exception for failures within a validator. | ||
|
||
.. php:attr:: message | ||
protected | ||
|
||
.. php:attr:: code | ||
protected | ||
|
||
.. php:attr:: file | ||
protected | ||
|
||
.. php:attr:: line | ||
protected | ||
|
||
.. php:method:: __clone() | ||
.. php:method:: __construct($message, $code, $previous) | ||
:param $message: | ||
:param $code: | ||
:param $previous: | ||
|
||
.. php:method:: __wakeup() | ||
.. php:method:: getMessage() | ||
.. php:method:: getCode() | ||
.. php:method:: getFile() | ||
.. php:method:: getLine() | ||
.. php:method:: getTrace() | ||
.. php:method:: getPrevious() | ||
.. php:method:: getTraceAsString() | ||
.. php:method:: __toString() |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
---------------- | ||
Valdi\\Validator | ||
---------------- | ||
|
||
.. php:namespace: Valdi | ||
.. php:class:: Validator | ||
The Validator is used to chain Validators together and validate a set of data | ||
with it. | ||
|
||
.. php:attr:: availableValidators | ||
protected | ||
|
||
Holds the available validators. | ||
|
||
.. php:method:: createValidators($validators) | ||
Creates instances of the available validators. | ||
|
||
:type $validators: array | ||
:param $validators: the validators to load, key = name, value = classname within the namespace "\Valdi\Validator" | ||
|
||
.. php:method:: isValidRule($validator, $parameters, $value) | ||
Validates a single rule. | ||
|
||
:type $validator: string | ||
:param $validator: the validator to use | ||
:type $parameters: string[] | ||
:param $parameters: the validation parameters, depending on the validator | ||
:type $value: string | ||
:param $value: the value to validate | ||
:returns: boolean true if the value is valid | ||
|
||
.. php:method:: __construct() | ||
Constructor. | ||
|
||
.. php:method:: addValidator($name, ValidatorInterface $validator) | ||
Adds additional validator. It can override existing validators as well. | ||
|
||
:type $name: string | ||
:param $name: the name of the new validator. | ||
:type $validator: ValidatorInterface | ||
:param $validator: the validator to add | ||
|
||
.. php:method:: isValidValue($rules, $value) | ||
Validates a value via the given rules. | ||
|
||
:type $rules: array | ||
:param $rules: the validation rules | ||
:type $value: string | ||
:param $value: the value to validate | ||
:returns: string[] the fields where the validation failed | ||
|
||
.. php:method:: isValid($rules, $data) | ||
Performs the actual validation. | ||
|
||
:type $rules: array | ||
:param $rules: the validation rules: an array with a field name as key and an array of rules to use for this field; each rule is an array with the validator name as first element and parameters as following elements; example: array('a' => array(array('required')), 'b' => array(array('min', 1))) | ||
:type $data: array | ||
:param $data: the data to validate as a map | ||
:returns: array<string,boolean|array> the validation result having the keys "valid" (true or false) and the key "errors" containing all failed fields as keys with arrays of the failed validator names; example where the field "b" from the above sample failed due to the min validator: array('valid' => false, errors => array('b' => array('min'))) the "or" validator doesn't return a single string on validation error; instead, it returns an array listing all failed validators of it: array('or' => array('url', 'email') |
45 changes: 45 additions & 0 deletions
45
docs/html/1.0.0/_sources/api/Validator/AbstractArray.rst.txt
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
------------------------------- | ||
Valdi\\Validator\\AbstractArray | ||
------------------------------- | ||
|
||
.. toctree:: | ||
|
||
Collection | ||
Nested | ||
|
||
.. php:namespace: Valdi\\Validator | ||
.. php:class:: AbstractArray | ||
Validator for array data, be it maps or lists. | ||
|
||
.. php:attr:: invalidDetails | ||
protected | ||
|
||
Holds the invalid values. | ||
|
||
.. php:method:: isValidArray($values, Validator $validator, $rules) | ||
Checks whether the given values are of the expected array data. | ||
|
||
:type $values: mixed | ||
:param $values: the potential array values to check | ||
:type $validator: Validator | ||
:param $validator: the validator to check with | ||
:type $rules: array | ||
:param $rules: the rules which the array data must fulfill | ||
:returns: boolean true if all the $values are valid, else false with the invalid details set | ||
|
||
.. php:method:: isValid($value, $parameters) | ||
{@inheritdoc} | ||
|
||
:param $value: | ||
:param $parameters: | ||
|
||
.. php:method:: getInvalidDetails() | ||
Gets the details if the validation failed. | ||
|
||
:returns: mixed the details |
71 changes: 71 additions & 0 deletions
71
docs/html/1.0.0/_sources/api/Validator/AbstractComparator.rst.txt
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
------------------------------------ | ||
Valdi\\Validator\\AbstractComparator | ||
------------------------------------ | ||
|
||
.. toctree:: | ||
|
||
Between | ||
LengthBetween | ||
Max | ||
MaxLength | ||
Min | ||
MinLength | ||
Regexp | ||
Value | ||
|
||
.. php:namespace: Valdi\\Validator | ||
.. php:class:: AbstractComparator | ||
Validator for comparing values. | ||
|
||
.. php:attr:: amountOfParameters | ||
protected | ||
|
||
Holds the amount of parameters. | ||
|
||
.. php:attr:: type | ||
protected | ||
|
||
Holds the type of the validator. | ||
|
||
.. php:method:: isValidComparison($value, $parameters) | ||
Performs the comparison. | ||
|
||
:type $value: mixed | ||
:param $value: the first value to compare | ||
:type $parameters: mixed | ||
:param $parameters: the values to compare | ||
:returns: boolean true if value compares to the parameters | ||
|
||
.. php:method:: isAllNumeric() | ||
Checks whether all given parameters are numeric. | ||
|
||
:returns: boolean true if all values are numeric | ||
|
||
.. php:method:: isValid($value, $parameters) | ||
{@inheritdoc} | ||
|
||
:param $value: | ||
:param $parameters: | ||
|
||
.. php:method:: getInvalidDetails() | ||
{@inheritdoc} | ||
|
||
.. php:method:: validateParameterCount($name, $parameterAmount, $parameters) | ||
Throws an exception if the parameters don't fulfill the expected | ||
parameter count. | ||
|
||
:type $name: string | ||
:param $name: the name of the validator | ||
:type $parameterAmount: integer | ||
:param $parameterAmount: the amount of expected parameters | ||
:type $parameters: string[] | ||
:param $parameters: the parameters |
Oops, something went wrong.