Laravel version update
Laravel version update
This commit is contained in:
@@ -22,7 +22,6 @@ The following validators come with the zend-validator distribution.
|
||||
- [IsInstanceOf](validators/isinstanceof.md)
|
||||
- [LessThan](validators/less-than.md)
|
||||
- [NotEmpty](validators/not-empty.md)
|
||||
- [PostCode](validators/post-code.md)
|
||||
- [Regex](validators/regex.md)
|
||||
- [Sitemap](validators/sitemap.md)
|
||||
- [Step](validators/step.md)
|
||||
|
@@ -33,6 +33,7 @@ The following issuing institutes are accepted:
|
||||
- Solo
|
||||
- Visa
|
||||
- Visa Electron
|
||||
- Russia Mir
|
||||
|
||||
> ### Invalid institutes
|
||||
>
|
||||
|
@@ -25,7 +25,7 @@ $validator->isValid('10.10.2000'); // returns false
|
||||
|
||||
`Zend\Validator\Date` also supports custom date formats. When you want to
|
||||
validate such a date, use the `format` option. This option accepts any format
|
||||
allowed by the PHP [date()](http://php.net/date) function.
|
||||
allowed by the PHP [DateTime::createFromFormat()](http://php.net/manual/en/datetime.createfromformat.php#refsect1-datetime.createfromformat-parameters) method.
|
||||
|
||||
```php
|
||||
$validator = new Zend\Validator\Date(['format' => 'Y']);
|
||||
|
@@ -31,21 +31,26 @@ at instantiation, by giving an array with the related options, or afterwards, by
|
||||
using `setOptions()`. The following options are supported:
|
||||
|
||||
- `allow`: Defines which type of domain names are accepted. This option is used
|
||||
in conjunction with the hostname option to set the hostname validator. For
|
||||
more information about possible values of this option, look at
|
||||
[Hostname](hostname.md) and possible `ALLOW_*` constants. This option
|
||||
defaults to `ALLOW_DNS`.
|
||||
- `deep`: Defines if the servers MX records should be verified by a deep check.
|
||||
in conjunction with the hostnameValidator option to set the hostname validator.
|
||||
Possible values of this option defined in [Hostname](hostname.md) validator's
|
||||
`ALLOW_*` constants:
|
||||
- `ALLOW_DNS` (default) - Allows Internet domain names _(e.g. example.com)_
|
||||
- `ALLOW_IP` - Allows IP addresses _(e.g. 192.168.0.1)_
|
||||
- `ALLOW_LOCAL` - Allows local network such as _localhost_ or _www.localdomain_
|
||||
- `ALLOW_URI` - Allows hostnames in URI generic syntax. See [RFC 3986](https://www.ietf.org/rfc/rfc3986.txt)
|
||||
- `ALLOW_ALL` - Allows all types of hostnames
|
||||
|
||||
- `useDeepMxCheck`: Defines if the servers MX records should be verified by a deep check.
|
||||
When this option is set to `true` then additionally to MX records also the `A`,
|
||||
`A6` and `AAAA` records are used to verify if the server accepts emails. This
|
||||
option defaults to `false`.
|
||||
- `domain`: Defines if the domain part should be checked. When this option is
|
||||
- `useDomainCheck`: Defines if the domain part should be checked. When this option is
|
||||
set to `false`, then only the local part of the email address will be checked.
|
||||
In this case the hostname validator will not be called. This option defaults
|
||||
to `true`.
|
||||
- `hostname`: Sets the hostname validator with which the domain part of the
|
||||
email address will be validated.
|
||||
- `mx`: Defines if the MX records from the server should be detected. If this
|
||||
- `hostnameValidator`: Sets the hostname validator object instance with which the
|
||||
domain part of the email address will be validated.
|
||||
- `useMxCheck`: Defines if the MX records from the server should be detected. If this
|
||||
option is defined to `true` then the MX records are used to verify if the
|
||||
server accepts emails. This option defaults to `false`.
|
||||
|
||||
|
48
vendor/zendframework/zend-validator/doc/book/validators/explode.md
vendored
Normal file
48
vendor/zendframework/zend-validator/doc/book/validators/explode.md
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
# Explode Validator
|
||||
|
||||
`Zend\Validator\Explode` executes a validator for each item exploded from an
|
||||
array.
|
||||
|
||||
## Supported options
|
||||
|
||||
The following options are supported for `Zend\Validator\Explode`:
|
||||
|
||||
- `valueDelimiter`: Defines the delimiter used to explode values from an array.
|
||||
It defaults to `,`. If the given value is an array, this option isn't used.
|
||||
- `validator`: Sets the validator that will be executed on each exploded item.
|
||||
This may be a validator instance, or a validator service name.
|
||||
|
||||
## Basic usage
|
||||
|
||||
To validate if every item in an array is in a specified haystack:
|
||||
|
||||
```php
|
||||
$inArrayValidator = new Zend\Validator\InArray([
|
||||
'haystack' => [1, 2, 3, 4, 5, 6],
|
||||
]);
|
||||
|
||||
$explodeValidator = new Zend\Validator\Explode([
|
||||
'validator' => $inArrayValidator
|
||||
]);
|
||||
|
||||
$explodeValidator->isValid([1, 4, 6]); // returns true
|
||||
$explodeValidator->isValid([1, 4, 6, 8]); // returns false
|
||||
```
|
||||
|
||||
## Exploding strings
|
||||
|
||||
To validate if every e-mail in a string is contained in a list of names:
|
||||
|
||||
```php
|
||||
$inEmailListValidator = new Zend\Validator\InArray([
|
||||
'haystack' => ['joseph@test.com', 'mark@test.com', 'lucia@test.com'],
|
||||
]);
|
||||
|
||||
$explodeValidator = new Zend\Validator\Explode([
|
||||
'validator' => $inEmailListValidator,
|
||||
'valueDelimiter' => ','
|
||||
]);
|
||||
|
||||
$explodeValidator->isValid('joseph@test.com,mark@test.com'); // returns true
|
||||
$explodeValidator->isValid('lucia@test.com,maria@test.com'); // returns false
|
||||
```
|
@@ -24,7 +24,7 @@ The following options are supported:
|
||||
$validator = new \Zend\Validator\File\Crc32('3b3652f');
|
||||
|
||||
// Or, check file against multiple hashes
|
||||
$validator = new \Zend\Validator\File\Crc32(array('3b3652f', 'e612b69'));
|
||||
$validator = new \Zend\Validator\File\Crc32(['3b3652f', 'e612b69']);
|
||||
|
||||
// Perform validation with file path
|
||||
if ($validator->isValid('./myfile.txt')) {
|
||||
|
@@ -68,7 +68,7 @@ $form->add([
|
||||
$form->add([
|
||||
'name' => 'elementTwo',
|
||||
'type' => 'Password',
|
||||
'validators' => array(
|
||||
'validators' => [
|
||||
[
|
||||
'name' => 'Identical',
|
||||
'options' => [
|
||||
@@ -136,7 +136,7 @@ $inputFilter = new InputFilter();
|
||||
$inputFilter->add([
|
||||
'name' => 'confirmEmail', // references (5)
|
||||
'validators' => [
|
||||
array(
|
||||
[
|
||||
'name' => 'Identical',
|
||||
'options' => [
|
||||
// 'user' key references 'user' fieldset (1), and 'email'
|
||||
@@ -162,7 +162,7 @@ $inputFilter->add([
|
||||
// 'deeperFieldsetInput' element (4)
|
||||
'deeperFieldset' => 'deeperFieldsetInput',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@@ -7,8 +7,8 @@ within an array. It is also able to validate multidimensional arrays.
|
||||
|
||||
The following options are supported for `Zend\Validator\InArray`:
|
||||
|
||||
- `haystack`: Sets the haystack for the validation. `recursive`: Defines if the
|
||||
- validation should be done recursively. This option
|
||||
- `haystack`: Sets the haystack for the validation.
|
||||
- `recursive`: Defines if the validation should be done recursively. This option
|
||||
defaults to `false`.
|
||||
- `strict`: Three modes of comparison are offered owing to an often overlooked,
|
||||
and potentially dangerous security issue when validating string input from
|
||||
@@ -35,7 +35,7 @@ Basic usage is to provide an array during instantiation:
|
||||
|
||||
```php
|
||||
$validator = new Zend\Validator\InArray([
|
||||
'haystack' => ['value1', 'value2',...'valueN']
|
||||
'haystack' => ['value1', 'value2',...'valueN'],
|
||||
]);
|
||||
|
||||
if ($validator->isValid('value')) {
|
||||
@@ -83,7 +83,7 @@ It's possible to set the strict mode at initialisation and afterwards with the
|
||||
```php
|
||||
// defaults to InArray::COMPARE_NOT_STRICT_AND_PREVENT_STR_TO_INT_VULNERABILITY
|
||||
$validator = new Zend\Validator\InArray([
|
||||
'haystack' => array('value1', 'value2', /* ... */ 'valueN'),
|
||||
'haystack' => ['value1', 'value2', /* ... */ 'valueN'],
|
||||
]);
|
||||
|
||||
// set strict mode
|
||||
@@ -118,7 +118,7 @@ To validate multidimensional arrays you have to set the `recursive` option.
|
||||
|
||||
```php
|
||||
$validator = new Zend\Validator\InArray([
|
||||
'haystack' => array(
|
||||
'haystack' => [
|
||||
'firstDimension' => ['value1', 'value2', / ... */ 'valueN'],
|
||||
'secondDimension' => ['foo1', 'foo2', /* ... */ 'fooN'],
|
||||
],
|
||||
|
107
vendor/zendframework/zend-validator/doc/book/validators/is-countable.md
vendored
Normal file
107
vendor/zendframework/zend-validator/doc/book/validators/is-countable.md
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
# IsCountable Validator
|
||||
|
||||
- **Since 2.10.0**
|
||||
|
||||
`Zend\Validator\IsCountable` allows you to validate that a value can be counted
|
||||
(i.e., it's an array or implements `Countable`), and, optionally:
|
||||
|
||||
- the exact count of the value
|
||||
- the minimum count of the value
|
||||
- the maximum count of the value
|
||||
|
||||
Specifying either of the latter two is inconsistent with the first, and, as
|
||||
such, the validator does not allow setting both a count and a minimum or maximum
|
||||
value. You may, however specify both minimum and maximum values, in which case
|
||||
the validator operates similar to the [Between validator](between.md).
|
||||
|
||||
## Supported options
|
||||
|
||||
The following options are supported for `Zend\Validator\IsCountable`:
|
||||
|
||||
- `count`: Defines if the validation should look for a specific, exact count for
|
||||
the value provided.
|
||||
- `max`: Sets the maximum value for the validation; if the count of the value is
|
||||
greater than the maximum, validation fails..
|
||||
- `min`: Sets the minimum value for the validation; if the count of the value is
|
||||
lower than the minimum, validation fails.
|
||||
|
||||
## Default behaviour
|
||||
|
||||
Given no options, the validator simply tests to see that the value may be
|
||||
counted (i.e., it's an array or `Countable` instance):
|
||||
|
||||
```php
|
||||
$validator = new Zend\Validator\IsCountable();
|
||||
|
||||
$validator->isValid(10); // false; not an array or Countable
|
||||
$validator->isValid([10]); // true; value is an array
|
||||
$validator->isValid(new ArrayObject([10])); // true; value is Countable
|
||||
$validator->isValid(new stdClass); // false; value is not Countable
|
||||
```
|
||||
|
||||
## Specifying an exact count
|
||||
|
||||
You can also specify an exact count; if the value is countable, and its count
|
||||
matches, the the value is valid.
|
||||
|
||||
```php
|
||||
$validator = new Zend\Validator\IsCountable(['count' => 3]);
|
||||
|
||||
$validator->isValid([1, 2, 3]); // true; countable, and count is 3
|
||||
$validator->isValid(new ArrayObject([1, 2, 3])); // true; countable, and count is 3
|
||||
$validator->isValid([1]); // false; countable, but count is 1
|
||||
$validator->isValid(new ArrayObject([1])); // false; countable, but count is 1
|
||||
```
|
||||
|
||||
## Specifying a minimum count
|
||||
|
||||
You may specify a minimum count. When you do, the value must be countable, and
|
||||
greater than or equal to the minimum count you specify in order to be valid.
|
||||
|
||||
```php
|
||||
$validator = new Zend\Validator\IsCountable(['min' => 2]);
|
||||
|
||||
$validator->isValid([1, 2, 3]); // true; countable, and count is 3
|
||||
$validator->isValid(new ArrayObject([1, 2, 3])); // true; countable, and count is 3
|
||||
$validator->isValid([1, 2]); // true; countable, and count is 2
|
||||
$validator->isValid(new ArrayObject([1, 2])); // true; countable, and count is 2
|
||||
$validator->isValid([1]); // false; countable, but count is 1
|
||||
$validator->isValid(new ArrayObject([1])); // false; countable, but count is 1
|
||||
```
|
||||
|
||||
## Specifying a maximum count
|
||||
|
||||
You may specify a maximum count. When you do, the value must be countable, and
|
||||
less than or equal to the maximum count you specify in order to be valid.
|
||||
|
||||
```php
|
||||
$validator = new Zend\Validator\IsCountable(['max' => 2]);
|
||||
|
||||
$validator->isValid([1, 2, 3]); // false; countable, but count is 3
|
||||
$validator->isValid(new ArrayObject([1, 2, 3])); // false; countable, but count is 3
|
||||
$validator->isValid([1, 2]); // true; countable, and count is 2
|
||||
$validator->isValid(new ArrayObject([1, 2])); // true; countable, and count is 2
|
||||
$validator->isValid([1]); // true; countable, and count is 1
|
||||
$validator->isValid(new ArrayObject([1])); // true; countable, and count is 1
|
||||
```
|
||||
|
||||
## Specifying both minimum and maximum
|
||||
|
||||
If you specify both a minimum and maximum, the count must be _between_ the two,
|
||||
inclusively (i.e., it may be the minimum or maximum, and any value between).
|
||||
|
||||
```php
|
||||
$validator = new Zend\Validator\IsCountable([
|
||||
'min' => 3,
|
||||
'max' => 5,
|
||||
]);
|
||||
|
||||
$validator->isValid([1, 2, 3]); // true; countable, and count is 3
|
||||
$validator->isValid(new ArrayObject([1, 2, 3])); // true; countable, and count is 3
|
||||
$validator->isValid(range(1, 5)); // true; countable, and count is 5
|
||||
$validator->isValid(new ArrayObject(range(1, 5))); // true; countable, and count is 5
|
||||
$validator->isValid([1, 2]); // false; countable, and count is 2
|
||||
$validator->isValid(new ArrayObject([1, 2])); // false; countable, and count is 2
|
||||
$validator->isValid(range(1, 6)); // false; countable, and count is 6
|
||||
$validator->isValid(new ArrayObject(range(1, 6))); // false; countable, and count is 6
|
||||
```
|
@@ -67,7 +67,7 @@ use Zend\Validator\NotEmpty;
|
||||
$validator = new NotEmpty(NotEmpty::INTEGER);
|
||||
|
||||
// Returns false on 0 or '0'
|
||||
$validator = new NotEmpty( NotEmpty::INTEGER + NotEmpty::ZERO);
|
||||
$validator = new NotEmpty( NotEmpty::INTEGER | NotEmpty::ZERO);
|
||||
|
||||
// Returns false on 0 or '0'
|
||||
$validator = new NotEmpty([ NotEmpty::INTEGER, NotEmpty::ZERO ]);
|
||||
|
@@ -1,90 +0,0 @@
|
||||
# PostCode Validator
|
||||
|
||||
`Zend\I18n\Validator\PostCode` allows you to determine if a given value is a
|
||||
valid postal code. Postal codes are specific to cities, and in some locales
|
||||
termed ZIP codes.
|
||||
|
||||
`Zend\I18n\Validator\PostCode` knows more than 160 different postal code
|
||||
formats. To select the correct format there are two ways. You can either use a
|
||||
fully qualified locale, or you can set your own format manually.
|
||||
|
||||
## Supported options
|
||||
|
||||
The following options are supported for `Zend\I18n\Validator\PostCode`:
|
||||
|
||||
- `format`: Sets a postcode format which will be used for validation of the
|
||||
input.
|
||||
- `locale`: Sets a locale from which the postcode will be taken from.
|
||||
|
||||
## Usage
|
||||
|
||||
Using a locale is more convenient as zend-validator already knows the
|
||||
appropriate postal code format for each locale; however, you need to use the
|
||||
fully qualified locale (one containing a region specifier) to do so. For
|
||||
instance, the locale `de` is a locale but could not be used with
|
||||
`Zend\I18n\Validator\PostCode` as it does not include the region; `de_AT`,
|
||||
however, would be a valid locale, as it specifies the region code (`AT`, for
|
||||
Austria).
|
||||
|
||||
```php
|
||||
$validator = new Zend\I18n\Validator\PostCode('de_AT');
|
||||
```
|
||||
|
||||
When you don't set a locale yourself, then `Zend\I18n\Validator\PostCode` will
|
||||
use the application wide set locale, or, when there is none, the locale returned
|
||||
by `Locale`.
|
||||
|
||||
```php
|
||||
// application wide locale within your bootstrap
|
||||
Locale::setDefault('de_AT');
|
||||
|
||||
$validator = new Zend\I18n\Validator\PostCode();
|
||||
```
|
||||
|
||||
You can also change the locale afterwards by calling `setLocale()`. And of
|
||||
course you can get the actual used locale by calling `getLocale()`.
|
||||
|
||||
```php
|
||||
$validator = new Zend\I18n\Validator\PostCode('de_AT');
|
||||
$validator->setLocale('en_GB');
|
||||
```
|
||||
|
||||
Postal code formats are regular expression strings. When the international
|
||||
postal code format, which is used by setting the locale, does not fit your
|
||||
needs, then you can also manually set a format by calling `setFormat()`.
|
||||
|
||||
```php
|
||||
$validator = new Zend\I18n\Validator\PostCode('de_AT');
|
||||
$validator->setFormat('AT-\d{5}');
|
||||
```
|
||||
|
||||
> ### Conventions for self defined formats
|
||||
>
|
||||
> When using self defined formats, you should omit the regex delimiters and
|
||||
> anchors (`'/^'` and `'$/'`). They are attached automatically.
|
||||
>
|
||||
> You should also be aware that postcode values are always be validated in a
|
||||
> strict way. This means that they have to be written standalone without
|
||||
> additional characters when they are not covered by the format.
|
||||
|
||||
## Constructor options
|
||||
|
||||
At its most basic, you may pass a string representing a fully qualified locale
|
||||
to the constructor of `Zend\I18n\Validator\PostCode`.
|
||||
|
||||
```php
|
||||
$validator = new Zend\I18n\Validator\PostCode('de_AT');
|
||||
$validator = new Zend\I18n\Validator\PostCode($locale);
|
||||
```
|
||||
|
||||
Additionally, you may pass either an array or a `Traversable` instance to the
|
||||
constructor. When you do so, you must include either the key `locale` or
|
||||
`format`; these will be used to set the appropriate values in the validator
|
||||
object.
|
||||
|
||||
```php
|
||||
$validator = new Zend\I18n\Validator\PostCode([
|
||||
'locale' => 'de_AT',
|
||||
'format' => 'AT_\d+'
|
||||
]);
|
||||
```
|
@@ -15,11 +15,12 @@ The following options are supported for `Zend\Validator\StringLength`:
|
||||
- `encoding`: Sets the `ICONV` encoding to use with the string.
|
||||
- `min`: Sets the minimum allowed length for a string.
|
||||
- `max`: Sets the maximum allowed length for a string.
|
||||
- `length`: Holds the actual length of the string.
|
||||
|
||||
## Default behaviour
|
||||
|
||||
By default, this validator checks if a value is between `min` and `max` using a
|
||||
default`min` value of `0` and default `max` value of `NULL` (meaning unlimited).
|
||||
default `min` value of `0` and default `max` value of `NULL` (meaning unlimited).
|
||||
|
||||
As such, without any options, the validator only checks that the input is a
|
||||
string.
|
||||
@@ -116,3 +117,11 @@ $validator2->isValid("Ärger"); // returns true
|
||||
|
||||
When your installation and your application are using different encodings, then
|
||||
you should always set an encoding manually.
|
||||
|
||||
## Validation Messages
|
||||
Using the setMessage() method you can set another message to be returned in case of the specified failure.
|
||||
|
||||
```php
|
||||
$validator = new Zend\Validator\StringLength(['min' => 3, 'max' => 30]);
|
||||
$validator->setMessage('Youre string is too long. You typed '%length%' chars.', Zend\Validator\StringLength::TOO_LONG);
|
||||
```
|
||||
|
@@ -76,7 +76,7 @@ message template.
|
||||
The following example demonstrates a more complex set of validation rules:
|
||||
|
||||
- The input must be numeric.
|
||||
- The input must fall within a range of bouncary values.
|
||||
- The input must fall within a range of boundary values.
|
||||
|
||||
An input value would fail validation for exactly one of the following reasons:
|
||||
|
||||
|
Reference in New Issue
Block a user