Skip to content

Commit

Permalink
version 0.12.0 released
Browse files Browse the repository at this point in the history
  • Loading branch information
philiplb committed Sep 9, 2019
1 parent e60a103 commit a86e53b
Show file tree
Hide file tree
Showing 140 changed files with 34,808 additions and 7 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
Valdi Changelog
===============

## 0.12.0
## 1.0.0

Released: Upcoming

## 0.12.0

Released: 2019-09-09

- Attention: Renamed the RuleBuilder function "addFieldRule" to "field"
- Attention: Renamed the RuleBuilder function "addRule" to "rule"
- Added examples to all validators to the manual

## 0.11.0

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Find out more and get started with the [documentation](https://philiplb.github.i

The documentation is available for each version:

* [0.12.0](https://philiplb.github.io/Valdi/docs/html/0.12.0) (Upcoming)
* [1.0.0](https://philiplb.github.io/Valdi/docs/html/1.0.0) (Upcoming)
* [0.12.0](https://philiplb.github.io/Valdi/docs/html/0.12.0)
* [0.11.0](https://philiplb.github.io/Valdi/docs/html/0.11.0)
* [0.10.0](https://philiplb.github.io/Valdi/docs/html/0.10.0)
* [0.9.0](https://philiplb.github.io/Valdi/docs/html/0.9.0)
Expand All @@ -36,15 +37,15 @@ The documentation is available for each version:

```json
"require": {
"philiplb/valdi": "0.11.0"
"philiplb/valdi": "0.12.0"
}
```

### Bleeding Edge

```json
"require": {
"philiplb/valdi": "0.12.x-dev"
"philiplb/valdi": "1.0.x-dev"
}
```

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.12.x-dev"
"dev-master": "1.0.x-dev"
}
}
}
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
# built documents.
#
# The short X.Y version.
version = u'0.12.0'
version = u'1.0.0'
# The full version, including alpha/beta/rc tags.
release = u'0.12.0'
release = u'1.0.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 4 additions & 0 deletions docs/html/1.0.0/.buildinfo
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
60 changes: 60 additions & 0 deletions docs/html/1.0.0/_sources/api/RulesBuilder.rst.txt
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
51 changes: 51 additions & 0 deletions docs/html/1.0.0/_sources/api/ValidationException.rst.txt
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()
68 changes: 68 additions & 0 deletions docs/html/1.0.0/_sources/api/Validator.rst.txt
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 docs/html/1.0.0/_sources/api/Validator/AbstractArray.rst.txt
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 docs/html/1.0.0/_sources/api/Validator/AbstractComparator.rst.txt
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
Loading

0 comments on commit a86e53b

Please sign in to comment.