diff -Nru php-respect-validation-1.1.15/CHANGELOG.md php-respect-validation-1.1.29/CHANGELOG.md --- php-respect-validation-1.1.15/CHANGELOG.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/CHANGELOG.md 2018-11-04 21:58:45.000000000 +0000 @@ -101,8 +101,6 @@ *** See also: +- [README](README.md) - [Contributing](CONTRIBUTING.md) -- [Feature Guide](docs/README.md) -- [Installation](docs/INSTALL.md) - [License](LICENSE.md) -- [Validators](docs/VALIDATORS.md) diff -Nru php-respect-validation-1.1.15/composer.json php-respect-validation-1.1.29/composer.json --- php-respect-validation-1.1.15/composer.json 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/composer.json 2018-11-04 21:58:45.000000000 +0000 @@ -4,7 +4,7 @@ "keywords": ["respect", "validation", "validator"], "type": "library", "homepage": "http://respect.github.io/Validation/", - "license": "BSD Style", + "license": "BSD-3-Clause", "authors": [ { "name": "Respect/Validation Contributors", @@ -16,7 +16,7 @@ "symfony/polyfill-mbstring": "^1.2" }, "require-dev": { - "egulias/email-validator": "~1.2", + "egulias/email-validator": "~1.2 || ~2.1", "mikey179/vfsStream": "^1.5", "phpunit/phpunit": "~4.0", "symfony/validator": "~2.6.9", @@ -28,7 +28,7 @@ "egulias/email-validator": "Strict (RFC compliant) email validation", "symfony/validator": "Use Symfony validator through Respect\\Validation", "zendframework/zend-validator": "Use Zend Framework validator through Respect\\Validation", - "fabpot/php-cs-fixer": "Fix PSR2 and other coding style issues" + "friendsofphp/php-cs-fixer": "Fix PSR2 and other coding style issues" }, "autoload": { "psr-4": { diff -Nru php-respect-validation-1.1.15/CONTRIBUTING.md php-respect-validation-1.1.29/CONTRIBUTING.md --- php-respect-validation-1.1.15/CONTRIBUTING.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/CONTRIBUTING.md 2018-11-04 21:58:45.000000000 +0000 @@ -179,8 +179,8 @@ ## Documentation Our docs at http://respect.github.io/Validation are generated from our Markdown -files using [Couscous][]. Add your brand new rule there and everything will be -updated as soon as possible. +files using [Read the Docs][]. Add your brand new rule there and everything will +be updated automatically. ## Running Tests @@ -234,15 +234,13 @@ *** See also: -- [Feature Guide](docs/README.md) -- [Installation](docs/INSTALL.md) +- [README](README.md) - [License](LICENSE.md) -- [Validators](docs/VALIDATORS.md) - [Changelog](CHANGELOG.md) [ArrayType]: https://github.com/Respect/Validation/commit/f08a1fa -[Couscous]: http://couscous.io/ "Couscous" +[Read the Docs]: https://readthedocs.org/ "Read the Docs" [data provider]: https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers "PHPUnit Data Providers" [open an issue]: http://github.com/Respect/Validation/issues [php-cs-fixer]: https://github.com/FriendsOfPHP/PHP-CS-Fixer "PHP Coding Standard Fixer" diff -Nru php-respect-validation-1.1.15/debian/changelog php-respect-validation-1.1.29/debian/changelog --- php-respect-validation-1.1.15/debian/changelog 2018-05-18 23:58:41.000000000 +0000 +++ php-respect-validation-1.1.29/debian/changelog 2019-01-05 11:05:13.000000000 +0000 @@ -1,3 +1,24 @@ +php-respect-validation (1.1.29-2) unstable; urgency=low + + [ Kunal Mehta ] + * Replace php-symfony-polyfill-mbstring dependency with php-mstring + (Closes: #918310) + + [ Thorsten Glaser ] + * Policy 4.3.0: terse, R³:no + * Bump debhelper to 12, as requested by lintian + * Remove extra licence file + * Add DEP 3 header to the patch added in the previous upload + + -- Thorsten Glaser Sat, 05 Jan 2019 12:05:13 +0100 + +php-respect-validation (1.1.29-1) unstable; urgency=medium + + * New upstream version. + * Bump Standards-Version (no changes needed). + + -- Dominik George Sun, 02 Dec 2018 17:44:28 +0100 + php-respect-validation (1.1.15-1) unstable; urgency=medium * Initial release (Closes: #878879) diff -Nru php-respect-validation-1.1.15/debian/compat php-respect-validation-1.1.29/debian/compat --- php-respect-validation-1.1.15/debian/compat 2018-05-18 23:10:57.000000000 +0000 +++ php-respect-validation-1.1.29/debian/compat 2019-01-05 11:00:23.000000000 +0000 @@ -1 +1 @@ -11 +12 diff -Nru php-respect-validation-1.1.15/debian/control php-respect-validation-1.1.29/debian/control --- php-respect-validation-1.1.15/debian/control 2018-05-18 23:31:06.000000000 +0000 +++ php-respect-validation-1.1.29/debian/control 2019-01-05 11:00:19.000000000 +0000 @@ -3,15 +3,16 @@ Priority: optional Maintainer: Teckids Debian Task Force Uploaders: Thorsten Glaser , Dominik George -Build-Depends: debhelper (>= 11~), pkg-php-tools (>= 1.7~) -Standards-Version: 4.1.4 +Build-Depends: debhelper (>= 12~), pkg-php-tools (>= 1.7~) +Standards-Version: 4.3.0 +Rules-Requires-Root: no Homepage: http://respect.github.io/Validation/ Vcs-Git: https://salsa.debian.org/tdtf-team/php-respect-validation.git Vcs-Browser: https://salsa.debian.org/tdtf-team/php-respect-validation Package: php-respect-validation Architecture: all -Depends: ${misc:Depends}, ${phpcomposer:Debian-require} +Depends: ${misc:Depends}, ${phpcomposer:Debian-require}, php-mbstring Recommends: ${phpcomposer:Debian-recommend} Suggests: ${phpcomposer:Debian-suggest} Replaces: ${phpcomposer:Debian-replace} diff -Nru php-respect-validation-1.1.15/debian/patches/fix-composer-versions.diff php-respect-validation-1.1.29/debian/patches/fix-composer-versions.diff --- php-respect-validation-1.1.15/debian/patches/fix-composer-versions.diff 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/debian/patches/fix-composer-versions.diff 2019-01-05 11:05:11.000000000 +0000 @@ -0,0 +1,14 @@ +Description: Add patch to make composer versions unique +Author: Dominik George + +--- a/composer.json ++++ b/composer.json +@@ -16,7 +16,7 @@ + "symfony/polyfill-mbstring": "^1.2" + }, + "require-dev": { +- "egulias/email-validator": "~1.2 || ~2.1", ++ "egulias/email-validator": "~2.1", + "mikey179/vfsStream": "^1.5", + "phpunit/phpunit": "~4.0", + "symfony/validator": "~2.6.9", diff -Nru php-respect-validation-1.1.15/debian/patches/series php-respect-validation-1.1.29/debian/patches/series --- php-respect-validation-1.1.15/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/debian/patches/series 2019-01-05 10:56:52.000000000 +0000 @@ -0,0 +1 @@ +fix-composer-versions.diff diff -Nru php-respect-validation-1.1.15/debian/pkg-php-tools-overrides php-respect-validation-1.1.29/debian/pkg-php-tools-overrides --- php-respect-validation-1.1.15/debian/pkg-php-tools-overrides 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/debian/pkg-php-tools-overrides 2019-01-05 10:58:13.000000000 +0000 @@ -0,0 +1 @@ +symfony polyfill-mbstring none diff -Nru php-respect-validation-1.1.15/debian/rules php-respect-validation-1.1.29/debian/rules --- php-respect-validation-1.1.15/debian/rules 2018-05-18 23:58:41.000000000 +0000 +++ php-respect-validation-1.1.29/debian/rules 2019-01-05 11:03:46.000000000 +0000 @@ -1,8 +1,18 @@ #!/usr/bin/make -f +ifeq (,$(findstring terse,${DEB_BUILD_OPTIONS})) +export DH_VERBOSE=1 +export V=1 +export VERBOSE=1 +endif + +LC_ALL:=C +export LC_ALL + %: dh $@ --with phpcomposer override_dh_installdocs: dh_installdocs rm -f debian/*/usr/share/doc/php-respect-validation/INSTALL.md + rm -f debian/*/usr/share/doc/php-respect-validation/license.md diff -Nru php-respect-validation-1.1.15/docs/Age.md php-respect-validation-1.1.29/docs/Age.md --- php-respect-validation-1.1.15/docs/Age.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Age.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -# Age - -- `v::age(int $minAge)` -- `v::age(int $minAge, int $maxAge)` -- `v::age(null, int $maxAge)` - -Validates ranges of years. - -The validated values can be any date value; internally they will be transformed -into [DateTime](http://php.net/manual/en/class.datetime.php) objects according -to the defined locale settings. - -The examples below validate if the given dates are lower or equal to 18 years ago: -```php -v::age(18)->validate('17 years ago'); // false -v::age(18)->validate('18 years ago'); // true -v::age(18)->validate('19 years ago'); // true -v::age(18)->validate('1970-01-01'); // true -v::age(18)->validate('today'); // false -``` - -The examples below validate if the given dates are between 10 and 50 years ago: -```php -v::age(10, 50)->validate('9 years ago'); // false -v::age(10, 50)->validate('10 years ago'); // true -v::age(10, 50)->validate('30 years ago'); // true -v::age(10, 50)->validate('50 years ago'); // true -v::age(10, 50)->validate('51 years ago'); // false -``` - -The examples below validate if the given dates are greater than or equal to 70 years ago: -```php -v::age(null, 70)->validate('today'); // true -v::age(null, 70)->validate('70 years ago'); // true -v::age(null, 70)->validate('71 years ago'); // false -``` - -Message template for this validator includes `{{minAge}}` and `{{maxAge}}`. - -*** -See also: - - * [Between](Between.md) - * [Date](Date.md) - * [Max](Max.md) - * [Min](Min.md) diff -Nru php-respect-validation-1.1.15/docs/AllOf.md php-respect-validation-1.1.29/docs/AllOf.md --- php-respect-validation-1.1.15/docs/AllOf.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/AllOf.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -# AllOf - -- `v::allOf(v $v1, v $v2, v $v3...)` - -Will validate if all inner validators validates. - -```php -v::allOf( - v::intVal(), - v::positive() -)->validate(15); // true -``` - -This is similar to the chain (which is an allOf already), but -its syntax allows you to set custom names for every node: - -```php -v::allOf( - v::intVal()->setName('Account Number'), - v::positive()->setName('Higher Than Zero') -)->setName('Positive integer') - ->validate(15); // true -``` - -*** -See also: - - * [OneOf](OneOf.md) - * [NoneOf](NoneOf.md) - * [When](When.md) diff -Nru php-respect-validation-1.1.15/docs/Alnum.md php-respect-validation-1.1.29/docs/Alnum.md --- php-respect-validation-1.1.15/docs/Alnum.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Alnum.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -# Alnum - -- `v::alnum()` -- `v::alnum(string $additionalChars)` - -Validates alphanumeric characters from a-Z and 0-9. - -```php -v::alnum()->validate('foo 123'); // true -``` - -A parameter for extra characters can be used: - -```php -v::alnum('-')->validate('foo - 123'); // true -``` - -This validator allows whitespace, if you want to -remove them add `->noWhitespace()` to the chain: - -```php -v::alnum()->noWhitespace()->validate('foo 123'); // false -``` - -You can restrict case using the `->lowercase()` and -`->uppercase()` validators: - -```php -v::alnum()->uppercase()->validate('aaa'); // false -``` - -Message template for this validator includes `{{additionalChars}}` as -the string of extra chars passed as the parameter. - -*** -See also: - - * [Alpha](Alpha.md) - * [Digit](Digit.md) - * [Consonant](Consonant.md) - * [Vowel](Vowel.md) diff -Nru php-respect-validation-1.1.15/docs/Alpha.md php-respect-validation-1.1.29/docs/Alpha.md --- php-respect-validation-1.1.15/docs/Alpha.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Alpha.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -# Alpha - -- `v::alpha()` -- `v::alpha(string $additionalChars)` - -This is similar to `v::alnum()`, but it doesn't allow numbers. - -*** -See also: - - * [Alnum](Alnum.md) - * [Digit](Digit.md) - * [Consonant](Consonant.md) - * [Vowel](Vowel.md) diff -Nru php-respect-validation-1.1.15/docs/AlwaysInvalid.md php-respect-validation-1.1.29/docs/AlwaysInvalid.md --- php-respect-validation-1.1.15/docs/AlwaysInvalid.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/AlwaysInvalid.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -# AlwaysInvalid - -- `v::alwaysInvalid()` - -Always return false. - -```php -v::alwaysInvalid()->validate($whatever); // false -``` - -*** -See also: - - * [AlwaysValid](AlwaysValid.md) diff -Nru php-respect-validation-1.1.15/docs/AlwaysValid.md php-respect-validation-1.1.29/docs/AlwaysValid.md --- php-respect-validation-1.1.15/docs/AlwaysValid.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/AlwaysValid.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -# AlwaysValid - -- `v::alwaysValid()` - -Always returns true. - -```php -v::alwaysValid()->validate($whatever); // true -``` - -*** -See also: - - * [AlwaysInvalid](AlwaysInvalid.md) diff -Nru php-respect-validation-1.1.15/docs/ArrayType.md php-respect-validation-1.1.29/docs/ArrayType.md --- php-respect-validation-1.1.15/docs/ArrayType.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/ArrayType.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -# ArrayType - -- `v::arrayType()` - -Validates whether the type of an input is array. - -```php -v::arrayType()->validate([]); // true -v::arrayType()->validate([1, 2, 3]); // true -v::arrayType()->validate(new ArrayObject()); // false -``` - -*** -See also: - - * [ArrayVal](ArrayVal.md) - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [Countable](Countable.md) - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [IterableType](IterableType.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/ArrayVal.md php-respect-validation-1.1.29/docs/ArrayVal.md --- php-respect-validation-1.1.15/docs/ArrayVal.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/ArrayVal.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# ArrayVal - -- `v::arrayVal()` - -Validates if the input is an array or if the input can be used as an array -(instance of `ArrayAccess`). - -```php -v::arrayVal()->validate([]); // true -v::arrayVal()->validate(new ArrayObject); // true -``` - -*** -See also: - - * [ArrayType](ArrayType.md) - * [Countable](Countable.md) - * [Each](Each.md) - * [IterableType](IterableType.md) - * [Key](Key.md) - * [KeySet](KeySet.md) - * [KeyValue](KeyValue.md) diff -Nru php-respect-validation-1.1.15/docs/Attribute.md php-respect-validation-1.1.29/docs/Attribute.md --- php-respect-validation-1.1.15/docs/Attribute.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Attribute.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -# Attribute - -- `v::attribute(string $name)` -- `v::attribute(string $name, v $validator)` -- `v::attribute(string $name, v $validator, boolean $mandatory = true)` - -Validates an object attribute. - -```php -$obj = new stdClass; -$obj->foo = 'bar'; - -v::attribute('foo')->validate($obj); // true -``` - -You can also validate the attribute itself: - -```php -v::attribute('foo', v::equals('bar'))->validate($obj); // true -``` - -Third parameter makes the attribute presence optional: - -```php -v::attribute('lorem', v::stringType(), false)->validate($obj); // true -``` - -The name of this validator is automatically set to the attribute name. - -*** -See also: - - * [Key](Key.md) diff -Nru php-respect-validation-1.1.15/docs/BankAccount.md php-respect-validation-1.1.29/docs/BankAccount.md --- php-respect-validation-1.1.15/docs/BankAccount.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/BankAccount.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -# BankAccount - -- `v::bankAccount(string $countryCode, string $bank)` - -Validates a bank account for a given bank. - -```php -v::bankAccount("de", "70169464")->validate("1112"); // true -v::bankAccount("de", "70169464")->validate("1234"); // false -``` - -These country codes are supported: - - * "de" (Germany) - You must add `"malkusch/bav": "~1.0"` to your `require` property on composer.json file. - -*** -See also: - - * [Bank](Bank.md) - * [Bic](Bic.md) diff -Nru php-respect-validation-1.1.15/docs/Bank.md php-respect-validation-1.1.29/docs/Bank.md --- php-respect-validation-1.1.15/docs/Bank.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Bank.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -# Bank - -- `v::bank(string $countryCode)` - -Validates a bank. - -```php -v::bank("de")->validate("70169464"); // true -v::bank("de")->validate("12345"); // false -``` - -These country codes are supported: - - * "de" (Germany) - You must add `"malkusch/bav": "~1.0"` to your `require` property on composer.json file. - -*** -See also: - - * [BankAccount](BankAccount.md) - * [Bic](Bic.md) diff -Nru php-respect-validation-1.1.15/docs/Between.md php-respect-validation-1.1.29/docs/Between.md --- php-respect-validation-1.1.15/docs/Between.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Between.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -# Between - -- `v::between(mixed $start, mixed $end)` -- `v::between(mixed $start, mixed $end, boolean $inclusive = true)` - -Validates ranges. Most simple example: - -```php -v::intVal()->between(10, 20)->validate(15); // true -``` - -The type as the first validator in a chain is a good practice, -since between accepts many types: - -```php -v::stringType()->between('a', 'f')->validate('c'); // true -``` - -Also very powerful with dates: - -```php -v::date()->between('2009-01-01', '2013-01-01')->validate('2010-01-01'); // true -``` - -Date ranges accept strtotime values: - -```php -v::date()->between('yesterday', 'tomorrow')->validate('now'); // true -``` - -A third parameter may be passed to validate the passed values inclusive: - -```php -v::date()->between(10, 20, true)->validate(20); // true -``` - -Message template for this validator includes `{{minValue}}` and `{{maxValue}}`. - -*** -See also: - - * [Length](Length.md) - * [Min](Min.md) - * [Max](Max.md) diff -Nru php-respect-validation-1.1.15/docs/Bic.md php-respect-validation-1.1.29/docs/Bic.md --- php-respect-validation-1.1.15/docs/Bic.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Bic.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -# Bic - -- `v::bic(string $countryCode)` - -Validates a BIC (Bank Identifier Code) for a given country. - -```php -v::bic("de")->validate("VZVDDED1XXX"); // true -v::bic("de")->validate("VZVDDED1"); // true -``` - -Theses country codes are supported: - - * "de" (Germany) - You must add `"malkusch/bav": "~1.0"` to your `require` property on composer.json file. - -*** -See also: - - * [Bank](Bank.md) - * [BankAccount](BankAccount.md) diff -Nru php-respect-validation-1.1.15/docs/BoolType.md php-respect-validation-1.1.29/docs/BoolType.md --- php-respect-validation-1.1.15/docs/BoolType.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/BoolType.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -# BoolType - -- `v::boolType()` - -Validates if the input is a boolean value: - -```php -v::boolType()->validate(true); // true -v::boolType()->validate(false); // true -``` - -*** -See also: - - * [ArrayType](ArrayType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [FloatVal](FloatVal.md) - * [IntType](IntType.md) - * [No](No.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [TrueVal](TrueVal.md) - * [Type](Type.md) - * [Yes](Yes.md) diff -Nru php-respect-validation-1.1.15/docs/BoolVal.md php-respect-validation-1.1.29/docs/BoolVal.md --- php-respect-validation-1.1.15/docs/BoolVal.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/BoolVal.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -# BoolVal - -- `v::boolVal()` - -Validates if the input results in a boolean value: - -```php -v::boolVal()->validate('on'); // true -v::boolVal()->validate('off'); // true -v::boolVal()->validate('yes'); // true -v::boolVal()->validate('no'); // true -v::boolVal()->validate(1); // true -v::boolVal()->validate(0); // true -``` - -*** -See also: - - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [FloatVal](FloatVal.md) - * [IntType](IntType.md) - * [No](No.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [TrueVal](TrueVal.md) - * [Type](Type.md) - * [Yes](Yes.md) diff -Nru php-respect-validation-1.1.15/docs/Bsn.md php-respect-validation-1.1.29/docs/Bsn.md --- php-respect-validation-1.1.15/docs/Bsn.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Bsn.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -# Bsn - -- `v::bsn()` - -Validates a Dutch citizen service number ([BSN](https://nl.wikipedia.org/wiki/Burgerservicenummer)). - -```php -v::bsn()->validate('612890053'); // true -``` - -*** -See also: - - * [Cnh](Cnh.md) - * [Cnpj](Cnpj.md) - * [Cpf](Cpf.md) diff -Nru php-respect-validation-1.1.15/docs/CallableType.md php-respect-validation-1.1.29/docs/CallableType.md --- php-respect-validation-1.1.15/docs/CallableType.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/CallableType.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -# CallableType - -- `v::callableType()` - -Validates if the input is a callable value. - -```php -v::callableType()->validate(function () {}); // true -v::callableType()->validate('trim'); // true -v::callableType()->validate([new ObjectType, 'methodName']); // true -``` - -*** -See also: - - * [ArrayType](ArrayType.md) - * [BoolType](BoolType.md) - * [Callback](Callback.md) - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/Callback.md php-respect-validation-1.1.29/docs/Callback.md --- php-respect-validation-1.1.15/docs/Callback.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Callback.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -# Callback - -- `v::callback(callable $callback)` - -This is a wildcard validator, it uses a function name, method or closure -to validate something: - -```php -v::callback('is_int')->validate(10); // true -``` - -(Please note that this is a sample, the `v::intVal()` validator is much better). - -As in `v::call()`, you can pass a method or closure to it. - -*** -See also: - - * [Call](Call.md) - * [CallableType](CallableType.md) - * [FilterVar](FilterVar.md) diff -Nru php-respect-validation-1.1.15/docs/Call.md php-respect-validation-1.1.29/docs/Call.md --- php-respect-validation-1.1.15/docs/Call.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Call.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -# Call - -- `v::call(callable $callback)` - -This is a very low level validator. It calls a function, method or closure -for the input and then validates it. Consider the following variable: - -```php -$url = 'http://www.google.com/search?q=respect.github.com' -``` - -To validate every part of this URL we could use the native `parse_url` -function to break its parts: - -```php -$parts = parse_url($url); -``` - -This function returns an array containing `scheme`, `host`, `path` and `query`. -We can validate them this way: - -```php -v::arrayVal()->key('scheme', v::startsWith('http')) - ->key('host', v::domain()) - ->key('path', v::stringType()) - ->key('query', v::notEmpty()); -``` - -Using `v::call()` you can do this in a single chain: - -```php -v::call( - 'parse_url', - v::arrayVal()->key('scheme', v::startsWith('http')) - ->key('host', v::domain()) - ->key('path', v::stringType()) - ->key('query', v::notEmpty()) -)->validate($url); -``` - -It is possible to call methods and closures as the first parameter: - -```php -v::call([$myObj, 'methodName'], v::intVal())->validate($myInput); -v::call(function($input) {}, v::intVal())->validate($myInput); -``` - -*** -See also: - - * [Callback](Callback.md) diff -Nru php-respect-validation-1.1.15/docs/Charset.md php-respect-validation-1.1.29/docs/Charset.md --- php-respect-validation-1.1.15/docs/Charset.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Charset.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -# Charset - -- `v::charset(mixed $charset)` - -Validates if a string is in a specific charset. - -```php -v::charset('ASCII')->validate('açúcar'); // false -v::charset('ASCII')->validate('sugar'); //true -v::charset(['ISO-8859-1', 'EUC-JP'])->validate('日本国'); // true -``` - -The array format is a logic OR, not AND. - -*** -See also: - - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) diff -Nru php-respect-validation-1.1.15/docs/Cnh.md php-respect-validation-1.1.29/docs/Cnh.md --- php-respect-validation-1.1.15/docs/Cnh.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Cnh.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# Cnh - -- `v::cnh()` - -Validates a Brazillian driver's license. - -```php -v::cnh()->validate('02650306461'); // true -``` - -*** -See also: - - * [Cnpj](Cnpj.md) - * [Cpf](Cpf.md) diff -Nru php-respect-validation-1.1.15/docs/Cnpj.md php-respect-validation-1.1.29/docs/Cnpj.md --- php-respect-validation-1.1.15/docs/Cnpj.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Cnpj.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -# Cnpj - -- `v::cnpj()` - -Validates the Brazillian CNPJ number. Ignores non-digit chars, so -use `->digit()` if needed. - -*** -See also: - - * [Cpf](Cpf.md) - * [Cnh](Cnh.md) diff -Nru php-respect-validation-1.1.15/docs/Cntrl.md php-respect-validation-1.1.29/docs/Cntrl.md --- php-respect-validation-1.1.15/docs/Cntrl.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Cntrl.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Cntrl - -- `v::cntrl()` -- `v::cntrl(string $additionalChars)` - -This is similar to `v::alnum()`, but only accepts control characters: - -```php -v::cntrl()->validate("\n\r\t"); // true -``` - -*** -See also: - - * [Alnum](Alnum.md) - * [Prnt](Prnt.md) - * [Space](Space.md) diff -Nru php-respect-validation-1.1.15/docs/concrete-api.md php-respect-validation-1.1.29/docs/concrete-api.md --- php-respect-validation-1.1.15/docs/concrete-api.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/concrete-api.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,77 @@ +# Concrete API + +There are many micro-frameworks that rely on magic methods. We don't. In this +document we're gonna explore the Respect\Validation API without fluent interfaces +or magic methods. We'll use a traditional dependency injection approach. + +```php +use Respect\Validation\Validator as v; + +$usernameValidator = v::alnum()->noWhitespace()->length(1,15); +$usernameValidator->validate('alganet'); // true +``` + +If you `var_dump($usernameValidator)`, you'll see a composite of objects with +`Respect\Validation\Rules\Alnum`, `Respect\Validation\Rules\NoWhitespace` and +`Respect\Validation\Rules\Length`. There is a specific object for each rule, and +the chain only builds the structure. You can build it by yourself: + +```php +use Respect\Validation\Rules; + +$usernameValidator = new Rules\AllOf( + new Rules\Alnum(), + new Rules\NoWhitespace(), + new Rules\Length(1, 15) +); +$usernameValidator->validate('alganet'); // true +``` + +This is still a very lean API. You can use it in any dependency injection +container or test it in the way you want. Nesting is still possible: + +```php +use Respect\Validation\Rules; + +$usernameValidator = new Rules\AllOf( + new Rules\Alnum(), + new Rules\NoWhitespace(), + new Rules\Length(1, 15) +); +$userValidator = new Rules\Key('name', $usernameValidator); +$userValidator->validate(['name' => 'alganet']); // true +``` + +## How It Works? + +The Respect\Validation chain is an +[internal DSL](http://martinfowler.com/bliki/InternalDslStyle.html). +It acts in the creational realm of objects (where Abstract Factories and Builders +live), and it's only job is to make rule construction terse and fluent. + +## FAQ + +> Is `v` in `v::something` a class name? + +No! The class is `Respect\Validation\Validator`, we suggest `v` as a very short alias. + +> Is `v::something()` a static call? + +Yes. Just like the default `DateTime::createFromFormat()` or +`Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration()`. It builds +something complex and returns for you. + +> I really don't like static calls, can I avoid it? + +Yes. Just use `$validator = new Validator();` each time you want a new validator, +and continue from there. + +> Do you have a static method for each rule? + +No. We use `__callStatic()`. + +> Magic methods are slow! Why do you use them? + +They're optional. If you use the `new` interface, they won't be called. + +(still, do some benchmarks, you'd be surprised with our implementation). diff -Nru php-respect-validation-1.1.15/docs/CONCRETE_API.md php-respect-validation-1.1.29/docs/CONCRETE_API.md --- php-respect-validation-1.1.15/docs/CONCRETE_API.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/CONCRETE_API.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -# Concrete API - -There are many micro-frameworks that rely on magic methods. We don't. In this -document we're gonna explore the Respect\Validation API without fluent interfaces -or magic methods. We'll use a traditional dependency injection approach. - -```php -use Respect\Validation\Validator as v; - -$usernameValidator = v::alnum()->noWhitespace()->length(1,15); -$usernameValidator->validate('alganet'); // true -``` - -If you `var_dump($usernameValidator)`, you'll see a composite of objects with -`Respect\Validation\Rules\Alnum`, `Respect\Validation\Rules\NoWhitespace` and -`Respect\Validation\Rules\Length`. There is a specific object for each rule, and -the chain only builds the structure. You can build it by yourself: - -```php -use Respect\Validation\Rules; - -$usernameValidator = new Rules\AllOf( - new Rules\Alnum(), - new Rules\NoWhitespace(), - new Rules\Length(1, 15) -); -$usernameValidator->validate('alganet'); // true -``` - -This is still a very lean API. You can use it in any dependency injection -container or test it in the way you want. Nesting is still possible: - -```php -use Respect\Validation\Rules; - -$usernameValidator = new Rules\AllOf( - new Rules\Alnum(), - new Rules\NoWhitespace(), - new Rules\Length(1, 15) -); -$userValidator = new Rules\Key('name', $usernameValidator); -$userValidator->validate(['name' => 'alganet']); // true -``` - -## How It Works? - -The Respect\Validation chain is an -[internal DSL](http://martinfowler.com/bliki/InternalDslStyle.html). -It acts in the creational realm of objects (where Abstract Factories and Builders -live), and it's only job is to make rule construction terse and fluent. - -## FAQ - -> Is `v` in `v::something` a class name? - -No! The class is `Respect\Validation\Validator`, we suggest `v` as a very short alias. - -> Is `v::something()` a static call? - -Yes. Just like the default `DateTime::createFromFormat()` or -`Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration()`. It builds -something complex and returns for you. - -> I really don't like static calls, can I avoid it? - -Yes. Just use `$validator = new Validator();` each time you want a new validator, -and continue from there. - -> Do you have a static method for each rule? - -No. We use `__callStatic()`. - -> Magic methods are slow! Why do you use them? - -They're optional. If you use the `new` interface, they won't be called. - -(still, do some benchmarks, you'd be surprised with our implementation). diff -Nru php-respect-validation-1.1.15/docs/Consonant.md php-respect-validation-1.1.29/docs/Consonant.md --- php-respect-validation-1.1.15/docs/Consonant.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Consonant.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -# Consonant - -- `v::consonant()` -- `v::consonant(string $additionalChars)` - -Similar to `v::alnum()`. Validates strings that contain only consonants: - -```php -v::consonant()->validate('xkcd'); // true -``` - -*** -See also: - - * [Alnum](Alnum.md) - * [Digit](Digit.md) - * [Alpha](Alpha.md) - * [Vowel](Vowel.md) diff -Nru php-respect-validation-1.1.15/docs/Contains.md php-respect-validation-1.1.29/docs/Contains.md --- php-respect-validation-1.1.15/docs/Contains.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Contains.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -# Contains - -- `v::contains(mixed $value)` -- `v::contains(mixed $value, boolean $identical = false)` - -For strings: - -```php -v::contains('ipsum')->validate('lorem ipsum'); // true -``` - -For arrays: - -```php -v::contains('ipsum')->validate(['ipsum', 'lorem']); // true -``` - -A second parameter may be passed for identical comparison instead -of equal comparison. - -Message template for this validator includes `{{containsValue}}`. - -*** -See also: - - * [StartsWith](StartsWith.md) - * [EndsWith](EndsWith.md) - * [In](In.md) diff -Nru php-respect-validation-1.1.15/docs/Countable.md php-respect-validation-1.1.29/docs/Countable.md --- php-respect-validation-1.1.15/docs/Countable.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Countable.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -# Countable - -- `v::countable()` - -Validates if the input is countable, in other words, if you're allowed to use -[count()](http://php.net/count) function on it. - -```php -v::countable()->validate([]); // true -v::countable()->validate(new ArrayObject()); // true -v::countable()->validate('string'); // false -``` - -*** -See also: - - * [ArrayVal](ArrayVal.md) - * [Instance](Instance.md) - * [IterableType](IterableType.md) diff -Nru php-respect-validation-1.1.15/docs/CountryCode.md php-respect-validation-1.1.29/docs/CountryCode.md --- php-respect-validation-1.1.15/docs/CountryCode.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/CountryCode.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -# CountryCode - -- `v::countryCode()` - -Validates an ISO country code like US or BR. - -```php -v::countryCode()->validate('BR'); // true -``` - -*** -See also: - - * [Tld](Tld.md) diff -Nru php-respect-validation-1.1.15/docs/Cpf.md php-respect-validation-1.1.29/docs/Cpf.md --- php-respect-validation-1.1.15/docs/Cpf.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Cpf.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -# Cpf - -- `v::cpf()` - -Validates a Brazillian CPF number. - -```php -v::cpf()->validate('44455566820'); // true -``` - -It ignores any non-digit char: - -```php -v::cpf()->validate('444.555.668-20'); // true -``` - -If you need to validate digits only, add `->digit()` to -the chain: - -```php -v::digit()->cpf()->validate('44455566820'); // true -``` - -*** -See also: - - * [Cnpj](Cnpj.md) - * [Cnh](Cnh.md) diff -Nru php-respect-validation-1.1.15/docs/CreditCard.md php-respect-validation-1.1.29/docs/CreditCard.md --- php-respect-validation-1.1.15/docs/CreditCard.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/CreditCard.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -# CreditCard - -- `v::creditCard()` -- `v::creditCard(string $brand)` - -Validates a credit card number. - -```php -v::creditCard()->validate('5376 7473 9720 8720'); // true - -v::creditCard('American Express')->validate('340316193809364'); // true -v::creditCard('Diners Club')->validate('30351042633884'); // true -v::creditCard('Discover')->validate('6011000990139424'); // true -v::creditCard('JCB')->validate('3566002020360505'); // true -v::creditCard('Master')->validate('5376747397208720'); // true -v::creditCard('Visa')->validate('4024007153361885'); // true -``` - -The current supported brands are: - -- American Express -- Diners Club -- Discover -- JCB -- MasterCard -- Visa - -It ignores any non-digit chars, so use `->digit()` when appropriate. - -```php -v::digit()->creditCard()->validate('5376747397208720'); // true -``` - -*** -See also: - - * [Bank](Bank.md) - * [BankAccount](BankAccount.md) - * [Bic](Bic.md) diff -Nru php-respect-validation-1.1.15/docs/CurrencyCode.md php-respect-validation-1.1.29/docs/CurrencyCode.md --- php-respect-validation-1.1.15/docs/CurrencyCode.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/CurrencyCode.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# CurrencyCode - -- `v::currencyCode()` - -Validates an [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code like GBP or EUR. - -```php -v::currencyCode()->validate('GBP'); // true -``` - -*** -See also: - - * [CountryCode](CountryCode.md) - * [SubdivisionCode](SubdivisionCode.md) diff -Nru php-respect-validation-1.1.15/docs/Date.md php-respect-validation-1.1.29/docs/Date.md --- php-respect-validation-1.1.15/docs/Date.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Date.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -# Date - -- `v::date()` -- `v::date(string $format)` - -Validates if input is a date: - -```php -v::date()->validate('2009-01-01'); // true -``` - -Also accepts strtotime values: - -```php -v::date()->validate('now'); // true -``` - -And DateTime instances: - -```php -v::date()->validate(new DateTime); // true -``` - -You can pass a format when validating strings: - -```php -v::date('Y-m-d')->validate('01-01-2009'); // false -``` - -Format has no effect when validating DateTime instances. - -Message template for this validator includes `{{format}}`. - -*** -See also: - - * [Between](Between.md) - * [MinimumAge](MinimumAge.md) - * [LeapDate](LeapDate.md) - * [LeapYear](LeapYear.md) diff -Nru php-respect-validation-1.1.15/docs/Digit.md php-respect-validation-1.1.29/docs/Digit.md --- php-respect-validation-1.1.15/docs/Digit.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Digit.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -# Digit - -- `v::digit()` - -This is similar to `v::alnum()`, but it doesn't allow a-Z. - -*** -See also: - - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) - * [Vowel](Vowel.md) - * [Consonant](Consonant.md) diff -Nru php-respect-validation-1.1.15/docs/Directory.md php-respect-validation-1.1.29/docs/Directory.md --- php-respect-validation-1.1.15/docs/Directory.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Directory.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -# Directory - -- `v::directory()` - -Validates directories. - -```php -v::directory()->validate(__DIR__); // true -v::directory()->validate(__FILE__); // false -``` - -This validator will consider SplFileInfo instances, so you can do something like: - -```php -v::directory()->validate(new \SplFileInfo($directory)); -``` - -*** -See also: - - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/Domain.md php-respect-validation-1.1.29/docs/Domain.md --- php-respect-validation-1.1.15/docs/Domain.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Domain.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -# Domain - -- `v::domain()` -- `v::domain(boolean $tldCheck = true)` - -Validates domain names. - -```php -v::domain()->validate('google.com'); -``` - -You can skip *top level domain* (TLD) checks to validate internal -domain names: - -```php -v::domain(false)->validate('dev.machine.local'); -``` - -This is a composite validator, it validates several rules -internally: - - * If input is an IP address, it fails. - * If input contains whitespace, it fails. - * If input does not contain any dots, it fails. - * If input has less than two parts, it fails. - * Input must end with a top-level-domain to pass (if not skipped). - * Each part must be alphanumeric and not start with an hyphen. - * [PunnyCode][] is accepted for [Internationalizing Domain Names in Applications][IDNA]. - -Messages for this validator will reflect rules above. - -*** -See also: - - * [Ip](Ip.md) - * [MacAddress](MacAddress.md) - * [Tld](Tld.md) - -[PunnyCode]: http://en.wikipedia.org/wiki/Punycode "Wikipedia: Punnycode" -[IDNA]: http://en.wikipedia.org/wiki/Internationalized_domain_name#Internationalizing_Domain_Names_in_Applications "Wikipedia: Internationalized domain name" diff -Nru php-respect-validation-1.1.15/docs/Each.md php-respect-validation-1.1.29/docs/Each.md --- php-respect-validation-1.1.15/docs/Each.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Each.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -# Each - -- `v::each(v $validatorForValue)` -- `v::each(null, v $validatorForKey)` -- `v::each(v $validatorForValue, v $validatorForKey)` - -Iterates over an array or Iterator and validates the value or key -of each entry: - -```php -$releaseDates = [ - 'validation' => '2010-01-01', - 'template' => '2011-01-01', - 'relational' => '2011-02-05', -]; - -v::arrayVal()->each(v::date())->validate($releaseDates); // true -v::arrayVal()->each(v::date(), v::stringType()->lowercase())->validate($releaseDates); // true -``` - -Using `arrayVal()` before `each()` is a best practice. - -*** -See also: - - * [Key](Key.md) - * [ArrayVal](ArrayVal.md) diff -Nru php-respect-validation-1.1.15/docs/Email.md php-respect-validation-1.1.29/docs/Email.md --- php-respect-validation-1.1.15/docs/Email.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Email.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -# Email - -- `v::email()` - -Validates an email address. - -```php -v::email()->validate('alexandre@gaigalas.net'); // true -``` - -*** -See also: - - * [Phone](Phone.md) - * [Url](Url.md) - * [VideoUrl](VideoUrl.md) diff -Nru php-respect-validation-1.1.15/docs/EndsWith.md php-respect-validation-1.1.29/docs/EndsWith.md --- php-respect-validation-1.1.15/docs/EndsWith.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/EndsWith.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -# EndsWith - -- `v::endsWith(mixed $value)` -- `v::endsWith(mixed $value, boolean $identical = false)` - -This validator is similar to `v::contains()`, but validates -only if the value is at the end of the input. - -For strings: - -```php -v::endsWith('ipsum')->validate('lorem ipsum'); // true -``` - -For arrays: - -```php -v::endsWith('ipsum')->validate(['lorem', 'ipsum']); // true -``` - -A second parameter may be passed for identical comparison instead -of equal comparison. - -Message template for this validator includes `{{endValue}}`. - -*** -See also: - - * [StartsWith](StartsWith.md) - * [Contains](Contains.md) - * [In](In.md) diff -Nru php-respect-validation-1.1.15/docs/Equals.md php-respect-validation-1.1.29/docs/Equals.md --- php-respect-validation-1.1.15/docs/Equals.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Equals.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Equals - -- `v::equals(mixed $value)` - -Validates if the input is equal to some value. - -```php -v::equals('alganet')->validate('alganet'); // true -``` - -Message template for this validator includes `{{compareTo}}`. - -*** -See also: - - * [Contains](Contains.md) - * [Identical](Identical.md) diff -Nru php-respect-validation-1.1.15/docs/Even.md php-respect-validation-1.1.29/docs/Even.md --- php-respect-validation-1.1.15/docs/Even.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Even.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Even - -- `v::even()` - -Validates an even number. - -```php -v::intVal()->even()->validate(2); // true -``` - -Using `int()` before `even()` is a best practice. - -*** -See also: - - * [Odd](Odd.md) - * [Multiple](Multiple.md) diff -Nru php-respect-validation-1.1.15/docs/Executable.md php-respect-validation-1.1.29/docs/Executable.md --- php-respect-validation-1.1.15/docs/Executable.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Executable.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -# Executable - -- `v::executable()` - -Validates if a file is an executable. - -```php -v::email()->executable('script.sh'); // true -``` - -*** -See also: - - * [Directory](Directory.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/Exists.md php-respect-validation-1.1.29/docs/Exists.md --- php-respect-validation-1.1.15/docs/Exists.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Exists.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -# Exists - -- `v::exists()` - -Validates files or directories. - -```php -v::exists()->validate(__FILE__); // true -v::exists()->validate(__DIR__); // true -``` - -This validator will consider SplFileInfo instances, so you can do something like: - -```php -v::exists()->validate(new \SplFileInfo($file)); -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/Extension.md php-respect-validation-1.1.29/docs/Extension.md --- php-respect-validation-1.1.15/docs/Extension.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Extension.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -# Extension - -- `v::extension(string $extension)` - -Validates if the file extension matches the expected one: - -```php -v::extension('png')->validate('image.png'); // true -``` - -This rule is case-sensitive. - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/Factor.md php-respect-validation-1.1.29/docs/Factor.md --- php-respect-validation-1.1.15/docs/Factor.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Factor.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -# Factor - -- `v::factor(int $dividend)` - -Validates if the input is a factor of the defined dividend. - -```php -v::factor(0)->validate(5); // true -v::factor(4)->validate(2); // true -v::factor(4)->validate(3); // false -``` - -*** -See also: - - * [Digit](Digit.md) - * [Finite](Finite.md) - * [Infinite](Infinite.md) - * [Numeric](Numeric.md) diff -Nru php-respect-validation-1.1.15/docs/FalseVal.md php-respect-validation-1.1.29/docs/FalseVal.md --- php-respect-validation-1.1.15/docs/FalseVal.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/FalseVal.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -# FalseVal - -- `v::falseVal()` - -Validates if a value is considered as `false`. - -```php -v::falseVal()->validate(false); // true -v::falseVal()->validate(0); // true -v::falseVal()->validate('0'); // true -v::falseVal()->validate('false'); // true -v::falseVal()->validate('off'); // true -v::falseVal()->validate('no'); // true -v::falseVal()->validate('0.5'); // false -v::falseVal()->validate('2'); // false -``` - -*** -See also: - - * [TrueVal](TrueVal.md) diff -Nru php-respect-validation-1.1.15/docs/feature-guide.md php-respect-validation-1.1.29/docs/feature-guide.md --- php-respect-validation-1.1.15/docs/feature-guide.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/feature-guide.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,301 @@ +# Feature Guide + +## Namespace import + +Respect\Validation is namespaced, but you can make your life easier by importing +a single class into your context: + +```php +use Respect\Validation\Validator as v; +``` + +## Simple validation + +The Hello World validator is something like this: + +```php +$number = 123; +v::numeric()->validate($number); // true +``` + +## Chained validation + +It is possible to use validators in a chain. Sample below validates a string +containing numbers and letters, no whitespace and length between 1 and 15. + +```php +$usernameValidator = v::alnum()->noWhitespace()->length(1, 15); +$usernameValidator->validate('alganet'); // true +``` + +## Validating object attributes + +Given this simple object: + +```php +$user = new stdClass; +$user->name = 'Alexandre'; +$user->birthdate = '1987-07-01'; +``` + +Is possible to validate its attributes in a single chain: + +```php +$userValidator = v::attribute('name', v::stringType()->length(1,32)) + ->attribute('birthdate', v::date()->age(18)); + +$userValidator->validate($user); // true +``` + +Validating array keys is also possible using `v::key()` + +Note that we used `v::stringType()` and `v::date()` in the beginning of the validator. +Although is not mandatory, it is a good practice to use the type of the +validated object as the first node in the chain. + +## Input optional + +On oldest versions of Respect\Validation all validators treat input as optional +and accept an empty string input as valid. Even though a useful feature that +caused a lot of troubles for our team and neither was an obvious behavior. Also +there was some people who likes to accept `null` as optional value, not only an +empty string. + +For that reason all rules are mandatory now but if you want to treat a value as +optional you can use `v::optional()` rule: + +```php +v::alpha()->validate(''); // false input required +v::alpha()->validate(null); // false input required + +v::optional(v::alpha())->validate(''); // true +v::optional(v::alpha())->validate(null); // true +``` + +By _optional_ we consider `null` or an empty string (`''`). + +See more on [Optional](rules/Optional.md). + +## Negating rules + +You can use the `v::not()` to negate any rule: + +```php +v::not(v::intVal())->validate(10); // false, input must not be integer +``` + +## Validator reuse + +Once created, you can reuse your validator anywhere. Remember `$usernameValidator`? + +```php +$usernameValidator->validate('respect'); //true +$usernameValidator->validate('alexandre gaigalas'); // false +$usernameValidator->validate('#$%'); //false +``` + +## Exception types + +* `Respect\Validation\Exceptions\ExceptionInterface`: + * All exceptions implement this interface; +* `Respect\Validation\Exceptions\ValidationException`: + * Implements the `Respect\Validation\Exceptions\ExceptionInterface` interface + * Thrown when the `check()` fails + * All validation exceptions extend this class + * Available methods: + * `getMainMessage()`; + * `setMode($mode)`; + * `setName($name)`; + * `setParam($name, $value)`; + * `setTemplate($template)`; + * more... +* `Respect\Validation\Exceptions\NestedValidationException`: + * Extends the `Respect\Validation\Exceptions\ValidationException` class + * Usually thrown when the `assert()` fails + * Available methods: + * `findMessages()`; + * `getFullMessage()`; + * `getMessages()`; + * more... + +## Informative exceptions + +When something goes wrong, Validation can tell you exactly what's going on. For this, +we use the `assert()` method instead of `validate()`: + +```php +use Respect\Validation\Exceptions\NestedValidationException; + +try { + $usernameValidator->assert('really messed up screen#name'); +} catch(NestedValidationException $exception) { + echo $exception->getFullMessage(); +} +``` + +The printed message is exactly this, as a nested Markdown list: + +```no-highlight +- All of the required rules must pass for "really messed up screen#name" + - "really messed up screen#name" must contain only letters (a-z) and digits (0-9) + - "really messed up screen#name" must not contain whitespace + - "really messed up screen#name" must have a length between 1 and 15 +``` + +## Getting all messages as an array + +The Markdown list is fine, but unusable on a HTML form or something more custom. +For that you can use `getMessages()`. + +It will return all messages from the rules that did not pass the validation. + +```php +try { + $usernameValidator->assert('really messed up screen#name'); +} catch(NestedValidationException $exception) { + print_r($exception->getMessages()); +} +``` + +The code above may display something like: + +```no-highlight +Array +( + [0] => "really messed up screen#name" must contain only letters (a-z) and digits (0-9) + [1] => "really messed up screen#name" must not contain whitespace + [2] => "really messed up screen#name" must have a length between 1 and 15 +) +``` + +## Getting messages as an array by name + +If you want to get specific message by name you can use `findMessages()` passing +the names of the rules you want: + +```php +try { + $usernameValidator->assert('really messed up screen#name'); +} catch(NestedValidationException $exception) { + print_r($exception->findMessages(['alnum', 'noWhitespace'])); +} +``` + +The `findMessages()` returns an array with messages from the requested validators, +like this: + +```no-highlight +Array +( + [alnum] => "really messed up screen#name" must contain only letters (a-z) and digits (0-9) + [noWhitespace] => "really messed up screen#name" must not contain whitespace +) +``` + +## Custom messages + +Getting messages as an array is fine, but sometimes you need to customize them in order +to present them to the user. This is possible using the `findMessages()` method as well: + +```php +$errors = $exception->findMessages([ + 'alnum' => '{{name}} must contain only letters and digits', + 'length' => '{{name}} must not have more than 15 chars', + 'noWhitespace' => '{{name}} cannot contain spaces' +]); +``` + +For all messages, the `{{name}}` variable is available for templates. If you +do not define a name it uses the input to replace this placeholder. + +## Message localization + +You're also able to translate your message to another language with Validation. +The only thing one must do is to define the param `translator` as a callable that +will handle the translation: + +```php +$exception->setParam('translator', 'gettext'); +``` + +The example above uses `gettext()` but you can use any other callable value, like +`[$translator, 'trans']` or `you_custom_function()`. + +After that, if you call `getMainMessage()` or `getFullMessage()` (for nested), +the message will be translated. + +Note that `getMessage()` will keep the original message. + +## Custom rules + +You also can use your own rules: + +```php +namespace My\Validation\Rules; + +use Respect\Validation\Rules\AbstractRule; + +class MyRule extends AbstractRule +{ + public function validate($input) + { + // Do something here with the $input and return a boolean value + } +} +``` + +If you do want Validation to execute you rule (or rules) in the chain, you must +use `v::with()` passing your rule's namespace as an argument: + +```php +v::with('My\\Validation\\Rules\\'); +v::myRule(); // Try to load "My\Validation\Rules\MyRule" if any +``` + +By default `with()` appends the given prefix, but you can change this behavior +in order to overwrite default rules: + +```php +v::with('My\\Validation\\Rules', true); +v::alnum(); // Try to use "My\Validation\Rules\Alnum" if any +``` + +## Validator name + +On `v::attribute()` and `v::key()`, `{{name}}` is the attribute/key name. For others, +is the same as the input. You can customize a validator name using: + +```php +v::date('Y-m-d')->between('1980-02-02', 'now')->setName('Member Since'); +``` + +## Zend/Symfony validators + +It is also possible to reuse validators from other frameworks if they are installed: + +```php +$hostnameValidator = v::zend('Hostname')->assert('google.com'); +$timeValidator = v::sf('Time')->assert('22:00:01'); +``` + +## Validation methods + +We've seen `validate()` that returns true or false and `assert()` that throws a complete +validation report. There is also a `check()` method that returns an Exception +only with the first error found: + +```php +use Respect\Validation\Exceptions\ValidationException; + +try { + $usernameValidator->check('really messed up screen#name'); +} catch(ValidationException $exception) { + echo $exception->getMainMessage(); +} +``` + +Message: + +```no-highlight +"really messed up screen#name" must contain only letters (a-z) and digits (0-9) +``` diff -Nru php-respect-validation-1.1.15/docs/Fibonacci.md php-respect-validation-1.1.29/docs/Fibonacci.md --- php-respect-validation-1.1.15/docs/Fibonacci.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Fibonacci.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Fibonacci - - - `v::fibonacci()` - -Validates whether the input follows the Fibonacci integer sequence. - -```php -v::fibonacci()->validate(1); // true -v::fibonacci()->validate('34'); // true -v::fibonacci()->validate(6); // false -``` - -*** -See also: - - * [PrimeNumber](PrimeNumber.md) - * [PerfectSquare](PerfectSquare.md) \ No newline at end of file diff -Nru php-respect-validation-1.1.15/docs/File.md php-respect-validation-1.1.29/docs/File.md --- php-respect-validation-1.1.15/docs/File.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/File.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -# File - -- `v::file()` - -Validates files. - -```php -v::file()->validate(__FILE__); // true -v::file()->validate(__DIR__); // false -``` - -This validator will consider SplFileInfo instances, so you can do something like: - -```php -v::file()->validate(new \SplFileInfo($file)); -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/FilterVar.md php-respect-validation-1.1.29/docs/FilterVar.md --- php-respect-validation-1.1.15/docs/FilterVar.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/FilterVar.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -# FilterVar - -- `v::filterVar(int $filter)` -- `v::filterVar(int $filter, mixed $options)` - -A wrapper for PHP's [filter_var()](http://php.net/filter_var) function. - -```php -v::filterVar(FILTER_VALIDATE_EMAIL)->validate('bob@example.com'); // true -v::filterVar(FILTER_VALIDATE_URL)->validate('http://example.com'); // true -v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->validate('http://example.com'); // false -v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->validate('http://example.com/path'); // true -``` - -*** -See also: - - * [Callback](Callback.md) diff -Nru php-respect-validation-1.1.15/docs/Finite.md php-respect-validation-1.1.29/docs/Finite.md --- php-respect-validation-1.1.15/docs/Finite.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Finite.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -# Finite - -- `v::finite()` - -Validates if the input is a finite number. - -```php -v::finite()->validate('10'); // true -v::finite()->validate(10); // true -``` - -*** -See also: - - * [Digit](Digit.md) - * [Infinite](Infinite.md) - * [IntVal](IntVal.md) - * [Numeric](Numeric.md) diff -Nru php-respect-validation-1.1.15/docs/FloatType.md php-respect-validation-1.1.29/docs/FloatType.md --- php-respect-validation-1.1.15/docs/FloatType.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/FloatType.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -# FloatType - -- `v::floatType()` - -Validates whether the type of a value is float. - -```php -v::floatType()->validate(1.5); // true -v::floatType()->validate('1.5'); // false -v::floatType()->validate(0e5); // true -``` - -*** -See also: - - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatVal](FloatVal.md) - * [IntType](IntType.md) - * [IntVal](IntVal.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/FloatVal.md php-respect-validation-1.1.29/docs/FloatVal.md --- php-respect-validation-1.1.15/docs/FloatVal.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/FloatVal.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# FloatVal - -- `v::floatVal()` - -Validates a floating point number. - -```php -v::floatVal()->validate(1.5); // true -v::floatVal()->validate('1e5'); // true -``` - -*** -See also: - - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [IntVal](IntVal.md) diff -Nru php-respect-validation-1.1.15/docs/Graph.md php-respect-validation-1.1.29/docs/Graph.md --- php-respect-validation-1.1.15/docs/Graph.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Graph.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# Graph - -- `v::graph()` -- `v::graph(string $additionalChars)` - -Validates all characters that are graphically represented. - -```php -v::graph()->validate('LKM@#$%4;'); // true -``` - -*** -See also: - - * [Prnt](Prnt.md) diff -Nru php-respect-validation-1.1.15/docs/HexRgbColor.md php-respect-validation-1.1.29/docs/HexRgbColor.md --- php-respect-validation-1.1.15/docs/HexRgbColor.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/HexRgbColor.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -# HexRgbColor - -- `v::hexRgbColor()` - -Validates a hex RGB color - -```php -v::hexRgbColor()->validate('#FFFAAA'); // true -v::hexRgbColor()->validate('123123'); // true -v::hexRgbColor()->validate('FCD'); // true -``` - -*** -See also: - - * [Vxdigit](Vxdigit.md) diff -Nru php-respect-validation-1.1.15/docs/Identical.md php-respect-validation-1.1.29/docs/Identical.md --- php-respect-validation-1.1.15/docs/Identical.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Identical.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -# Identical - -- `v::identical(mixed $value)` - -Validates if the input is identical to some value. - -```php -v::identical(42)->validate(42); // true -v::identical(42)->validate('42'); // false -``` - -Message template for this validator includes `{{compareTo}}`. - -*** -See also: - - * [Contains](Contains.md) - * [Equals](Equals.md) diff -Nru php-respect-validation-1.1.15/docs/IdentityCard.md php-respect-validation-1.1.29/docs/IdentityCard.md --- php-respect-validation-1.1.15/docs/IdentityCard.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/IdentityCard.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -# IdentityCard - -- `v::identityCard(string $countryCode)` - -Validates Identity Card numbers according to the defined country. - -```php -v::identityCard('PL')->validate('AYW036733'); // true -v::identityCard('PL')->validate('APH505567'); // true -v::identityCard('PL')->validate('APH 505567'); // false -v::identityCard('PL')->validate('AYW036731'); // false -``` - -For now this rule only accepts Polish Identity Card numbers (Dowód Osobisty). - -*** -See also: - - * [Bank](Bank.md) - * [Pesel](Pesel.md) - * [SubdivisionCode](SubdivisionCode.md) diff -Nru php-respect-validation-1.1.15/docs/Image.md php-respect-validation-1.1.29/docs/Image.md --- php-respect-validation-1.1.15/docs/Image.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Image.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -# Image - -- `v::image()` -- `v::image(finfo $fileInfo)` - -Validates if the file is a valid image by checking its MIME type. - -```php -v::image()->validate('image.gif'); // true -v::image()->validate('image.jpg'); // true -v::image()->validate('image.png'); // true -``` - -All the validations above must return `false` if the input is not a valid file -or of the MIME doesn't match with the file extension. - -This rule relies on [fileinfo](http://php.net/fileinfo) PHP extension. - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/Imei.md php-respect-validation-1.1.29/docs/Imei.md --- php-respect-validation-1.1.15/docs/Imei.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Imei.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -# Imei - -- `v::imei()` - -Validates is the input is a valid [IMEI][]. - -```php -v::imei()->validate('35-209900-176148-1'); // true -v::imei()->validate('490154203237518'); // true -``` - -*** -See also: - - * [Bsn](Bsn.md) - * [Cnh](Cnh.md) - * [Cnpj](Cnpj.md) - * [Cpf](Cpf.md) - -[IMEI]: https://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity "International Mobile Station Equipment Identity" diff -Nru php-respect-validation-1.1.15/docs/index.md php-respect-validation-1.1.29/docs/index.md --- php-respect-validation-1.1.15/docs/index.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/index.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,16 @@ +# Overview + +[![Build Status](https://img.shields.io/travis/Respect/Validation/master.svg?style=flat-square)](http://travis-ci.org/Respect/Validation) +[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/Respect/Validation/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/Respect/Validation/?branch=master) +[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/Respect/Validation/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/Respect/Validation/?branch=master) +[![Latest Stable Version](https://img.shields.io/packagist/v/respect/validation.svg?style=flat-square)](https://packagist.org/packages/respect/validation) +[![Total Downloads](https://img.shields.io/packagist/dt/respect/validation.svg?style=flat-square)](https://packagist.org/packages/respect/validation) +[![License](https://img.shields.io/packagist/l/respect/validation.svg?style=flat-square)](https://packagist.org/packages/respect/validation) + +[The most awesome validation engine ever created for PHP.](http://bit.ly/1a1oeQv) + +- Complex rules made simple: `v::numeric()->positive()->between(1, 255)->validate($input)`. +- [Granularity control](feature-guide.md#validation-methods) for advanced reporting. +- More than 100 (fully tested) validators. +- [A concrete API](concrete-api.md) for non fluent usage. +- Works on PHP 5.4+ or HHVM 3.3+ diff -Nru php-respect-validation-1.1.15/docs/Infinite.md php-respect-validation-1.1.29/docs/Infinite.md --- php-respect-validation-1.1.15/docs/Infinite.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Infinite.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Infinite - -- `v::infinite()` - -Validates if the input is an infinite number. - -```php -v::infinite()->validate(INF); // true -``` - -*** -See also: - - * [Digit](Digit.md) - * [Finite](Finite.md) - * [IntVal](IntVal.md) - * [Numeric](Numeric.md) diff -Nru php-respect-validation-1.1.15/docs/In.md php-respect-validation-1.1.29/docs/In.md --- php-respect-validation-1.1.15/docs/In.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/In.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -# In - -- `v::in(mixed $haystack)` -- `v::in(mixed $haystack, boolean $identical = false)` - -Validates if the input is contained in a specific haystack. - -For strings: - -```php -v::in('lorem ipsum')->validate('ipsum'); // true -``` - -For arrays: - -```php -v::in(['lorem', 'ipsum'])->validate('lorem'); // true -``` - -A second parameter may be passed for identical comparison instead -of equal comparison. - -Message template for this validator includes `{{haystack}}`. - -*** -See also: - - * [StartsWith](StartsWith.md) - * [EndsWith](EndsWith.md) - * [Contains](Contains.md) diff -Nru php-respect-validation-1.1.15/docs/installation.md php-respect-validation-1.1.29/docs/installation.md --- php-respect-validation-1.1.15/docs/installation.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/installation.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,10 @@ +# Installation + +Package is available on [Packagist](http://packagist.org/packages/respect/validation), +you can install it using [Composer](http://getcomposer.org). + +```shell +composer require respect/validation +``` + +[PHP](https://php.net) 5.4+ or [HHVM](http://hhvm.com) 3.3+ are required. diff -Nru php-respect-validation-1.1.15/docs/INSTALL.md php-respect-validation-1.1.29/docs/INSTALL.md --- php-respect-validation-1.1.15/docs/INSTALL.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/INSTALL.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -# Installation - -Package is available on [Packagist](http://packagist.org/packages/respect/validation), -you can install it using [Composer](http://getcomposer.org). - -```shell -composer require respect/validation -``` - -[PHP](https://php.net) 5.4+ or [HHVM](http://hhvm.com) 3.3+ are required. - -*** -See also: - -- [Contributing](../CONTRIBUTING.md) -- [Feature Guide](README.md) -- [License](../LICENSE.md) -- [Validators](VALIDATORS.md) diff -Nru php-respect-validation-1.1.15/docs/Instance.md php-respect-validation-1.1.29/docs/Instance.md --- php-respect-validation-1.1.15/docs/Instance.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Instance.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Instance - -- `v::instance(string $instanceName)` - -Validates if the input is an instance of the given class or interface. - -```php -v::instance('DateTime')->validate(new DateTime); // true -v::instance('Traversable')->validate(new ArrayObject); // true -``` - -Message template for this validator includes `{{instanceName}}`. - -*** -See also: - - * [ObjectType](ObjectType.md) diff -Nru php-respect-validation-1.1.15/docs/IntType.md php-respect-validation-1.1.29/docs/IntType.md --- php-respect-validation-1.1.15/docs/IntType.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/IntType.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -# IntType - -- `v::intType()` - -Validates whether the type of a value is integer. - -```php -v::intType()->validate(42); // true -v::intType()->validate('10'); // false -``` - -*** -See also: - - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [Digit](Digit.md) - * [Finite](Finite.md) - * [FloatType](FloatType.md) - * [Infinite](Infinite.md) - * [IntVal](IntVal.md) - * [NullType](NullType.md) - * [Numeric](Numeric.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/IntVal.md php-respect-validation-1.1.29/docs/IntVal.md --- php-respect-validation-1.1.15/docs/IntVal.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/IntVal.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -# IntVal - -- `v::intVal()` - -Validates if the input is an integer. - -```php -v::intVal()->validate('10'); // true -v::intVal()->validate(10); // true -``` - -*** -See also: - - * [Digit](Digit.md) - * [Finite](Finite.md) - * [Infinite](Infinite.md) - * [Numeric](Numeric.md) diff -Nru php-respect-validation-1.1.15/docs/Ip.md php-respect-validation-1.1.29/docs/Ip.md --- php-respect-validation-1.1.15/docs/Ip.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Ip.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -# Ip - -- `v::ip()` -- `v::ip(mixed $options)` - -Validates IP Addresses. This validator uses the native filter_var() -PHP function. - -```php -v::ip()->validate('192.168.0.1'); -``` - -You can pass a parameter with filter_var flags for IP. - -```php -v::ip(FILTER_FLAG_NO_PRIV_RANGE)->validate('127.0.0.1'); // false -``` - -*** -See also: - - * [Domain](Domain.md) - * [MacAddress](MacAddress.md) - * [Tld](Tld.md) diff -Nru php-respect-validation-1.1.15/docs/Iterable.md php-respect-validation-1.1.29/docs/Iterable.md --- php-respect-validation-1.1.15/docs/Iterable.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Iterable.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -# Iterable - -- `v::iterable()` - -**Deprecated**: Use [IterableType](IterableType.md) instead. diff -Nru php-respect-validation-1.1.15/docs/IterableType.md php-respect-validation-1.1.29/docs/IterableType.md --- php-respect-validation-1.1.15/docs/IterableType.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/IterableType.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -# IterableType - -- `v::iterableType()` - -Validates if the input is iterable, in other words, if you're able to iterate -over it with [foreach](http://php.net/foreach) language construct. - -```php -v::iterableType()->validate([]); // true -v::iterableType()->validate(new ArrayObject()); // true -v::iterableType()->validate(new stdClass()); // true -v::iterableType()->validate('string'); // false -``` - -*** -See also: - - * [ArrayVal](ArrayVal.md) - * [Countable](Countable.md) - * [Instance](Instance.md) diff -Nru php-respect-validation-1.1.15/docs/Json.md php-respect-validation-1.1.29/docs/Json.md --- php-respect-validation-1.1.15/docs/Json.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Json.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -# Json - -- `v::json()` - -Validates if the given input is a valid JSON. - -```php -v::json()->validate('{"foo":"bar"}'); // true -``` - -*** -See also: - - * [Domain](Domain.md) - * [Email](Email.md) - * [FilterVar](FilterVar.md) - * [Phone](Phone.md) - * [VideoUrl](VideoUrl.md) diff -Nru php-respect-validation-1.1.15/docs/Key.md php-respect-validation-1.1.29/docs/Key.md --- php-respect-validation-1.1.15/docs/Key.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Key.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -# Key - -- `v::key(string $name)` -- `v::key(string $name, v $validator)` -- `v::key(string $name, v $validator, boolean $mandatory = true)` - -Validates an array key. - -```php -$dict = [ - 'foo' => 'bar' -]; - -v::key('foo')->validate($dict); // true -``` - -You can also validate the key value itself: - -```php -v::key('foo', v::equals('bar'))->validate($dict); // true -``` - -Third parameter makes the key presence optional: - -```php -v::key('lorem', v::stringType(), false)->validate($dict); // true -``` - -The name of this validator is automatically set to the key name. - -*** -See also: - - * [Attribute](Attribute.md) diff -Nru php-respect-validation-1.1.15/docs/KeyNested.md php-respect-validation-1.1.29/docs/KeyNested.md --- php-respect-validation-1.1.15/docs/KeyNested.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/KeyNested.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -# KeyNested - -- `v::keyNested(string $name)` -- `v::keyNested(string $name, v $validator)` -- `v::keyNested(string $name, v $validator, boolean $mandatory = true)` - -Validates an array key or an object property using `.` to represent nested data. - -Validating keys from arrays or `ArrayAccess` instances: - -```php -$array = [ - 'foo' => [ - 'bar' => 123, - ], -]; - -v::keyNested('foo.bar')->validate($array); // true -``` - -Validating object properties: - -```php -$object = new stdClass(); -$object->foo = new stdClass(); -$object->foo->bar = 42; - -v::keyNested('foo.bar')->validate($object); // true -``` - -This rule was inspired by [Yii2 ArrayHelper][]. - -*** -See also: - - * [Attribute](Attribute.md) - * [Key](Key.md) - - -[Yii2 ArrayHelper]: https://github.com/yiisoft/yii2/blob/68c30c1/framework/helpers/BaseArrayHelper.php "Yii2 ArrayHelper" diff -Nru php-respect-validation-1.1.15/docs/KeySet.md php-respect-validation-1.1.29/docs/KeySet.md --- php-respect-validation-1.1.15/docs/KeySet.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/KeySet.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -# KeySet - -- `v::keySet(Key $rule...)` - -Validates a keys in a defined structure. - -```php -$dict = ['foo' => 42]; - -v::keySet( - v::key('foo', v::intVal()) -)->validate($dict); // true -``` - -Extra keys are not allowed: -```php -$dict = ['foo' => 42, 'bar' => 'String']; - -v::keySet( - v::key('foo', v::intVal()) -)->validate($dict); // false -``` - -Missing required keys are not allowed: -```php -$dict = ['foo' => 42, 'bar' => 'String']; - -v::keySet( - v::key('foo', v::intVal()), - v::key('bar', v::stringType()), - v::key('baz', v::boolType()) -)->validate($dict); // false -``` - -Missing non-required keys are allowed: -```php -$dict = ['foo' => 42, 'bar' => 'String']; - -v::keySet( - v::key('foo', v::intVal()), - v::key('bar', v::stringType()), - v::key('baz', v::boolType(), false) -)->validate($dict); // true -``` - -The keys' order is not considered in the validation. - -*** -See also: - - * [Key](Key.md) diff -Nru php-respect-validation-1.1.15/docs/KeyValue.md php-respect-validation-1.1.29/docs/KeyValue.md --- php-respect-validation-1.1.15/docs/KeyValue.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/KeyValue.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -# KeyValue - -- `keyValue(string $comparedKey, string $ruleName, string $baseKey)` - -Performs validation of `$comparedKey` using the rule named on `$ruleName` with -`$baseKey` as base. - -Sometimes, when validating arrays, the validation of a key value depends on -another key value and that may cause some ugly code since you need the input -before the validation, making some checking manually: - -```php -v::key('password')->check($_POST); -v::key('password_confirmation', v::equals($_POST['password']))->check($_POST); -``` - -The problem with the above code is because you do not know if `password` is a -valid key, so you must check it manually before performing the validation on -`password_confirmation`. - -The `keyValue()` rule makes this job easier by creating a rule named on -`$ruleName` passing `$baseKey` as the first argument of this rule, see an example: - -```php -v::keyValue('password_confirmation', 'equals', 'password')->validate($_POST); -``` - -The above code will result on `true` if _`$_POST['password_confirmation']` is -[equals](Equals.md) to `$_POST['password']`_, it's the same of: - -See another example: - -```php -v::keyValue('state', 'subdivisionCode', 'country')->validate($_POST); -``` - -The above code will result on `true` if _`$_POST['state']` is a -[subdivision code](SubdivisionCode.md) of `$_POST['country']`_: - -This rule will invalidate the input if `$comparedKey` or `$baseKey` don't exist, -or if the rule named on `$ruleName` could not be created (or don't exist). - -When using `assert()` or `check()` methods and the rule do not pass, it overwrites -all values in the validation exceptions with `$baseKey` and `$comparedKey`. - -```php -v::keyValue('password_confirmation', 'equals', 'password')->check($input); -``` - -The above code may generate the message: - -``` -password_confirmation must be equals "password" -``` - -*** -See also: - - * [Key](Key.md) - * [KeyNested](KeyNested.md) - * [KeySet](KeySet.md) - diff -Nru php-respect-validation-1.1.15/docs/LanguageCode.md php-respect-validation-1.1.29/docs/LanguageCode.md --- php-respect-validation-1.1.15/docs/LanguageCode.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/LanguageCode.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -# LanguageCode - -- `v::languageCode()` - -Validates a language code based on ISO 639: - -```php -v::languageCode()->validate('pt'); // true -v::languageCode()->validate('en'); // true -v::languageCode()->validate('it'); // true -v::languageCode('alpha-3')->validate('ita'); // true -v::languageCode('alpha-3')->validate('eng'); // true -``` - -You can choose between alpha-2 and alpha-3, alpha-2 is set by default. - -*** -See also: - - * [CountryCode](CountryCode.md) \ No newline at end of file diff -Nru php-respect-validation-1.1.15/docs/LeapDate.md php-respect-validation-1.1.29/docs/LeapDate.md --- php-respect-validation-1.1.15/docs/LeapDate.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/LeapDate.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -# LeapDate - -- `v::leapDate(string $format)` - -Validates if a date is leap. - -```php -v::leapDate('Y-m-d')->validate('1988-02-29'); // true -``` - -This validator accepts DateTime instances as well. The $format -parameter is mandatory. - -*** -See also: - - * [Date](Date.md) - * [LeapYear](LeapYear.md) diff -Nru php-respect-validation-1.1.15/docs/LeapYear.md php-respect-validation-1.1.29/docs/LeapYear.md --- php-respect-validation-1.1.15/docs/LeapYear.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/LeapYear.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# LeapYear - -- `v::leapYear()` - -Validates if a year is leap. - -```php -v::leapYear()->validate('1988'); // true -``` - -This validator accepts DateTime instances as well. - -*** -See also: - - * [Date](Date.md) - * [LeapDate](LeapDate.md) diff -Nru php-respect-validation-1.1.15/docs/Length.md php-respect-validation-1.1.29/docs/Length.md --- php-respect-validation-1.1.15/docs/Length.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Length.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -# Length - -- `v::length(int $min, int $max)` -- `v::length(int $min, null)` -- `v::length(null, int $max)` -- `v::length(int $min, int $max, boolean $inclusive = true)` - -Validates lengths. Most simple example: - -```php -v::stringType()->length(1, 5)->validate('abc'); // true -``` - -You can also validate only minimum length: - -```php -v::stringType()->length(5, null)->validate('abcdef'); // true -``` - -Only maximum length: - -```php -v::stringType()->length(null, 5)->validate('abc'); // true -``` - -The type as the first validator in a chain is a good practice, -since length accepts many types: - -```php -v::arrayVal()->length(1, 5)->validate(['foo', 'bar']); // true -``` - -A third parameter may be passed to validate the passed values inclusive: - -```php -v::stringType()->length(1, 5, true)->validate('a'); // true -``` - -Message template for this validator includes `{{minValue}}` and `{{maxValue}}`. - -*** -See also: - - * [Between](Between.md) diff -Nru php-respect-validation-1.1.15/docs/license.md php-respect-validation-1.1.29/docs/license.md --- php-respect-validation-1.1.15/docs/license.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/license.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,30 @@ +# License + +Copyright (c) 2009-2015, [Alexandre Gomes Gaigalas](http://github.com/alganet). + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Alexandre Gomes Gaigalas nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff -Nru php-respect-validation-1.1.15/docs/list-of-rules.md php-respect-validation-1.1.29/docs/list-of-rules.md --- php-respect-validation-1.1.15/docs/list-of-rules.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/list-of-rules.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,329 @@ +# List of rules + +## Types + + * [ArrayVal](rules/ArrayVal.md) + * [ArrayType](rules/ArrayType.md) + * [BoolVal](rules/BoolVal.md) + * [BoolType](rules/BoolType.md) + * [CallableType](rules/CallableType.md) + * [Countable](rules/Countable.md) + * [Date](rules/Date.md) + * [FalseVal](rules/FalseVal.md) + * [FloatVal](rules/FloatVal.md) + * [FloatType](rules/FloatType.md) + * [Instance](rules/Instance.md) + * [IntVal](rules/IntVal.md) + * [IntType](rules/IntType.md) + * [IterableType](rules/IterableType.md) + * [NullType](rules/NullType.md) + * [Numeric](rules/Numeric.md) + * [ObjectType](rules/ObjectType.md) + * [ResourceType](rules/ResourceType.md) + * [ScalarVal](rules/ScalarVal.md) + * [StringType](rules/StringType.md) + * [TrueVal](rules/TrueVal.md) + * [Type](rules/Type.md) + * [Xdigit](rules/Xdigit.md) + +## Generics + + * [AlwaysInvalid](rules/AlwaysInvalid.md) + * [AlwaysValid](rules/AlwaysValid.md) + * [Call](rules/Call.md) + * [Callback](rules/Callback.md) + * [FilterVar](rules/FilterVar.md) + * [Not](rules/Not.md) + * [Optional](rules/Optional.md) + * [Type](rules/Type.md) + * [When](rules/When.md) + +## Comparing Values + + * [Age](rules/Age.md) + * [Between](rules/Between.md) + * [Equals](rules/Equals.md) + * [Identical](rules/Identical.md) + * [Max](rules/Max.md) + * [Min](rules/Min.md) + +## Numeric + + * [Between](rules/Between.md) + * [BoolType](rules/BoolType.md) + * [Even](rules/Even.md) + * [Factor](rules/Factor.md) + * [Fibonacci](rules/Fibonacci.md) + * [Finite](rules/Finite.md) + * [FloatVal](rules/FloatVal.md) + * [FloatType](rules/FloatType.md) + * [Infinite](rules/Infinite.md) + * [IntVal](rules/IntVal.md) + * [IntType](rules/IntType.md) + * [Multiple](rules/Multiple.md) + * [Negative](rules/Negative.md) + * [NotEmpty](rules/NotEmpty.md) + * [Numeric](rules/Numeric.md) + * [Odd](rules/Odd.md) + * [PerfectSquare](rules/PerfectSquare.md) + * [Positive](rules/Positive.md) + * [PrimeNumber](rules/PrimeNumber.md) + * [Roman](rules/Roman.md) + * [Xdigit](rules/Xdigit.md) + +## String + + * [Alnum](rules/Alnum.md) + * [Alpha](rules/Alpha.md) + * [Between](rules/Between.md) + * [Charset](rules/Charset.md) + * [Cntrl](rules/Cntrl.md) + * [Consonant](rules/Consonant.md) + * [Contains](rules/Contains.md) + * [Digit](rules/Digit.md) + * [EndsWith](rules/EndsWith.md) + * [Graph](rules/Graph.md) + * [In](rules/In.md) + * [Length](rules/Length.md) + * [Lowercase](rules/Lowercase.md) + * [NotEmpty](rules/NotEmpty.md) + * [NoWhitespace](rules/NoWhitespace.md) + * [PhpLabel](rules/PhpLabel.md) + * [Prnt](rules/Prnt.md) + * [Punct](rules/Punct.md) + * [Regex](rules/Regex.md) + * [ResourceType](rules/ResourceType.md) + * [Slug](rules/Slug.md) + * [Space](rules/Space.md) + * [StartsWith](rules/StartsWith.md) + * [Uppercase](rules/Uppercase.md) + * [Version](rules/Version.md) + * [Vowel](rules/Vowel.md) + * [Xdigit](rules/Xdigit.md) + +## Arrays + + * [ArrayVal](rules/ArrayVal.md) + * [ArrayType](rules/ArrayType.md) + * [Contains](rules/Contains.md) + * [Each](rules/Each.md) + * [EndsWith](rules/EndsWith.md) + * [In](rules/In.md) + * [Key](rules/Key.md) + * [KeyNested](rules/KeyNested.md) + * [KeySet](rules/KeySet.md) + * [KeyValue](rules/KeyValue.md) + * [Length](rules/Length.md) + * [NotEmpty](rules/NotEmpty.md) + * [StartsWith](rules/StartsWith.md) + +## Objects + + * [Attribute](rules/Attribute.md) + * [Instance](rules/Instance.md) + * [Length](rules/Length.md) + +## Date and Time + + * [Age](rules/Age.md) + * [Between](rules/Between.md) + * [Date](rules/Date.md) + * [LeapDate](rules/LeapDate.md) + * [LeapYear](rules/LeapYear.md) + * [MinimumAge](rules/MinimumAge.md) + +## Group Validators + + * [AllOf](rules/AllOf.md) + * [NoneOf](rules/NoneOf.md) + * [OneOf](rules/OneOf.md) + +## Regional + + * [CountryCode](rules/CountryCode.md) + * [CurrencyCode](rules/CurrencyCode.md) + * [IdentityCard](rules/IdentityCard.md) + * [LanguageCode](rules/LanguageCode.md) + * [PostalCode](rules/PostalCode.md) + * [SubdivisionCode](rules/SubdivisionCode.md) + * [Tld](rules/Tld.md) + +## Files + + * [Directory](rules/Directory.md) + * [Executable](rules/Executable.md) + * [Exists](rules/Exists.md) + * [Extension](rules/Extension.md) + * [File](rules/File.md) + * [Image](rules/Image.md) + * [Mimetype](rules/Mimetype.md) + * [Readable](rules/Readable.md) + * [Size](rules/Size.md) + * [SymbolicLink](rules/SymbolicLink.md) + * [Uploaded](rules/Uploaded.md) + * [Writable](rules/Writable.md) + +## Banking + + * [Bank](rules/Bank.md) + * [BankAccount](rules/BankAccount.md) + * [Bic](rules/Bic.md) + +## Other + + * [Bsn](rules/Bsn.md) + * [Cnh](rules/Cnh.md) + * [Cnpj](rules/Cnpj.md) + * [Cpf](rules/Cpf.md) + * [Domain](rules/Domain.md) + * [Email](rules/Email.md) + * [HexRgbColor](rules/HexRgbColor.md) + * [Imei](rules/Imei.md) + * [Ip](rules/Ip.md) + * [Json](rules/Json.md) + * [MacAddress](rules/MacAddress.md) + * [NfeAccessKey](rules/NfeAccessKey.md) + * [NotBlank](rules/NotBlank.md) + * [NotOptional](rules/NotOptional.md) + * [Pesel](rules/Pesel.md) + * [Phone](rules/Phone.md) + * [Sf](rules/Sf.md) + * [Url](rules/Url.md) + * [VideoUrl](rules/VideoUrl.md) + * [Zend](rules/Zend.md) + +## Yes/No + + * [No](rules/No.md) + * [Yes](rules/Yes.md) + +## Alphabetically + + * [Age](rules/Age.md) + * [AllOf](rules/AllOf.md) + * [Alnum](rules/Alnum.md) + * [Alpha](rules/Alpha.md) + * [AlwaysInvalid](rules/AlwaysInvalid.md) + * [AlwaysValid](rules/AlwaysValid.md) + * [ArrayVal](rules/ArrayVal.md) + * [ArrayType](rules/ArrayType.md) + * [Attribute](rules/Attribute.md) + * [Bank](rules/Bank.md) + * [BankAccount](rules/BankAccount.md) + * [Between](rules/Between.md) + * [Bic](rules/Bic.md) + * [BoolType](rules/BoolType.md) + * [Bsn](rules/Bsn.md) + * [Call](rules/Call.md) + * [CallableType](rules/CallableType.md) + * [Callback](rules/Callback.md) + * [Charset](rules/Charset.md) + * [Cnh](rules/Cnh.md) + * [Cnpj](rules/Cnpj.md) + * [Cntrl](rules/Cntrl.md) + * [Consonant](rules/Consonant.md) + * [Contains](rules/Contains.md) + * [Countable](rules/Countable.md) + * [CountryCode](rules/CountryCode.md) + * [Cpf](rules/Cpf.md) + * [CreditCard](rules/CreditCard.md) + * [Date](rules/Date.md) + * [Digit](rules/Digit.md) + * [Directory](rules/Directory.md) + * [Domain](rules/Domain.md) + * [Each](rules/Each.md) + * [Email](rules/Email.md) + * [EndsWith](rules/EndsWith.md) + * [Equals](rules/Equals.md) + * [Even](rules/Even.md) + * [Executable](rules/Executable.md) + * [Exists](rules/Exists.md) + * [Extension](rules/Extension.md) + * [Factor](rules/Factor.md) + * [FalseVal](rules/FalseVal.md) + * [Fibonacci](rules/Fibonacci.md) + * [File](rules/File.md) + * [FilterVar](rules/FilterVar.md) + * [Finite](rules/Finite.md) + * [FloatVal](rules/FloatVal.md) + * [FloatType](rules/FloatType.md) + * [Graph](rules/Graph.md) + * [HexRgbColor](rules/HexRgbColor.md) + * [Identical](rules/Identical.md) + * [IdentityCard](rules/IdentityCard.md) + * [Image](rules/Image.md) + * [Imei](rules/Imei.md) + * [In](rules/In.md) + * [Infinite](rules/Infinite.md) + * [Instance](rules/Instance.md) + * [IntVal](rules/IntVal.md) + * [IntType](rules/IntType.md) + * [Ip](rules/Ip.md) + * [IterableType](rules/IterableType.md) + * [Json](rules/Json.md) + * [Key](rules/Key.md) + * [KeyNested](rules/KeyNested.md) + * [KeySet](rules/KeySet.md) + * [KeyValue](rules/KeyValue.md) + * [LanguageCode](rules/LanguageCode.md) + * [LeapDate](rules/LeapDate.md) + * [LeapYear](rules/LeapYear.md) + * [Length](rules/Length.md) + * [Lowercase](rules/Lowercase.md) + * [MacAddress](rules/MacAddress.md) + * [Max](rules/Max.md) + * [Mimetype](rules/Mimetype.md) + * [Min](rules/Min.md) + * [MinimumAge](rules/MinimumAge.md) + * [Multiple](rules/Multiple.md) + * [Negative](rules/Negative.md) + * [NfeAccessKey](rules/NfeAccessKey.md) + * [No](rules/No.md) + * [NoWhitespace](rules/NoWhitespace.md) + * [NoneOf](rules/NoneOf.md) + * [Not](rules/Not.md) + * [NotBlank](rules/NotBlank.md) + * [NotEmpty](rules/NotEmpty.md) + * [NotOptional](rules/NotOptional.md) + * [NullType](rules/NullType.md) + * [Numeric](rules/Numeric.md) + * [ObjectType](rules/ObjectType.md) + * [Odd](rules/Odd.md) + * [OneOf](rules/OneOf.md) + * [Optional](rules/Optional.md) + * [PerfectSquare](rules/PerfectSquare.md) + * [Pesel](rules/Pesel.md) + * [Phone](rules/Phone.md) + * [PhpLabel](rules/PhpLabel.md) + * [Positive](rules/Positive.md) + * [PostalCode](rules/PostalCode.md) + * [PrimeNumber](rules/PrimeNumber.md) + * [Prnt](rules/Prnt.md) + * [Punct](rules/Punct.md) + * [Readable](rules/Readable.md) + * [Regex](rules/Regex.md) + * [ResourceType](rules/ResourceType.md) + * [Roman](rules/Roman.md) + * [ScalarVal](rules/ScalarVal.md) + * [Sf](rules/Sf.md) + * [Size](rules/Size.md) + * [Slug](rules/Slug.md) + * [Space](rules/Space.md) + * [StartsWith](rules/StartsWith.md) + * [StringType](rules/StringType.md) + * [SubdivisionCode](rules/SubdivisionCode.md) + * [SymbolicLink](rules/SymbolicLink.md) + * [Tld](rules/Tld.md) + * [TrueVal](rules/TrueVal.md) + * [Type](rules/Type.md) + * [Uploaded](rules/Uploaded.md) + * [Uppercase](rules/Uppercase.md) + * [Url](rules/Url.md) + * [Version](rules/Version.md) + * [VideoUrl](rules/VideoUrl.md) + * [Vowel](rules/Vowel.md) + * [When](rules/When.md) + * [Writable](rules/Writable.md) + * [Xdigit](rules/Xdigit.md) + * [Yes](rules/Yes.md) + * [Zend](rules/Zend.md) diff -Nru php-respect-validation-1.1.15/docs/Lowercase.md php-respect-validation-1.1.29/docs/Lowercase.md --- php-respect-validation-1.1.15/docs/Lowercase.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Lowercase.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -# Lowercase - -- `v::lowercase()` - -Validates if string characters are lowercase in the input: - -```php -v::stringType()->lowercase()->validate('xkcd'); // true -``` - -*** -See also: - - * [Uppercase](Uppercase.md) diff -Nru php-respect-validation-1.1.15/docs/MacAddress.md php-respect-validation-1.1.29/docs/MacAddress.md --- php-respect-validation-1.1.15/docs/MacAddress.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/MacAddress.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# MacAddress - -- `v::macAddress()` - -Validates a Mac Address. - -```php -v::macAddress()->validate('00:11:22:33:44:55'); // true -v::macAddress()->validate('af-AA-22-33-44-55'); // true -``` - -*** -See also: - - * [Domain](Domain.md) - * [Ip](Ip.md) - * [Tld](Tld.md) diff -Nru php-respect-validation-1.1.15/docs/Max.md php-respect-validation-1.1.29/docs/Max.md --- php-respect-validation-1.1.15/docs/Max.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Max.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -# Max - -- `v::max(mixed $maxValue)` -- `v::max(mixed $maxValue, boolean $inclusive = true)` - -Validates if the input doesn't exceed the maximum value. - -```php -v::intVal()->max(15)->validate(20); // false -v::intVal()->max(20)->validate(20); // false -v::intVal()->max(20, true)->validate(20); // true -``` - -Also accepts dates: - -```php -v::date()->max('2012-01-01')->validate('2010-01-01'); // true -``` - -Also date intervals: - -```php -// Same of minimum age validation -v::date()->max('-18 years')->validate('1988-09-09'); // true -``` - -`true` may be passed as a parameter to indicate that inclusive -values must be used. - -Message template for this validator includes `{{maxValue}}`. - -*** -See also: - - * [Min](Min.md) - * [Between](Between.md) diff -Nru php-respect-validation-1.1.15/docs/Mimetype.md php-respect-validation-1.1.29/docs/Mimetype.md --- php-respect-validation-1.1.15/docs/Mimetype.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Mimetype.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -# Mimetype - -- `v::mimetype(string $mimetype)` - -Validates if the file mimetype matches the expected one: - -```php -v::mimetype('image/png')->validate('image.png'); // true -``` - -This rule is case-sensitive and requires [fileinfo](http://php.net/fileinfo) PHP extension. - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/MinimumAge.md php-respect-validation-1.1.29/docs/MinimumAge.md --- php-respect-validation-1.1.15/docs/MinimumAge.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/MinimumAge.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -# MinimumAge - -This is going to be deprecated, please use [Age](Age.md) instead. - -- `v::minimumAge(int $age)` -- `v::minimumAge(int $age, string $format)` - -Validates a minimum age for a given date. - -```php -v::minimumAge(18)->validate('1987-01-01'); // true -v::minimumAge(18, 'd/m/Y')->validate('01/01/1987'); // true -``` - -Using `date()` before is a best-practice. - -Message template for this validator includes `{{age}}`. - -*** -See also: - - * [Age](Age.md) - * [Date](Date.md) diff -Nru php-respect-validation-1.1.15/docs/Min.md php-respect-validation-1.1.29/docs/Min.md --- php-respect-validation-1.1.15/docs/Min.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Min.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -# Min - -- `v::min(mixed $minValue)` -- `v::min(mixed $minValue, boolean $inclusive = true)` - -Validates if the input is greater than the minimum value. - -```php -v::intVal()->min(15)->validate(5); // false -v::intVal()->min(5)->validate(5); // false -v::intVal()->min(5, true)->validate(5); // true -``` - -Also accepts dates: - -```php -v::date()->min('2012-01-01')->validate('2015-01-01'); // true -``` - -`true` may be passed as a parameter to indicate that inclusive -values must be used. - -Message template for this validator includes `{{minValue}}`. - -*** -See also: - - * [Max](Max.md) - * [Between](Between.md) diff -Nru php-respect-validation-1.1.15/docs/Multiple.md php-respect-validation-1.1.29/docs/Multiple.md --- php-respect-validation-1.1.15/docs/Multiple.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Multiple.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -# Multiple - -- `v::multiple(int $multipleOf)` - -Validates if the input is a multiple of the given parameter - -```php -v::intVal()->multiple(3)->validate(9); // true -``` - -*** -See also: - - * [PrimeNumber](PrimeNumber.md) diff -Nru php-respect-validation-1.1.15/docs/Negative.md php-respect-validation-1.1.29/docs/Negative.md --- php-respect-validation-1.1.15/docs/Negative.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Negative.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -# Negative - -- `v::negative()` - -Validates if a number is lower than zero - -```php -v::numeric()->negative()->validate(-15); // true -``` - -*** -See also: - - * [Positive](Positive.md) diff -Nru php-respect-validation-1.1.15/docs/NfeAccessKey.md php-respect-validation-1.1.29/docs/NfeAccessKey.md --- php-respect-validation-1.1.15/docs/NfeAccessKey.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/NfeAccessKey.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -# NfeAccessKey - -- `v::nfeAccessKey(string $accessKey)` - -Validates the access key of the Brazilian electronic invoice (NFe). - -```php -v::nfeAccessKey()->validate('31841136830118868211870485416765268625116906'); // true -``` - -*** -See also: - - * [Cnh](Cnh.md) - * [Cnpj](Cnpj.md) - * [Cpf](Cpf.md) diff -Nru php-respect-validation-1.1.15/docs/No.md php-respect-validation-1.1.29/docs/No.md --- php-respect-validation-1.1.15/docs/No.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/No.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -# No - -- `v::no()` -- `v::no(boolean $locale)` - -Validates if value is considered as "No". - -```php -v::no()->validate('N'); // true -v::no()->validate('Nay'); // true -v::no()->validate('Nix'); // true -v::no()->validate('No'); // true -v::no()->validate('Nope'); // true -v::no()->validate('Not'); // true -``` - -This rule is case insensitive. - -If `$locale` is TRUE, uses the value of [nl_langinfo()](http://php.net/nl_langinfo) with `NOEXPR` constant. - -*** -See also: - - * [Yes](Yes.md) diff -Nru php-respect-validation-1.1.15/docs/NoneOf.md php-respect-validation-1.1.29/docs/NoneOf.md --- php-respect-validation-1.1.15/docs/NoneOf.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/NoneOf.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -# NoneOf - -- `v::noneOf(v $v1, v $v2, v $v3...)` - -Validates if NONE of the given validators validate: - -```php -v::noneOf( - v::intVal(), - v::floatVal() -)->validate('foo'); // true -``` - -In the sample above, 'foo' isn't a integer nor a float, so noneOf returns true. - -*** -See also: - - * [Not](Not.md) - * [AllOf](AllOf.md) - * [OneOf](OneOf.md) diff -Nru php-respect-validation-1.1.15/docs/NotBlank.md php-respect-validation-1.1.29/docs/NotBlank.md --- php-respect-validation-1.1.15/docs/NotBlank.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/NotBlank.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -# NotBlank - -- `v::notBlank()` - -Validates if the given input is not a blank value (`null`, zeros, empty strings -or empty arrays, recursively). - -```php -v::notBlank()->validate(null); // false -v::notBlank()->validate(''); // false -v::notBlank()->validate([]); // false -v::notBlank()->validate(' '); // false -v::notBlank()->validate(0); // false -v::notBlank()->validate('0'); // false -v::notBlank()->validate(0); // false -v::notBlank()->validate('0.0'); // false -v::notBlank()->validate(false); // false -v::notBlank()->validate(['']); // false -v::notBlank()->validate([' ']); // false -v::notBlank()->validate([0]); // false -v::notBlank()->validate(['0']); // false -v::notBlank()->validate([false]); // false -v::notBlank()->validate([[''], [0]]); // false -v::notBlank()->validate(new stdClass()); // false -``` - -It's similar to [NotEmpty](NotEmpty.md) but it's way more strict. - -*** -See also: - - * [NoWhitespace](NoWhitespace.md) - * [NotEmpty](NotEmpty.md) - * [NullType](NullType.md) diff -Nru php-respect-validation-1.1.15/docs/NotEmpty.md php-respect-validation-1.1.29/docs/NotEmpty.md --- php-respect-validation-1.1.15/docs/NotEmpty.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/NotEmpty.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -# NotEmpty - -- `v::notEmpty()` - -Validates if the given input is not empty or in other words is input mandatory and -required. This function also takes whitespace into account, use `noWhitespace()` -if no spaces or linebreaks and other whitespace anywhere in the input is desired. - -```php -v::stringType()->notEmpty()->validate(''); // false -``` - -Null values are empty: - -```php -v::notEmpty()->validate(null); // false -``` - -Numbers: - -```php -v::intVal()->notEmpty()->validate(0); // false -``` - -Empty arrays: - -```php -v::arrayVal()->notEmpty()->validate([]); // false -``` - -Whitespace: - -```php -v::stringType()->notEmpty()->validate(' '); //false -v::stringType()->notEmpty()->validate("\t \n \r"); //false -``` - -*** -See also: - - * [NoWhitespace](NoWhitespace.md) - * [NullType](NullType.md) diff -Nru php-respect-validation-1.1.15/docs/Not.md php-respect-validation-1.1.29/docs/Not.md --- php-respect-validation-1.1.15/docs/Not.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Not.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -# Not - -- `v::not(v $negatedValidator)` - -Negates any rule. - -```php -v::not(v::ip())->validate('foo'); // true -``` - -In the sample above, validator returns true because 'foo' isn't an IP Address. - -You can negate complex, grouped or chained validators as well: - -```php -v::not(v::intVal()->positive())->validate(-1.5); // true -``` - -Each other validation has custom messages for negated rules. - -*** -See also: - - * [NoneOf](NoneOf.md) diff -Nru php-respect-validation-1.1.15/docs/NotOptional.md php-respect-validation-1.1.29/docs/NotOptional.md --- php-respect-validation-1.1.15/docs/NotOptional.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/NotOptional.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -# NotOptional - -- `v::notOptional()` - -Validates if the given input is not optional. By _optional_ we consider `null` -or an empty string (`''`). - -```php -v::notOptional()->validate(''); // false -v::notOptional()->validate(null); // false -``` - -Other values: - -```php -v::notOptional()->validate([]); // true -v::notOptional()->validate(' '); // true -v::notOptional()->validate(0); // true -v::notOptional()->validate('0'); // true -v::notOptional()->validate(0); // true -v::notOptional()->validate('0.0'); // true -v::notOptional()->validate(false); // true -v::notOptional()->validate(['']); // true -v::notOptional()->validate([' ']); // true -v::notOptional()->validate([0]); // true -v::notOptional()->validate(['0']); // true -v::notOptional()->validate([false]); // true -v::notOptional()->validate([[''), [0]]); // true -v::notOptional()->validate(new stdClass()); // true -``` - -*** -See also: - - * [NoWhitespace](NoWhitespace.md) - * [NotBlank](NotBlank.md) - * [NotEmpty](NotEmpty.md) - * [NullType](NullType.md) - * [Optional](Optional.md) diff -Nru php-respect-validation-1.1.15/docs/NoWhitespace.md php-respect-validation-1.1.29/docs/NoWhitespace.md --- php-respect-validation-1.1.15/docs/NoWhitespace.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/NoWhitespace.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -# NoWhitespace - -- `v::noWhitespace()` - -Validates if a string contains no whitespace (spaces, tabs and line breaks); - -```php -v::noWhitespace()->validate('foo bar'); //false -v::noWhitespace()->validate("foo\nbar"); // false -``` - -This is most useful when chaining with other validators such as `v::alnum()` - -*** -See also: - - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) - * [NotBlank](NotBlank.md) - * [NotEmpty](NotEmpty.md) - * [NotOptional](NotOptional.md) diff -Nru php-respect-validation-1.1.15/docs/NullType.md php-respect-validation-1.1.29/docs/NullType.md --- php-respect-validation-1.1.15/docs/NullType.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/NullType.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -# NullType - -- `v::nullType()` - -Validates if the input is null. - -```php -v::nullType()->validate(null); // true -``` - -*** -See also: - - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [NotBlank](NotBlank.md) - * [NotEmpty](NotEmpty.md) - * [NotOptional](NotOptional.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/Numeric.md php-respect-validation-1.1.29/docs/Numeric.md --- php-respect-validation-1.1.15/docs/Numeric.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Numeric.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -# Numeric - -- `v::numeric()` - -Validates on any numeric value. - -```php -v::numeric()->validate(-12); // true -v::numeric()->validate('135.0'); // true -``` - -*** -See also: - - * [Digit](Digit.md) - * [Finite](Finite.md) - * [Infinite](Infinite.md) - * [IntVal](IntVal.md) diff -Nru php-respect-validation-1.1.15/docs/ObjectType.md php-respect-validation-1.1.29/docs/ObjectType.md --- php-respect-validation-1.1.15/docs/ObjectType.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/ObjectType.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -# ObjectType - -- `v::objectType()` - -Validates if the input is an object. - -```php -v::objectType()->validate(new stdClass); // true -``` - -*** -See also: - - * [Attribute](Attribute.md) - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [Instance](Instance.md) - * [IntType](IntType.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/Odd.md php-respect-validation-1.1.29/docs/Odd.md --- php-respect-validation-1.1.15/docs/Odd.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Odd.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Odd - -- `v::odd()` - -Validates an odd number. - -```php -v::intVal()->odd()->validate(3); // true -``` - -Using `int()` before `odd()` is a best practice. - -*** -See also: - - * [Even](Even.md) - * [Multiple](Multiple.md) diff -Nru php-respect-validation-1.1.15/docs/OneOf.md php-respect-validation-1.1.29/docs/OneOf.md --- php-respect-validation-1.1.15/docs/OneOf.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/OneOf.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -# OneOf - -- `v::oneOf(v $v1, v $v2, v $v3...)` - -This is a group validator that acts as an OR operator. - -```php -v::oneOf( - v::intVal(), - v::floatVal() -)->validate(15.5); // true -``` - -In the sample above, `v::intVal()` doesn't validates, but -`v::floatVal()` validates, so oneOf returns true. - -`v::oneOf` returns true if at least one inner validator -passes. - -*** -See also: - - * [AllOf](AllOf.md) - * [NoneOf](NoneOf.md) - * [When](When.md) diff -Nru php-respect-validation-1.1.15/docs/Optional.md php-respect-validation-1.1.29/docs/Optional.md --- php-respect-validation-1.1.15/docs/Optional.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Optional.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -# Optional - -- `v::optional(v $rule)` - -Validates if the given input is optional or not. By _optional_ we consider `null` -or an empty string (`''`). - -```php -v::optional(v::alpha())->validate(''); // true -v::optional(v::digit())->validate(null); // true -``` - - -*** -See also: - - * [NoWhitespace](NoWhitespace.md) - * [NotBlank](NotBlank.md) - * [NotEmpty](NotEmpty.md) - * [NotOptional](NotOptional.md) - * [NullType](NullType.md) diff -Nru php-respect-validation-1.1.15/docs/PerfectSquare.md php-respect-validation-1.1.29/docs/PerfectSquare.md --- php-respect-validation-1.1.15/docs/PerfectSquare.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/PerfectSquare.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -# PerfectSquare - -- `v::perfectSquare()` - -Validates a perfect square. - -```php -v::perfectSquare()->validate(25); // true (5*5) -v::perfectSquare()->validate(9); // true (3*3) -``` - -*** -See also: - - * [Factor](Factor.md) - * [PrimeNumber](PrimeNumber.md) diff -Nru php-respect-validation-1.1.15/docs/Pesel.md php-respect-validation-1.1.29/docs/Pesel.md --- php-respect-validation-1.1.15/docs/Pesel.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Pesel.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -# Pesel - -- `v::pesel()` - -Validates PESEL (Polish human identification number). - -```php -v::pesel()->validate('21120209256'); // true -v::pesel()->validate('97072704800'); // true -v::pesel()->validate('97072704801'); // false -v::pesel()->validate('PESEL123456'); // false -``` diff -Nru php-respect-validation-1.1.15/docs/Phone.md php-respect-validation-1.1.29/docs/Phone.md --- php-respect-validation-1.1.15/docs/Phone.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Phone.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Phone - -- `v::phone()` - -Validates a valid 7, 10, 11 digit phone number (North America, Europe and most -Asian and Middle East countries), supporting country and area codes (in dot, -space or dashed notations) such as: - - (555)555-5555 - 555 555 5555 - +5(555)555.5555 - 33(1)22 22 22 22 - +33(1)22 22 22 22 - +33(020)7777 7777 - 03-6106666 - -*** -See also: - - * [Email](Email.md) - * [Url](Url.md) - * [VideoUrl](VideoUrl.md) diff -Nru php-respect-validation-1.1.15/docs/PhpLabel.md php-respect-validation-1.1.29/docs/PhpLabel.md --- php-respect-validation-1.1.15/docs/PhpLabel.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/PhpLabel.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -# PhpLabel - -- `v::phpLabel()` - -Validates if a value is considered a valid PHP Label, -so that it can be used as a *variable*, *function* or *class* name, for example. - -Reference: -http://php.net/manual/en/language.variables.basics.php - -```php -v::phpLabel()->validate('person'); //true -v::phpLabel()->validate('foo'); //true -v::phpLabel()->validate('4ccess'); //false -``` - -*** -See also: - - * [Regex](Regex.md) - * [ResourceType](ResourceType.md) - * [Slug](Slug.md) - * [Charset](Charset.md) - \ No newline at end of file diff -Nru php-respect-validation-1.1.15/docs/Positive.md php-respect-validation-1.1.29/docs/Positive.md --- php-respect-validation-1.1.15/docs/Positive.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Positive.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -# Positive - -- `v::positive()` - -Validates if a number is higher than zero - -```php -v::numeric()->positive()->validate(-15); // false -``` - -*** -See also: - - * [Negative](Negative.md) diff -Nru php-respect-validation-1.1.15/docs/PostalCode.md php-respect-validation-1.1.29/docs/PostalCode.md --- php-respect-validation-1.1.15/docs/PostalCode.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/PostalCode.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# PostalCode - -- `v::postalCode(string $countryCode)` - -Validates a postal code according to the given country code. - -```php -v::postalCode('BR')->validate('02179000'); // true -v::postalCode('BR')->validate('02179-000'); // true -v::postalCode('US')->validate('02179-000'); // false -v::postalCode('US')->validate('55372'); // true -v::postalCode('PL')->validate('99-300'); // true -``` - -Message template for this validator includes `{{countryCode}}`. - -Extracted from [GeoNames](http://www.geonames.org/). - -*** -See also: - - * [CountryCode](CountryCode.md) diff -Nru php-respect-validation-1.1.15/docs/PrimeNumber.md php-respect-validation-1.1.29/docs/PrimeNumber.md --- php-respect-validation-1.1.15/docs/PrimeNumber.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/PrimeNumber.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -# PrimeNumber - -- `v::primeNumber()` - -Validates a prime number - -```php -v::primeNumber()->validate(7); // true -``` - -*** -See also: - - * [Factor](Factor.md) - * [PerfectSquare](PerfectSquare.md) - * [PrimeNumber](PrimeNumber.md) diff -Nru php-respect-validation-1.1.15/docs/Prnt.md php-respect-validation-1.1.29/docs/Prnt.md --- php-respect-validation-1.1.15/docs/Prnt.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Prnt.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# Prnt - -- `v::prnt()` -- `v::prnt(string $additionalChars)` - -Similar to `v::graph` but accepts whitespace. - -```php -v::prnt()->validate('LMKA0$% _123'); // true -``` - -*** -See also: - - * [Graph](Graph.md) diff -Nru php-respect-validation-1.1.15/docs/Punct.md php-respect-validation-1.1.29/docs/Punct.md --- php-respect-validation-1.1.15/docs/Punct.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Punct.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Punct - -- `v::punct()` -- `v::punct(string $additionalChars)` - -Accepts only punctuation characters: - -```php -v::punct()->validate('&,.;[]'); // true -``` - -*** -See also: - - * [Cntrl](Cntrl.md) - * [Graph](Graph.md) - * [Prnt](Prnt.md) diff -Nru php-respect-validation-1.1.15/docs/Readable.md php-respect-validation-1.1.29/docs/Readable.md --- php-respect-validation-1.1.15/docs/Readable.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Readable.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -# Readable - -- `v::readable()` - -Validates if the given data is a file exists and is readable. - -```php -v::readable()->validate('/path/of/a/readable/file'); // true -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/README.md php-respect-validation-1.1.29/docs/README.md --- php-respect-validation-1.1.15/docs/README.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,310 +0,0 @@ -# Feature Guide - -## Namespace import - -Respect\Validation is namespaced, but you can make your life easier by importing -a single class into your context: - -```php -use Respect\Validation\Validator as v; -``` - -## Simple validation - -The Hello World validator is something like this: - -```php -$number = 123; -v::numeric()->validate($number); // true -``` - -## Chained validation - -It is possible to use validators in a chain. Sample below validates a string -containing numbers and letters, no whitespace and length between 1 and 15. - -```php -$usernameValidator = v::alnum()->noWhitespace()->length(1, 15); -$usernameValidator->validate('alganet'); // true -``` - -## Validating object attributes - -Given this simple object: - -```php -$user = new stdClass; -$user->name = 'Alexandre'; -$user->birthdate = '1987-07-01'; -``` - -Is possible to validate its attributes in a single chain: - -```php -$userValidator = v::attribute('name', v::stringType()->length(1,32)) - ->attribute('birthdate', v::date()->age(18)); - -$userValidator->validate($user); // true -``` - -Validating array keys is also possible using `v::key()` - -Note that we used `v::stringType()` and `v::date()` in the beginning of the validator. -Although is not mandatory, it is a good practice to use the type of the -validated object as the first node in the chain. - -## Input optional - -On oldest versions of Respect\Validation all validators treat input as optional -and accept an empty string input as valid. Even though a useful feature that -caused a lot of troubles for our team and neither was an obvious behavior. Also -there was some people who likes to accept `null` as optional value, not only an -empty string. - -For that reason all rules are mandatory now but if you want to treat a value as -optional you can use `v::optional()` rule: - -```php -v::alpha()->validate(''); // false input required -v::alpha()->validate(null); // false input required - -v::optional(v::alpha())->validate(''); // true -v::optional(v::alpha())->validate(null); // true -``` - -By _optional_ we consider `null` or an empty string (`''`). - -See more on [Optional](Optional.md). - -## Negating rules - -You can use the `v::not()` to negate any rule: - -```php -v::not(v::intVal())->validate(10); // false, input must not be integer -``` - -## Validator reuse - -Once created, you can reuse your validator anywhere. Remember `$usernameValidator`? - -```php -$usernameValidator->validate('respect'); //true -$usernameValidator->validate('alexandre gaigalas'); // false -$usernameValidator->validate('#$%'); //false -``` - -## Exception types - -* `Respect\Validation\Exceptions\ExceptionInterface`: - * All exceptions implement this interface; -* `Respect\Validation\Exceptions\ValidationException`: - * Implements the `Respect\Validation\Exceptions\ExceptionInterface` interface - * Thrown when the `check()` fails - * All validation exceptions extend this class - * Available methods: - * `getMainMessage()`; - * `setMode($mode)`; - * `setName($name)`; - * `setParam($name, $value)`; - * `setTemplate($template)`; - * more... -* `Respect\Validation\Exceptions\NestedValidationException`: - * Extends the `Respect\Validation\Exceptions\ValidationException` class - * Usually thrown when the `assert()` fails - * Available methods: - * `findMessages()`; - * `getFullMessage()`; - * `getMessages()`; - * more... - -## Informative exceptions - -When something goes wrong, Validation can tell you exactly what's going on. For this, -we use the `assert()` method instead of `validate()`: - -```php -use Respect\Validation\Exceptions\NestedValidationException; - -try { - $usernameValidator->assert('really messed up screen#name'); -} catch(NestedValidationException $exception) { - echo $exception->getFullMessage(); -} -``` - -The printed message is exactly this, as a nested Markdown list: - -```no-highlight -- All of the required rules must pass for "really messed up screen#name" - - "really messed up screen#name" must contain only letters (a-z) and digits (0-9) - - "really messed up screen#name" must not contain whitespace - - "really messed up screen#name" must have a length between 1 and 15 -``` - -## Getting all messages as an array - -The Markdown list is fine, but unusable on a HTML form or something more custom. -For that you can use `getMessages()`. - -It will return all messages from the rules that did not pass the validation. - -```php -try { - $usernameValidator->assert('really messed up screen#name'); -} catch(NestedValidationException $exception) { - print_r($exception->getMessages()); -} -``` - -The code above may display something like: - -```no-highlight -Array -( - [0] => "really messed up screen#name" must contain only letters (a-z) and digits (0-9) - [1] => "really messed up screen#name" must not contain whitespace - [2] => "really messed up screen#name" must have a length between 1 and 15 -) -``` - -## Getting messages as an array by name - -If you want to get specific message by name you can use `findMessages()` passing -the names of the rules you want: - -```php -try { - $usernameValidator->assert('really messed up screen#name'); -} catch(NestedValidationException $exception) { - print_r($exception->findMessages(['alnum', 'noWhitespace'])); -} -``` - -The `findMessages()` returns an array with messages from the requested validators, -like this: - -```no-highlight -Array -( - [alnum] => "really messed up screen#name" must contain only letters (a-z) and digits (0-9) - [noWhitespace] => "really messed up screen#name" must not contain whitespace -) -``` - -## Custom messages - -Getting messages as an array is fine, but sometimes you need to customize them in order -to present them to the user. This is possible using the `findMessages()` method as well: - -```php -$errors = $exception->findMessages([ - 'alnum' => '{{name}} must contain only letters and digits', - 'length' => '{{name}} must not have more than 15 chars', - 'noWhitespace' => '{{name}} cannot contain spaces' -]); -``` - -For all messages, the `{{name}}` variable is available for templates. If you -do not define a name it uses the input to replace this placeholder. - -## Message localization - -You're also able to translate your message to another language with Validation. -The only thing one must do is to define the param `translator` as a callable that -will handle the translation: - -```php -$exception->setParam('translator', 'gettext'); -``` - -The example above uses `gettext()` but you can use any other callable value, like -`[$translator, 'trans']` or `you_custom_function()`. - -After that, if you call `getMainMessage()` or `getFullMessage()` (for nested), -the message will be translated. - -Note that `getMessage()` will keep the original message. - -## Custom rules - -You also can use your own rules: - -```php -namespace My\Validation\Rules; - -use Respect\Validation\Rules\AbstractRule; - -class MyRule extends AbstractRule -{ - public function validate($input) - { - // Do something here with the $input and return a boolean value - } -} -``` - -If you do want Validation to execute you rule (or rules) in the chain, you must -use `v::with()` passing your rule's namespace as an argument: - -```php -v::with('My\\Validation\\Rules\\'); -v::myRule(); // Try to load "My\Validation\Rules\MyRule" if any -``` - -By default `with()` appends the given prefix, but you can change this behavior -in order to overwrite default rules: - -```php -v::with('My\\Validation\\Rules', true); -v::alnum(); // Try to use "My\Validation\Rules\Alnum" if any -``` - -## Validator name - -On `v::attribute()` and `v::key()`, `{{name}}` is the attribute/key name. For others, -is the same as the input. You can customize a validator name using: - -```php -v::date('Y-m-d')->between('1980-02-02', 'now')->setName('Member Since'); -``` - -## Zend/Symfony validators - -It is also possible to reuse validators from other frameworks if they are installed: - -```php -$hostnameValidator = v::zend('Hostname')->assert('google.com'); -$timeValidator = v::sf('Time')->assert('22:00:01'); -``` - -## Validation methods - -We've seen `validate()` that returns true or false and `assert()` that throws a complete -validation report. There is also a `check()` method that returns an Exception -only with the first error found: - -```php -use Respect\Validation\Exceptions\ValidationException; - -try { - $usernameValidator->check('really messed up screen#name'); -} catch(ValidationException $exception) { - echo $exception->getMainMessage(); -} -``` - -Message: - -```no-highlight -"really messed up screen#name" must contain only letters (a-z) and digits (0-9) -``` - -*** -See also: - -- [Contributing](../CONTRIBUTING.md) -- [Installation](INSTALL.md) -- [License](../LICENSE.md) -- [Validators](VALIDATORS.md) -- [Changelog](../CHANGELOG.md) diff -Nru php-respect-validation-1.1.15/docs/Regex.md php-respect-validation-1.1.29/docs/Regex.md --- php-respect-validation-1.1.15/docs/Regex.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Regex.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -# Regex - -- `v::regex(string $regex)` - -Evaluates a regex on the input and validates if matches - -```php -v::regex('/[a-z]/')->validate('a'); // true -``` - -Message template for this validator includes `{{regex}}` - -*** -See also: - - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) - * [Contains](Contains.md) - * [Digit](Digit.md) - * [EndsWith](EndsWith.md) - * [StartsWith](StartsWith.md) diff -Nru php-respect-validation-1.1.15/docs/ResourceType.md php-respect-validation-1.1.29/docs/ResourceType.md --- php-respect-validation-1.1.15/docs/ResourceType.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/ResourceType.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -# ResourceType - -- `v::resourceType()` - -Validates if the input is a resource. - -```php -v::resourceType()->validate(fopen('/path/to/file.txt', 'w')); // true -``` - -*** -See also: - - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/Roman.md php-respect-validation-1.1.29/docs/Roman.md --- php-respect-validation-1.1.15/docs/Roman.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Roman.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -# Roman - -- `v::roman()` - -Validates roman numbers - -```php -v::roman()->validate('IV'); // true -``` - -*** -See also: - - * [In](In.md) - * [Regex](Regex.md) - * [Uppercase](Uppercase.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Age.md php-respect-validation-1.1.29/docs/rules/Age.md --- php-respect-validation-1.1.15/docs/rules/Age.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Age.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,46 @@ +# Age + +- `v::age(int $minAge)` +- `v::age(int $minAge, int $maxAge)` +- `v::age(null, int $maxAge)` + +Validates ranges of years. + +The validated values can be any date value; internally they will be transformed +into [DateTime](http://php.net/manual/en/class.datetime.php) objects according +to the defined locale settings. + +The examples below validate if the given dates are lower or equal to 18 years ago: +```php +v::age(18)->validate('17 years ago'); // false +v::age(18)->validate('18 years ago'); // true +v::age(18)->validate('19 years ago'); // true +v::age(18)->validate('1970-01-01'); // true +v::age(18)->validate('today'); // false +``` + +The examples below validate if the given dates are between 10 and 50 years ago: +```php +v::age(10, 50)->validate('9 years ago'); // false +v::age(10, 50)->validate('10 years ago'); // true +v::age(10, 50)->validate('30 years ago'); // true +v::age(10, 50)->validate('50 years ago'); // true +v::age(10, 50)->validate('51 years ago'); // false +``` + +The examples below validate if the given dates are greater than or equal to 70 years ago: +```php +v::age(null, 70)->validate('today'); // true +v::age(null, 70)->validate('70 years ago'); // true +v::age(null, 70)->validate('71 years ago'); // false +``` + +Message template for this validator includes `{{minAge}}` and `{{maxAge}}`. + +*** +See also: + + * [Between](Between.md) + * [Date](Date.md) + * [Max](Max.md) + * [Min](Min.md) diff -Nru php-respect-validation-1.1.15/docs/rules/AllOf.md php-respect-validation-1.1.29/docs/rules/AllOf.md --- php-respect-validation-1.1.15/docs/rules/AllOf.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/AllOf.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,30 @@ +# AllOf + +- `v::allOf(v $v1, v $v2, v $v3...)` + +Will validate if all inner validators validates. + +```php +v::allOf( + v::intVal(), + v::positive() +)->validate(15); // true +``` + +This is similar to the chain (which is an allOf already), but +its syntax allows you to set custom names for every node: + +```php +v::allOf( + v::intVal()->setName('Account Number'), + v::positive()->setName('Higher Than Zero') +)->setName('Positive integer') + ->validate(15); // true +``` + +*** +See also: + + * [OneOf](OneOf.md) + * [NoneOf](NoneOf.md) + * [When](When.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Alnum.md php-respect-validation-1.1.29/docs/rules/Alnum.md --- php-respect-validation-1.1.15/docs/rules/Alnum.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Alnum.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,44 @@ +# Alnum + +- `v::alnum()` +- `v::alnum(string $additionalChars)` + +Validates alphanumeric characters from a-Z and 0-9. + +```php +v::alnum()->validate('foo 123'); // true +v::alnum()->validate('number 100%'); // false +v::alnum('%')->validate('number 100%'); // true +``` + +Because this rule allows whitespaces by default, you can separate additional +characters with a whitespace: + +```php +v::alnum('- ! :')->validate('foo :- 123 !'); // true +``` + +This validator allows whitespace, if you want to +remove them add `->noWhitespace()` to the chain: + +```php +v::alnum()->noWhitespace()->validate('foo 123'); // false +``` + +You can restrict case using the `->lowercase()` and +`->uppercase()` validators: + +```php +v::alnum()->uppercase()->validate('aaa'); // false +``` + +Message template for this validator includes `{{additionalChars}}` as +the string of extra chars passed as the parameter. + +*** +See also: + + * [Alpha](Alpha.md) + * [Digit](Digit.md) + * [Consonant](Consonant.md) + * [Vowel](Vowel.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Alpha.md php-respect-validation-1.1.29/docs/rules/Alpha.md --- php-respect-validation-1.1.15/docs/rules/Alpha.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Alpha.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,14 @@ +# Alpha + +- `v::alpha()` +- `v::alpha(string $additionalChars)` + +This is similar to `v::alnum()`, but it doesn't allow numbers. + +*** +See also: + + * [Alnum](Alnum.md) + * [Digit](Digit.md) + * [Consonant](Consonant.md) + * [Vowel](Vowel.md) diff -Nru php-respect-validation-1.1.15/docs/rules/AlwaysInvalid.md php-respect-validation-1.1.29/docs/rules/AlwaysInvalid.md --- php-respect-validation-1.1.15/docs/rules/AlwaysInvalid.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/AlwaysInvalid.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,14 @@ +# AlwaysInvalid + +- `v::alwaysInvalid()` + +Always return false. + +```php +v::alwaysInvalid()->validate($whatever); // false +``` + +*** +See also: + + * [AlwaysValid](AlwaysValid.md) diff -Nru php-respect-validation-1.1.15/docs/rules/AlwaysValid.md php-respect-validation-1.1.29/docs/rules/AlwaysValid.md --- php-respect-validation-1.1.15/docs/rules/AlwaysValid.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/AlwaysValid.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,14 @@ +# AlwaysValid + +- `v::alwaysValid()` + +Always returns true. + +```php +v::alwaysValid()->validate($whatever); // true +``` + +*** +See also: + + * [AlwaysInvalid](AlwaysInvalid.md) diff -Nru php-respect-validation-1.1.15/docs/rules/ArrayType.md php-respect-validation-1.1.29/docs/rules/ArrayType.md --- php-respect-validation-1.1.15/docs/rules/ArrayType.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/ArrayType.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,27 @@ +# ArrayType + +- `v::arrayType()` + +Validates whether the type of an input is array. + +```php +v::arrayType()->validate([]); // true +v::arrayType()->validate([1, 2, 3]); // true +v::arrayType()->validate(new ArrayObject()); // false +``` + +*** +See also: + + * [ArrayVal](ArrayVal.md) + * [BoolType](BoolType.md) + * [CallableType](CallableType.md) + * [Countable](Countable.md) + * [FloatType](FloatType.md) + * [IntType](IntType.md) + * [IterableType](IterableType.md) + * [NullType](NullType.md) + * [ObjectType](ObjectType.md) + * [ResourceType](ResourceType.md) + * [StringType](StringType.md) + * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/rules/ArrayVal.md php-respect-validation-1.1.29/docs/rules/ArrayVal.md --- php-respect-validation-1.1.15/docs/rules/ArrayVal.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/ArrayVal.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,22 @@ +# ArrayVal + +- `v::arrayVal()` + +Validates if the input is an array or if the input can be used as an array +(instance of `ArrayAccess`). + +```php +v::arrayVal()->validate([]); // true +v::arrayVal()->validate(new ArrayObject); // true +``` + +*** +See also: + + * [ArrayType](ArrayType.md) + * [Countable](Countable.md) + * [Each](Each.md) + * [IterableType](IterableType.md) + * [Key](Key.md) + * [KeySet](KeySet.md) + * [KeyValue](KeyValue.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Attribute.md php-respect-validation-1.1.29/docs/rules/Attribute.md --- php-respect-validation-1.1.15/docs/rules/Attribute.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Attribute.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,33 @@ +# Attribute + +- `v::attribute(string $name)` +- `v::attribute(string $name, v $validator)` +- `v::attribute(string $name, v $validator, boolean $mandatory = true)` + +Validates an object attribute. + +```php +$obj = new stdClass; +$obj->foo = 'bar'; + +v::attribute('foo')->validate($obj); // true +``` + +You can also validate the attribute itself: + +```php +v::attribute('foo', v::equals('bar'))->validate($obj); // true +``` + +Third parameter makes the attribute presence optional: + +```php +v::attribute('lorem', v::stringType(), false)->validate($obj); // true +``` + +The name of this validator is automatically set to the attribute name. + +*** +See also: + + * [Key](Key.md) diff -Nru php-respect-validation-1.1.15/docs/rules/BankAccount.md php-respect-validation-1.1.29/docs/rules/BankAccount.md --- php-respect-validation-1.1.15/docs/rules/BankAccount.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/BankAccount.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,20 @@ +# BankAccount + +- `v::bankAccount(string $countryCode, string $bank)` + +Validates a bank account for a given bank. + +```php +v::bankAccount("de", "70169464")->validate("1112"); // true +v::bankAccount("de", "70169464")->validate("1234"); // false +``` + +These country codes are supported: + + * "de" (Germany) - You must add `"malkusch/bav": "~1.0"` to your `require` property on composer.json file. + +*** +See also: + + * [Bank](Bank.md) + * [Bic](Bic.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Bank.md php-respect-validation-1.1.29/docs/rules/Bank.md --- php-respect-validation-1.1.15/docs/rules/Bank.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Bank.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,20 @@ +# Bank + +- `v::bank(string $countryCode)` + +Validates a bank. + +```php +v::bank("de")->validate("70169464"); // true +v::bank("de")->validate("12345"); // false +``` + +These country codes are supported: + + * "de" (Germany) - You must add `"malkusch/bav": "~1.0"` to your `require` property on composer.json file. + +*** +See also: + + * [BankAccount](BankAccount.md) + * [Bic](Bic.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Between.md php-respect-validation-1.1.29/docs/rules/Between.md --- php-respect-validation-1.1.15/docs/rules/Between.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Between.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,44 @@ +# Between + +- `v::between(mixed $start, mixed $end)` +- `v::between(mixed $start, mixed $end, boolean $inclusive = true)` + +Validates ranges. Most simple example: + +```php +v::intVal()->between(10, 20)->validate(15); // true +``` + +The type as the first validator in a chain is a good practice, +since between accepts many types: + +```php +v::stringType()->between('a', 'f')->validate('c'); // true +``` + +Also very powerful with dates: + +```php +v::date()->between('2009-01-01', '2013-01-01')->validate('2010-01-01'); // true +``` + +Date ranges accept strtotime values: + +```php +v::date()->between('yesterday', 'tomorrow')->validate('now'); // true +``` + +A third parameter may be passed to validate the passed values inclusive: + +```php +v::date()->between(10, 20, true)->validate(20); // true +``` + +Message template for this validator includes `{{minValue}}` and `{{maxValue}}`. + +*** +See also: + + * [Length](Length.md) + * [Min](Min.md) + * [Max](Max.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Bic.md php-respect-validation-1.1.29/docs/rules/Bic.md --- php-respect-validation-1.1.15/docs/rules/Bic.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Bic.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,20 @@ +# Bic + +- `v::bic(string $countryCode)` + +Validates a BIC (Bank Identifier Code) for a given country. + +```php +v::bic("de")->validate("VZVDDED1XXX"); // true +v::bic("de")->validate("VZVDDED1"); // true +``` + +Theses country codes are supported: + + * "de" (Germany) - You must add `"malkusch/bav": "~1.0"` to your `require` property on composer.json file. + +*** +See also: + + * [Bank](Bank.md) + * [BankAccount](BankAccount.md) diff -Nru php-respect-validation-1.1.15/docs/rules/BoolType.md php-respect-validation-1.1.29/docs/rules/BoolType.md --- php-respect-validation-1.1.15/docs/rules/BoolType.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/BoolType.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,27 @@ +# BoolType + +- `v::boolType()` + +Validates if the input is a boolean value: + +```php +v::boolType()->validate(true); // true +v::boolType()->validate(false); // true +``` + +*** +See also: + + * [ArrayType](ArrayType.md) + * [CallableType](CallableType.md) + * [FloatType](FloatType.md) + * [FloatVal](FloatVal.md) + * [IntType](IntType.md) + * [No](No.md) + * [NullType](NullType.md) + * [ObjectType](ObjectType.md) + * [ResourceType](ResourceType.md) + * [StringType](StringType.md) + * [TrueVal](TrueVal.md) + * [Type](Type.md) + * [Yes](Yes.md) diff -Nru php-respect-validation-1.1.15/docs/rules/BoolVal.md php-respect-validation-1.1.29/docs/rules/BoolVal.md --- php-respect-validation-1.1.15/docs/rules/BoolVal.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/BoolVal.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,31 @@ +# BoolVal + +- `v::boolVal()` + +Validates if the input results in a boolean value: + +```php +v::boolVal()->validate('on'); // true +v::boolVal()->validate('off'); // true +v::boolVal()->validate('yes'); // true +v::boolVal()->validate('no'); // true +v::boolVal()->validate(1); // true +v::boolVal()->validate(0); // true +``` + +*** +See also: + + * [BoolType](BoolType.md) + * [CallableType](CallableType.md) + * [FloatType](FloatType.md) + * [FloatVal](FloatVal.md) + * [IntType](IntType.md) + * [No](No.md) + * [NullType](NullType.md) + * [ObjectType](ObjectType.md) + * [ResourceType](ResourceType.md) + * [StringType](StringType.md) + * [TrueVal](TrueVal.md) + * [Type](Type.md) + * [Yes](Yes.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Bsn.md php-respect-validation-1.1.29/docs/rules/Bsn.md --- php-respect-validation-1.1.15/docs/rules/Bsn.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Bsn.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,16 @@ +# Bsn + +- `v::bsn()` + +Validates a Dutch citizen service number ([BSN](https://nl.wikipedia.org/wiki/Burgerservicenummer)). + +```php +v::bsn()->validate('612890053'); // true +``` + +*** +See also: + + * [Cnh](Cnh.md) + * [Cnpj](Cnpj.md) + * [Cpf](Cpf.md) diff -Nru php-respect-validation-1.1.15/docs/rules/CallableType.md php-respect-validation-1.1.29/docs/rules/CallableType.md --- php-respect-validation-1.1.15/docs/rules/CallableType.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/CallableType.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,25 @@ +# CallableType + +- `v::callableType()` + +Validates if the input is a callable value. + +```php +v::callableType()->validate(function () {}); // true +v::callableType()->validate('trim'); // true +v::callableType()->validate([new ObjectType, 'methodName']); // true +``` + +*** +See also: + + * [ArrayType](ArrayType.md) + * [BoolType](BoolType.md) + * [Callback](Callback.md) + * [FloatType](FloatType.md) + * [IntType](IntType.md) + * [NullType](NullType.md) + * [ObjectType](ObjectType.md) + * [ResourceType](ResourceType.md) + * [StringType](StringType.md) + * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Callback.md php-respect-validation-1.1.29/docs/rules/Callback.md --- php-respect-validation-1.1.15/docs/rules/Callback.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Callback.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,21 @@ +# Callback + +- `v::callback(callable $callback)` + +This is a wildcard validator, it uses a function name, method or closure +to validate something: + +```php +v::callback('is_int')->validate(10); // true +``` + +(Please note that this is a sample, the `v::intVal()` validator is much better). + +As in `v::call()`, you can pass a method or closure to it. + +*** +See also: + + * [Call](Call.md) + * [CallableType](CallableType.md) + * [FilterVar](FilterVar.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Call.md php-respect-validation-1.1.29/docs/rules/Call.md --- php-respect-validation-1.1.15/docs/rules/Call.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Call.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,51 @@ +# Call + +- `v::call(callable $callback)` + +This is a very low level validator. It calls a function, method or closure +for the input and then validates it. Consider the following variable: + +```php +$url = 'http://www.google.com/search?q=respect.github.com' +``` + +To validate every part of this URL we could use the native `parse_url` +function to break its parts: + +```php +$parts = parse_url($url); +``` + +This function returns an array containing `scheme`, `host`, `path` and `query`. +We can validate them this way: + +```php +v::arrayVal()->key('scheme', v::startsWith('http')) + ->key('host', v::domain()) + ->key('path', v::stringType()) + ->key('query', v::notEmpty()); +``` + +Using `v::call()` you can do this in a single chain: + +```php +v::call( + 'parse_url', + v::arrayVal()->key('scheme', v::startsWith('http')) + ->key('host', v::domain()) + ->key('path', v::stringType()) + ->key('query', v::notEmpty()) +)->validate($url); +``` + +It is possible to call methods and closures as the first parameter: + +```php +v::call([$myObj, 'methodName'], v::intVal())->validate($myInput); +v::call(function($input) {}, v::intVal())->validate($myInput); +``` + +*** +See also: + + * [Callback](Callback.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Charset.md php-respect-validation-1.1.29/docs/rules/Charset.md --- php-respect-validation-1.1.15/docs/rules/Charset.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Charset.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,19 @@ +# Charset + +- `v::charset(mixed $charset)` + +Validates if a string is in a specific charset. + +```php +v::charset('ASCII')->validate('açúcar'); // false +v::charset('ASCII')->validate('sugar'); //true +v::charset(['ISO-8859-1', 'EUC-JP'])->validate('日本国'); // true +``` + +The array format is a logic OR, not AND. + +*** +See also: + + * [Alnum](Alnum.md) + * [Alpha](Alpha.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Cnh.md php-respect-validation-1.1.29/docs/rules/Cnh.md --- php-respect-validation-1.1.15/docs/rules/Cnh.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Cnh.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,15 @@ +# Cnh + +- `v::cnh()` + +Validates a Brazillian driver's license. + +```php +v::cnh()->validate('02650306461'); // true +``` + +*** +See also: + + * [Cnpj](Cnpj.md) + * [Cpf](Cpf.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Cnpj.md php-respect-validation-1.1.29/docs/rules/Cnpj.md --- php-respect-validation-1.1.15/docs/rules/Cnpj.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Cnpj.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,12 @@ +# Cnpj + +- `v::cnpj()` + +Validates the Brazillian CNPJ number. Ignores non-digit chars, so +use `->digit()` if needed. + +*** +See also: + + * [Cpf](Cpf.md) + * [Cnh](Cnh.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Cntrl.md php-respect-validation-1.1.29/docs/rules/Cntrl.md --- php-respect-validation-1.1.15/docs/rules/Cntrl.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Cntrl.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Cntrl + +- `v::cntrl()` +- `v::cntrl(string $additionalChars)` + +This is similar to `v::alnum()`, but only accepts control characters: + +```php +v::cntrl()->validate("\n\r\t"); // true +``` + +*** +See also: + + * [Alnum](Alnum.md) + * [Prnt](Prnt.md) + * [Space](Space.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Consonant.md php-respect-validation-1.1.29/docs/rules/Consonant.md --- php-respect-validation-1.1.15/docs/rules/Consonant.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Consonant.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,18 @@ +# Consonant + +- `v::consonant()` +- `v::consonant(string $additionalChars)` + +Similar to `v::alnum()`. Validates strings that contain only consonants: + +```php +v::consonant()->validate('xkcd'); // true +``` + +*** +See also: + + * [Alnum](Alnum.md) + * [Digit](Digit.md) + * [Alpha](Alpha.md) + * [Vowel](Vowel.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Contains.md php-respect-validation-1.1.29/docs/rules/Contains.md --- php-respect-validation-1.1.15/docs/rules/Contains.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Contains.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,28 @@ +# Contains + +- `v::contains(mixed $value)` +- `v::contains(mixed $value, boolean $identical = false)` + +For strings: + +```php +v::contains('ipsum')->validate('lorem ipsum'); // true +``` + +For arrays: + +```php +v::contains('ipsum')->validate(['ipsum', 'lorem']); // true +``` + +A second parameter may be passed for identical comparison instead +of equal comparison. + +Message template for this validator includes `{{containsValue}}`. + +*** +See also: + + * [StartsWith](StartsWith.md) + * [EndsWith](EndsWith.md) + * [In](In.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Countable.md php-respect-validation-1.1.29/docs/rules/Countable.md --- php-respect-validation-1.1.15/docs/rules/Countable.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Countable.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,19 @@ +# Countable + +- `v::countable()` + +Validates if the input is countable, in other words, if you're allowed to use +[count()](http://php.net/count) function on it. + +```php +v::countable()->validate([]); // true +v::countable()->validate(new ArrayObject()); // true +v::countable()->validate('string'); // false +``` + +*** +See also: + + * [ArrayVal](ArrayVal.md) + * [Instance](Instance.md) + * [IterableType](IterableType.md) diff -Nru php-respect-validation-1.1.15/docs/rules/CountryCode.md php-respect-validation-1.1.29/docs/rules/CountryCode.md --- php-respect-validation-1.1.15/docs/rules/CountryCode.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/CountryCode.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,14 @@ +# CountryCode + +- `v::countryCode()` + +Validates an ISO country code like US or BR. + +```php +v::countryCode()->validate('BR'); // true +``` + +*** +See also: + + * [Tld](Tld.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Cpf.md php-respect-validation-1.1.29/docs/rules/Cpf.md --- php-respect-validation-1.1.15/docs/rules/Cpf.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Cpf.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,28 @@ +# Cpf + +- `v::cpf()` + +Validates a Brazillian CPF number. + +```php +v::cpf()->validate('44455566820'); // true +``` + +It ignores any non-digit char: + +```php +v::cpf()->validate('444.555.668-20'); // true +``` + +If you need to validate digits only, add `->digit()` to +the chain: + +```php +v::digit()->cpf()->validate('44455566820'); // true +``` + +*** +See also: + + * [Cnpj](Cnpj.md) + * [Cnh](Cnh.md) diff -Nru php-respect-validation-1.1.15/docs/rules/CreditCard.md php-respect-validation-1.1.29/docs/rules/CreditCard.md --- php-respect-validation-1.1.15/docs/rules/CreditCard.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/CreditCard.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,39 @@ +# CreditCard + +- `v::creditCard()` +- `v::creditCard(string $brand)` + +Validates a credit card number. + +```php +v::creditCard()->validate('5376 7473 9720 8720'); // true + +v::creditCard('American Express')->validate('340316193809364'); // true +v::creditCard('Diners Club')->validate('30351042633884'); // true +v::creditCard('Discover')->validate('6011000990139424'); // true +v::creditCard('JCB')->validate('3566002020360505'); // true +v::creditCard('Master')->validate('5376747397208720'); // true +v::creditCard('Visa')->validate('4024007153361885'); // true +``` + +The current supported brands are: + +- American Express +- Diners Club +- Discover +- JCB +- MasterCard +- Visa + +It ignores any non-digit chars, so use `->digit()` when appropriate. + +```php +v::digit()->creditCard()->validate('5376747397208720'); // true +``` + +*** +See also: + + * [Bank](Bank.md) + * [BankAccount](BankAccount.md) + * [Bic](Bic.md) diff -Nru php-respect-validation-1.1.15/docs/rules/CurrencyCode.md php-respect-validation-1.1.29/docs/rules/CurrencyCode.md --- php-respect-validation-1.1.15/docs/rules/CurrencyCode.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/CurrencyCode.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,15 @@ +# CurrencyCode + +- `v::currencyCode()` + +Validates an [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code like GBP or EUR. + +```php +v::currencyCode()->validate('GBP'); // true +``` + +*** +See also: + + * [CountryCode](CountryCode.md) + * [SubdivisionCode](SubdivisionCode.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Date.md php-respect-validation-1.1.29/docs/rules/Date.md --- php-respect-validation-1.1.15/docs/rules/Date.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Date.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,40 @@ +# Date + +- `v::date()` +- `v::date(string $format)` + +Validates if input is a date: + +```php +v::date()->validate('2009-01-01'); // true +``` + +Also accepts strtotime values: + +```php +v::date()->validate('now'); // true +``` + +And DateTime instances: + +```php +v::date()->validate(new DateTime); // true +``` + +You can pass a format when validating strings: + +```php +v::date('Y-m-d')->validate('01-01-2009'); // false +``` + +Format has no effect when validating DateTime instances. + +Message template for this validator includes `{{format}}`. + +*** +See also: + + * [Between](Between.md) + * [MinimumAge](MinimumAge.md) + * [LeapDate](LeapDate.md) + * [LeapYear](LeapYear.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Digit.md php-respect-validation-1.1.29/docs/rules/Digit.md --- php-respect-validation-1.1.15/docs/rules/Digit.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Digit.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,13 @@ +# Digit + +- `v::digit()` + +This is similar to `v::alnum()`, but it doesn't allow a-Z. + +*** +See also: + + * [Alnum](Alnum.md) + * [Alpha](Alpha.md) + * [Vowel](Vowel.md) + * [Consonant](Consonant.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Directory.md php-respect-validation-1.1.29/docs/rules/Directory.md --- php-respect-validation-1.1.15/docs/rules/Directory.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Directory.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,30 @@ +# Directory + +- `v::directory()` + +Validates directories. + +```php +v::directory()->validate(__DIR__); // true +v::directory()->validate(__FILE__); // false +``` + +This validator will consider SplFileInfo instances, so you can do something like: + +```php +v::directory()->validate(new \SplFileInfo($directory)); +``` + +*** +See also: + + * [Executable](Executable.md) + * [Exists](Exists.md) + * [Extension](Extension.md) + * [File](File.md) + * [Mimetype](Mimetype.md) + * [Readable](Readable.md) + * [Size](Size.md) + * [SymbolicLink](SymbolicLink.md) + * [Uploaded](Uploaded.md) + * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Domain.md php-respect-validation-1.1.29/docs/rules/Domain.md --- php-respect-validation-1.1.15/docs/rules/Domain.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Domain.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,40 @@ +# Domain + +- `v::domain()` +- `v::domain(boolean $tldCheck = true)` + +Validates domain names. + +```php +v::domain()->validate('google.com'); +``` + +You can skip *top level domain* (TLD) checks to validate internal +domain names: + +```php +v::domain(false)->validate('dev.machine.local'); +``` + +This is a composite validator, it validates several rules +internally: + + * If input is an IP address, it fails. + * If input contains whitespace, it fails. + * If input does not contain any dots, it fails. + * If input has less than two parts, it fails. + * Input must end with a top-level-domain to pass (if not skipped). + * Each part must be alphanumeric and not start with an hyphen. + * [PunnyCode][] is accepted for [Internationalizing Domain Names in Applications][IDNA]. + +Messages for this validator will reflect rules above. + +*** +See also: + + * [Ip](Ip.md) + * [MacAddress](MacAddress.md) + * [Tld](Tld.md) + +[PunnyCode]: http://en.wikipedia.org/wiki/Punycode "Wikipedia: Punnycode" +[IDNA]: http://en.wikipedia.org/wiki/Internationalized_domain_name#Internationalizing_Domain_Names_in_Applications "Wikipedia: Internationalized domain name" diff -Nru php-respect-validation-1.1.15/docs/rules/Each.md php-respect-validation-1.1.29/docs/rules/Each.md --- php-respect-validation-1.1.15/docs/rules/Each.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Each.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,27 @@ +# Each + +- `v::each(v $validatorForValue)` +- `v::each(null, v $validatorForKey)` +- `v::each(v $validatorForValue, v $validatorForKey)` + +Iterates over an array or Iterator and validates the value or key +of each entry: + +```php +$releaseDates = [ + 'validation' => '2010-01-01', + 'template' => '2011-01-01', + 'relational' => '2011-02-05', +]; + +v::arrayVal()->each(v::date())->validate($releaseDates); // true +v::arrayVal()->each(v::date(), v::stringType()->lowercase())->validate($releaseDates); // true +``` + +Using `arrayVal()` before `each()` is a best practice. + +*** +See also: + + * [Key](Key.md) + * [ArrayVal](ArrayVal.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Email.md php-respect-validation-1.1.29/docs/rules/Email.md --- php-respect-validation-1.1.15/docs/rules/Email.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Email.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,16 @@ +# Email + +- `v::email()` + +Validates an email address. + +```php +v::email()->validate('alexandre@gaigalas.net'); // true +``` + +*** +See also: + + * [Phone](Phone.md) + * [Url](Url.md) + * [VideoUrl](VideoUrl.md) diff -Nru php-respect-validation-1.1.15/docs/rules/EndsWith.md php-respect-validation-1.1.29/docs/rules/EndsWith.md --- php-respect-validation-1.1.15/docs/rules/EndsWith.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/EndsWith.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,31 @@ +# EndsWith + +- `v::endsWith(mixed $value)` +- `v::endsWith(mixed $value, boolean $identical = false)` + +This validator is similar to `v::contains()`, but validates +only if the value is at the end of the input. + +For strings: + +```php +v::endsWith('ipsum')->validate('lorem ipsum'); // true +``` + +For arrays: + +```php +v::endsWith('ipsum')->validate(['lorem', 'ipsum']); // true +``` + +A second parameter may be passed for identical comparison instead +of equal comparison. + +Message template for this validator includes `{{endValue}}`. + +*** +See also: + + * [StartsWith](StartsWith.md) + * [Contains](Contains.md) + * [In](In.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Equals.md php-respect-validation-1.1.29/docs/rules/Equals.md --- php-respect-validation-1.1.15/docs/rules/Equals.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Equals.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Equals + +- `v::equals(mixed $value)` + +Validates if the input is equal to some value. + +```php +v::equals('alganet')->validate('alganet'); // true +``` + +Message template for this validator includes `{{compareTo}}`. + +*** +See also: + + * [Contains](Contains.md) + * [Identical](Identical.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Even.md php-respect-validation-1.1.29/docs/rules/Even.md --- php-respect-validation-1.1.15/docs/rules/Even.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Even.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Even + +- `v::even()` + +Validates an even number. + +```php +v::intVal()->even()->validate(2); // true +``` + +Using `int()` before `even()` is a best practice. + +*** +See also: + + * [Odd](Odd.md) + * [Multiple](Multiple.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Executable.md php-respect-validation-1.1.29/docs/rules/Executable.md --- php-respect-validation-1.1.15/docs/rules/Executable.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Executable.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,23 @@ +# Executable + +- `v::executable()` + +Validates if a file is an executable. + +```php +v::email()->executable('script.sh'); // true +``` + +*** +See also: + + * [Directory](Directory.md) + * [Exists](Exists.md) + * [Extension](Extension.md) + * [File](File.md) + * [Mimetype](Mimetype.md) + * [Readable](Readable.md) + * [Size](Size.md) + * [SymbolicLink](SymbolicLink.md) + * [Uploaded](Uploaded.md) + * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Exists.md php-respect-validation-1.1.29/docs/rules/Exists.md --- php-respect-validation-1.1.15/docs/rules/Exists.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Exists.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,30 @@ +# Exists + +- `v::exists()` + +Validates files or directories. + +```php +v::exists()->validate(__FILE__); // true +v::exists()->validate(__DIR__); // true +``` + +This validator will consider SplFileInfo instances, so you can do something like: + +```php +v::exists()->validate(new \SplFileInfo($file)); +``` + +*** +See also: + + * [Directory](Directory.md) + * [Executable](Executable.md) + * [Extension](Extension.md) + * [File](File.md) + * [Mimetype](Mimetype.md) + * [Readable](Readable.md) + * [Size](Size.md) + * [SymbolicLink](SymbolicLink.md) + * [Uploaded](Uploaded.md) + * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Extension.md php-respect-validation-1.1.29/docs/rules/Extension.md --- php-respect-validation-1.1.15/docs/rules/Extension.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Extension.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,25 @@ +# Extension + +- `v::extension(string $extension)` + +Validates if the file extension matches the expected one: + +```php +v::extension('png')->validate('image.png'); // true +``` + +This rule is case-sensitive. + +*** +See also: + + * [Directory](Directory.md) + * [Executable](Executable.md) + * [Exists](Exists.md) + * [File](File.md) + * [Mimetype](Mimetype.md) + * [Readable](Readable.md) + * [Size](Size.md) + * [SymbolicLink](SymbolicLink.md) + * [Uploaded](Uploaded.md) + * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Factor.md php-respect-validation-1.1.29/docs/rules/Factor.md --- php-respect-validation-1.1.15/docs/rules/Factor.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Factor.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,19 @@ +# Factor + +- `v::factor(int $dividend)` + +Validates if the input is a factor of the defined dividend. + +```php +v::factor(0)->validate(5); // true +v::factor(4)->validate(2); // true +v::factor(4)->validate(3); // false +``` + +*** +See also: + + * [Digit](Digit.md) + * [Finite](Finite.md) + * [Infinite](Infinite.md) + * [Numeric](Numeric.md) diff -Nru php-respect-validation-1.1.15/docs/rules/FalseVal.md php-respect-validation-1.1.29/docs/rules/FalseVal.md --- php-respect-validation-1.1.15/docs/rules/FalseVal.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/FalseVal.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,21 @@ +# FalseVal + +- `v::falseVal()` + +Validates if a value is considered as `false`. + +```php +v::falseVal()->validate(false); // true +v::falseVal()->validate(0); // true +v::falseVal()->validate('0'); // true +v::falseVal()->validate('false'); // true +v::falseVal()->validate('off'); // true +v::falseVal()->validate('no'); // true +v::falseVal()->validate('0.5'); // false +v::falseVal()->validate('2'); // false +``` + +*** +See also: + + * [TrueVal](TrueVal.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Fibonacci.md php-respect-validation-1.1.29/docs/rules/Fibonacci.md --- php-respect-validation-1.1.15/docs/rules/Fibonacci.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Fibonacci.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Fibonacci + + - `v::fibonacci()` + +Validates whether the input follows the Fibonacci integer sequence. + +```php +v::fibonacci()->validate(1); // true +v::fibonacci()->validate('34'); // true +v::fibonacci()->validate(6); // false +``` + +*** +See also: + + * [PrimeNumber](PrimeNumber.md) + * [PerfectSquare](PerfectSquare.md) \ No newline at end of file diff -Nru php-respect-validation-1.1.15/docs/rules/File.md php-respect-validation-1.1.29/docs/rules/File.md --- php-respect-validation-1.1.15/docs/rules/File.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/File.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,30 @@ +# File + +- `v::file()` + +Validates files. + +```php +v::file()->validate(__FILE__); // true +v::file()->validate(__DIR__); // false +``` + +This validator will consider SplFileInfo instances, so you can do something like: + +```php +v::file()->validate(new \SplFileInfo($file)); +``` + +*** +See also: + + * [Directory](Directory.md) + * [Executable](Executable.md) + * [Exists](Exists.md) + * [Extension](Extension.md) + * [Mimetype](Mimetype.md) + * [Readable](Readable.md) + * [Size](Size.md) + * [SymbolicLink](SymbolicLink.md) + * [Uploaded](Uploaded.md) + * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/rules/FilterVar.md php-respect-validation-1.1.29/docs/rules/FilterVar.md --- php-respect-validation-1.1.15/docs/rules/FilterVar.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/FilterVar.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,18 @@ +# FilterVar + +- `v::filterVar(int $filter)` +- `v::filterVar(int $filter, mixed $options)` + +A wrapper for PHP's [filter_var()](http://php.net/filter_var) function. + +```php +v::filterVar(FILTER_VALIDATE_EMAIL)->validate('bob@example.com'); // true +v::filterVar(FILTER_VALIDATE_URL)->validate('http://example.com'); // true +v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->validate('http://example.com'); // false +v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->validate('http://example.com/path'); // true +``` + +*** +See also: + + * [Callback](Callback.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Finite.md php-respect-validation-1.1.29/docs/rules/Finite.md --- php-respect-validation-1.1.15/docs/rules/Finite.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Finite.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,18 @@ +# Finite + +- `v::finite()` + +Validates if the input is a finite number. + +```php +v::finite()->validate('10'); // true +v::finite()->validate(10); // true +``` + +*** +See also: + + * [Digit](Digit.md) + * [Infinite](Infinite.md) + * [IntVal](IntVal.md) + * [Numeric](Numeric.md) diff -Nru php-respect-validation-1.1.15/docs/rules/FloatType.md php-respect-validation-1.1.29/docs/rules/FloatType.md --- php-respect-validation-1.1.15/docs/rules/FloatType.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/FloatType.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,25 @@ +# FloatType + +- `v::floatType()` + +Validates whether the type of a value is float. + +```php +v::floatType()->validate(1.5); // true +v::floatType()->validate('1.5'); // false +v::floatType()->validate(0e5); // true +``` + +*** +See also: + + * [BoolType](BoolType.md) + * [CallableType](CallableType.md) + * [FloatVal](FloatVal.md) + * [IntType](IntType.md) + * [IntVal](IntVal.md) + * [NullType](NullType.md) + * [ObjectType](ObjectType.md) + * [ResourceType](ResourceType.md) + * [StringType](StringType.md) + * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/rules/FloatVal.md php-respect-validation-1.1.29/docs/rules/FloatVal.md --- php-respect-validation-1.1.15/docs/rules/FloatVal.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/FloatVal.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# FloatVal + +- `v::floatVal()` + +Validates a floating point number. + +```php +v::floatVal()->validate(1.5); // true +v::floatVal()->validate('1e5'); // true +``` + +*** +See also: + + * [FloatType](FloatType.md) + * [IntType](IntType.md) + * [IntVal](IntVal.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Graph.md php-respect-validation-1.1.29/docs/rules/Graph.md --- php-respect-validation-1.1.15/docs/rules/Graph.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Graph.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,15 @@ +# Graph + +- `v::graph()` +- `v::graph(string $additionalChars)` + +Validates all characters that are graphically represented. + +```php +v::graph()->validate('LKM@#$%4;'); // true +``` + +*** +See also: + + * [Prnt](Prnt.md) diff -Nru php-respect-validation-1.1.15/docs/rules/HexRgbColor.md php-respect-validation-1.1.29/docs/rules/HexRgbColor.md --- php-respect-validation-1.1.15/docs/rules/HexRgbColor.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/HexRgbColor.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,16 @@ +# HexRgbColor + +- `v::hexRgbColor()` + +Validates a hex RGB color + +```php +v::hexRgbColor()->validate('#FFFAAA'); // true +v::hexRgbColor()->validate('123123'); // true +v::hexRgbColor()->validate('FCD'); // true +``` + +*** +See also: + + * [Vxdigit](Vxdigit.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Identical.md php-respect-validation-1.1.29/docs/rules/Identical.md --- php-respect-validation-1.1.15/docs/rules/Identical.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Identical.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,18 @@ +# Identical + +- `v::identical(mixed $value)` + +Validates if the input is identical to some value. + +```php +v::identical(42)->validate(42); // true +v::identical(42)->validate('42'); // false +``` + +Message template for this validator includes `{{compareTo}}`. + +*** +See also: + + * [Contains](Contains.md) + * [Equals](Equals.md) diff -Nru php-respect-validation-1.1.15/docs/rules/IdentityCard.md php-respect-validation-1.1.29/docs/rules/IdentityCard.md --- php-respect-validation-1.1.15/docs/rules/IdentityCard.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/IdentityCard.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,21 @@ +# IdentityCard + +- `v::identityCard(string $countryCode)` + +Validates Identity Card numbers according to the defined country. + +```php +v::identityCard('PL')->validate('AYW036733'); // true +v::identityCard('PL')->validate('APH505567'); // true +v::identityCard('PL')->validate('APH 505567'); // false +v::identityCard('PL')->validate('AYW036731'); // false +``` + +For now this rule only accepts Polish Identity Card numbers (Dowód Osobisty). + +*** +See also: + + * [Bank](Bank.md) + * [Pesel](Pesel.md) + * [SubdivisionCode](SubdivisionCode.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Image.md php-respect-validation-1.1.29/docs/rules/Image.md --- php-respect-validation-1.1.15/docs/rules/Image.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Image.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,32 @@ +# Image + +- `v::image()` +- `v::image(finfo $fileInfo)` + +Validates if the file is a valid image by checking its MIME type. + +```php +v::image()->validate('image.gif'); // true +v::image()->validate('image.jpg'); // true +v::image()->validate('image.png'); // true +``` + +All the validations above must return `false` if the input is not a valid file +or of the MIME doesn't match with the file extension. + +This rule relies on [fileinfo](http://php.net/fileinfo) PHP extension. + +*** +See also: + + * [Directory](Directory.md) + * [Executable](Executable.md) + * [Exists](Exists.md) + * [Extension](Extension.md) + * [File](File.md) + * [Mimetype](Mimetype.md) + * [Readable](Readable.md) + * [Size](Size.md) + * [SymbolicLink](SymbolicLink.md) + * [Uploaded](Uploaded.md) + * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Imei.md php-respect-validation-1.1.29/docs/rules/Imei.md --- php-respect-validation-1.1.15/docs/rules/Imei.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Imei.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,20 @@ +# Imei + +- `v::imei()` + +Validates is the input is a valid [IMEI][]. + +```php +v::imei()->validate('35-209900-176148-1'); // true +v::imei()->validate('490154203237518'); // true +``` + +*** +See also: + + * [Bsn](Bsn.md) + * [Cnh](Cnh.md) + * [Cnpj](Cnpj.md) + * [Cpf](Cpf.md) + +[IMEI]: https://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity "International Mobile Station Equipment Identity" diff -Nru php-respect-validation-1.1.15/docs/rules/Infinite.md php-respect-validation-1.1.29/docs/rules/Infinite.md --- php-respect-validation-1.1.15/docs/rules/Infinite.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Infinite.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Infinite + +- `v::infinite()` + +Validates if the input is an infinite number. + +```php +v::infinite()->validate(INF); // true +``` + +*** +See also: + + * [Digit](Digit.md) + * [Finite](Finite.md) + * [IntVal](IntVal.md) + * [Numeric](Numeric.md) diff -Nru php-respect-validation-1.1.15/docs/rules/In.md php-respect-validation-1.1.29/docs/rules/In.md --- php-respect-validation-1.1.15/docs/rules/In.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/In.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,30 @@ +# In + +- `v::in(mixed $haystack)` +- `v::in(mixed $haystack, boolean $identical = false)` + +Validates if the input is contained in a specific haystack. + +For strings: + +```php +v::in('lorem ipsum')->validate('ipsum'); // true +``` + +For arrays: + +```php +v::in(['lorem', 'ipsum'])->validate('lorem'); // true +``` + +A second parameter may be passed for identical comparison instead +of equal comparison. + +Message template for this validator includes `{{haystack}}`. + +*** +See also: + + * [StartsWith](StartsWith.md) + * [EndsWith](EndsWith.md) + * [Contains](Contains.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Instance.md php-respect-validation-1.1.29/docs/rules/Instance.md --- php-respect-validation-1.1.15/docs/rules/Instance.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Instance.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Instance + +- `v::instance(string $instanceName)` + +Validates if the input is an instance of the given class or interface. + +```php +v::instance('DateTime')->validate(new DateTime); // true +v::instance('Traversable')->validate(new ArrayObject); // true +``` + +Message template for this validator includes `{{instanceName}}`. + +*** +See also: + + * [ObjectType](ObjectType.md) diff -Nru php-respect-validation-1.1.15/docs/rules/IntType.md php-respect-validation-1.1.29/docs/rules/IntType.md --- php-respect-validation-1.1.15/docs/rules/IntType.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/IntType.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,27 @@ +# IntType + +- `v::intType()` + +Validates whether the type of a value is integer. + +```php +v::intType()->validate(42); // true +v::intType()->validate('10'); // false +``` + +*** +See also: + + * [BoolType](BoolType.md) + * [CallableType](CallableType.md) + * [Digit](Digit.md) + * [Finite](Finite.md) + * [FloatType](FloatType.md) + * [Infinite](Infinite.md) + * [IntVal](IntVal.md) + * [NullType](NullType.md) + * [Numeric](Numeric.md) + * [ObjectType](ObjectType.md) + * [ResourceType](ResourceType.md) + * [StringType](StringType.md) + * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/rules/IntVal.md php-respect-validation-1.1.29/docs/rules/IntVal.md --- php-respect-validation-1.1.15/docs/rules/IntVal.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/IntVal.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,18 @@ +# IntVal + +- `v::intVal()` + +Validates if the input is an integer. + +```php +v::intVal()->validate('10'); // true +v::intVal()->validate(10); // true +``` + +*** +See also: + + * [Digit](Digit.md) + * [Finite](Finite.md) + * [Infinite](Infinite.md) + * [Numeric](Numeric.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Ip.md php-respect-validation-1.1.29/docs/rules/Ip.md --- php-respect-validation-1.1.15/docs/rules/Ip.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Ip.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,24 @@ +# Ip + +- `v::ip()` +- `v::ip(mixed $options)` + +Validates IP Addresses. This validator uses the native filter_var() +PHP function. + +```php +v::ip()->validate('192.168.0.1'); +``` + +You can pass a parameter with filter_var flags for IP. + +```php +v::ip(FILTER_FLAG_NO_PRIV_RANGE)->validate('127.0.0.1'); // false +``` + +*** +See also: + + * [Domain](Domain.md) + * [MacAddress](MacAddress.md) + * [Tld](Tld.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Iterable.md php-respect-validation-1.1.29/docs/rules/Iterable.md --- php-respect-validation-1.1.15/docs/rules/Iterable.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Iterable.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,5 @@ +# Iterable + +- `v::iterable()` + +**Deprecated**: Use [IterableType](IterableType.md) instead. diff -Nru php-respect-validation-1.1.15/docs/rules/IterableType.md php-respect-validation-1.1.29/docs/rules/IterableType.md --- php-respect-validation-1.1.15/docs/rules/IterableType.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/IterableType.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,20 @@ +# IterableType + +- `v::iterableType()` + +Validates if the input is iterable, in other words, if you're able to iterate +over it with [foreach](http://php.net/foreach) language construct. + +```php +v::iterableType()->validate([]); // true +v::iterableType()->validate(new ArrayObject()); // true +v::iterableType()->validate(new stdClass()); // true +v::iterableType()->validate('string'); // false +``` + +*** +See also: + + * [ArrayVal](ArrayVal.md) + * [Countable](Countable.md) + * [Instance](Instance.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Json.md php-respect-validation-1.1.29/docs/rules/Json.md --- php-respect-validation-1.1.15/docs/rules/Json.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Json.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,18 @@ +# Json + +- `v::json()` + +Validates if the given input is a valid JSON. + +```php +v::json()->validate('{"foo":"bar"}'); // true +``` + +*** +See also: + + * [Domain](Domain.md) + * [Email](Email.md) + * [FilterVar](FilterVar.md) + * [Phone](Phone.md) + * [VideoUrl](VideoUrl.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Key.md php-respect-validation-1.1.29/docs/rules/Key.md --- php-respect-validation-1.1.15/docs/rules/Key.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Key.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,34 @@ +# Key + +- `v::key(string $name)` +- `v::key(string $name, v $validator)` +- `v::key(string $name, v $validator, boolean $mandatory = true)` + +Validates an array key. + +```php +$dict = [ + 'foo' => 'bar' +]; + +v::key('foo')->validate($dict); // true +``` + +You can also validate the key value itself: + +```php +v::key('foo', v::equals('bar'))->validate($dict); // true +``` + +Third parameter makes the key presence optional: + +```php +v::key('lorem', v::stringType(), false)->validate($dict); // true +``` + +The name of this validator is automatically set to the key name. + +*** +See also: + + * [Attribute](Attribute.md) diff -Nru php-respect-validation-1.1.15/docs/rules/KeyNested.md php-respect-validation-1.1.29/docs/rules/KeyNested.md --- php-respect-validation-1.1.15/docs/rules/KeyNested.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/KeyNested.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,40 @@ +# KeyNested + +- `v::keyNested(string $name)` +- `v::keyNested(string $name, v $validator)` +- `v::keyNested(string $name, v $validator, boolean $mandatory = true)` + +Validates an array key or an object property using `.` to represent nested data. + +Validating keys from arrays or `ArrayAccess` instances: + +```php +$array = [ + 'foo' => [ + 'bar' => 123, + ], +]; + +v::keyNested('foo.bar')->validate($array); // true +``` + +Validating object properties: + +```php +$object = new stdClass(); +$object->foo = new stdClass(); +$object->foo->bar = 42; + +v::keyNested('foo.bar')->validate($object); // true +``` + +This rule was inspired by [Yii2 ArrayHelper][]. + +*** +See also: + + * [Attribute](Attribute.md) + * [Key](Key.md) + + +[Yii2 ArrayHelper]: https://github.com/yiisoft/yii2/blob/68c30c1/framework/helpers/BaseArrayHelper.php "Yii2 ArrayHelper" diff -Nru php-respect-validation-1.1.15/docs/rules/KeySet.md php-respect-validation-1.1.29/docs/rules/KeySet.md --- php-respect-validation-1.1.15/docs/rules/KeySet.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/KeySet.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,51 @@ +# KeySet + +- `v::keySet(Key $rule...)` + +Validates a keys in a defined structure. + +```php +$dict = ['foo' => 42]; + +v::keySet( + v::key('foo', v::intVal()) +)->validate($dict); // true +``` + +Extra keys are not allowed: +```php +$dict = ['foo' => 42, 'bar' => 'String']; + +v::keySet( + v::key('foo', v::intVal()) +)->validate($dict); // false +``` + +Missing required keys are not allowed: +```php +$dict = ['foo' => 42, 'bar' => 'String']; + +v::keySet( + v::key('foo', v::intVal()), + v::key('bar', v::stringType()), + v::key('baz', v::boolType()) +)->validate($dict); // false +``` + +Missing non-required keys are allowed: +```php +$dict = ['foo' => 42, 'bar' => 'String']; + +v::keySet( + v::key('foo', v::intVal()), + v::key('bar', v::stringType()), + v::key('baz', v::boolType(), false) +)->validate($dict); // true +``` + +The keys' order is not considered in the validation. + +*** +See also: + + * [Key](Key.md) diff -Nru php-respect-validation-1.1.15/docs/rules/KeyValue.md php-respect-validation-1.1.29/docs/rules/KeyValue.md --- php-respect-validation-1.1.15/docs/rules/KeyValue.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/KeyValue.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,62 @@ +# KeyValue + +- `keyValue(string $comparedKey, string $ruleName, string $baseKey)` + +Performs validation of `$comparedKey` using the rule named on `$ruleName` with +`$baseKey` as base. + +Sometimes, when validating arrays, the validation of a key value depends on +another key value and that may cause some ugly code since you need the input +before the validation, making some checking manually: + +```php +v::key('password')->check($_POST); +v::key('password_confirmation', v::equals($_POST['password']))->check($_POST); +``` + +The problem with the above code is because you do not know if `password` is a +valid key, so you must check it manually before performing the validation on +`password_confirmation`. + +The `keyValue()` rule makes this job easier by creating a rule named on +`$ruleName` passing `$baseKey` as the first argument of this rule, see an example: + +```php +v::keyValue('password_confirmation', 'equals', 'password')->validate($_POST); +``` + +The above code will result on `true` if _`$_POST['password_confirmation']` is +[equals](Equals.md) to `$_POST['password']`_, it's the same of: + +See another example: + +```php +v::keyValue('state', 'subdivisionCode', 'country')->validate($_POST); +``` + +The above code will result on `true` if _`$_POST['state']` is a +[subdivision code](SubdivisionCode.md) of `$_POST['country']`_: + +This rule will invalidate the input if `$comparedKey` or `$baseKey` don't exist, +or if the rule named on `$ruleName` could not be created (or don't exist). + +When using `assert()` or `check()` methods and the rule do not pass, it overwrites +all values in the validation exceptions with `$baseKey` and `$comparedKey`. + +```php +v::keyValue('password_confirmation', 'equals', 'password')->check($input); +``` + +The above code may generate the message: + +``` +password_confirmation must be equals "password" +``` + +*** +See also: + + * [Key](Key.md) + * [KeyNested](KeyNested.md) + * [KeySet](KeySet.md) + diff -Nru php-respect-validation-1.1.15/docs/rules/LanguageCode.md php-respect-validation-1.1.29/docs/rules/LanguageCode.md --- php-respect-validation-1.1.15/docs/rules/LanguageCode.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/LanguageCode.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,20 @@ +# LanguageCode + +- `v::languageCode()` + +Validates a language code based on ISO 639: + +```php +v::languageCode()->validate('pt'); // true +v::languageCode()->validate('en'); // true +v::languageCode()->validate('it'); // true +v::languageCode('alpha-3')->validate('ita'); // true +v::languageCode('alpha-3')->validate('eng'); // true +``` + +You can choose between alpha-2 and alpha-3, alpha-2 is set by default. + +*** +See also: + + * [CountryCode](CountryCode.md) \ No newline at end of file diff -Nru php-respect-validation-1.1.15/docs/rules/LeapDate.md php-respect-validation-1.1.29/docs/rules/LeapDate.md --- php-respect-validation-1.1.15/docs/rules/LeapDate.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/LeapDate.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,18 @@ +# LeapDate + +- `v::leapDate(string $format)` + +Validates if a date is leap. + +```php +v::leapDate('Y-m-d')->validate('1988-02-29'); // true +``` + +This validator accepts DateTime instances as well. The $format +parameter is mandatory. + +*** +See also: + + * [Date](Date.md) + * [LeapYear](LeapYear.md) diff -Nru php-respect-validation-1.1.15/docs/rules/LeapYear.md php-respect-validation-1.1.29/docs/rules/LeapYear.md --- php-respect-validation-1.1.15/docs/rules/LeapYear.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/LeapYear.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# LeapYear + +- `v::leapYear()` + +Validates if a year is leap. + +```php +v::leapYear()->validate('1988'); // true +``` + +This validator accepts DateTime instances as well. + +*** +See also: + + * [Date](Date.md) + * [LeapDate](LeapDate.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Length.md php-respect-validation-1.1.29/docs/rules/Length.md --- php-respect-validation-1.1.15/docs/rules/Length.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Length.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,44 @@ +# Length + +- `v::length(int $min, int $max)` +- `v::length(int $min, null)` +- `v::length(null, int $max)` +- `v::length(int $min, int $max, boolean $inclusive = true)` + +Validates lengths. Most simple example: + +```php +v::stringType()->length(1, 5)->validate('abc'); // true +``` + +You can also validate only minimum length: + +```php +v::stringType()->length(5, null)->validate('abcdef'); // true +``` + +Only maximum length: + +```php +v::stringType()->length(null, 5)->validate('abc'); // true +``` + +The type as the first validator in a chain is a good practice, +since length accepts many types: + +```php +v::arrayVal()->length(1, 5)->validate(['foo', 'bar']); // true +``` + +A third parameter may be passed to validate the passed values inclusive: + +```php +v::stringType()->length(1, 5, true)->validate('a'); // true +``` + +Message template for this validator includes `{{minValue}}` and `{{maxValue}}`. + +*** +See also: + + * [Between](Between.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Lowercase.md php-respect-validation-1.1.29/docs/rules/Lowercase.md --- php-respect-validation-1.1.15/docs/rules/Lowercase.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Lowercase.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,14 @@ +# Lowercase + +- `v::lowercase()` + +Validates if string characters are lowercase in the input: + +```php +v::stringType()->lowercase()->validate('xkcd'); // true +``` + +*** +See also: + + * [Uppercase](Uppercase.md) diff -Nru php-respect-validation-1.1.15/docs/rules/MacAddress.md php-respect-validation-1.1.29/docs/rules/MacAddress.md --- php-respect-validation-1.1.15/docs/rules/MacAddress.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/MacAddress.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# MacAddress + +- `v::macAddress()` + +Validates a Mac Address. + +```php +v::macAddress()->validate('00:11:22:33:44:55'); // true +v::macAddress()->validate('af-AA-22-33-44-55'); // true +``` + +*** +See also: + + * [Domain](Domain.md) + * [Ip](Ip.md) + * [Tld](Tld.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Max.md php-respect-validation-1.1.29/docs/rules/Max.md --- php-respect-validation-1.1.15/docs/rules/Max.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Max.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,36 @@ +# Max + +- `v::max(mixed $maxValue)` +- `v::max(mixed $maxValue, boolean $inclusive = true)` + +Validates if the input doesn't exceed the maximum value. + +```php +v::intVal()->max(15)->validate(20); // false +v::intVal()->max(20)->validate(20); // false +v::intVal()->max(20, true)->validate(20); // true +``` + +Also accepts dates: + +```php +v::date()->max('2012-01-01')->validate('2010-01-01'); // true +``` + +Also date intervals: + +```php +// Same of minimum age validation +v::date()->max('-18 years')->validate('1988-09-09'); // true +``` + +`true` may be passed as a parameter to indicate that inclusive +values must be used. + +Message template for this validator includes `{{maxValue}}`. + +*** +See also: + + * [Min](Min.md) + * [Between](Between.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Mimetype.md php-respect-validation-1.1.29/docs/rules/Mimetype.md --- php-respect-validation-1.1.15/docs/rules/Mimetype.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Mimetype.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,25 @@ +# Mimetype + +- `v::mimetype(string $mimetype)` + +Validates if the file mimetype matches the expected one: + +```php +v::mimetype('image/png')->validate('image.png'); // true +``` + +This rule is case-sensitive and requires [fileinfo](http://php.net/fileinfo) PHP extension. + +*** +See also: + + * [Directory](Directory.md) + * [Executable](Executable.md) + * [Exists](Exists.md) + * [Extension](Extension.md) + * [File](File.md) + * [Readable](Readable.md) + * [Size](Size.md) + * [SymbolicLink](SymbolicLink.md) + * [Uploaded](Uploaded.md) + * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/rules/MinimumAge.md php-respect-validation-1.1.29/docs/rules/MinimumAge.md --- php-respect-validation-1.1.15/docs/rules/MinimumAge.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/MinimumAge.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,23 @@ +# MinimumAge + +This is going to be deprecated, please use [Age](Age.md) instead. + +- `v::minimumAge(int $age)` +- `v::minimumAge(int $age, string $format)` + +Validates a minimum age for a given date. + +```php +v::minimumAge(18)->validate('1987-01-01'); // true +v::minimumAge(18, 'd/m/Y')->validate('01/01/1987'); // true +``` + +Using `date()` before is a best-practice. + +Message template for this validator includes `{{age}}`. + +*** +See also: + + * [Age](Age.md) + * [Date](Date.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Min.md php-respect-validation-1.1.29/docs/rules/Min.md --- php-respect-validation-1.1.15/docs/rules/Min.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Min.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,29 @@ +# Min + +- `v::min(mixed $minValue)` +- `v::min(mixed $minValue, boolean $inclusive = true)` + +Validates if the input is greater than the minimum value. + +```php +v::intVal()->min(15)->validate(5); // false +v::intVal()->min(5)->validate(5); // false +v::intVal()->min(5, true)->validate(5); // true +``` + +Also accepts dates: + +```php +v::date()->min('2012-01-01')->validate('2015-01-01'); // true +``` + +`true` may be passed as a parameter to indicate that inclusive +values must be used. + +Message template for this validator includes `{{minValue}}`. + +*** +See also: + + * [Max](Max.md) + * [Between](Between.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Multiple.md php-respect-validation-1.1.29/docs/rules/Multiple.md --- php-respect-validation-1.1.15/docs/rules/Multiple.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Multiple.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,14 @@ +# Multiple + +- `v::multiple(int $multipleOf)` + +Validates if the input is a multiple of the given parameter + +```php +v::intVal()->multiple(3)->validate(9); // true +``` + +*** +See also: + + * [PrimeNumber](PrimeNumber.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Negative.md php-respect-validation-1.1.29/docs/rules/Negative.md --- php-respect-validation-1.1.15/docs/rules/Negative.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Negative.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,14 @@ +# Negative + +- `v::negative()` + +Validates if a number is lower than zero + +```php +v::numeric()->negative()->validate(-15); // true +``` + +*** +See also: + + * [Positive](Positive.md) diff -Nru php-respect-validation-1.1.15/docs/rules/NfeAccessKey.md php-respect-validation-1.1.29/docs/rules/NfeAccessKey.md --- php-respect-validation-1.1.15/docs/rules/NfeAccessKey.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/NfeAccessKey.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,16 @@ +# NfeAccessKey + +- `v::nfeAccessKey(string $accessKey)` + +Validates the access key of the Brazilian electronic invoice (NFe). + +```php +v::nfeAccessKey()->validate('31841136830118868211870485416765268625116906'); // true +``` + +*** +See also: + + * [Cnh](Cnh.md) + * [Cnpj](Cnpj.md) + * [Cpf](Cpf.md) diff -Nru php-respect-validation-1.1.15/docs/rules/No.md php-respect-validation-1.1.29/docs/rules/No.md --- php-respect-validation-1.1.15/docs/rules/No.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/No.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,24 @@ +# No + +- `v::no()` +- `v::no(boolean $locale)` + +Validates if value is considered as "No". + +```php +v::no()->validate('N'); // true +v::no()->validate('Nay'); // true +v::no()->validate('Nix'); // true +v::no()->validate('No'); // true +v::no()->validate('Nope'); // true +v::no()->validate('Not'); // true +``` + +This rule is case insensitive. + +If `$locale` is TRUE, uses the value of [nl_langinfo()](http://php.net/nl_langinfo) with `NOEXPR` constant. + +*** +See also: + + * [Yes](Yes.md) diff -Nru php-respect-validation-1.1.15/docs/rules/NoneOf.md php-respect-validation-1.1.29/docs/rules/NoneOf.md --- php-respect-validation-1.1.15/docs/rules/NoneOf.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/NoneOf.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,21 @@ +# NoneOf + +- `v::noneOf(v $v1, v $v2, v $v3...)` + +Validates if NONE of the given validators validate: + +```php +v::noneOf( + v::intVal(), + v::floatVal() +)->validate('foo'); // true +``` + +In the sample above, 'foo' isn't a integer nor a float, so noneOf returns true. + +*** +See also: + + * [Not](Not.md) + * [AllOf](AllOf.md) + * [OneOf](OneOf.md) diff -Nru php-respect-validation-1.1.15/docs/rules/NotBlank.md php-respect-validation-1.1.29/docs/rules/NotBlank.md --- php-respect-validation-1.1.15/docs/rules/NotBlank.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/NotBlank.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,34 @@ +# NotBlank + +- `v::notBlank()` + +Validates if the given input is not a blank value (`null`, zeros, empty strings +or empty arrays, recursively). + +```php +v::notBlank()->validate(null); // false +v::notBlank()->validate(''); // false +v::notBlank()->validate([]); // false +v::notBlank()->validate(' '); // false +v::notBlank()->validate(0); // false +v::notBlank()->validate('0'); // false +v::notBlank()->validate(0); // false +v::notBlank()->validate('0.0'); // false +v::notBlank()->validate(false); // false +v::notBlank()->validate(['']); // false +v::notBlank()->validate([' ']); // false +v::notBlank()->validate([0]); // false +v::notBlank()->validate(['0']); // false +v::notBlank()->validate([false]); // false +v::notBlank()->validate([[''], [0]]); // false +v::notBlank()->validate(new stdClass()); // false +``` + +It's similar to [NotEmpty](NotEmpty.md) but it's way more strict. + +*** +See also: + + * [NoWhitespace](NoWhitespace.md) + * [NotEmpty](NotEmpty.md) + * [NullType](NullType.md) diff -Nru php-respect-validation-1.1.15/docs/rules/NotEmpty.md php-respect-validation-1.1.29/docs/rules/NotEmpty.md --- php-respect-validation-1.1.15/docs/rules/NotEmpty.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/NotEmpty.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,42 @@ +# NotEmpty + +- `v::notEmpty()` + +Validates if the given input is not empty or in other words is input mandatory and +required. This function also takes whitespace into account, use `noWhitespace()` +if no spaces or linebreaks and other whitespace anywhere in the input is desired. + +```php +v::stringType()->notEmpty()->validate(''); // false +``` + +Null values are empty: + +```php +v::notEmpty()->validate(null); // false +``` + +Numbers: + +```php +v::intVal()->notEmpty()->validate(0); // false +``` + +Empty arrays: + +```php +v::arrayVal()->notEmpty()->validate([]); // false +``` + +Whitespace: + +```php +v::stringType()->notEmpty()->validate(' '); //false +v::stringType()->notEmpty()->validate("\t \n \r"); //false +``` + +*** +See also: + + * [NoWhitespace](NoWhitespace.md) + * [NullType](NullType.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Not.md php-respect-validation-1.1.29/docs/rules/Not.md --- php-respect-validation-1.1.15/docs/rules/Not.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Not.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,24 @@ +# Not + +- `v::not(v $negatedValidator)` + +Negates any rule. + +```php +v::not(v::ip())->validate('foo'); // true +``` + +In the sample above, validator returns true because 'foo' isn't an IP Address. + +You can negate complex, grouped or chained validators as well: + +```php +v::not(v::intVal()->positive())->validate(-1.5); // true +``` + +Each other validation has custom messages for negated rules. + +*** +See also: + + * [NoneOf](NoneOf.md) diff -Nru php-respect-validation-1.1.15/docs/rules/NotOptional.md php-respect-validation-1.1.29/docs/rules/NotOptional.md --- php-respect-validation-1.1.15/docs/rules/NotOptional.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/NotOptional.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,39 @@ +# NotOptional + +- `v::notOptional()` + +Validates if the given input is not optional. By _optional_ we consider `null` +or an empty string (`''`). + +```php +v::notOptional()->validate(''); // false +v::notOptional()->validate(null); // false +``` + +Other values: + +```php +v::notOptional()->validate([]); // true +v::notOptional()->validate(' '); // true +v::notOptional()->validate(0); // true +v::notOptional()->validate('0'); // true +v::notOptional()->validate(0); // true +v::notOptional()->validate('0.0'); // true +v::notOptional()->validate(false); // true +v::notOptional()->validate(['']); // true +v::notOptional()->validate([' ']); // true +v::notOptional()->validate([0]); // true +v::notOptional()->validate(['0']); // true +v::notOptional()->validate([false]); // true +v::notOptional()->validate([[''), [0]]); // true +v::notOptional()->validate(new stdClass()); // true +``` + +*** +See also: + + * [NoWhitespace](NoWhitespace.md) + * [NotBlank](NotBlank.md) + * [NotEmpty](NotEmpty.md) + * [NullType](NullType.md) + * [Optional](Optional.md) diff -Nru php-respect-validation-1.1.15/docs/rules/NoWhitespace.md php-respect-validation-1.1.29/docs/rules/NoWhitespace.md --- php-respect-validation-1.1.15/docs/rules/NoWhitespace.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/NoWhitespace.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,21 @@ +# NoWhitespace + +- `v::noWhitespace()` + +Validates if a string contains no whitespace (spaces, tabs and line breaks); + +```php +v::noWhitespace()->validate('foo bar'); //false +v::noWhitespace()->validate("foo\nbar"); // false +``` + +This is most useful when chaining with other validators such as `v::alnum()` + +*** +See also: + + * [Alnum](Alnum.md) + * [Alpha](Alpha.md) + * [NotBlank](NotBlank.md) + * [NotEmpty](NotEmpty.md) + * [NotOptional](NotOptional.md) diff -Nru php-respect-validation-1.1.15/docs/rules/NullType.md php-respect-validation-1.1.29/docs/rules/NullType.md --- php-respect-validation-1.1.15/docs/rules/NullType.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/NullType.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,25 @@ +# NullType + +- `v::nullType()` + +Validates if the input is null. + +```php +v::nullType()->validate(null); // true +``` + +*** +See also: + + * [BoolType](BoolType.md) + * [CallableType](CallableType.md) + * [FloatType](FloatType.md) + * [IntType](IntType.md) + * [NotBlank](NotBlank.md) + * [NotEmpty](NotEmpty.md) + * [NotOptional](NotOptional.md) + * [NullType](NullType.md) + * [ObjectType](ObjectType.md) + * [ResourceType](ResourceType.md) + * [StringType](StringType.md) + * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Numeric.md php-respect-validation-1.1.29/docs/rules/Numeric.md --- php-respect-validation-1.1.15/docs/rules/Numeric.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Numeric.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,18 @@ +# Numeric + +- `v::numeric()` + +Validates on any numeric value. + +```php +v::numeric()->validate(-12); // true +v::numeric()->validate('135.0'); // true +``` + +*** +See also: + + * [Digit](Digit.md) + * [Finite](Finite.md) + * [Infinite](Infinite.md) + * [IntVal](IntVal.md) diff -Nru php-respect-validation-1.1.15/docs/rules/ObjectType.md php-respect-validation-1.1.29/docs/rules/ObjectType.md --- php-respect-validation-1.1.15/docs/rules/ObjectType.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/ObjectType.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,24 @@ +# ObjectType + +- `v::objectType()` + +Validates if the input is an object. + +```php +v::objectType()->validate(new stdClass); // true +``` + +*** +See also: + + * [Attribute](Attribute.md) + * [BoolType](BoolType.md) + * [CallableType](CallableType.md) + * [FloatType](FloatType.md) + * [Instance](Instance.md) + * [IntType](IntType.md) + * [NullType](NullType.md) + * [ObjectType](ObjectType.md) + * [ResourceType](ResourceType.md) + * [StringType](StringType.md) + * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Odd.md php-respect-validation-1.1.29/docs/rules/Odd.md --- php-respect-validation-1.1.15/docs/rules/Odd.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Odd.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Odd + +- `v::odd()` + +Validates an odd number. + +```php +v::intVal()->odd()->validate(3); // true +``` + +Using `int()` before `odd()` is a best practice. + +*** +See also: + + * [Even](Even.md) + * [Multiple](Multiple.md) diff -Nru php-respect-validation-1.1.15/docs/rules/OneOf.md php-respect-validation-1.1.29/docs/rules/OneOf.md --- php-respect-validation-1.1.15/docs/rules/OneOf.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/OneOf.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,25 @@ +# OneOf + +- `v::oneOf(v $v1, v $v2, v $v3...)` + +This is a group validator that acts as an OR operator. + +```php +v::oneOf( + v::intVal(), + v::floatVal() +)->validate(15.5); // true +``` + +In the sample above, `v::intVal()` doesn't validates, but +`v::floatVal()` validates, so oneOf returns true. + +`v::oneOf` returns true if at least one inner validator +passes. + +*** +See also: + + * [AllOf](AllOf.md) + * [NoneOf](NoneOf.md) + * [When](When.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Optional.md php-respect-validation-1.1.29/docs/rules/Optional.md --- php-respect-validation-1.1.15/docs/rules/Optional.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Optional.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,21 @@ +# Optional + +- `v::optional(v $rule)` + +Validates if the given input is optional or not. By _optional_ we consider `null` +or an empty string (`''`). + +```php +v::optional(v::alpha())->validate(''); // true +v::optional(v::digit())->validate(null); // true +``` + + +*** +See also: + + * [NoWhitespace](NoWhitespace.md) + * [NotBlank](NotBlank.md) + * [NotEmpty](NotEmpty.md) + * [NotOptional](NotOptional.md) + * [NullType](NullType.md) diff -Nru php-respect-validation-1.1.15/docs/rules/PerfectSquare.md php-respect-validation-1.1.29/docs/rules/PerfectSquare.md --- php-respect-validation-1.1.15/docs/rules/PerfectSquare.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/PerfectSquare.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,16 @@ +# PerfectSquare + +- `v::perfectSquare()` + +Validates a perfect square. + +```php +v::perfectSquare()->validate(25); // true (5*5) +v::perfectSquare()->validate(9); // true (3*3) +``` + +*** +See also: + + * [Factor](Factor.md) + * [PrimeNumber](PrimeNumber.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Pesel.md php-respect-validation-1.1.29/docs/rules/Pesel.md --- php-respect-validation-1.1.15/docs/rules/Pesel.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Pesel.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,12 @@ +# Pesel + +- `v::pesel()` + +Validates PESEL (Polish human identification number). + +```php +v::pesel()->validate('21120209256'); // true +v::pesel()->validate('97072704800'); // true +v::pesel()->validate('97072704801'); // false +v::pesel()->validate('PESEL123456'); // false +``` diff -Nru php-respect-validation-1.1.15/docs/rules/Phone.md php-respect-validation-1.1.29/docs/rules/Phone.md --- php-respect-validation-1.1.15/docs/rules/Phone.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Phone.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,22 @@ +# Phone + +- `v::phone()` + +Validates a valid 7, 10, 11 digit phone number (North America, Europe and most +Asian and Middle East countries), supporting country and area codes (in dot, +space or dashed notations) such as: + + (555)555-5555 + 555 555 5555 + +5(555)555.5555 + 33(1)22 22 22 22 + +33(1)22 22 22 22 + +33(020)7777 7777 + 03-6106666 + +*** +See also: + + * [Email](Email.md) + * [Url](Url.md) + * [VideoUrl](VideoUrl.md) diff -Nru php-respect-validation-1.1.15/docs/rules/PhpLabel.md php-respect-validation-1.1.29/docs/rules/PhpLabel.md --- php-respect-validation-1.1.15/docs/rules/PhpLabel.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/PhpLabel.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,24 @@ +# PhpLabel + +- `v::phpLabel()` + +Validates if a value is considered a valid PHP Label, +so that it can be used as a *variable*, *function* or *class* name, for example. + +Reference: +http://php.net/manual/en/language.variables.basics.php + +```php +v::phpLabel()->validate('person'); //true +v::phpLabel()->validate('foo'); //true +v::phpLabel()->validate('4ccess'); //false +``` + +*** +See also: + + * [Regex](Regex.md) + * [ResourceType](ResourceType.md) + * [Slug](Slug.md) + * [Charset](Charset.md) + \ No newline at end of file diff -Nru php-respect-validation-1.1.15/docs/rules/Positive.md php-respect-validation-1.1.29/docs/rules/Positive.md --- php-respect-validation-1.1.15/docs/rules/Positive.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Positive.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,14 @@ +# Positive + +- `v::positive()` + +Validates if a number is higher than zero + +```php +v::numeric()->positive()->validate(-15); // false +``` + +*** +See also: + + * [Negative](Negative.md) diff -Nru php-respect-validation-1.1.15/docs/rules/PostalCode.md php-respect-validation-1.1.29/docs/rules/PostalCode.md --- php-respect-validation-1.1.15/docs/rules/PostalCode.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/PostalCode.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,22 @@ +# PostalCode + +- `v::postalCode(string $countryCode)` + +Validates a postal code according to the given country code. + +```php +v::postalCode('BR')->validate('02179000'); // true +v::postalCode('BR')->validate('02179-000'); // true +v::postalCode('US')->validate('02179-000'); // false +v::postalCode('US')->validate('55372'); // true +v::postalCode('PL')->validate('99-300'); // true +``` + +Message template for this validator includes `{{countryCode}}`. + +Extracted from [GeoNames](http://www.geonames.org/). + +*** +See also: + + * [CountryCode](CountryCode.md) diff -Nru php-respect-validation-1.1.15/docs/rules/PrimeNumber.md php-respect-validation-1.1.29/docs/rules/PrimeNumber.md --- php-respect-validation-1.1.15/docs/rules/PrimeNumber.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/PrimeNumber.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,16 @@ +# PrimeNumber + +- `v::primeNumber()` + +Validates a prime number + +```php +v::primeNumber()->validate(7); // true +``` + +*** +See also: + + * [Factor](Factor.md) + * [PerfectSquare](PerfectSquare.md) + * [PrimeNumber](PrimeNumber.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Prnt.md php-respect-validation-1.1.29/docs/rules/Prnt.md --- php-respect-validation-1.1.15/docs/rules/Prnt.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Prnt.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,15 @@ +# Prnt + +- `v::prnt()` +- `v::prnt(string $additionalChars)` + +Similar to `v::graph` but accepts whitespace. + +```php +v::prnt()->validate('LMKA0$% _123'); // true +``` + +*** +See also: + + * [Graph](Graph.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Punct.md php-respect-validation-1.1.29/docs/rules/Punct.md --- php-respect-validation-1.1.15/docs/rules/Punct.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Punct.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Punct + +- `v::punct()` +- `v::punct(string $additionalChars)` + +Accepts only punctuation characters: + +```php +v::punct()->validate('&,.;[]'); // true +``` + +*** +See also: + + * [Cntrl](Cntrl.md) + * [Graph](Graph.md) + * [Prnt](Prnt.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Readable.md php-respect-validation-1.1.29/docs/rules/Readable.md --- php-respect-validation-1.1.15/docs/rules/Readable.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Readable.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,23 @@ +# Readable + +- `v::readable()` + +Validates if the given data is a file exists and is readable. + +```php +v::readable()->validate('/path/of/a/readable/file'); // true +``` + +*** +See also: + + * [Directory](Directory.md) + * [Executable](Executable.md) + * [Exists](Exists.md) + * [Extension](Extension.md) + * [File](File.md) + * [Mimetype](Mimetype.md) + * [Size](Size.md) + * [SymbolicLink](SymbolicLink.md) + * [Uploaded](Uploaded.md) + * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Regex.md php-respect-validation-1.1.29/docs/rules/Regex.md --- php-respect-validation-1.1.15/docs/rules/Regex.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Regex.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,21 @@ +# Regex + +- `v::regex(string $regex)` + +Evaluates a regex on the input and validates if matches + +```php +v::regex('/[a-z]/')->validate('a'); // true +``` + +Message template for this validator includes `{{regex}}` + +*** +See also: + + * [Alnum](Alnum.md) + * [Alpha](Alpha.md) + * [Contains](Contains.md) + * [Digit](Digit.md) + * [EndsWith](EndsWith.md) + * [StartsWith](StartsWith.md) diff -Nru php-respect-validation-1.1.15/docs/rules/ResourceType.md php-respect-validation-1.1.29/docs/rules/ResourceType.md --- php-respect-validation-1.1.15/docs/rules/ResourceType.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/ResourceType.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,21 @@ +# ResourceType + +- `v::resourceType()` + +Validates if the input is a resource. + +```php +v::resourceType()->validate(fopen('/path/to/file.txt', 'w')); // true +``` + +*** +See also: + + * [BoolType](BoolType.md) + * [CallableType](CallableType.md) + * [FloatType](FloatType.md) + * [IntType](IntType.md) + * [NullType](NullType.md) + * [ObjectType](ObjectType.md) + * [StringType](StringType.md) + * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Roman.md php-respect-validation-1.1.29/docs/rules/Roman.md --- php-respect-validation-1.1.15/docs/rules/Roman.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Roman.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,16 @@ +# Roman + +- `v::roman()` + +Validates roman numbers + +```php +v::roman()->validate('IV'); // true +``` + +*** +See also: + + * [In](In.md) + * [Regex](Regex.md) + * [Uppercase](Uppercase.md) diff -Nru php-respect-validation-1.1.15/docs/rules/ScalarVal.md php-respect-validation-1.1.29/docs/rules/ScalarVal.md --- php-respect-validation-1.1.15/docs/rules/ScalarVal.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/ScalarVal.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,15 @@ +# ScalarVal + +- `v::scalarVal()` + +Validates if the input is a scalar value. + +```php +v::scalarVal()->validate([]); // false +v::scalarVal()->validate(135.0); // true +``` + +*** +See also: + + * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Sf.md php-respect-validation-1.1.29/docs/rules/Sf.md --- php-respect-validation-1.1.15/docs/rules/Sf.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Sf.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,19 @@ +# Sf + +- `v::sf(string $validator)` + +Use Symfony2 validators inside Respect\Validation flow. Messages +are preserved. + +```php +v::sf('Time')->validate('15:00:00'); +``` + + +You must add `"symfony/validator": "~2.6"` to your `require` property on composer.json file. + + +*** +See also: + + * [Zend](Zend.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Size.md php-respect-validation-1.1.29/docs/rules/Size.md --- php-respect-validation-1.1.15/docs/rules/Size.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Size.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,48 @@ +# Size + +- `v::size(string $minSize)` +- `v::size(string $minSize, string $maxSize)` +- `v::size(null, string $maxSize)` + +Validates file sizes: + +```php +v::size('1KB')->validate($filename); // Must have at least 1KB size +v::size('1MB', '2MB')->validate($filename); // Must have the size between 1MB and 2MB +v::size(null, '1GB')->validate($filename); // Must not be greater than 1GB +``` + +Sizes are not case-sensitive and the accepted values are: + +- B +- KB +- MB +- GB +- TB +- PB +- EB +- ZB +- YB + +This validator will consider `SplFileInfo` instances, like: + +```php +$fileInfo = new SplFileInfo($filename); +v::size('1.5mb')->validate($fileInfo); // Will return true or false +``` + +Message template for this validator includes `{{minSize}}` and `{{maxSize}}`. + +*** +See also: + + * [Directory](Directory.md) + * [Executable](Executable.md) + * [Exists](Exists.md) + * [Extension](Extension.md) + * [File](File.md) + * [Mimetype](Mimetype.md) + * [Readable](Readable.md) + * [SymbolicLink](SymbolicLink.md) + * [Uploaded](Uploaded.md) + * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Slug.md php-respect-validation-1.1.29/docs/rules/Slug.md --- php-respect-validation-1.1.15/docs/rules/Slug.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Slug.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Slug + +- `v::slug()` + +Validates slug-like strings: + +```php +v::slug()->validate('my-wordpress-title'); // true +v::slug()->validate('my-wordpress--title'); // false +v::slug()->validate('my-wordpress-title-'); // false +``` + +*** +See also: + + * [Url](Url.md) + * [VideoUrl](VideoUrl.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Space.md php-respect-validation-1.1.29/docs/rules/Space.md --- php-respect-validation-1.1.15/docs/rules/Space.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Space.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,15 @@ +# Space + +- `v::space()` +- `v::space(string $additionalChars)` + +Accepts only whitespace: + +```php +v::space()->validate(' '); // true +``` + +*** +See also: + + * [Cntrl](Cntrl.md) diff -Nru php-respect-validation-1.1.15/docs/rules/StartsWith.md php-respect-validation-1.1.29/docs/rules/StartsWith.md --- php-respect-validation-1.1.15/docs/rules/StartsWith.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/StartsWith.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,31 @@ +# StartsWith + +- `v::startsWith(mixed $value)` +- `v::startsWith(mixed $value, boolean $identical = false)` + +This validator is similar to `v::contains()`, but validates +only if the value is at the beginning of the input. + +For strings: + +```php +v::startsWith('lorem')->validate('lorem ipsum'); // true +``` + +For arrays: + +```php +v::startsWith('lorem')->validate(['lorem', 'ipsum']); // true +``` + +`true` may be passed as a parameter to indicate identical comparison +instead of equal. + +Message template for this validator includes `{{startValue}}`. + +*** +See also: + + * [EndsWith](EndsWith.md) + * [Contains](Contains.md) + * [In](In.md) diff -Nru php-respect-validation-1.1.15/docs/rules/StringType.md php-respect-validation-1.1.29/docs/rules/StringType.md --- php-respect-validation-1.1.15/docs/rules/StringType.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/StringType.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,22 @@ +# StringType + +- `v::stringType()` + +Validates a string. + +```php +v::stringType()->validate('hi'); // true +``` + +*** +See also: + + * [Alnum](Alnum.md) + * [BoolType](BoolType.md) + * [CallableType](CallableType.md) + * [FloatType](FloatType.md) + * [IntType](IntType.md) + * [NullType](NullType.md) + * [ObjectType](ObjectType.md) + * [ResourceType](ResourceType.md) + * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/rules/SubdivisionCode.md php-respect-validation-1.1.29/docs/rules/SubdivisionCode.md --- php-respect-validation-1.1.15/docs/rules/SubdivisionCode.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/SubdivisionCode.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,284 @@ +# SubdivisionCode + +- `v::subdivisionCode(string $countryCode)` + +Validates subdivision country codes according to [ISO 3166-2][]. + +The `$countryCode` must be a country in [ISO 3166-1 alpha-2][] format. + +```php +v::subdivisionCode('BR')->validate('SP'); // true +v::subdivisionCode('US')->validate('CA'); // true +``` + +This rule is case sensitive. + +## Available country codes + +- `AD`: Andorra +- `AE`: United Arab Emirates +- `AF`: Afghanistan +- `AG`: Antigua and Barbuda +- `AI`: Anguilla +- `AL`: Albania +- `AM`: Armenia +- `AN`: AN.html +- `AO`: Angola +- `AQ`: Antarctica +- `AR`: Argentina +- `AS`: American Samoa +- `AT`: Austria +- `AU`: Australia +- `AW`: Aruba +- `AX`: Åland +- `AZ`: Azerbaijan +- `BA`: Bosnia and Herzegovina +- `BB`: Barbados +- `BD`: Bangladesh +- `BE`: Belgium +- `BF`: Burkina Faso +- `BG`: Bulgaria +- `BH`: Bahrain +- `BI`: Burundi +- `BJ`: Benin +- `BL`: Saint Barthélemy +- `BM`: Bermuda +- `BN`: Brunei +- `BO`: Bolivia +- `BQ`: Bonaire +- `BR`: Brazil +- `BS`: Bahamas +- `BT`: Bhutan +- `BV`: Bouvet Island +- `BW`: Botswana +- `BY`: Belarus +- `BZ`: Belize +- `CA`: Canada +- `CC`: Cocos [Keeling] Islands +- `CD`: Democratic Republic of the Congo +- `CF`: Central African Republic +- `CG`: Republic of the Congo +- `CH`: Switzerland +- `CI`: Ivory Coast +- `CK`: Cook Islands +- `CL`: Chile +- `CM`: Cameroon +- `CN`: China +- `CO`: Colombia +- `CR`: Costa Rica +- `CS`: CS.html +- `CU`: Cuba +- `CV`: Cape Verde +- `CW`: Curacao +- `CX`: Christmas Island +- `CY`: Cyprus +- `CZ`: Czech Republic +- `DE`: Germany +- `DJ`: Djibouti +- `DK`: Denmark +- `DM`: Dominica +- `DO`: Dominican Republic +- `DZ`: Algeria +- `EC`: Ecuador +- `EE`: Estonia +- `EG`: Egypt +- `EH`: Western Sahara +- `ER`: Eritrea +- `ES`: Spain +- `ET`: Ethiopia +- `FI`: Finland +- `FJ`: Fiji +- `FK`: Falkland Islands +- `FM`: Micronesia +- `FO`: Faroe Islands +- `FR`: France +- `GA`: Gabon +- `GB`: United Kingdom +- `GD`: Grenada +- `GE`: Georgia +- `GF`: French Guiana +- `GG`: Guernsey +- `GH`: Ghana +- `GI`: Gibraltar +- `GL`: Greenland +- `GM`: Gambia +- `GN`: Guinea +- `GP`: Guadeloupe +- `GQ`: Equatorial Guinea +- `GR`: Greece +- `GS`: South Georgia and the South Sandwich Islands +- `GT`: Guatemala +- `GU`: Guam +- `GW`: Guinea-Bissau +- `GY`: Guyana +- `HK`: Hong Kong +- `HM`: Heard Island and McDonald Islands +- `HN`: Honduras +- `HR`: Croatia +- `HT`: Haiti +- `HU`: Hungary +- `ID`: Indonesia +- `IE`: Ireland +- `IL`: Israel +- `IM`: Isle of Man +- `IN`: India +- `IO`: British Indian Ocean Territory +- `IQ`: Iraq +- `IR`: Iran +- `IS`: Iceland +- `IT`: Italy +- `JE`: Jersey +- `JM`: Jamaica +- `JO`: Jordan +- `JP`: Japan +- `KE`: Kenya +- `KG`: Kyrgyzstan +- `KH`: Cambodia +- `KI`: Kiribati +- `KM`: Comoros +- `KN`: Saint Kitts and Nevis +- `KP`: North Korea +- `KR`: South Korea +- `KW`: Kuwait +- `KY`: Cayman Islands +- `KZ`: Kazakhstan +- `LA`: Laos +- `LB`: Lebanon +- `LC`: Saint Lucia +- `LI`: Liechtenstein +- `LK`: Sri Lanka +- `LR`: Liberia +- `LS`: Lesotho +- `LT`: Lithuania +- `LU`: Luxembourg +- `LV`: Latvia +- `LY`: Libya +- `MA`: Morocco +- `MC`: Monaco +- `MD`: Moldova +- `ME`: Montenegro +- `MF`: Saint Martin +- `MG`: Madagascar +- `MH`: Marshall Islands +- `MK`: Macedonia +- `ML`: Mali +- `MM`: Myanmar [Burma] +- `MN`: Mongolia +- `MO`: Macao +- `MP`: Northern Mariana Islands +- `MQ`: Martinique +- `MR`: Mauritania +- `MS`: Montserrat +- `MT`: Malta +- `MU`: Mauritius +- `MV`: Maldives +- `MW`: Malawi +- `MX`: Mexico +- `MY`: Malaysia +- `MZ`: Mozambique +- `NA`: Namibia +- `NC`: New Caledonia +- `NE`: Niger +- `NF`: Norfolk Island +- `NG`: Nigeria +- `NI`: Nicaragua +- `NL`: Netherlands +- `NO`: Norway +- `NP`: Nepal +- `NR`: Nauru +- `NU`: Niue +- `NZ`: New Zealand +- `OM`: Oman +- `PA`: Panama +- `PE`: Peru +- `PF`: French Polynesia +- `PG`: Papua New Guinea +- `PH`: Philippines +- `PK`: Pakistan +- `PL`: Poland +- `PM`: Saint Pierre and Miquelon +- `PN`: Pitcairn Islands +- `PR`: Puerto Rico +- `PS`: Palestine +- `PT`: Portugal +- `PW`: Palau +- `PY`: Paraguay +- `QA`: Qatar +- `RE`: Réunion +- `RO`: Romania +- `RS`: Serbia +- `RU`: Russia +- `RW`: Rwanda +- `SA`: Saudi Arabia +- `SB`: Solomon Islands +- `SC`: Seychelles +- `SD`: Sudan +- `SE`: Sweden +- `SG`: Singapore +- `SH`: Saint Helena +- `SI`: Slovenia +- `SJ`: Svalbard and Jan Mayen +- `SK`: Slovakia +- `SL`: Sierra Leone +- `SM`: San Marino +- `SN`: Senegal +- `SO`: Somalia +- `SR`: Suriname +- `SS`: South Sudan +- `ST`: São Tomé and Príncipe +- `SV`: El Salvador +- `SX`: Sint Maarten +- `SY`: Syria +- `SZ`: Swaziland +- `TC`: Turks and Caicos Islands +- `TD`: Chad +- `TF`: French Southern Territories +- `TG`: Togo +- `TH`: Thailand +- `TJ`: Tajikistan +- `TK`: Tokelau +- `TL`: East Timor +- `TM`: Turkmenistan +- `TN`: Tunisia +- `TO`: Tonga +- `TR`: Turkey +- `TT`: Trinidad and Tobago +- `TV`: Tuvalu +- `TW`: Taiwan +- `TZ`: Tanzania +- `UA`: Ukraine +- `UG`: Uganda +- `UM`: U.S. Minor Outlying Islands +- `US`: United States +- `UY`: Uruguay +- `UZ`: Uzbekistan +- `VA`: Vatican City +- `VC`: Saint Vincent and the Grenadines +- `VE`: Venezuela +- `VG`: British Virgin Islands +- `VI`: U.S. Virgin Islands +- `VN`: Vietnam +- `VU`: Vanuatu +- `WF`: Wallis and Futuna +- `WS`: Samoa +- `XK`: Kosovo +- `YE`: Yemen +- `YT`: Mayotte +- `ZA`: South Africa +- `ZM`: Zambia +- `ZW`: Zimbabwe + +All data was extrated from [GeoNames][] which is licensed under a +[Creative Commons Attribution 3.0 License][]. + +*** +See also: + + * [CountryCode](CountryCode.md) + * [Tld](Tld.md) + + +[Creative Commons Attribution 3.0 License]: http://creativecommons.org/licenses/by/3.0 "Creative Commons Attribution 3.0 License" +[GeoNames]: http://www.geonames.org "GetNames" +[ISO 3166-1 alpha-2]: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 "ISO 3166-1 alpha-2" +[ISO 3166-2]: http://en.wikipedia.org/wiki/ISO_3166-2 "ISO 3166-2" diff -Nru php-respect-validation-1.1.15/docs/rules/SymbolicLink.md php-respect-validation-1.1.29/docs/rules/SymbolicLink.md --- php-respect-validation-1.1.15/docs/rules/SymbolicLink.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/SymbolicLink.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,23 @@ +# SymbolicLink + +- `v::symbolicLink()` + +Validates if the given data is a path of a valid symbolic link. + +```php +v::symbolicLink()->validate('/path/of/valid/symbolic/link'); // true +``` + +*** +See also: + + * [Directory](Directory.md) + * [Executable](Executable.md) + * [Exists](Exists.md) + * [Extension](Extension.md) + * [File](File.md) + * [Mimetype](Mimetype.md) + * [Readable](Readable.md) + * [Size](Size.md) + * [Uploaded](Uploaded.md) + * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Tld.md php-respect-validation-1.1.29/docs/rules/Tld.md --- php-respect-validation-1.1.15/docs/rules/Tld.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Tld.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Tld + +- `v::tld()` + +Validates a top-level domain + +```php +v::tld()->validate('com'); // true +v::tld()->validate('ly'); // true +v::tld()->validate('org'); // true +``` + +*** +See also: + + * [Domain](Domain.md) + * [CountryCode](CountryCode.md) diff -Nru php-respect-validation-1.1.15/docs/rules/TrueVal.md php-respect-validation-1.1.29/docs/rules/TrueVal.md --- php-respect-validation-1.1.15/docs/rules/TrueVal.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/TrueVal.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,21 @@ +# TrueVal + +- `v::trueVal()` + +Validates if a value is considered as `true`. + +```php +v::trueVal()->validate(true); // true +v::trueVal()->validate(1); // true +v::trueVal()->validate('1'); // true +v::trueVal()->validate('true'); // true +v::trueVal()->validate('on'); // true +v::trueVal()->validate('yes'); // true +v::trueVal()->validate('0.5'); // false +v::trueVal()->validate('2'); // false +``` + +*** +See also: + + * [FalseVal](FalseVal.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Type.md php-respect-validation-1.1.29/docs/rules/Type.md --- php-respect-validation-1.1.15/docs/rules/Type.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Type.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,31 @@ +# Type + +- `v::type(string $type)` + +Validates the type of input. + +```php +v::type('bool')->validate(true); // true +v::type('callable')->validate(function (){}); // true +v::type('object')->validate(new stdClass()); // true +``` + +*** +See also: + + * [ArrayVal](ArrayVal.md) + * [BoolType](BoolType.md) + * [CallableType](CallableType.md) + * [Finite](Finite.md) + * [FloatType](FloatType.md) + * [FloatVal](FloatVal.md) + * [Infinite](Infinite.md) + * [Instance](Instance.md) + * [IntType](IntType.md) + * [IntVal](IntVal.md) + * [NullType](NullType.md) + * [ObjectType](ObjectType.md) + * [ResourceType](ResourceType.md) + * [ScalarVal](ScalarVal.md) + * [StringType](StringType.md) + * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Uploaded.md php-respect-validation-1.1.29/docs/rules/Uploaded.md --- php-respect-validation-1.1.15/docs/rules/Uploaded.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Uploaded.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,23 @@ +# Uploaded + +- `v::uploaded()` + +Validates if the given data is a file that was uploaded via HTTP POST. + +```php +v::uploaded()->validate('/path/of/an/uploaded/file'); // true +``` + +*** +See also: + + * [Directory](Directory.md) + * [Executable](Executable.md) + * [Exists](Exists.md) + * [Extension](Extension.md) + * [File](File.md) + * [Mimetype](Mimetype.md) + * [Readable](Readable.md) + * [Size](Size.md) + * [SymbolicLink](SymbolicLink.md) + * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Uppercase.md php-respect-validation-1.1.29/docs/rules/Uppercase.md --- php-respect-validation-1.1.15/docs/rules/Uppercase.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Uppercase.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,14 @@ +# Uppercase + +- `v::uppercase()` + +Validates if string characters are uppercase in the input: + +```php +v::stringType()->uppercase()->validate('W3C'); // true +``` + +*** +See also: + + * [Lowercase](Lowercase.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Url.md php-respect-validation-1.1.29/docs/rules/Url.md --- php-respect-validation-1.1.15/docs/rules/Url.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Url.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,24 @@ +# Url + +- `v::url()` + +Validates if input is an URL: + +```php +v::url()->validate('http://example.com'); // true +v::url()->validate('https://www.youtube.com/watch?v=6FOUqQt3Kg0'); // true +v::url()->validate('ldap://[::1]'); // true +v::url()->validate('mailto:john.doe@example.com'); // true +v::url()->validate('news:new.example.com'); // true +``` + +This rule uses [FilterVar](FilterVar.md) + +*** +See also: + + * [Domain](Domain.md) + * [Email](Email.md) + * [FilterVar](FilterVar.md) + * [Phone](Phone.md) + * [VideoUrl](VideoUrl.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Version.md php-respect-validation-1.1.29/docs/rules/Version.md --- php-respect-validation-1.1.15/docs/rules/Version.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Version.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,16 @@ +# Version + +- `v::version()` + +Validates version numbers using Semantic Versioning. + +```php +v::version()->validate('1.0.0'); +``` + +*** +See also: + + * [Equals](Equals.md) + * [Regex](Regex.md) + * [Roman](Roman.md) diff -Nru php-respect-validation-1.1.15/docs/rules/VideoUrl.md php-respect-validation-1.1.29/docs/rules/VideoUrl.md --- php-respect-validation-1.1.15/docs/rules/VideoUrl.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/VideoUrl.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,35 @@ +# VideoUrl + +- `v::videoUrl()` +- `v::videoUrl(string $service)` + +Validates if the input is a video URL value: + +```php +v::videoUrl()->validate('https://player.vimeo.com/video/71787467'); // true +v::videoUrl()->validate('https://vimeo.com/71787467'); // true +v::videoUrl()->validate('https://www.youtube.com/embed/netHLn9TScY'); // true +v::videoUrl()->validate('https://www.youtube.com/watch?v=netHLn9TScY'); // true +v::videoUrl()->validate('https://youtu.be/netHLn9TScY'); // true + +v::videoUrl('youtube')->validate('https://www.youtube.com/watch?v=netHLn9TScY'); // true +v::videoUrl('vimeo')->validate('https://vimeo.com/71787467'); // true + +v::videoUrl()->validate('https://youtube.com'); // false +v::videoUrl('youtube')->validate('https://vimeo.com/71787467'); // false +``` + +The services accepted are: + +- YouTube +- Vimeo + +The `$service` value is not case-sensitive. + +Message template for this validator includes `{{service}}`. + + +*** +See also: + + * [Url](Url.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Vowel.md php-respect-validation-1.1.29/docs/rules/Vowel.md --- php-respect-validation-1.1.15/docs/rules/Vowel.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Vowel.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Vowel + +- `v::vowel()` + +Similar to `v::alnum()`. Validates strings that contains only vowels: + +```php +v::vowel()->validate('aei'); // true +``` + +*** +See also: + + * [Alnum](Alnum.md) + * [Digit](Digit.md) + * [Alpha](Alpha.md) + * [Consonant](Consonant.md) diff -Nru php-respect-validation-1.1.15/docs/rules/When.md php-respect-validation-1.1.29/docs/rules/When.md --- php-respect-validation-1.1.15/docs/rules/When.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/When.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,24 @@ +# When + +- `v::when(v $if, v $then, v $else)` +- `v::when(v $if, v $then)` + +A ternary validator that accepts three parameters. + +When the `$if` validates, returns validation for `$then`. +When the `$if` doesn't validate, returns validation for `$else`, if defined. + +```php +v::when(v::intVal(), v::positive(), v::notEmpty())->validate($input); +``` + +In the sample above, if `$input` is an integer, then it must be positive. +If `$input` is not an integer, then it must not me empty. +When `$else` is not defined use [AlwaysInvalid](AlwaysInvalid.md) + +*** +See also: + + * [AllOf](AllOf.md) + * [OneOf](OneOf.md) + * [NoneOf](NoneOf.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Writable.md php-respect-validation-1.1.29/docs/rules/Writable.md --- php-respect-validation-1.1.15/docs/rules/Writable.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Writable.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,23 @@ +# Writable + +- `v::writable()` + +Validates if the given input is writable file. + +```php +v::writable()->validate('/path/of/a/writable/file'); // true +``` + +*** +See also: + + * [Directory](Directory.md) + * [Executable](Executable.md) + * [Exists](Exists.md) + * [Extension](Extension.md) + * [File](File.md) + * [Mimetype](Mimetype.md) + * [Readable](Readable.md) + * [Size](Size.md) + * [SymbolicLink](SymbolicLink.md) + * [Uploaded](Uploaded.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Xdigit.md php-respect-validation-1.1.29/docs/rules/Xdigit.md --- php-respect-validation-1.1.15/docs/rules/Xdigit.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Xdigit.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,22 @@ +# Xdigit + +- `v::xdigit()` + +Accepts an hexadecimal number: + +```php +v::xdigit()->validate('abc123'); // true +``` + +Notice, however, that it doesn't accept strings starting with 0x: + +```php +v::xdigit()->validate('0x1f'); // false +``` + +*** +See also: + + * [Digit](Digit.md) + * [Alnum](Alnum.md) + * [HexRgbColor](HexRgbColor.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Yes.md php-respect-validation-1.1.29/docs/rules/Yes.md --- php-respect-validation-1.1.15/docs/rules/Yes.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Yes.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,23 @@ +# Yes + +- `v::yes()` +- `v::yes(boolean $locale)` + +Validates if value is considered as "Yes". + +```php +v::yes()->validate('Y'); // true +v::yes()->validate('Yea'); // true +v::yes()->validate('Yeah'); // true +v::yes()->validate('Yep'); // true +v::yes()->validate('Yes'); // true +``` + +This rule is case insensitive. + +If `$locale` is TRUE, uses the value of [nl_langinfo()](http://php.net/nl_langinfo) with `YESEXPR` constant. + +*** +See also: + + * [No](No.md) diff -Nru php-respect-validation-1.1.15/docs/rules/Zend.md php-respect-validation-1.1.29/docs/rules/Zend.md --- php-respect-validation-1.1.15/docs/rules/Zend.md 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/docs/rules/Zend.md 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,17 @@ +# Zend + +- `v::zend(mixed $validator)` + +Use Zend validators inside Respect\Validation flow. Messages +are preserved. + +```php +v::zend('Hostname')->validate('google.com'); +``` + +You must add `"zendframework/zend-validator": "~2.3"` to your `require` property on composer.json file. + +*** +See also: + + * [Sf](Sf.md) diff -Nru php-respect-validation-1.1.15/docs/ScalarVal.md php-respect-validation-1.1.29/docs/ScalarVal.md --- php-respect-validation-1.1.15/docs/ScalarVal.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/ScalarVal.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# ScalarVal - -- `v::scalarVal()` - -Validates if the input is a scalar value. - -```php -v::scalarVal()->validate([]); // false -v::scalarVal()->validate(135.0); // true -``` - -*** -See also: - - * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/Sf.md php-respect-validation-1.1.29/docs/Sf.md --- php-respect-validation-1.1.15/docs/Sf.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Sf.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -# Sf - -- `v::sf(string $validator)` - -Use Symfony2 validators inside Respect\Validation flow. Messages -are preserved. - -```php -v::sf('Time')->validate('15:00:00'); -``` - - -You must add `"symfony/validator": "~2.6"` to your `require` property on composer.json file. - - -*** -See also: - - * [Zend](Zend.md) diff -Nru php-respect-validation-1.1.15/docs/Size.md php-respect-validation-1.1.29/docs/Size.md --- php-respect-validation-1.1.15/docs/Size.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Size.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -# Size - -- `v::size(string $minSize)` -- `v::size(string $minSize, string $maxSize)` -- `v::size(null, string $maxSize)` - -Validates file sizes: - -```php -v::size('1KB')->validate($filename); // Must have at least 1KB size -v::size('1MB', '2MB')->validate($filename); // Must have the size between 1MB and 2MB -v::size(null, '1GB')->validate($filename); // Must not be greater than 1GB -``` - -Sizes are not case-sensitive and the accepted values are: - -- B -- KB -- MB -- GB -- TB -- PB -- EB -- ZB -- YB - -This validator will consider `SplFileInfo` instances, like: - -```php -$fileInfo = new SplFileInfo($filename); -v::size('1.5mb')->validate($fileInfo); // Will return true or false -``` - -Message template for this validator includes `{{minSize}}` and `{{maxSize}}`. - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/Slug.md php-respect-validation-1.1.29/docs/Slug.md --- php-respect-validation-1.1.15/docs/Slug.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Slug.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Slug - -- `v::slug()` - -Validates slug-like strings: - -```php -v::slug()->validate('my-wordpress-title'); // true -v::slug()->validate('my-wordpress--title'); // false -v::slug()->validate('my-wordpress-title-'); // false -``` - -*** -See also: - - * [Url](Url.md) - * [VideoUrl](VideoUrl.md) diff -Nru php-respect-validation-1.1.15/docs/Space.md php-respect-validation-1.1.29/docs/Space.md --- php-respect-validation-1.1.15/docs/Space.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Space.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# Space - -- `v::space()` -- `v::space(string $additionalChars)` - -Accepts only whitespace: - -```php -v::space()->validate(' '); // true -``` - -*** -See also: - - * [Cntrl](Cntrl.md) diff -Nru php-respect-validation-1.1.15/docs/StartsWith.md php-respect-validation-1.1.29/docs/StartsWith.md --- php-respect-validation-1.1.15/docs/StartsWith.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/StartsWith.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -# StartsWith - -- `v::startsWith(mixed $value)` -- `v::startsWith(mixed $value, boolean $identical = false)` - -This validator is similar to `v::contains()`, but validates -only if the value is at the beginning of the input. - -For strings: - -```php -v::startsWith('lorem')->validate('lorem ipsum'); // true -``` - -For arrays: - -```php -v::startsWith('lorem')->validate(['lorem', 'ipsum']); // true -``` - -`true` may be passed as a parameter to indicate identical comparison -instead of equal. - -Message template for this validator includes `{{startValue}}`. - -*** -See also: - - * [EndsWith](EndsWith.md) - * [Contains](Contains.md) - * [In](In.md) diff -Nru php-respect-validation-1.1.15/docs/StringType.md php-respect-validation-1.1.29/docs/StringType.md --- php-respect-validation-1.1.15/docs/StringType.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/StringType.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# StringType - -- `v::stringType()` - -Validates a string. - -```php -v::stringType()->validate('hi'); // true -``` - -*** -See also: - - * [Alnum](Alnum.md) - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/SubdivisionCode.md php-respect-validation-1.1.29/docs/SubdivisionCode.md --- php-respect-validation-1.1.15/docs/SubdivisionCode.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/SubdivisionCode.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,284 +0,0 @@ -# SubdivisionCode - -- `v::subdivisionCode(string $countryCode)` - -Validates subdivision country codes according to [ISO 3166-2][]. - -The `$countryCode` must be a country in [ISO 3166-1 alpha-2][] format. - -```php -v::subdivisionCode('BR')->validate('SP'); // true -v::subdivisionCode('US')->validate('CA'); // true -``` - -This rule is case sensitive. - -## Available country codes - -- `AD`: Andorra -- `AE`: United Arab Emirates -- `AF`: Afghanistan -- `AG`: Antigua and Barbuda -- `AI`: Anguilla -- `AL`: Albania -- `AM`: Armenia -- `AN`: AN.html -- `AO`: Angola -- `AQ`: Antarctica -- `AR`: Argentina -- `AS`: American Samoa -- `AT`: Austria -- `AU`: Australia -- `AW`: Aruba -- `AX`: Åland -- `AZ`: Azerbaijan -- `BA`: Bosnia and Herzegovina -- `BB`: Barbados -- `BD`: Bangladesh -- `BE`: Belgium -- `BF`: Burkina Faso -- `BG`: Bulgaria -- `BH`: Bahrain -- `BI`: Burundi -- `BJ`: Benin -- `BL`: Saint Barthélemy -- `BM`: Bermuda -- `BN`: Brunei -- `BO`: Bolivia -- `BQ`: Bonaire -- `BR`: Brazil -- `BS`: Bahamas -- `BT`: Bhutan -- `BV`: Bouvet Island -- `BW`: Botswana -- `BY`: Belarus -- `BZ`: Belize -- `CA`: Canada -- `CC`: Cocos [Keeling] Islands -- `CD`: Democratic Republic of the Congo -- `CF`: Central African Republic -- `CG`: Republic of the Congo -- `CH`: Switzerland -- `CI`: Ivory Coast -- `CK`: Cook Islands -- `CL`: Chile -- `CM`: Cameroon -- `CN`: China -- `CO`: Colombia -- `CR`: Costa Rica -- `CS`: CS.html -- `CU`: Cuba -- `CV`: Cape Verde -- `CW`: Curacao -- `CX`: Christmas Island -- `CY`: Cyprus -- `CZ`: Czech Republic -- `DE`: Germany -- `DJ`: Djibouti -- `DK`: Denmark -- `DM`: Dominica -- `DO`: Dominican Republic -- `DZ`: Algeria -- `EC`: Ecuador -- `EE`: Estonia -- `EG`: Egypt -- `EH`: Western Sahara -- `ER`: Eritrea -- `ES`: Spain -- `ET`: Ethiopia -- `FI`: Finland -- `FJ`: Fiji -- `FK`: Falkland Islands -- `FM`: Micronesia -- `FO`: Faroe Islands -- `FR`: France -- `GA`: Gabon -- `GB`: United Kingdom -- `GD`: Grenada -- `GE`: Georgia -- `GF`: French Guiana -- `GG`: Guernsey -- `GH`: Ghana -- `GI`: Gibraltar -- `GL`: Greenland -- `GM`: Gambia -- `GN`: Guinea -- `GP`: Guadeloupe -- `GQ`: Equatorial Guinea -- `GR`: Greece -- `GS`: South Georgia and the South Sandwich Islands -- `GT`: Guatemala -- `GU`: Guam -- `GW`: Guinea-Bissau -- `GY`: Guyana -- `HK`: Hong Kong -- `HM`: Heard Island and McDonald Islands -- `HN`: Honduras -- `HR`: Croatia -- `HT`: Haiti -- `HU`: Hungary -- `ID`: Indonesia -- `IE`: Ireland -- `IL`: Israel -- `IM`: Isle of Man -- `IN`: India -- `IO`: British Indian Ocean Territory -- `IQ`: Iraq -- `IR`: Iran -- `IS`: Iceland -- `IT`: Italy -- `JE`: Jersey -- `JM`: Jamaica -- `JO`: Jordan -- `JP`: Japan -- `KE`: Kenya -- `KG`: Kyrgyzstan -- `KH`: Cambodia -- `KI`: Kiribati -- `KM`: Comoros -- `KN`: Saint Kitts and Nevis -- `KP`: North Korea -- `KR`: South Korea -- `KW`: Kuwait -- `KY`: Cayman Islands -- `KZ`: Kazakhstan -- `LA`: Laos -- `LB`: Lebanon -- `LC`: Saint Lucia -- `LI`: Liechtenstein -- `LK`: Sri Lanka -- `LR`: Liberia -- `LS`: Lesotho -- `LT`: Lithuania -- `LU`: Luxembourg -- `LV`: Latvia -- `LY`: Libya -- `MA`: Morocco -- `MC`: Monaco -- `MD`: Moldova -- `ME`: Montenegro -- `MF`: Saint Martin -- `MG`: Madagascar -- `MH`: Marshall Islands -- `MK`: Macedonia -- `ML`: Mali -- `MM`: Myanmar [Burma] -- `MN`: Mongolia -- `MO`: Macao -- `MP`: Northern Mariana Islands -- `MQ`: Martinique -- `MR`: Mauritania -- `MS`: Montserrat -- `MT`: Malta -- `MU`: Mauritius -- `MV`: Maldives -- `MW`: Malawi -- `MX`: Mexico -- `MY`: Malaysia -- `MZ`: Mozambique -- `NA`: Namibia -- `NC`: New Caledonia -- `NE`: Niger -- `NF`: Norfolk Island -- `NG`: Nigeria -- `NI`: Nicaragua -- `NL`: Netherlands -- `NO`: Norway -- `NP`: Nepal -- `NR`: Nauru -- `NU`: Niue -- `NZ`: New Zealand -- `OM`: Oman -- `PA`: Panama -- `PE`: Peru -- `PF`: French Polynesia -- `PG`: Papua New Guinea -- `PH`: Philippines -- `PK`: Pakistan -- `PL`: Poland -- `PM`: Saint Pierre and Miquelon -- `PN`: Pitcairn Islands -- `PR`: Puerto Rico -- `PS`: Palestine -- `PT`: Portugal -- `PW`: Palau -- `PY`: Paraguay -- `QA`: Qatar -- `RE`: Réunion -- `RO`: Romania -- `RS`: Serbia -- `RU`: Russia -- `RW`: Rwanda -- `SA`: Saudi Arabia -- `SB`: Solomon Islands -- `SC`: Seychelles -- `SD`: Sudan -- `SE`: Sweden -- `SG`: Singapore -- `SH`: Saint Helena -- `SI`: Slovenia -- `SJ`: Svalbard and Jan Mayen -- `SK`: Slovakia -- `SL`: Sierra Leone -- `SM`: San Marino -- `SN`: Senegal -- `SO`: Somalia -- `SR`: Suriname -- `SS`: South Sudan -- `ST`: São Tomé and Príncipe -- `SV`: El Salvador -- `SX`: Sint Maarten -- `SY`: Syria -- `SZ`: Swaziland -- `TC`: Turks and Caicos Islands -- `TD`: Chad -- `TF`: French Southern Territories -- `TG`: Togo -- `TH`: Thailand -- `TJ`: Tajikistan -- `TK`: Tokelau -- `TL`: East Timor -- `TM`: Turkmenistan -- `TN`: Tunisia -- `TO`: Tonga -- `TR`: Turkey -- `TT`: Trinidad and Tobago -- `TV`: Tuvalu -- `TW`: Taiwan -- `TZ`: Tanzania -- `UA`: Ukraine -- `UG`: Uganda -- `UM`: U.S. Minor Outlying Islands -- `US`: United States -- `UY`: Uruguay -- `UZ`: Uzbekistan -- `VA`: Vatican City -- `VC`: Saint Vincent and the Grenadines -- `VE`: Venezuela -- `VG`: British Virgin Islands -- `VI`: U.S. Virgin Islands -- `VN`: Vietnam -- `VU`: Vanuatu -- `WF`: Wallis and Futuna -- `WS`: Samoa -- `XK`: Kosovo -- `YE`: Yemen -- `YT`: Mayotte -- `ZA`: South Africa -- `ZM`: Zambia -- `ZW`: Zimbabwe - -All data was extrated from [GeoNames][] which is licensed under a -[Creative Commons Attribution 3.0 License][]. - -*** -See also: - - * [CountryCode](CountryCode.md) - * [Tld](Tld.md) - - -[Creative Commons Attribution 3.0 License]: http://creativecommons.org/licenses/by/3.0 "Creative Commons Attribution 3.0 License" -[GeoNames]: http://www.geonames.org "GetNames" -[ISO 3166-1 alpha-2]: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 "ISO 3166-1 alpha-2" -[ISO 3166-2]: http://en.wikipedia.org/wiki/ISO_3166-2 "ISO 3166-2" diff -Nru php-respect-validation-1.1.15/docs/SymbolicLink.md php-respect-validation-1.1.29/docs/SymbolicLink.md --- php-respect-validation-1.1.15/docs/SymbolicLink.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/SymbolicLink.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -# SymbolicLink - -- `v::symbolicLink()` - -Validates if the given data is a path of a valid symbolic link. - -```php -v::symbolicLink()->validate('/path/of/valid/symbolic/link'); // true -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/Tld.md php-respect-validation-1.1.29/docs/Tld.md --- php-respect-validation-1.1.15/docs/Tld.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Tld.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Tld - -- `v::tld()` - -Validates a top-level domain - -```php -v::tld()->validate('com'); // true -v::tld()->validate('ly'); // true -v::tld()->validate('org'); // true -``` - -*** -See also: - - * [Domain](Domain.md) - * [CountryCode](CountryCode.md) diff -Nru php-respect-validation-1.1.15/docs/TrueVal.md php-respect-validation-1.1.29/docs/TrueVal.md --- php-respect-validation-1.1.15/docs/TrueVal.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/TrueVal.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -# TrueVal - -- `v::trueVal()` - -Validates if a value is considered as `true`. - -```php -v::trueVal()->validate(true); // true -v::trueVal()->validate(1); // true -v::trueVal()->validate('1'); // true -v::trueVal()->validate('true'); // true -v::trueVal()->validate('on'); // true -v::trueVal()->validate('yes'); // true -v::trueVal()->validate('0.5'); // false -v::trueVal()->validate('2'); // false -``` - -*** -See also: - - * [FalseVal](FalseVal.md) diff -Nru php-respect-validation-1.1.15/docs/Type.md php-respect-validation-1.1.29/docs/Type.md --- php-respect-validation-1.1.15/docs/Type.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Type.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -# Type - -- `v::type(string $type)` - -Validates the type of input. - -```php -v::type('bool')->validate(true); // true -v::type('callable')->validate(function (){}); // true -v::type('object')->validate(new stdClass()); // true -``` - -*** -See also: - - * [ArrayVal](ArrayVal.md) - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [Finite](Finite.md) - * [FloatType](FloatType.md) - * [FloatVal](FloatVal.md) - * [Infinite](Infinite.md) - * [Instance](Instance.md) - * [IntType](IntType.md) - * [IntVal](IntVal.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [ScalarVal](ScalarVal.md) - * [StringType](StringType.md) - * [Type](Type.md) diff -Nru php-respect-validation-1.1.15/docs/Uploaded.md php-respect-validation-1.1.29/docs/Uploaded.md --- php-respect-validation-1.1.15/docs/Uploaded.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Uploaded.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -# Uploaded - -- `v::uploaded()` - -Validates if the given data is a file that was uploaded via HTTP POST. - -```php -v::uploaded()->validate('/path/of/an/uploaded/file'); // true -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Writable](Writable.md) diff -Nru php-respect-validation-1.1.15/docs/Uppercase.md php-respect-validation-1.1.29/docs/Uppercase.md --- php-respect-validation-1.1.15/docs/Uppercase.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Uppercase.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -# Uppercase - -- `v::uppercase()` - -Validates if string characters are uppercase in the input: - -```php -v::stringType()->uppercase()->validate('W3C'); // true -``` - -*** -See also: - - * [Lowercase](Lowercase.md) diff -Nru php-respect-validation-1.1.15/docs/Url.md php-respect-validation-1.1.29/docs/Url.md --- php-respect-validation-1.1.15/docs/Url.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Url.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -# Url - -- `v::url()` - -Validates if input is an URL: - -```php -v::url()->validate('http://example.com'); // true -v::url()->validate('https://www.youtube.com/watch?v=6FOUqQt3Kg0'); // true -v::url()->validate('ldap://[::1]'); // true -v::url()->validate('mailto:john.doe@example.com'); // true -v::url()->validate('news:new.example.com'); // true -``` - -This rule uses [FilterVar](FilterVar.md) - -*** -See also: - - * [Domain](Domain.md) - * [Email](Email.md) - * [FilterVar](FilterVar.md) - * [Phone](Phone.md) - * [VideoUrl](VideoUrl.md) diff -Nru php-respect-validation-1.1.15/docs/VALIDATORS.md php-respect-validation-1.1.29/docs/VALIDATORS.md --- php-respect-validation-1.1.15/docs/VALIDATORS.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/VALIDATORS.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,338 +0,0 @@ -# Validators - -## Types - - * [ArrayVal](ArrayVal.md) - * [ArrayType](ArrayType.md) - * [BoolVal](BoolVal.md) - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [Countable](Countable.md) - * [Date](Date.md) - * [FalseVal](FalseVal.md) - * [FloatVal](FloatVal.md) - * [FloatType](FloatType.md) - * [Instance](Instance.md) - * [IntVal](IntVal.md) - * [IntType](IntType.md) - * [IterableType](IterableType.md) - * [NullType](NullType.md) - * [Numeric](Numeric.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [ScalarVal](ScalarVal.md) - * [StringType](StringType.md) - * [TrueVal](TrueVal.md) - * [Type](Type.md) - * [Xdigit](Xdigit.md) - -## Generics - - * [AlwaysInvalid](AlwaysInvalid.md) - * [AlwaysValid](AlwaysValid.md) - * [Call](Call.md) - * [Callback](Callback.md) - * [FilterVar](FilterVar.md) - * [Not](Not.md) - * [Optional](Optional.md) - * [Type](Type.md) - * [When](When.md) - -## Comparing Values - - * [Age](Age.md) - * [Between](Between.md) - * [Equals](Equals.md) - * [Identical](Identical.md) - * [Max](Max.md) - * [Min](Min.md) - -## Numeric - - * [Between](Between.md) - * [BoolType](BoolType.md) - * [Even](Even.md) - * [Factor](Factor.md) - * [Fibonacci](Fibonacci.md) - * [Finite](Finite.md) - * [FloatVal](FloatVal.md) - * [FloatType](FloatType.md) - * [Infinite](Infinite.md) - * [IntVal](IntVal.md) - * [IntType](IntType.md) - * [Multiple](Multiple.md) - * [Negative](Negative.md) - * [NotEmpty](NotEmpty.md) - * [Numeric](Numeric.md) - * [Odd](Odd.md) - * [PerfectSquare](PerfectSquare.md) - * [Positive](Positive.md) - * [PrimeNumber](PrimeNumber.md) - * [Roman](Roman.md) - * [Xdigit](Xdigit.md) - -## String - - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) - * [Between](Between.md) - * [Charset](Charset.md) - * [Cntrl](Cntrl.md) - * [Consonant](Consonant.md) - * [Contains](Contains.md) - * [Digit](Digit.md) - * [EndsWith](EndsWith.md) - * [Graph](Graph.md) - * [In](In.md) - * [Length](Length.md) - * [Lowercase](Lowercase.md) - * [NotEmpty](NotEmpty.md) - * [NoWhitespace](NoWhitespace.md) - * [PhpLabel](PhpLabel.md) - * [Prnt](Prnt.md) - * [Punct](Punct.md) - * [Regex](Regex.md) - * [ResourceType](ResourceType.md) - * [Slug](Slug.md) - * [Space](Space.md) - * [StartsWith](StartsWith.md) - * [Uppercase](Uppercase.md) - * [Version](Version.md) - * [Vowel](Vowel.md) - * [Xdigit](Xdigit.md) - -## Arrays - - * [ArrayVal](ArrayVal.md) - * [ArrayType](ArrayType.md) - * [Contains](Contains.md) - * [Each](Each.md) - * [EndsWith](EndsWith.md) - * [In](In.md) - * [Key](Key.md) - * [KeyNested](KeyNested.md) - * [KeySet](KeySet.md) - * [KeyValue](KeyValue.md) - * [Length](Length.md) - * [NotEmpty](NotEmpty.md) - * [StartsWith](StartsWith.md) - -## Objects - - * [Attribute](Attribute.md) - * [Instance](Instance.md) - * [Length](Length.md) - -## Date and Time - - * [Age](Age.md) - * [Between](Between.md) - * [Date](Date.md) - * [LeapDate](LeapDate.md) - * [LeapYear](LeapYear.md) - * [MinimumAge](MinimumAge.md) - -## Group Validators - - * [AllOf](AllOf.md) - * [NoneOf](NoneOf.md) - * [OneOf](OneOf.md) - -## Regional - - * [CountryCode](CountryCode.md) - * [CurrencyCode](CurrencyCode.md) - * [IdentityCard](IdentityCard.md) - * [LanguageCode](LanguageCode.md) - * [PostalCode](PostalCode.md) - * [SubdivisionCode](SubdivisionCode.md) - * [Tld](Tld.md) - -## Files - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Image](Image.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) - -## Banking - - * [Bank](Bank.md) - * [BankAccount](BankAccount.md) - * [Bic](Bic.md) - -## Other - - * [Bsn](Bsn.md) - * [Cnh](Cnh.md) - * [Cnpj](Cnpj.md) - * [Cpf](Cpf.md) - * [Domain](Domain.md) - * [Email](Email.md) - * [HexRgbColor](HexRgbColor.md) - * [Imei](Imei.md) - * [Ip](Ip.md) - * [Json](Json.md) - * [MacAddress](MacAddress.md) - * [NfeAccessKey](NfeAccessKey.md) - * [NotBlank](NotBlank.md) - * [NotOptional](NotOptional.md) - * [Pesel](Pesel.md) - * [Phone](Phone.md) - * [Sf](Sf.md) - * [Url](Url.md) - * [VideoUrl](VideoUrl.md) - * [Zend](Zend.md) - -## Yes/No - - * [No](No.md) - * [Yes](Yes.md) - -## Alphabetically - - * [Age](Age.md) - * [AllOf](AllOf.md) - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) - * [AlwaysInvalid](AlwaysInvalid.md) - * [AlwaysValid](AlwaysValid.md) - * [ArrayVal](ArrayVal.md) - * [ArrayType](ArrayType.md) - * [Attribute](Attribute.md) - * [Bank](Bank.md) - * [BankAccount](BankAccount.md) - * [Between](Between.md) - * [Bic](Bic.md) - * [BoolType](BoolType.md) - * [Bsn](Bsn.md) - * [Call](Call.md) - * [CallableType](CallableType.md) - * [Callback](Callback.md) - * [Charset](Charset.md) - * [Cnh](Cnh.md) - * [Cnpj](Cnpj.md) - * [Cntrl](Cntrl.md) - * [Consonant](Consonant.md) - * [Contains](Contains.md) - * [Countable](Countable.md) - * [CountryCode](CountryCode.md) - * [Cpf](Cpf.md) - * [CreditCard](CreditCard.md) - * [Date](Date.md) - * [Digit](Digit.md) - * [Directory](Directory.md) - * [Domain](Domain.md) - * [Each](Each.md) - * [Email](Email.md) - * [EndsWith](EndsWith.md) - * [Equals](Equals.md) - * [Even](Even.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [Factor](Factor.md) - * [FalseVal](FalseVal.md) - * [Fibonacci](Fibonacci.md) - * [File](File.md) - * [FilterVar](FilterVar.md) - * [Finite](Finite.md) - * [FloatVal](FloatVal.md) - * [FloatType](FloatType.md) - * [Graph](Graph.md) - * [HexRgbColor](HexRgbColor.md) - * [Identical](Identical.md) - * [IdentityCard](IdentityCard.md) - * [Image](Image.md) - * [Imei](Imei.md) - * [In](In.md) - * [Infinite](Infinite.md) - * [Instance](Instance.md) - * [IntVal](IntVal.md) - * [IntType](IntType.md) - * [Ip](Ip.md) - * [IterableType](IterableType.md) - * [Json](Json.md) - * [Key](Key.md) - * [KeyNested](KeyNested.md) - * [KeySet](KeySet.md) - * [KeyValue](KeyValue.md) - * [LanguageCode](LanguageCode.md) - * [LeapDate](LeapDate.md) - * [LeapYear](LeapYear.md) - * [Length](Length.md) - * [Lowercase](Lowercase.md) - * [MacAddress](MacAddress.md) - * [Max](Max.md) - * [Mimetype](Mimetype.md) - * [Min](Min.md) - * [MinimumAge](MinimumAge.md) - * [Multiple](Multiple.md) - * [Negative](Negative.md) - * [NfeAccessKey](NfeAccessKey.md) - * [No](No.md) - * [NoWhitespace](NoWhitespace.md) - * [NoneOf](NoneOf.md) - * [Not](Not.md) - * [NotBlank](NotBlank.md) - * [NotEmpty](NotEmpty.md) - * [NotOptional](NotOptional.md) - * [NullType](NullType.md) - * [Numeric](Numeric.md) - * [ObjectType](ObjectType.md) - * [Odd](Odd.md) - * [OneOf](OneOf.md) - * [Optional](Optional.md) - * [PerfectSquare](PerfectSquare.md) - * [Pesel](Pesel.md) - * [Phone](Phone.md) - * [PhpLabel](PhpLabel.md) - * [Positive](Positive.md) - * [PostalCode](PostalCode.md) - * [PrimeNumber](PrimeNumber.md) - * [Prnt](Prnt.md) - * [Punct](Punct.md) - * [Readable](Readable.md) - * [Regex](Regex.md) - * [ResourceType](ResourceType.md) - * [Roman](Roman.md) - * [ScalarVal](ScalarVal.md) - * [Sf](Sf.md) - * [Size](Size.md) - * [Slug](Slug.md) - * [Space](Space.md) - * [StartsWith](StartsWith.md) - * [StringType](StringType.md) - * [SubdivisionCode](SubdivisionCode.md) - * [SymbolicLink](SymbolicLink.md) - * [Tld](Tld.md) - * [TrueVal](TrueVal.md) - * [Type](Type.md) - * [Uploaded](Uploaded.md) - * [Uppercase](Uppercase.md) - * [Url](Url.md) - * [Version](Version.md) - * [VideoUrl](VideoUrl.md) - * [Vowel](Vowel.md) - * [When](When.md) - * [Writable](Writable.md) - * [Xdigit](Xdigit.md) - * [Yes](Yes.md) - * [Zend](Zend.md) - -*** -See also: - -- [Contributing](../CONTRIBUTING.md) -- [Feature Guide](README.md) -- [Installation](INSTALL.md) -- [License](../LICENSE.md) -- [Changelog](../CHANGELOG.md) diff -Nru php-respect-validation-1.1.15/docs/Version.md php-respect-validation-1.1.29/docs/Version.md --- php-respect-validation-1.1.15/docs/Version.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Version.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -# Version - -- `v::version()` - -Validates version numbers using Semantic Versioning. - -```php -v::version()->validate('1.0.0'); -``` - -*** -See also: - - * [Equals](Equals.md) - * [Regex](Regex.md) - * [Roman](Roman.md) diff -Nru php-respect-validation-1.1.15/docs/VideoUrl.md php-respect-validation-1.1.29/docs/VideoUrl.md --- php-respect-validation-1.1.15/docs/VideoUrl.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/VideoUrl.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -# VideoUrl - -- `v::videoUrl()` -- `v::videoUrl(string $service)` - -Validates if the input is a video URL value: - -```php -v::videoUrl()->validate('https://player.vimeo.com/video/71787467'); // true -v::videoUrl()->validate('https://vimeo.com/71787467'); // true -v::videoUrl()->validate('https://www.youtube.com/embed/netHLn9TScY'); // true -v::videoUrl()->validate('https://www.youtube.com/watch?v=netHLn9TScY'); // true -v::videoUrl()->validate('https://youtu.be/netHLn9TScY'); // true - -v::videoUrl('youtube')->validate('https://www.youtube.com/watch?v=netHLn9TScY'); // true -v::videoUrl('vimeo')->validate('https://vimeo.com/71787467'); // true - -v::videoUrl()->validate('https://youtube.com'); // false -v::videoUrl('youtube')->validate('https://vimeo.com/71787467'); // false -``` - -The services accepted are: - -- YouTube -- Vimeo - -The `$service` value is not case-sensitive. - -Message template for this validator includes `{{service}}`. - - -*** -See also: - - * [Url](Url.md) diff -Nru php-respect-validation-1.1.15/docs/Vowel.md php-respect-validation-1.1.29/docs/Vowel.md --- php-respect-validation-1.1.15/docs/Vowel.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Vowel.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Vowel - -- `v::vowel()` - -Similar to `v::alnum()`. Validates strings that contains only vowels: - -```php -v::vowel()->validate('aei'); // true -``` - -*** -See also: - - * [Alnum](Alnum.md) - * [Digit](Digit.md) - * [Alpha](Alpha.md) - * [Consonant](Consonant.md) diff -Nru php-respect-validation-1.1.15/docs/When.md php-respect-validation-1.1.29/docs/When.md --- php-respect-validation-1.1.15/docs/When.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/When.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -# When - -- `v::when(v $if, v $then, v $else)` -- `v::when(v $if, v $then)` - -A ternary validator that accepts three parameters. - -When the `$if` validates, returns validation for `$then`. -When the `$if` doesn't validate, returns validation for `$else`, if defined. - -```php -v::when(v::intVal(), v::positive(), v::notEmpty())->validate($input); -``` - -In the sample above, if `$input` is an integer, then it must be positive. -If `$input` is not an integer, then it must not me empty. -When `$else` is not defined use [AlwaysInvalid](AlwaysInvalid.md) - -*** -See also: - - * [AllOf](AllOf.md) - * [OneOf](OneOf.md) - * [NoneOf](NoneOf.md) diff -Nru php-respect-validation-1.1.15/docs/Writable.md php-respect-validation-1.1.29/docs/Writable.md --- php-respect-validation-1.1.15/docs/Writable.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Writable.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -# Writable - -- `v::writable()` - -Validates if the given input is writable file. - -```php -v::writable()->validate('/path/of/a/writable/file'); // true -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) diff -Nru php-respect-validation-1.1.15/docs/Xdigit.md php-respect-validation-1.1.29/docs/Xdigit.md --- php-respect-validation-1.1.15/docs/Xdigit.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Xdigit.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Xdigit - -- `v::xdigit()` - -Accepts an hexadecimal number: - -```php -v::xdigit()->validate('abc123'); // true -``` - -Notice, however, that it doesn't accept strings starting with 0x: - -```php -v::xdigit()->validate('0x1f'); // false -``` - -*** -See also: - - * [Digit](Digit.md) - * [Alnum](Alnum.md) - * [HexRgbColor](HexRgbColor.md) diff -Nru php-respect-validation-1.1.15/docs/Yes.md php-respect-validation-1.1.29/docs/Yes.md --- php-respect-validation-1.1.15/docs/Yes.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Yes.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -# Yes - -- `v::yes()` -- `v::yes(boolean $locale)` - -Validates if value is considered as "Yes". - -```php -v::yes()->validate('Y'); // true -v::yes()->validate('Yea'); // true -v::yes()->validate('Yeah'); // true -v::yes()->validate('Yep'); // true -v::yes()->validate('Yes'); // true -``` - -This rule is case insensitive. - -If `$locale` is TRUE, uses the value of [nl_langinfo()](http://php.net/nl_langinfo) with `YESEXPR` constant. - -*** -See also: - - * [No](No.md) diff -Nru php-respect-validation-1.1.15/docs/Zend.md php-respect-validation-1.1.29/docs/Zend.md --- php-respect-validation-1.1.15/docs/Zend.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/docs/Zend.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -# Zend - -- `v::zend(mixed $validator)` - -Use Zend validators inside Respect\Validation flow. Messages -are preserved. - -```php -v::zend('Hostname')->validate('google.com'); -``` - -You must add `"zendframework/zend-validator": "~2.3"` to your `require` property on composer.json file. - -*** -See also: - - * [Sf](Sf.md) diff -Nru php-respect-validation-1.1.15/library/Exceptions/IpException.php php-respect-validation-1.1.29/library/Exceptions/IpException.php --- php-respect-validation-1.1.15/library/Exceptions/IpException.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Exceptions/IpException.php 2018-11-04 21:58:45.000000000 +0000 @@ -29,6 +29,7 @@ public function configure($name, array $params = []) { + $params += ['networkRange' => null, 'min' => null]; if ($params['networkRange']) { $range = $params['networkRange']; $message = $range['min']; diff -Nru php-respect-validation-1.1.15/library/Exceptions/NestedValidationException.php php-respect-validation-1.1.29/library/Exceptions/NestedValidationException.php --- php-respect-validation-1.1.15/library/Exceptions/NestedValidationException.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Exceptions/NestedValidationException.php 2018-11-04 21:58:45.000000000 +0000 @@ -60,7 +60,7 @@ /** * @param array $paths * - * @return self + * @return array */ public function findMessages(array $paths) { @@ -122,6 +122,31 @@ return $recursiveIteratorIterator; } + private function isSkippable(ValidationException $exception) + { + if (!$exception instanceof self) { + return false; + } + + if (1 !== $exception->getRelated()->count()) { + return false; + } + + if (!$exception->hasCustomTemplate()) { + return true; + } + + return $this->hasChildTemplate($exception); + } + + private function hasChildTemplate(self $exception) + { + $exception->getRelated()->rewind(); + $childException = $exception->getRelated()->current(); + + return $childException->getMessage() === $exception->getMessage(); + } + /** * @return SplObjectStorage */ @@ -136,9 +161,7 @@ $lastDepthOriginal = 0; $knownDepths = []; foreach ($recursiveIteratorIterator as $childException) { - if ($childException instanceof self - && $childException->getRelated()->count() > 0 - && $childException->getRelated()->count() < 2) { + if ($this->isSkippable($childException)) { continue; } @@ -147,8 +170,7 @@ if (isset($knownDepths[$currentDepthOriginal])) { $currentDepth = $knownDepths[$currentDepthOriginal]; - } elseif ($currentDepthOriginal > $lastDepthOriginal - && ($this->hasCustomTemplate() || $exceptionIterator->count() != 1)) { + } elseif ($currentDepthOriginal > $lastDepthOriginal) { ++$currentDepth; } @@ -195,18 +217,21 @@ */ public function getFullMessage() { - $marker = '-'; $messages = []; - $exceptions = $this->getIterator(); + $leveler = 1; - if ($this->hasCustomTemplate() || count($exceptions) != 1) { - $messages[] = sprintf('%s %s', $marker, $this->getMessage()); + if (!$this->isSkippable($this)) { + $leveler = 0; + $messages[] = sprintf('- %s', $this->getMessage()); } + $exceptions = $this->getIterator(); foreach ($exceptions as $exception) { - $depth = $exceptions[$exception]['depth']; - $prefix = str_repeat(' ', $depth * 2); - $messages[] = sprintf('%s%s %s', $prefix, $marker, $exception->getMessage()); + $messages[] = sprintf( + '%s- %s', + str_repeat(' ', ($exceptions[$exception]['depth'] - $leveler) * 2), + $exception->getMessage() + ); } return implode(PHP_EOL, $messages); diff -Nru php-respect-validation-1.1.15/library/Exceptions/UrlException.php php-respect-validation-1.1.29/library/Exceptions/UrlException.php --- php-respect-validation-1.1.15/library/Exceptions/UrlException.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Exceptions/UrlException.php 2018-11-04 21:58:45.000000000 +0000 @@ -15,10 +15,10 @@ { public static $defaultTemplates = [ self::MODE_DEFAULT => [ - self::STANDARD => '{{name}} must be an URL', + self::STANDARD => '{{name}} must be a URL', ], self::MODE_NEGATIVE => [ - self::STANDARD => '{{name}} must not be an URL', + self::STANDARD => '{{name}} must not be a URL', ], ]; } diff -Nru php-respect-validation-1.1.15/library/Rules/AbstractComposite.php php-respect-validation-1.1.29/library/Rules/AbstractComposite.php --- php-respect-validation-1.1.15/library/Rules/AbstractComposite.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Rules/AbstractComposite.php 2018-11-04 21:58:45.000000000 +0000 @@ -11,6 +11,7 @@ namespace Respect\Validation\Rules; +use Respect\Validation\Exceptions\NestedValidationException; use Respect\Validation\Exceptions\ValidationException; use Respect\Validation\Validatable; use Respect\Validation\Validator; @@ -109,16 +110,33 @@ protected function validateRules($input) { - $validators = $this->getRules(); $exceptions = []; - foreach ($validators as $v) { + foreach ($this->getRules() as $rule) { try { - $v->assert($input); - } catch (ValidationException $e) { - $exceptions[] = $e; + $rule->assert($input); + } catch (ValidationException $exception) { + $exceptions[] = $exception; + $this->setExceptionTemplate($exception); } } return $exceptions; } + + private function setExceptionTemplate(ValidationException $exception) + { + if (null === $this->template || $exception->hasCustomTemplate()) { + return; + } + + $exception->setTemplate($this->template); + + if (!$exception instanceof NestedValidationException) { + return; + } + + foreach ($exception->getRelated() as $relatedException) { + $this->setExceptionTemplate($relatedException); + } + } } diff -Nru php-respect-validation-1.1.15/library/Rules/AbstractInterval.php php-respect-validation-1.1.29/library/Rules/AbstractInterval.php --- php-respect-validation-1.1.15/library/Rules/AbstractInterval.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Rules/AbstractInterval.php 2018-11-04 21:58:45.000000000 +0000 @@ -25,6 +25,11 @@ $this->inclusive = $inclusive; } + protected function isAbleToCompareValues($left, $right) + { + return is_scalar($left) === is_scalar($right); + } + protected function filterInterval($value) { if (!is_string($value) || is_numeric($value) || empty($value)) { diff -Nru php-respect-validation-1.1.15/library/Rules/Date.php php-respect-validation-1.1.29/library/Rules/Date.php --- php-respect-validation-1.1.15/library/Rules/Date.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Rules/Date.php 2018-11-04 21:58:45.000000000 +0000 @@ -49,8 +49,39 @@ $this->format = $exceptionalFormats[$this->format]; } - $info = date_parse_from_format($this->format, $inputString); + return $this->isValidForFormatProvided($input); + } + + private function isValidForFormatProvided($input) + { + $info = date_parse_from_format($this->format, $input); + if (!$this->isParsable($info)) { + return false; + } + + if ($this->hasDateFormat()) { + return $this->hasValidDate($info); + } + + return true; + } + private function isParsable(array $info) + { return ($info['error_count'] === 0 && $info['warning_count'] === 0); } + + private function hasDateFormat() + { + return preg_match('/[djSFmMnYy]/', $this->format) > 0; + } + + private function hasValidDate(array $info) + { + if ($info['day']) { + return checkdate((int) $info['month'], $info['day'], (int) $info['year']); + } + + return checkdate($info['month'] ?: 1, $info['day'] ?: 1, $info['year'] ?: 1); + } } diff -Nru php-respect-validation-1.1.15/library/Rules/Email.php php-respect-validation-1.1.29/library/Rules/Email.php --- php-respect-validation-1.1.15/library/Rules/Email.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Rules/Email.php 2018-11-04 21:58:45.000000000 +0000 @@ -33,9 +33,13 @@ public function validate($input) { + if (!is_string($input)) { + return false; + } + $emailValidator = $this->getEmailValidator(); if (!$emailValidator instanceof EmailValidator) { - return is_string($input) && filter_var($input, FILTER_VALIDATE_EMAIL); + return (bool) filter_var($input, FILTER_VALIDATE_EMAIL); } if (!class_exists('Egulias\\EmailValidator\\Validation\\RFCValidation')) { diff -Nru php-respect-validation-1.1.15/library/Rules/IntVal.php php-respect-validation-1.1.29/library/Rules/IntVal.php --- php-respect-validation-1.1.15/library/Rules/IntVal.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Rules/IntVal.php 2018-11-04 21:58:45.000000000 +0000 @@ -15,6 +15,10 @@ { public function validate($input) { - return is_numeric($input) && (int) $input == $input; + if (is_float($input) || is_bool($input)) { + return false; + } + + return false !== filter_var($input, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_OCTAL); } } diff -Nru php-respect-validation-1.1.15/library/Rules/Max.php php-respect-validation-1.1.29/library/Rules/Max.php --- php-respect-validation-1.1.15/library/Rules/Max.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Rules/Max.php 2018-11-04 21:58:45.000000000 +0000 @@ -15,10 +15,17 @@ { public function validate($input) { + $filteredInput = $this->filterInterval($input); + $filteredInterval = $this->filterInterval($this->interval); + + if (!$this->isAbleToCompareValues($filteredInput, $filteredInterval)) { + return false; + } + if ($this->inclusive) { - return $this->filterInterval($input) <= $this->filterInterval($this->interval); + return $filteredInput <= $filteredInterval; } - return $this->filterInterval($input) < $this->filterInterval($this->interval); + return $filteredInput < $filteredInterval; } } diff -Nru php-respect-validation-1.1.15/library/Rules/Min.php php-respect-validation-1.1.29/library/Rules/Min.php --- php-respect-validation-1.1.15/library/Rules/Min.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Rules/Min.php 2018-11-04 21:58:45.000000000 +0000 @@ -15,10 +15,17 @@ { public function validate($input) { + $filteredInput = $this->filterInterval($input); + $filteredInterval = $this->filterInterval($this->interval); + + if (!$this->isAbleToCompareValues($filteredInput, $filteredInterval)) { + return false; + } + if ($this->inclusive) { - return $this->filterInterval($input) >= $this->filterInterval($this->interval); + return $filteredInput >= $filteredInterval; } - return $this->filterInterval($input) > $this->filterInterval($this->interval); + return $filteredInput > $filteredInterval; } } diff -Nru php-respect-validation-1.1.15/library/Rules/PostalCode.php php-respect-validation-1.1.29/library/Rules/PostalCode.php --- php-respect-validation-1.1.15/library/Rules/PostalCode.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Rules/PostalCode.php 2018-11-04 21:58:45.000000000 +0000 @@ -21,157 +21,166 @@ * @link http://download.geonames.org/export/dump/countryInfo.txt */ public $postalCodes = [ - 'AD' => "/^(?:AD)*(\d{3})$/", - 'AM' => "/^(\d{6})$/", - 'AR' => "/^([A-Z]\d{4}[A-Z]{3})$/", - 'AT' => "/^(\d{4})$/", - 'AU' => "/^(\d{4})$/", - 'AX' => "/^(?:FI)*(\d{5})$/", - 'AZ' => "/^(?:AZ)*(\d{4})$/", - 'BA' => "/^(\d{5})$/", - 'BB' => "/^(?:BB)*(\d{5})$/", - 'BD' => "/^(\d{4})$/", - 'BE' => "/^(\d{4})$/", - 'BG' => "/^(\d{4})$/", - 'BH' => "/^(\d{3}\d?)$/", - 'BM' => "/^([A-Z]{2}\d{2})$/", - 'BN' => "/^([A-Z]{2}\d{4})$/", - 'BR' => "/^(\d{8}|\d{5}-\d{3})$/", - 'BY' => "/^(\d{6})$/", - 'CA' => "/^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]) ?(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$/", - 'CH' => "/^(\d{4})$/", - 'CL' => "/^(\d{7})$/", - 'CN' => "/^(\d{6})$/", - 'CR' => "/^(\d{4})$/", - 'CS' => "/^((\d{5})|(\d{3}\040\d{2}))$/", - 'CU' => "/^(?:CP)*(\d{5})$/", - 'CV' => "/^(\d{4})$/", - 'CX' => "/^(\d{4})$/", - 'CY' => "/^(\d{4})$/", - 'CZ' => "/^(\d{5})$/", - 'DE' => "/^(\d{5})$/", - 'DK' => "/^(\d{4})$/", - 'DO' => "/^(\d{5})$/", - 'DZ' => "/^(\d{5})$/", - 'EC' => "/^([a-zA-Z]\d{4}[a-zA-Z])$/", - 'EE' => "/^(\d{5})$/", - 'EG' => "/^(\d{5})$/", - 'ES' => "/^(\d{5})$/", - 'ET' => "/^(\d{4})$/", - 'FI' => "/^(?:FI)*(\d{5})$/", - 'FM' => "/^(\d{5})$/", - 'FO' => "/^(?:FO)*(\d{3})$/", - 'FR' => "/^(\d{5})$/", + 'AD' => '/^(?:AD)*(\d{3})$/', + 'AL' => '/^(\d{4})$/', + 'AM' => '/^(\d{6})$/', + 'AR' => '/^[A-Z]?\d{4}[A-Z]{0,3}$/', + 'AS' => '/96799/', + 'AT' => '/^(\d{4})$/', + 'AU' => '/^(\d{4})$/', + 'AX' => '/^(?:FI)*(\d{5})$/', + 'AZ' => '/^(?:AZ)*(\d{4})$/', + 'BA' => '/^(\d{5})$/', + 'BB' => '/^(?:BB)*(\d{5})$/', + 'BD' => '/^(\d{4})$/', + 'BE' => '/^(\d{4})$/', + 'BG' => '/^(\d{4})$/', + 'BH' => '/^(\d{3}\d?)$/', + 'BL' => '/^(\d{5})$/', + 'BM' => '/^([A-Z]{2}\d{2})$/', + 'BN' => '/^([A-Z]{2}\d{4})$/', + 'BR' => '/^\d{5}-?\d{3}$/', + 'BY' => '/^(\d{6})$/', + 'CA' => '/^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]) ?(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$/', + 'CH' => '/^(\d{4})$/', + 'CL' => '/^(\d{7})$/', + 'CN' => '/^(\d{6})$/', + 'CO' => '/^(\d{6})$/', + 'CR' => '/^(\d{5})$/', + 'CS' => '/^(\d{5})$/', + 'CU' => '/^(?:CP)*(\d{5})$/', + 'CV' => '/^(\d{4})$/', + 'CX' => '/^(\d{4})$/', + 'CY' => '/^(\d{4})$/', + 'CZ' => '/^\d{3}\s?\d{2}$/', + 'DE' => '/^(\d{5})$/', + 'DK' => '/^(\d{4})$/', + 'DO' => '/^(\d{5})$/', + 'DZ' => '/^(\d{5})$/', + 'EC' => '/^([a-zA-Z]\d{4}[a-zA-Z])$/', + 'EE' => '/^(\d{5})$/', + 'EG' => '/^(\d{5})$/', + 'ES' => '/^(\d{5})$/', + 'ET' => '/^(\d{4})$/', + 'FI' => '/^(?:FI)*(\d{5})$/', + 'FM' => '/^(\d{5})$/', + 'FO' => '/^(?:FO)*(\d{3})$/', + 'FR' => '/^(\d{5})$/', 'GB' => '/^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2})$/', - 'GE' => "/^(\d{4})$/", - 'GF' => "/^((97|98)3\d{2})$/", - 'GG' => "/^(([A-Z]\d{2}[A-Z]{2})|([A-Z]\d{3}[A-Z]{2})|([A-Z]{2}\d{2}[A-Z]{2})|([A-Z]{2}\d{3}[A-Z]{2})|([A-Z]\d[A-Z]\d[A-Z]{2})|([A-Z]{2}\d[A-Z]\d[A-Z]{2})|(GIR0AA))$/", - 'GL' => "/^(\d{4})$/", - 'GP' => "/^((97|98)\d{3})$/", - 'GR' => "/^(\d{5})$/", - 'GT' => "/^(\d{5})$/", - 'GU' => "/^(969\d{2})$/", - 'GW' => "/^(\d{4})$/", - 'HN' => "/^([A-Z]{2}\d{4})$/", - 'HR' => "/^(?:HR)*(\d{5})$/", - 'HT' => "/^(?:HT)*(\d{4})$/", - 'HU' => "/^(\d{4})$/", - 'ID' => "/^(\d{5})$/", - 'IL' => "/^(\d{5})$/", - 'IM' => "/^(([A-Z]\d{2}[A-Z]{2})|([A-Z]\d{3}[A-Z]{2})|([A-Z]{2}\d{2}[A-Z]{2})|([A-Z]{2}\d{3}[A-Z]{2})|([A-Z]\d[A-Z]\d[A-Z]{2})|([A-Z]{2}\d[A-Z]\d[A-Z]{2})|(GIR0AA))$/", - 'IN' => "/^(\d{6})$/", - 'IQ' => "/^(\d{5})$/", - 'IR' => "/^(\d{10})$/", - 'IS' => "/^(\d{3})$/", - 'IT' => "/^(\d{5})$/", - 'JE' => "/^(([A-Z]\d{2}[A-Z]{2})|([A-Z]\d{3}[A-Z]{2})|([A-Z]{2}\d{2}[A-Z]{2})|([A-Z]{2}\d{3}[A-Z]{2})|([A-Z]\d[A-Z]\d[A-Z]{2})|([A-Z]{2}\d[A-Z]\d[A-Z]{2})|(GIR0AA))$/", - 'JO' => "/^(\d{5})$/", - 'JP' => "/^(\d{7})$/", - 'KE' => "/^(\d{5})$/", - 'KG' => "/^(\d{6})$/", - 'KH' => "/^(\d{5})$/", - 'KP' => "/^(\d{6})$/", - 'KR' => "/^(?:SEOUL)*(\d{6})$/", - 'KW' => "/^(\d{5})$/", - 'KZ' => "/^(\d{6})$/", - 'LA' => "/^(\d{5})$/", - 'LB' => "/^(\d{4}(\d{4})?)$/", - 'LI' => "/^(\d{4})$/", - 'LK' => "/^(\d{5})$/", - 'LR' => "/^(\d{4})$/", - 'LS' => "/^(\d{3})$/", - 'LT' => "/^(?:LT)*(\d{5})$/", - 'LU' => "/^(\d{4})$/", - 'LV' => "/^(?:LV)*(\d{4})$/", - 'MA' => "/^(\d{5})$/", - 'MC' => "/^(\d{5})$/", - 'MD' => "/^(?:MD)*(\d{4})$/", - 'ME' => "/^(\d{5})$/", - 'MG' => "/^(\d{3})$/", - 'MK' => "/^(\d{4})$/", - 'MM' => "/^(\d{5})$/", - 'MN' => "/^(\d{6})$/", - 'MQ' => "/^(\d{5})$/", - 'MT' => "/^([A-Z]{3}\d{2}\d?)$/", - 'MV' => "/^(\d{5})$/", - 'MX' => "/^(\d{5})$/", - 'MY' => "/^(\d{5})$/", - 'MZ' => "/^(\d{4})$/", - 'NC' => "/^(\d{5})$/", - 'NE' => "/^(\d{4})$/", - 'NF' => "/^(\d{4})$/", - 'NG' => "/^(\d{6})$/", - 'NI' => "/^(\d{7})$/", - 'NL' => "/^(\d{4}[A-Z]{2})$/", - 'NO' => "/^(\d{4})$/", - 'NP' => "/^(\d{5})$/", - 'NZ' => "/^(\d{4})$/", - 'OM' => "/^(\d{3})$/", - 'PF' => "/^((97|98)7\d{2})$/", - 'PG' => "/^(\d{3})$/", - 'PH' => "/^(\d{4})$/", - 'PK' => "/^(\d{5})$/", - 'PL' => "/^(\d{2}-\d{3})$/", + 'GE' => '/^(\d{4})$/', + 'GF' => '/^((97|98)3\d{2})$/', + 'GG' => '/^((?:(?:[A-PR-UWYZ][A-HK-Y]\d[ABEHMNPRV-Y0-9]|[A-PR-UWYZ]\d[A-HJKPS-UW0-9])\s\d[ABD-HJLNP-UW-Z]{2})|GIR\s?0AA)$/', + 'GL' => '/^(\d{4})$/', + 'GP' => '/^((97|98)\d{3})$/', + 'GR' => '/^(\d{5})$/', + 'GT' => '/^(\d{5})$/', + 'GU' => '/^(969\d{2})$/', + 'GW' => '/^(\d{4})$/', + 'HN' => '/^([A-Z]{2}\d{4})$/', + 'HR' => '/^(?:HR)*(\d{5})$/', + 'HT' => '/^(?:HT)*(\d{4})$/', + 'HU' => '/^(\d{4})$/', + 'ID' => '/^(\d{5})$/', + 'IE' => '/^[A-Z]\d{2}$|^[A-Z]{3}[A-Z]{4}$/', + 'IL' => '/^(\d{5})$/', + 'IM' => '/^((?:(?:[A-PR-UWYZ][A-HK-Y]\d[ABEHMNPRV-Y0-9]|[A-PR-UWYZ]\d[A-HJKPS-UW0-9])\s\d[ABD-HJLNP-UW-Z]{2})|GIR\s?0AA)$/', + 'IN' => '/^(\d{6})$/', + 'IQ' => '/^(\d{5})$/', + 'IR' => '/^(\d{10})$/', + 'IS' => '/^(\d{3})$/', + 'IT' => '/^(\d{5})$/', + 'JE' => '/^((?:(?:[A-PR-UWYZ][A-HK-Y]\d[ABEHMNPRV-Y0-9]|[A-PR-UWYZ]\d[A-HJKPS-UW0-9])\s\d[ABD-HJLNP-UW-Z]{2})|GIR\s?0AA)$/', + 'JO' => '/^(\d{5})$/', + 'JP' => '/^\d{3}-\d{4}$/', + 'KE' => '/^(\d{5})$/', + 'KG' => '/^(\d{6})$/', + 'KH' => '/^(\d{5})$/', + 'KP' => '/^(\d{6})$/', + 'KR' => '/^(\d{5})$/', + 'KW' => '/^(\d{5})$/', + 'KZ' => '/^(\d{6})$/', + 'LA' => '/^(\d{5})$/', + 'LB' => '/^(\d{4}(\d{4})?)$/', + 'LI' => '/^(\d{4})$/', + 'LK' => '/^(\d{5})$/', + 'LR' => '/^(\d{4})$/', + 'LS' => '/^(\d{3})$/', + 'LT' => '/^(?:LT)*(\d{5})$/', + 'LU' => '/^(?:L-)?\d{4}$/', + 'LV' => '/^(?:LV)*(\d{4})$/', + 'MA' => '/^(\d{5})$/', + 'MC' => '/^(\d{5})$/', + 'MD' => '/^MD-\d{4}$/', + 'ME' => '/^(\d{5})$/', + 'MF' => '/^(\d{5})$/', + 'MG' => '/^(\d{3})$/', + 'MH' => '/^969\d{2}(-\d{4})$/', + 'MK' => '/^(\d{4})$/', + 'MM' => '/^(\d{5})$/', + 'MN' => '/^(\d{6})$/', + 'MP' => '/^9695\d{1}$/', + 'MQ' => '/^(\d{5})$/', + 'MT' => '/^[A-Z]{3}\s?\d{4}$/', + 'MV' => '/^(\d{5})$/', + 'MX' => '/^(\d{5})$/', + 'MY' => '/^(\d{5})$/', + 'MZ' => '/^(\d{4})$/', + 'NC' => '/^(\d{5})$/', + 'NE' => '/^(\d{4})$/', + 'NF' => '/^(\d{4})$/', + 'NG' => '/^(\d{6})$/', + 'NI' => '/^(\d{7})$/', + 'NL' => '/^(\d{4} ?[A-Z]{2})$/', + 'NO' => '/^(\d{4})$/', + 'NP' => '/^(\d{5})$/', + 'NZ' => '/^(\d{4})$/', + 'OM' => '/^(\d{3})$/', + 'PF' => '/^((97|98)7\d{2})$/', + 'PG' => '/^(\d{3})$/', + 'PH' => '/^(\d{4})$/', + 'PK' => '/^(\d{5})$/', + 'PL' => '/^\d{2}-\d{3}$/', 'PM' => '/^(97500)$/', - 'PR' => "/^(\d{9})$/", - 'PT' => "/^(\d{7})$/", + 'PR' => '/^00[679]\d{2}(?:-\d{4})?$/', + 'PT' => '/^\d{4}-?\d{3}$/', 'PW' => '/^(96940)$/', - 'PY' => "/^(\d{4})$/", - 'RE' => "/^((97|98)(4|7|8)\d{2})$/", - 'RO' => "/^(\d{6})$/", - 'RS' => "/^(\d{6})$/", - 'RU' => "/^(\d{6})$/", - 'SA' => "/^(\d{5})$/", - 'SD' => "/^(\d{5})$/", - 'SE' => "/^(?:SE)*(\d{5})$/", - 'SG' => "/^(\d{6})$/", + 'PY' => '/^(\d{4})$/', + 'RE' => '/^((97|98)(4|7|8)\d{2})$/', + 'RO' => '/^(\d{6})$/', + 'RS' => '/^(\d{6})$/', + 'RU' => '/^(\d{6})$/', + 'SA' => '/^(\d{5})$/', + 'SD' => '/^(\d{5})$/', + 'SE' => '/^(?:SE)?\d{3}\s\d{2}$/', + 'SG' => '/^(\d{6})$/', 'SH' => '/^(STHL1ZZ)$/', - 'SI' => "/^(?:SI)*(\d{4})$/", - 'SK' => "/^((\d{5})|(\d{3}\040\d{2}))$/", - 'SM' => "/^(4789\d)$/", - 'SN' => "/^(\d{5})$/", - 'SO' => "/^([A-Z]{2}\d{5})$/", - 'SV' => "/^(?:CP)*(\d{4})$/", - 'SZ' => "/^([A-Z]\d{3})$/", + 'SI' => '/^(?:SI)*(\d{4})$/', + 'SJ' => '/^(\d{4})$/', + 'SK' => '/^\d{3}\s?\d{2}$/', + 'SM' => '/^(4789\d)$/', + 'SN' => '/^(\d{5})$/', + 'SO' => '/^([A-Z]{2}\d{5})$/', + 'SV' => '/^(?:CP)*(\d{4})$/', + 'SZ' => '/^([A-Z]\d{3})$/', 'TC' => '/^(TKCA 1ZZ)$/', - 'TH' => "/^(\d{5})$/", - 'TJ' => "/^(\d{6})$/", - 'TM' => "/^(\d{6})$/", - 'TN' => "/^(\d{4})$/", - 'TR' => "/^(\d{5})$/", - 'TW' => "/^(\d{5})$/", - 'UA' => "/^(\d{5})$/", - 'US' => "/^\d{5}(-\d{4})?$/", - 'UY' => "/^(\d{5})$/", - 'UZ' => "/^(\d{6})$/", - 'VA' => "/^(\d{5})$/", - 'VE' => "/^(\d{4})$/", - 'VI' => "/^\d{5}(-\d{4})?$/", - 'VN' => "/^(\d{6})$/", - 'WF' => "/^(986\d{2})$/", - 'YT' => "/^(\d{5})$/", - 'ZA' => "/^(\d{4})$/", - 'ZM' => "/^(\d{5})$/", + 'TH' => '/^(\d{5})$/', + 'TJ' => '/^(\d{6})$/', + 'TM' => '/^(\d{6})$/', + 'TN' => '/^(\d{4})$/', + 'TR' => '/^(\d{5})$/', + 'TW' => '/^(\d{5})$/', + 'UA' => '/^(\d{5})$/', + 'US' => '/^\d{5}(-\d{4})?$/', + 'UY' => '/^(\d{5})$/', + 'UZ' => '/^(\d{6})$/', + 'VA' => '/^(\d{5})$/', + 'VE' => '/^(\d{4})$/', + 'VI' => '/^008\d{2}(?:-\d{4})?$/', + 'VN' => '/^(\d{6})$/', + 'WF' => '/^(986\d{2})$/', + 'YT' => '/^(\d{5})$/', + 'ZA' => '/^(\d{4})$/', + 'ZM' => '/^(\d{5})$/', ]; public $countryCode; diff -Nru php-respect-validation-1.1.15/library/Rules/SubdivisionCode/FrSubdivisionCode.php php-respect-validation-1.1.29/library/Rules/SubdivisionCode/FrSubdivisionCode.php --- php-respect-validation-1.1.15/library/Rules/SubdivisionCode/FrSubdivisionCode.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Rules/SubdivisionCode/FrSubdivisionCode.php 2018-11-04 21:58:45.000000000 +0000 @@ -19,32 +19,27 @@ * ISO 3166-1 alpha-2: FR * * @link http://www.geonames.org/FR/administrative-division-france.html + * @link https://www.iso.org/obp/ui/en/#iso:code:3166:FR */ class FrSubdivisionCode extends AbstractSearcher { public $haystack = [ - 'A', // Alsace - 'B', // Aquitaine - 'C', // Auvergne - 'D', // Bourgogne - 'E', // Bretagne - 'F', // Centre - 'G', // Champagne-Ardenne - 'H', // Territorial Collectivity of Corsica - 'I', // Franche-Comté - 'J', // Île-de-France - 'K', // Languedoc-Roussillon - 'L', // Limousin - 'M', // Lorraine - 'N', // Midi-Pyrénées - 'O', // Nord-Pas-de-Calais - 'P', // Basse-Normandie - 'Q', // Haute-Normandie - 'R', // Pays de la Loire - 'S', // Picardie - 'T', // Poitou-Charentes - 'U', // Provence-Alpes-Côte d'Azur - 'V', // Rhône-Alpes + 'ARA', // Auvergne-Rhône-Alpes + 'BFC', // Bourgogne-Franche-Comté + 'BRE', // Bretagne + 'CVL', // Centre-Val de Loire + 'COR', // Corse + 'GES', // Grand Est + 'GUA', // Guadeloupe + 'HDF', // Hauts-de-France + 'IDF', // Île-de-France + 'MAY', // Mayotte + 'NOR', // Normandie + 'NAQ', // Nouvelle-Aquitaine + 'OCC', // Occitanie + 'PDL', // Pays de la Loire + 'PAC', // Provence-Alpes-Côte d'Azur + 'LRE', // La Réunion '01', // Ain '02', // Aisne '03', // Allier @@ -143,10 +138,14 @@ '95', // Val-d'Oise 'BL', // Saint Barthélemy (see also separate ISO 3166-1 entry under BL) 'CP', // Clipperton + 'GF', // Guyane (française) (see also separate country code entry under GF) + 'GP', // Guadeloupe (see also separate country code entry under GP) 'MF', // Saint Martin (see also separate ISO 3166-1 entry under MF) + 'MQ', // Martinique (see also separate country code entry under MQ) 'NC', // Nouvelle-Calédonie (see also separate ISO 3166-1 entry under NC) 'PF', // Polynésie française (see also separate ISO 3166-1 entry under PF) 'PM', // Saint-Pierre-et-Miquelon (see also separate ISO 3166-1 entry under PM) + 'RE', // La Réunion (see also separate country code entry under RE) 'TF', // Terres Australes Françaises (see also separate ISO 3166-1 entry under TF) 'WF', // Wallis et Futuna (see also separate ISO 3166-1 entry under WF) 'YT', // Mayotte (see also separate ISO 3166-1 entry under YT) diff -Nru php-respect-validation-1.1.15/library/Rules/Tld.php php-respect-validation-1.1.29/library/Rules/Tld.php --- php-respect-validation-1.1.15/library/Rules/Tld.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Rules/Tld.php 2018-11-04 21:58:45.000000000 +0000 @@ -14,109 +14,230 @@ class Tld extends AbstractRule { protected $tldList = [ - //generic - http://en.wikipedia.org/wiki/Generic_top-level_domain - 'aero', 'asia', 'biz', 'cat', 'com', 'coop', 'edu', 'gov', 'info', - 'int', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'org', 'post', 'pro', - 'tel', 'travel', 'xxx', 'ninja', 'abb', 'abbott', 'abogado', 'academy', - 'accenture', 'accountant', 'accountants', 'active', 'actor', 'ads', 'adult', - 'aeg', 'afl', 'agency', 'aig', 'airforce', 'allfinanz', 'alsace', 'amsterdam', - 'an', 'android', 'apartments', 'app', 'aquarelle', 'archi', 'army', 'arpa', - 'associates', 'attorney', 'auction', 'audio', 'auto', 'autos', 'axa', 'azure', - 'band', 'bank', 'bar', 'barclaycard', 'barclays', 'bargains', 'bauhaus', - 'bayern', 'bbc', 'bbva', 'beer', 'berlin', 'best', 'bharti', 'bible', 'bid', - 'bike', 'bing', 'bingo', 'bio', 'black', 'blackfriday', 'bloomberg', 'blue', - 'bmw', 'bnl', 'bnpparibas', 'boats', 'bond', 'boo', 'boutique', 'bradesco', - 'bridgestone', 'broker', 'brother', 'brussels', 'budapest', 'build', 'builders', - 'business', 'buzz', 'bv', 'bzh', 'cab', 'cafe', 'cal', 'camera', 'camp', - 'cancerresearch', 'canon', 'capetown', 'capital', 'caravan', 'cards', - 'care', 'career', 'careers', 'cars', 'cartier', 'casa', 'cash', 'casino', - 'catering', 'cba', 'cbn', 'center', 'ceo', 'cern', 'cfa', 'cfd', 'channel', - 'chat', 'cheap', 'chloe', 'christmas', 'chrome', 'church', 'cisco', 'citic', - 'city', 'claims', 'cleaning', 'click', 'clinic', 'clothing', 'cloud', 'club', - 'coach', 'codes', 'coffee', 'college', 'cologne', 'commbank', 'community', - 'company', 'computer', 'condos', 'construction', 'consulting', 'contractors', - 'cooking', 'cool', 'corsica', 'country', 'coupons', 'courses', 'credit', - 'creditcard', 'cricket', 'crown', 'crs', 'cruises', 'cuisinella', 'cw', - 'cymru', 'cyou', 'dabur', 'dad', 'dance', 'date', 'dating', 'datsun', - 'day', 'dclk', 'deals', 'degree', 'delivery', 'democrat', 'dental', 'dentist' - , 'desi', 'design', 'dev', 'diamonds', 'diet', 'digital', 'direct', 'directory', - 'discount', 'dnp', 'docs', 'dog', 'doha', 'domains', 'doosan', 'download', - 'drive', 'durban', 'dvag', 'earth', 'eat', 'education', 'email', 'emerck', - 'energy', 'engineer', 'engineering', 'enterprises', 'epson', 'equipment', - 'erni', 'esq', 'estate', 'eurovision', 'eus', 'events', 'everbank', - 'exchange', 'expert', 'exposed', 'express', 'fail', 'faith', 'fan', 'fans', - 'farm', 'fashion', 'feedback', 'film', 'finance', 'financial', 'firmdale', - 'fish', 'fishing', 'fit', 'fitness', 'flights', 'florist', 'flowers', 'flsmidth', - 'fly', 'foo', 'football', 'forex', 'forsale', 'forum', 'foundation', 'frl', - 'frogans', 'fund', 'furniture', 'futbol', 'fyi', 'gal', 'gallery', 'garden', - 'gbiz', 'gdn', 'gent', 'genting', 'ggee', 'gift', 'gifts', 'gives', 'glass', - 'gle', 'global', 'globo', 'gmail', 'gmo', 'gmx', 'gold', 'goldpoint', 'golf', - 'goo', 'goog', 'google', 'gop', 'graphics', 'gratis', 'green', 'gripe', 'guge', - 'guide', 'guitars', 'guru', 'hamburg', 'hangout', 'haus', 'healthcare', 'help', - 'here', 'hermes', 'hiphop', 'hitachi', 'hiv', 'hockey', 'holdings', 'holiday', - 'homedepot', 'homes', 'honda', 'horse', 'host', 'hosting', 'hoteles', 'hotmail', - 'house', 'how', 'ibm', 'icbc', 'icu', 'ifm', 'immo', 'immobilien', 'industries', - 'infiniti', 'ing', 'ink', 'institute', 'insure', 'international', 'investments', - 'irish', 'iwc', 'java', 'jcb', 'jetzt', 'jewelry', 'jlc', 'jll', 'joburg', 'juegos', - 'kaufen', 'kddi', 'kim', 'kitchen', 'kiwi', 'koeln', 'komatsu', 'krd', 'kred', - 'kyoto', 'lacaixa', 'land', 'lasalle', 'lat', 'latrobe', 'law', 'lawyer', 'lds', - 'lease', 'leclerc', 'legal', 'lgbt', 'liaison', 'lidl', 'life', 'lighting', - 'limited', 'limo', 'link', 'loan', 'loans', 'lol', 'london', 'lotte', 'lotto', - 'love', 'ltda', 'lupin', 'luxe', 'luxury', 'madrid', 'maif', 'maison', 'management', - 'mango', 'market', 'marketing', 'markets', 'marriott', 'mba', 'media', 'meet', - 'melbourne', 'meme', 'memorial', 'men', 'menu', 'miami', 'microsoft', 'mini', 'mma', - 'moda', 'moe', 'monash', 'money', 'montblanc', 'mormon', 'mortgage', 'moscow', - 'motorcycles', 'mov', 'movie', 'movistar', 'mtn', 'mtpc', 'nadex', 'nagoya', 'navy', - 'nec', 'netbank', 'network', 'neustar', 'new', 'news', 'nexus', 'ngo', 'nhk', 'nico', - 'ninja', 'nissan', 'nra', 'nrw', 'ntt', 'nyc', 'office', 'okinawa', 'omega', 'one', - 'ong', 'onl', 'online', 'ooo', 'oracle', 'organic', 'osaka', 'otsuka', 'ovh', 'page', - 'panerai', 'paris', 'partners', 'parts', 'party', 'pharmacy', 'philips', 'photo', - 'photography', 'photos', 'physio', 'piaget', 'pics', 'pictet', 'pictures', 'pink', - 'pizza', 'place', 'play', 'plumbing', 'plus', 'pohl', 'poker', 'porn', 'praxi', - 'press', 'prod', 'productions', 'prof', 'properties', 'property', 'pub', 'qpon', - 'quebec', 'racing', 'realtor', 'realty', 'recipes', 'red', 'redstone', 'rehab', - 'reise', 'reisen', 'reit', 'ren', 'rent', 'rentals', 'repair', 'report', 'republican', - 'rest', 'restaurant', 'review', 'reviews', 'rich', 'ricoh', 'rio', 'rip', 'rocks', - 'rodeo', 'rsvp', 'ruhr', 'run', 'ryukyu', 'saarland', 'sakura', 'sale', 'samsung', - 'sandvik', 'sandvikcoromant', 'sap', 'sarl', 'saxo', 'sca', 'scb', 'schmidt', - 'scholarships', 'school', 'schule', 'schwarz', 'science', 'scor', 'scot', 'seat', - 'sener', 'services', 'sew', 'sex', 'sexy', 'shiksha', 'shoes', 'show', 'shriram', - 'singles', 'site', 'sj', 'ski', 'sky', 'skype', 'sncf', 'soccer', 'social', - 'software', 'sohu', 'solar', 'solutions', 'sony', 'soy', 'space', 'spiegel', - 'spreadbetting', 'starhub', 'statoil', 'study', 'style', 'sucks', 'supplies', - 'supply', 'support', 'surf', 'surgery', 'suzuki', 'swatch', 'swiss', 'sx', 'sydney', - 'systems', 'taipei', 'tatar', 'tattoo', 'tax', 'taxi', 'team', 'tech', 'technology', - 'telefonica', 'temasek', 'tennis', 'thd', 'theater', 'tickets', 'tienda', 'tips', - 'tires', 'tirol', 'today', 'tokyo', 'tools', 'top', 'toray', 'toshiba', 'tours', - 'town', 'toys', 'trade', 'trading', 'training', 'trust', 'tui', 'university', 'uno', - 'uol', 'vacations', 'vegas', 'ventures', 'versicherung', 'vet', 'viajes', 'video', - 'villas', 'vision', 'vista', 'vistaprint', 'vlaanderen', 'vodka', 'vote', 'voting', - 'voto', 'voyage', 'wales', 'walter', 'wang', 'watch', 'webcam', 'website', 'wed', - 'wedding', 'weir', 'whoswho', 'wien', 'wiki', 'williamhill', 'win', 'windows', - 'wme', 'work', 'works', 'world', 'wtc', 'wtf', 'xbox', 'xerox', 'xin', 'xyz', - 'yachts', 'yandex', 'yodobashi', 'yoga', 'yokohama', 'youtube', 'zip', 'zone', 'zuerich', - //country - 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'ao', 'aq', 'ar', 'as', - 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', - 'bi', 'bj', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bw', 'by', 'bz', - 'ca', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', - 'cr', 'cs', 'cu', 'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', - 'dz', 'ec', 'ee', 'eg', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', - 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', - 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', - 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', - 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', - 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', - 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mk', 'ml', 'mm', - 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', - 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', - 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', - 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', - 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sk', 'sl', 'sm', 'sn', 'so', - 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', - 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', - 'ug', 'uk', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', - 'wf', 'ws', 'ye', 'yt', 'za', 'zm', 'zw', + // https://data.iana.org/TLD/tlds-alpha-by-domain.txt + // Version 2018100800, Last Updated Mon Oct 8 07:07:01 2018 UTC + 'aaa', 'aarp', 'abarth', 'abb', 'abbott', 'abbvie', 'abc', 'able', + 'abogado', 'abudhabi', 'ac', 'academy', 'accenture', 'accountant', + 'accountants', 'aco', 'active', 'actor', 'ad', 'adac', 'ads', 'adult', + 'ae', 'aeg', 'aero', 'aetna', 'af', 'afamilycompany', 'afl', 'africa', + 'ag', 'agakhan', 'agency', 'ai', 'aig', 'aigo', 'airbus', 'airforce', + 'airtel', 'akdn', 'al', 'alfaromeo', 'alibaba', 'alipay', 'allfinanz', + 'allstate', 'ally', 'alsace', 'alstom', 'am', 'americanexpress', + 'americanfamily', 'amex', 'amfam', 'amica', 'amsterdam', 'analytics', + 'android', 'anquan', 'anz', 'ao', 'aol', 'apartments', 'app', 'apple', + 'aq', 'aquarelle', 'ar', 'arab', 'aramco', 'archi', 'army', 'arpa', + 'art', 'arte', 'as', 'asda', 'asia', 'associates', 'at', 'athleta', + 'attorney', 'au', 'auction', 'audi', 'audible', 'audio', 'auspost', + 'author', 'auto', 'autos', 'avianca', 'aw', 'aws', 'ax', 'axa', 'az', + 'azure', 'ba', 'baby', 'baidu', 'banamex', 'bananarepublic', 'band', + 'bank', 'bar', 'barcelona', 'barclaycard', 'barclays', 'barefoot', + 'bargains', 'baseball', 'basketball', 'bauhaus', 'bayern', 'bb', 'bbc', + 'bbt', 'bbva', 'bcg', 'bcn', 'bd', 'be', 'beats', 'beauty', 'beer', + 'bentley', 'berlin', 'best', 'bestbuy', 'bet', 'bf', 'bg', 'bh', + 'bharti', 'bi', 'bible', 'bid', 'bike', 'bing', 'bingo', 'bio', 'biz', + 'bj', 'black', 'blackfriday', 'blanco', 'blockbuster', 'blog', + 'bloomberg', 'blue', 'bm', 'bms', 'bmw', 'bn', 'bnl', 'bnpparibas', + 'bo', 'boats', 'boehringer', 'bofa', 'bom', 'bond', 'boo', 'book', + 'booking', 'bosch', 'bostik', 'boston', 'bot', 'boutique', 'box', 'br', + 'bradesco', 'bridgestone', 'broadway', 'broker', 'brother', 'brussels', + 'bs', 'bt', 'budapest', 'bugatti', 'build', 'builders', 'business', + 'buy', 'buzz', 'bv', 'bw', 'by', 'bz', 'bzh', 'ca', 'cab', 'cafe', + 'cal', 'call', 'calvinklein', 'cam', 'camera', 'camp', + 'cancerresearch', 'canon', 'capetown', 'capital', 'capitalone', 'car', + 'caravan', 'cards', 'care', 'career', 'careers', 'cars', 'cartier', + 'casa', 'case', 'caseih', 'cash', 'casino', 'cat', 'catering', + 'catholic', 'cba', 'cbn', 'cbre', 'cbs', 'cc', 'cd', 'ceb', 'center', + 'ceo', 'cern', 'cf', 'cfa', 'cfd', 'cg', 'ch', 'chanel', 'channel', + 'charity', 'chase', 'chat', 'cheap', 'chintai', 'christmas', 'chrome', + 'chrysler', 'church', 'ci', 'cipriani', 'circle', 'cisco', 'citadel', + 'citi', 'citic', 'city', 'cityeats', 'ck', 'cl', 'claims', 'cleaning', + 'click', 'clinic', 'clinique', 'clothing', 'cloud', 'club', 'clubmed', + 'cm', 'cn', 'co', 'coach', 'codes', 'coffee', 'college', 'cologne', + 'com', 'comcast', 'commbank', 'community', 'company', 'compare', + 'computer', 'comsec', 'condos', 'construction', 'consulting', + 'contact', 'contractors', 'cooking', 'cookingchannel', 'cool', 'coop', + 'corsica', 'country', 'coupon', 'coupons', 'courses', 'cr', 'credit', + 'creditcard', 'creditunion', 'cricket', 'crown', 'crs', 'cruise', + 'cruises', 'csc', 'cu', 'cuisinella', 'cv', 'cw', 'cx', 'cy', 'cymru', + 'cyou', 'cz', 'dabur', 'dad', 'dance', 'data', 'date', 'dating', + 'datsun', 'day', 'dclk', 'dds', 'de', 'deal', 'dealer', 'deals', + 'degree', 'delivery', 'dell', 'deloitte', 'delta', 'democrat', + 'dental', 'dentist', 'desi', 'design', 'dev', 'dhl', 'diamonds', + 'diet', 'digital', 'direct', 'directory', 'discount', 'discover', + 'dish', 'diy', 'dj', 'dk', 'dm', 'dnp', 'do', 'docs', 'doctor', + 'dodge', 'dog', 'doha', 'domains', 'dot', 'download', 'drive', 'dtv', + 'dubai', 'duck', 'dunlop', 'duns', 'dupont', 'durban', 'dvag', 'dvr', + 'dz', 'earth', 'eat', 'ec', 'eco', 'edeka', 'edu', 'education', 'ee', + 'eg', 'email', 'emerck', 'energy', 'engineer', 'engineering', + 'enterprises', 'epost', 'epson', 'equipment', 'er', 'ericsson', 'erni', + 'es', 'esq', 'estate', 'esurance', 'et', 'etisalat', 'eu', + 'eurovision', 'eus', 'events', 'everbank', 'exchange', 'expert', + 'exposed', 'express', 'extraspace', 'fage', 'fail', 'fairwinds', + 'faith', 'family', 'fan', 'fans', 'farm', 'farmers', 'fashion', 'fast', + 'fedex', 'feedback', 'ferrari', 'ferrero', 'fi', 'fiat', 'fidelity', + 'fido', 'film', 'final', 'finance', 'financial', 'fire', 'firestone', + 'firmdale', 'fish', 'fishing', 'fit', 'fitness', 'fj', 'fk', 'flickr', + 'flights', 'flir', 'florist', 'flowers', 'fly', 'fm', 'fo', 'foo', + 'food', 'foodnetwork', 'football', 'ford', 'forex', 'forsale', 'forum', + 'foundation', 'fox', 'fr', 'free', 'fresenius', 'frl', 'frogans', + 'frontdoor', 'frontier', 'ftr', 'fujitsu', 'fujixerox', 'fun', 'fund', + 'furniture', 'futbol', 'fyi', 'ga', 'gal', 'gallery', 'gallo', + 'gallup', 'game', 'games', 'gap', 'garden', 'gb', 'gbiz', 'gd', 'gdn', + 'ge', 'gea', 'gent', 'genting', 'george', 'gf', 'gg', 'ggee', 'gh', + 'gi', 'gift', 'gifts', 'gives', 'giving', 'gl', 'glade', 'glass', + 'gle', 'global', 'globo', 'gm', 'gmail', 'gmbh', 'gmo', 'gmx', 'gn', + 'godaddy', 'gold', 'goldpoint', 'golf', 'goo', 'goodyear', 'goog', + 'google', 'gop', 'got', 'gov', 'gp', 'gq', 'gr', 'grainger', + 'graphics', 'gratis', 'green', 'gripe', 'grocery', 'group', 'gs', 'gt', + 'gu', 'guardian', 'gucci', 'guge', 'guide', 'guitars', 'guru', 'gw', + 'gy', 'hair', 'hamburg', 'hangout', 'haus', 'hbo', 'hdfc', 'hdfcbank', + 'health', 'healthcare', 'help', 'helsinki', 'here', 'hermes', 'hgtv', + 'hiphop', 'hisamitsu', 'hitachi', 'hiv', 'hk', 'hkt', 'hm', 'hn', + 'hockey', 'holdings', 'holiday', 'homedepot', 'homegoods', 'homes', + 'homesense', 'honda', 'honeywell', 'horse', 'hospital', 'host', + 'hosting', 'hot', 'hoteles', 'hotels', 'hotmail', 'house', 'how', 'hr', + 'hsbc', 'ht', 'hu', 'hughes', 'hyatt', 'hyundai', 'ibm', 'icbc', 'ice', + 'icu', 'id', 'ie', 'ieee', 'ifm', 'ikano', 'il', 'im', 'imamat', + 'imdb', 'immo', 'immobilien', 'in', 'inc', 'industries', 'infiniti', + 'info', 'ing', 'ink', 'institute', 'insurance', 'insure', 'int', + 'intel', 'international', 'intuit', 'investments', 'io', 'ipiranga', + 'iq', 'ir', 'irish', 'is', 'iselect', 'ismaili', 'ist', 'istanbul', + 'it', 'itau', 'itv', 'iveco', 'jaguar', 'java', 'jcb', 'jcp', 'je', + 'jeep', 'jetzt', 'jewelry', 'jio', 'jll', 'jm', 'jmp', 'jnj', 'jo', + 'jobs', 'joburg', 'jot', 'joy', 'jp', 'jpmorgan', 'jprs', 'juegos', + 'juniper', 'kaufen', 'kddi', 'ke', 'kerryhotels', 'kerrylogistics', + 'kerryproperties', 'kfh', 'kg', 'kh', 'ki', 'kia', 'kim', 'kinder', + 'kindle', 'kitchen', 'kiwi', 'km', 'kn', 'koeln', 'komatsu', 'kosher', + 'kp', 'kpmg', 'kpn', 'kr', 'krd', 'kred', 'kuokgroup', 'kw', 'ky', + 'kyoto', 'kz', 'la', 'lacaixa', 'ladbrokes', 'lamborghini', 'lamer', + 'lancaster', 'lancia', 'lancome', 'land', 'landrover', 'lanxess', + 'lasalle', 'lat', 'latino', 'latrobe', 'law', 'lawyer', 'lb', 'lc', + 'lds', 'lease', 'leclerc', 'lefrak', 'legal', 'lego', 'lexus', 'lgbt', + 'li', 'liaison', 'lidl', 'life', 'lifeinsurance', 'lifestyle', + 'lighting', 'like', 'lilly', 'limited', 'limo', 'lincoln', 'linde', + 'link', 'lipsy', 'live', 'living', 'lixil', 'lk', 'llc', 'loan', + 'loans', 'locker', 'locus', 'loft', 'lol', 'london', 'lotte', 'lotto', + 'love', 'lpl', 'lplfinancial', 'lr', 'ls', 'lt', 'ltd', 'ltda', 'lu', + 'lundbeck', 'lupin', 'luxe', 'luxury', 'lv', 'ly', 'ma', 'macys', + 'madrid', 'maif', 'maison', 'makeup', 'man', 'management', 'mango', + 'map', 'market', 'marketing', 'markets', 'marriott', 'marshalls', + 'maserati', 'mattel', 'mba', 'mc', 'mckinsey', 'md', 'me', 'med', + 'media', 'meet', 'melbourne', 'meme', 'memorial', 'men', 'menu', + 'merckmsd', 'metlife', 'mg', 'mh', 'miami', 'microsoft', 'mil', 'mini', + 'mint', 'mit', 'mitsubishi', 'mk', 'ml', 'mlb', 'mls', 'mm', 'mma', + 'mn', 'mo', 'mobi', 'mobile', 'mobily', 'moda', 'moe', 'moi', 'mom', + 'monash', 'money', 'monster', 'mopar', 'mormon', 'mortgage', 'moscow', + 'moto', 'motorcycles', 'mov', 'movie', 'movistar', 'mp', 'mq', 'mr', + 'ms', 'msd', 'mt', 'mtn', 'mtr', 'mu', 'museum', 'mutual', 'mv', 'mw', + 'mx', 'my', 'mz', 'na', 'nab', 'nadex', 'nagoya', 'name', 'nationwide', + 'natura', 'navy', 'nba', 'nc', 'ne', 'nec', 'net', 'netbank', + 'netflix', 'network', 'neustar', 'new', 'newholland', 'news', 'next', + 'nextdirect', 'nexus', 'nf', 'nfl', 'ng', 'ngo', 'nhk', 'ni', 'nico', + 'nike', 'nikon', 'ninja', 'nissan', 'nissay', 'nl', 'no', 'nokia', + 'northwesternmutual', 'norton', 'now', 'nowruz', 'nowtv', 'np', 'nr', + 'nra', 'nrw', 'ntt', 'nu', 'nyc', 'nz', 'obi', 'observer', 'off', + 'office', 'okinawa', 'olayan', 'olayangroup', 'oldnavy', 'ollo', 'om', + 'omega', 'one', 'ong', 'onl', 'online', 'onyourside', 'ooo', 'open', + 'oracle', 'orange', 'org', 'organic', 'origins', 'osaka', 'otsuka', + 'ott', 'ovh', 'pa', 'page', 'panasonic', 'paris', 'pars', 'partners', + 'parts', 'party', 'passagens', 'pay', 'pccw', 'pe', 'pet', 'pf', + 'pfizer', 'pg', 'ph', 'pharmacy', 'phd', 'philips', 'phone', 'photo', + 'photography', 'photos', 'physio', 'piaget', 'pics', 'pictet', + 'pictures', 'pid', 'pin', 'ping', 'pink', 'pioneer', 'pizza', 'pk', + 'pl', 'place', 'play', 'playstation', 'plumbing', 'plus', 'pm', 'pn', + 'pnc', 'pohl', 'poker', 'politie', 'porn', 'post', 'pr', 'pramerica', + 'praxi', 'press', 'prime', 'pro', 'prod', 'productions', 'prof', + 'progressive', 'promo', 'properties', 'property', 'protection', 'pru', + 'prudential', 'ps', 'pt', 'pub', 'pw', 'pwc', 'py', 'qa', 'qpon', + 'quebec', 'quest', 'qvc', 'racing', 'radio', 'raid', 're', 'read', + 'realestate', 'realtor', 'realty', 'recipes', 'red', 'redstone', + 'redumbrella', 'rehab', 'reise', 'reisen', 'reit', 'reliance', 'ren', + 'rent', 'rentals', 'repair', 'report', 'republican', 'rest', + 'restaurant', 'review', 'reviews', 'rexroth', 'rich', 'richardli', + 'ricoh', 'rightathome', 'ril', 'rio', 'rip', 'rmit', 'ro', 'rocher', + 'rocks', 'rodeo', 'rogers', 'room', 'rs', 'rsvp', 'ru', 'rugby', + 'ruhr', 'run', 'rw', 'rwe', 'ryukyu', 'sa', 'saarland', 'safe', + 'safety', 'sakura', 'sale', 'salon', 'samsclub', 'samsung', 'sandvik', + 'sandvikcoromant', 'sanofi', 'sap', 'sarl', 'sas', 'save', 'saxo', + 'sb', 'sbi', 'sbs', 'sc', 'sca', 'scb', 'schaeffler', 'schmidt', + 'scholarships', 'school', 'schule', 'schwarz', 'science', 'scjohnson', + 'scor', 'scot', 'sd', 'se', 'search', 'seat', 'secure', 'security', + 'seek', 'select', 'sener', 'services', 'ses', 'seven', 'sew', 'sex', + 'sexy', 'sfr', 'sg', 'sh', 'shangrila', 'sharp', 'shaw', 'shell', + 'shia', 'shiksha', 'shoes', 'shop', 'shopping', 'shouji', 'show', + 'showtime', 'shriram', 'si', 'silk', 'sina', 'singles', 'site', 'sj', + 'sk', 'ski', 'skin', 'sky', 'skype', 'sl', 'sling', 'sm', 'smart', + 'smile', 'sn', 'sncf', 'so', 'soccer', 'social', 'softbank', + 'software', 'sohu', 'solar', 'solutions', 'song', 'sony', 'soy', + 'space', 'spiegel', 'sport', 'spot', 'spreadbetting', 'sr', 'srl', + 'srt', 'st', 'stada', 'staples', 'star', 'starhub', 'statebank', + 'statefarm', 'stc', 'stcgroup', 'stockholm', 'storage', 'store', + 'stream', 'studio', 'study', 'style', 'su', 'sucks', 'supplies', + 'supply', 'support', 'surf', 'surgery', 'suzuki', 'sv', 'swatch', + 'swiftcover', 'swiss', 'sx', 'sy', 'sydney', 'symantec', 'systems', + 'sz', 'tab', 'taipei', 'talk', 'taobao', 'target', 'tatamotors', + 'tatar', 'tattoo', 'tax', 'taxi', 'tc', 'tci', 'td', 'tdk', 'team', + 'tech', 'technology', 'tel', 'telefonica', 'temasek', 'tennis', 'teva', + 'tf', 'tg', 'th', 'thd', 'theater', 'theatre', 'tiaa', 'tickets', + 'tienda', 'tiffany', 'tips', 'tires', 'tirol', 'tj', 'tjmaxx', 'tjx', + 'tk', 'tkmaxx', 'tl', 'tm', 'tmall', 'tn', 'to', 'today', 'tokyo', + 'tools', 'top', 'toray', 'toshiba', 'total', 'tours', 'town', 'toyota', + 'toys', 'tr', 'trade', 'trading', 'training', 'travel', + 'travelchannel', 'travelers', 'travelersinsurance', 'trust', 'trv', + 'tt', 'tube', 'tui', 'tunes', 'tushu', 'tv', 'tvs', 'tw', 'tz', 'ua', + 'ubank', 'ubs', 'uconnect', 'ug', 'uk', 'unicom', 'university', 'uno', + 'uol', 'ups', 'us', 'uy', 'uz', 'va', 'vacations', 'vana', 'vanguard', + 'vc', 've', 'vegas', 'ventures', 'verisign', 'versicherung', 'vet', + 'vg', 'vi', 'viajes', 'video', 'vig', 'viking', 'villas', 'vin', 'vip', + 'virgin', 'visa', 'vision', 'vistaprint', 'viva', 'vivo', 'vlaanderen', + 'vn', 'vodka', 'volkswagen', 'volvo', 'vote', 'voting', 'voto', + 'voyage', 'vu', 'vuelos', 'wales', 'walmart', 'walter', 'wang', + 'wanggou', 'warman', 'watch', 'watches', 'weather', 'weatherchannel', + 'webcam', 'weber', 'website', 'wed', 'wedding', 'weibo', 'weir', 'wf', + 'whoswho', 'wien', 'wiki', 'williamhill', 'win', 'windows', 'wine', + 'winners', 'wme', 'wolterskluwer', 'woodside', 'work', 'works', + 'world', 'wow', 'ws', 'wtc', 'wtf', 'xbox', 'xerox', 'xfinity', + 'xihuan', 'xin', 'xn--11b4c3d', 'xn--1ck2e1b', 'xn--1qqw23a', + 'xn--2scrj9c', 'xn--30rr7y', 'xn--3bst00m', 'xn--3ds443g', + 'xn--3e0b707e', 'xn--3hcrj9c', 'xn--3oq18vl8pn36a', 'xn--3pxu8k', + 'xn--42c2d9a', 'xn--45br5cyl', 'xn--45brj9c', 'xn--45q11c', + 'xn--4gbrim', 'xn--54b7fta0cc', 'xn--55qw42g', 'xn--55qx5d', + 'xn--5su34j936bgsg', 'xn--5tzm5g', 'xn--6frz82g', 'xn--6qq986b3xl', + 'xn--80adxhks', 'xn--80ao21a', 'xn--80aqecdr1a', 'xn--80asehdb', + 'xn--80aswg', 'xn--8y0a063a', 'xn--90a3ac', 'xn--90ae', 'xn--90ais', + 'xn--9dbq2a', 'xn--9et52u', 'xn--9krt00a', 'xn--b4w605ferd', + 'xn--bck1b9a5dre4c', 'xn--c1avg', 'xn--c2br7g', 'xn--cck2b3b', + 'xn--cg4bki', 'xn--clchc0ea0b2g2a9gcd', 'xn--czr694b', 'xn--czrs0t', + 'xn--czru2d', 'xn--d1acj3b', 'xn--d1alf', 'xn--e1a4c', 'xn--eckvdtc9d', + 'xn--efvy88h', 'xn--estv75g', 'xn--fct429k', 'xn--fhbei', + 'xn--fiq228c5hs', 'xn--fiq64b', 'xn--fiqs8s', 'xn--fiqz9s', + 'xn--fjq720a', 'xn--flw351e', 'xn--fpcrj9c3d', 'xn--fzc2c9e2c', + 'xn--fzys8d69uvgm', 'xn--g2xx48c', 'xn--gckr3f0f', 'xn--gecrj9c', + 'xn--gk3at1e', 'xn--h2breg3eve', 'xn--h2brj9c', 'xn--h2brj9c8c', + 'xn--hxt814e', 'xn--i1b6b1a6a2e', 'xn--imr513n', 'xn--io0a7i', + 'xn--j1aef', 'xn--j1amh', 'xn--j6w193g', 'xn--jlq61u9w7b', + 'xn--jvr189m', 'xn--kcrx77d1x4a', 'xn--kprw13d', 'xn--kpry57d', + 'xn--kpu716f', 'xn--kput3i', 'xn--l1acc', 'xn--lgbbat1ad8j', + 'xn--mgb9awbf', 'xn--mgba3a3ejt', 'xn--mgba3a4f16a', + 'xn--mgba7c0bbn0a', 'xn--mgbaakc7dvf', 'xn--mgbaam7a8h', + 'xn--mgbab2bd', 'xn--mgbai9azgqp6j', 'xn--mgbayh7gpa', + 'xn--mgbb9fbpob', 'xn--mgbbh1a', 'xn--mgbbh1a71e', 'xn--mgbc0a9azcg', + 'xn--mgbca7dzdo', 'xn--mgberp4a5d4ar', 'xn--mgbgu82a', + 'xn--mgbi4ecexp', 'xn--mgbpl2fh', 'xn--mgbt3dhd', 'xn--mgbtx2b', + 'xn--mgbx4cd0ab', 'xn--mix891f', 'xn--mk1bu44c', 'xn--mxtq1m', + 'xn--ngbc5azd', 'xn--ngbe9e0a', 'xn--ngbrx', 'xn--node', 'xn--nqv7f', + 'xn--nqv7fs00ema', 'xn--nyqy26a', 'xn--o3cw4h', 'xn--ogbpf8fl', + 'xn--otu796d', 'xn--p1acf', 'xn--p1ai', 'xn--pbt977c', 'xn--pgbs0dh', + 'xn--pssy2u', 'xn--q9jyb4c', 'xn--qcka1pmc', 'xn--qxam', 'xn--rhqv96g', + 'xn--rovu88b', 'xn--rvc1e0am3e', 'xn--s9brj9c', 'xn--ses554g', + 'xn--t60b56a', 'xn--tckwe', 'xn--tiq49xqyj', 'xn--unup4y', + 'xn--vermgensberater-ctb', 'xn--vermgensberatung-pwb', 'xn--vhquv', + 'xn--vuq861b', 'xn--w4r85el8fhu5dnra', 'xn--w4rs40l', 'xn--wgbh1c', + 'xn--wgbl6a', 'xn--xhq521b', 'xn--xkc2al3hye2a', 'xn--xkc2dl3a5ee0h', + 'xn--y9a3aq', 'xn--yfro4i67o', 'xn--ygbi2ammx', 'xn--zfr164b', 'xxx', + 'xyz', 'yachts', 'yahoo', 'yamaxun', 'yandex', 'ye', 'yodobashi', + 'yoga', 'yokohama', 'you', 'youtube', 'yt', 'yun', 'za', 'zappos', + 'zara', 'zero', 'zip', 'zippo', 'zm', 'zone', 'zuerich', 'zw', ]; public function validate($input) diff -Nru php-respect-validation-1.1.15/library/Validator.php php-respect-validation-1.1.29/library/Validator.php --- php-respect-validation-1.1.15/library/Validator.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/library/Validator.php 2018-11-04 21:58:45.000000000 +0000 @@ -32,19 +32,19 @@ * @method static Validator bank(string $countryCode) * @method static Validator bankAccount(string $countryCode) * @method static Validator base() - * @method static Validator between(mixed $min = null, mixed $max = null, bool $inclusive = true) + * @method static Validator between($min = null, $max = null, bool $inclusive = true) * @method static Validator bic(string $countryCode) * @method static Validator boolType() * @method static Validator boolVal() * @method static Validator bsn() * @method static Validator call() * @method static Validator callableType() - * @method static Validator callback(mixed $callback) - * @method static Validator charset(mixed $charset) + * @method static Validator callback(callable $callback) + * @method static Validator charset($charset) * @method static Validator cnh() * @method static Validator cnpj() * @method static Validator consonant(string $additionalChars = null) - * @method static Validator contains(mixed $containsValue, bool $identical = false) + * @method static Validator contains($containsValue, bool $identical = false) * @method static Validator countable() * @method static Validator countryCode() * @method static Validator currencyCode() @@ -56,8 +56,8 @@ * @method static Validator domain(bool $tldCheck = true) * @method static Validator each(Validatable $itemValidator = null, Validatable $keyValidator = null) * @method static Validator email() - * @method static Validator endsWith(mixed $endValue, bool $identical = false) - * @method static Validator equals(mixed $compareTo) + * @method static Validator endsWith($endValue, bool $identical = false) + * @method static Validator equals($compareTo) * @method static Validator even() * @method static Validator executable() * @method static Validator exists() @@ -66,22 +66,22 @@ * @method static Validator falseVal() * @method static Validator fibonacci() * @method static Validator file() - * @method static Validator filterVar(int $filter, mixed $options = null) + * @method static Validator filterVar(int $filter, $options = null) * @method static Validator finite() * @method static Validator floatVal() * @method static Validator floatType() * @method static Validator graph(string $additionalChars = null) * @method static Validator hexRgbColor() - * @method static Validator identical(mixed $value) + * @method static Validator identical($value) * @method static Validator identityCard(string $countryCode) * @method static Validator image(finfo $fileInfo = null) * @method static Validator imei() - * @method static Validator in(mixed $haystack, bool $compareIdentical = false) + * @method static Validator in($haystack, bool $compareIdentical = false) * @method static Validator infinite() * @method static Validator instance(string $instanceName) * @method static Validator intVal() * @method static Validator intType() - * @method static Validator ip(mixed $ipOptions = null) + * @method static Validator ip($ipOptions = null) * @method static Validator iterableType() * @method static Validator json() * @method static Validator key(string $reference, Validatable $referenceValidator = null, bool $mandatory = true) @@ -94,9 +94,9 @@ * @method static Validator length(int $min = null, int $max = null, bool $inclusive = true) * @method static Validator lowercase() * @method static Validator macAddress() - * @method static Validator max(mixed $maxValue, bool $inclusive = true) + * @method static Validator max($maxValue, bool $inclusive = true) * @method static Validator mimetype(string $mimetype) - * @method static Validator min(mixed $minValue, bool $inclusive = true) + * @method static Validator min($minValue, bool $inclusive = true) * @method static Validator minimumAge(int $age) * @method static Validator multiple(int $multipleOf) * @method static Validator negative() @@ -131,7 +131,7 @@ * @method static Validator size(string $minSize = null, string $maxSize = null) * @method static Validator slug() * @method static Validator space(string $additionalChars = null) - * @method static Validator startsWith(mixed $startValue, bool $identical = false) + * @method static Validator startsWith($startValue, bool $identical = false) * @method static Validator stringType() * @method static Validator subdivisionCode(string $countryCode) * @method static Validator symbolicLink() @@ -148,7 +148,7 @@ * @method static Validator writable() * @method static Validator xdigit(string $additionalChars = null) * @method static Validator yes($useLocale = false) - * @method static Validator zend(mixed $validator, array $params = null) + * @method static Validator zend($validator, array $params = null) */ class Validator extends AllOf { diff -Nru php-respect-validation-1.1.15/LICENSE.md php-respect-validation-1.1.29/LICENSE.md --- php-respect-validation-1.1.15/LICENSE.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/LICENSE.md 2018-11-04 21:58:45.000000000 +0000 @@ -32,8 +32,6 @@ *** See also: +- [README](README.md) - [Contributing](CONTRIBUTING.md) -- [Feature Guide](docs/README.md) -- [Installation](docs/INSTALL.md) -- [Validators](docs/VALIDATORS.md) - [Changelog](CHANGELOG.md) diff -Nru php-respect-validation-1.1.15/README.md php-respect-validation-1.1.29/README.md --- php-respect-validation-1.1.15/README.md 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/README.md 2018-11-04 21:58:45.000000000 +0000 @@ -10,16 +10,18 @@ [The most awesome validation engine ever created for PHP.](http://bit.ly/1a1oeQv) - Complex rules made simple: `v::numeric()->positive()->between(1, 255)->validate($input)`. -- [Granularity control](docs/README.md#validation-methods) for advanced reporting. +- Granularity control for advanced reporting. - More than 100 (fully tested) validators. -- [A concrete API](docs/CONCRETE_API.md) for non fluent usage. +- A concrete API for non fluent usage. - Works on PHP 5.4+ or HHVM 3.3+ +## Documentation + +Documentation can be found in https://respect-validation.readthedocs.io +and also in the [docs/](docs/index.md) folder. + ## Table of contents - [Contributing](CONTRIBUTING.md) -- [Feature Guide](docs/README.md) -- [Installation](docs/INSTALL.md) - [License](LICENSE.md) -- [Validators](docs/VALIDATORS.md) - [Changelog](CHANGELOG.md) diff -Nru php-respect-validation-1.1.15/tests/integration/issue-1033.phpt php-respect-validation-1.1.29/tests/integration/issue-1033.phpt --- php-respect-validation-1.1.15/tests/integration/issue-1033.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/tests/integration/issue-1033.phpt 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,27 @@ +--DESCRIPTION-- +The previous output was: + +- All of the required rules must pass for `{ "A", "B", "B" }` +- Each item in `{ "A", "B", "B" }` must be valid +- "A" must equal 1 +- "B" must equal 1 +- "B" must equal 1 +--FILE-- +assert(['A', 'B', 'B']); +} catch (AllOfException $exception) { + echo $exception->getFullMessage().PHP_EOL; +} +?> +--EXPECTF-- +- Each item in { "A", "B", "B" } must be valid + - "A" must be equals 1 + - "B" must be equals 1 + - "B" must be equals 1 diff -Nru php-respect-validation-1.1.15/tests/integration/issue-619.phpt php-respect-validation-1.1.29/tests/integration/issue-619.phpt --- php-respect-validation-1.1.15/tests/integration/issue-619.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/tests/integration/issue-619.phpt 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,16 @@ +--FILE-- +setTemplate('invalid object')->assert('test'); +} catch (ValidationException $exception) { + print_r($exception->getMainMessage()); +} +?> +--EXPECTF-- +invalid object diff -Nru php-respect-validation-1.1.15/tests/integration/issue-805.phpt php-respect-validation-1.1.29/tests/integration/issue-805.phpt --- php-respect-validation-1.1.15/tests/integration/issue-805.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-respect-validation-1.1.29/tests/integration/issue-805.phpt 2018-11-04 21:58:45.000000000 +0000 @@ -0,0 +1,19 @@ +--FILE-- +setTemplate('WRONG EMAIL!!!!!!'))->assert(['email' => 'qwe']); +} catch (NestedValidationException $exception) { + print_r($exception->getMessages()); +} +?> +--EXPECTF-- +Array +( + [0] => WRONG EMAIL!!!!!! +) diff -Nru php-respect-validation-1.1.15/tests/integration/set_template_with_multiple_validators_should_use_template_as_full_message.phpt php-respect-validation-1.1.29/tests/integration/set_template_with_multiple_validators_should_use_template_as_full_message.phpt --- php-respect-validation-1.1.15/tests/integration/set_template_with_multiple_validators_should_use_template_as_full_message.phpt 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/tests/integration/set_template_with_multiple_validators_should_use_template_as_full_message.phpt 2018-11-04 21:58:45.000000000 +0000 @@ -15,4 +15,3 @@ ?> --EXPECTF-- - "something" is not tasty - - "something" must be greater than or equal to 1 diff -Nru php-respect-validation-1.1.15/tests/unit/Rules/AlnumTest.php php-respect-validation-1.1.29/tests/unit/Rules/AlnumTest.php --- php-respect-validation-1.1.15/tests/unit/Rules/AlnumTest.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/tests/unit/Rules/AlnumTest.php 2018-11-04 21:58:45.000000000 +0000 @@ -77,7 +77,8 @@ { return [ ['alganet', ''], - ['alganet', 'alganet'], + ['foo :- 123 !', '- ! :'], + ['number 100%', '%'], ['0alg-anet0', '0-9'], ['1', ''], ["\t", ''], @@ -98,6 +99,7 @@ { return [ ['', ''], + ['number 100%', ''], ['@#$', ''], ['_', ''], ['dgç', ''], diff -Nru php-respect-validation-1.1.15/tests/unit/Rules/DateTest.php php-respect-validation-1.1.29/tests/unit/Rules/DateTest.php --- php-respect-validation-1.1.15/tests/unit/Rules/DateTest.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/tests/unit/Rules/DateTest.php 2018-11-04 21:58:45.000000000 +0000 @@ -19,7 +19,7 @@ * @covers Respect\Validation\Rules\Date * @covers Respect\Validation\Exceptions\DateException */ -class DateTest extends \PHPUnit_Framework_TestCase +class DateTest extends RuleTestCase { protected $dateValidator; @@ -150,4 +150,57 @@ ['UTC', 'z', 320], ]; } + + /** + * {@inheritdoc} + */ + public function providerForValidInput() + { + return [ + [new Date(), 'now'], + [new Date(), 'today'], + [new Date(), 'tomorrow'], + [new Date(), 'yesterday'], + [new Date(), '+1 day'], + [new Date(), 'next Thursday'], + [new Date(), '+1 week 2 days 4 hours 2 seconds'], + [new Date(), 2018], + [new Date(), new DateTime()], + [new Date('Y-m-d'), '2009-09-09'], + [new Date('d/m/Y'), '23/05/1987'], + [new Date('c'), '2004-02-12T15:19:21+00:00'], + [new Date('r'), 'Thu, 29 Dec 2005 01:02:03 +0000'], + [new Date('U'), 1464658596], + [new Date('h'), 6], + [new Date('z'), 320], + [new Date('Ym'), 202302], + [new Date('m'), 12], + [new Date('Y'), 2000], + ]; + } + + /** + * {@inheritdoc} + */ + public function providerForInvalidInput() + { + return [ + [new Date(), 'not-a-date'], + [new Date(), []], + [new Date(), true], + [new Date(), false], + [new Date(), null], + [new Date(), ''], + [new Date('Y-m-d'), '2009-12-00'], + [new Date('Y-m-d'), '2018-02-29'], + [new Date('h'), 24], + [new Date(), '2014-99'], + [new Date('d'), 1], + [new Date('Y-m'), '2014-99'], + [new Date('m'), '99'], + [new Date('H'), '24'], + [new Date('i'), '60'], + [new Date('s'), '60'], + ]; + } } diff -Nru php-respect-validation-1.1.15/tests/unit/Rules/EmailTest.php php-respect-validation-1.1.29/tests/unit/Rules/EmailTest.php --- php-respect-validation-1.1.15/tests/unit/Rules/EmailTest.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/tests/unit/Rules/EmailTest.php 2018-11-04 21:58:45.000000000 +0000 @@ -11,6 +11,8 @@ namespace Respect\Validation\Rules; +use stdClass; + function class_exists($className) { if (isset($GLOBALS['class_exists'][$className])) { @@ -142,6 +144,10 @@ ['test@test..com'], ['test@test.com.'], ['.test@test.com'], + [[]], + [new stdClass()], + [null], + [tmpfile()], ]; } } diff -Nru php-respect-validation-1.1.15/tests/unit/Rules/IntValTest.php php-respect-validation-1.1.29/tests/unit/Rules/IntValTest.php --- php-respect-validation-1.1.15/tests/unit/Rules/IntValTest.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/tests/unit/Rules/IntValTest.php 2018-11-04 21:58:45.000000000 +0000 @@ -52,6 +52,8 @@ ['165'], [123456], [PHP_INT_MAX], + ['06'], + ['0'] ]; } @@ -61,7 +63,11 @@ [''], [null], ['a'], + ['1.0'], + [1.0], [' '], + [true], + [false], ['Foo'], ['1.44'], [1e-5], diff -Nru php-respect-validation-1.1.15/tests/unit/Rules/MaxTest.php php-respect-validation-1.1.29/tests/unit/Rules/MaxTest.php --- php-respect-validation-1.1.15/tests/unit/Rules/MaxTest.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/tests/unit/Rules/MaxTest.php 2018-11-04 21:58:45.000000000 +0000 @@ -62,6 +62,8 @@ [200, false, 250], [200, false, 1500], [200, false, 200], + [1900, false, '2018-01-25'], + [10.5, false, '2018-01-25'], ]; } } diff -Nru php-respect-validation-1.1.15/tests/unit/Rules/MinTest.php php-respect-validation-1.1.29/tests/unit/Rules/MinTest.php --- php-respect-validation-1.1.15/tests/unit/Rules/MinTest.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/tests/unit/Rules/MinTest.php 2018-11-04 21:58:45.000000000 +0000 @@ -70,6 +70,8 @@ [0, false, -250], [0, false, -50], [50, false, 50], + [2040, false, '2018-01-25'], + [10.5, false, '2018-01-25'], ]; } } diff -Nru php-respect-validation-1.1.15/tests/unit/Rules/PostalCodeTest.php php-respect-validation-1.1.29/tests/unit/Rules/PostalCodeTest.php --- php-respect-validation-1.1.15/tests/unit/Rules/PostalCodeTest.php 2018-01-02 21:47:22.000000000 +0000 +++ php-respect-validation-1.1.29/tests/unit/Rules/PostalCodeTest.php 2018-11-04 21:58:45.000000000 +0000 @@ -86,11 +86,18 @@ return [ ['BR', '02179-000'], ['BR', '02179000'], + ['CA', 'A1A 2B2'], ['GB', 'GIR 0AA'], ['GB', 'PR1 9LY'], ['US', '02179'], ['YE', ''], ['PL', '99-300'], + ['NL', '1012 GX'], + ['NL', '1012GX'], + ['PT', '3660-606'], + ['PT', '3660606'], + ['CO', '110231'], + ['KR', '03187'], ]; } @@ -119,12 +126,15 @@ return [ ['BR', '02179'], ['BR', '02179.000'], + ['CA', '1A1B2B'], ['GB', 'GIR 00A'], ['GB', 'GIR0AA'], ['GB', 'PR19LY'], ['US', '021 79'], ['YE', '02179'], ['PL', '99300'], + ['KR', '548940'], + ['KR', '548-940'], ]; } }