Skip to content

Commit

Permalink
Change how documentation of rules are presented
Browse files Browse the repository at this point in the history
Rules are not always used from the alias `v`, neither called staticaly.
  • Loading branch information
henriquemoody committed Mar 27, 2017
1 parent a0ba215 commit 2a2e1d5
Show file tree
Hide file tree
Showing 134 changed files with 191 additions and 192 deletions.
6 changes: 3 additions & 3 deletions docs/Age.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Age

- `v::age(int $minAge)`
- `v::age(int $minAge, int $maxAge)`
- `v::age(null, int $maxAge)`
- `Age(int $minAge)`
- `Age(int $minAge, int $maxAge)`
- `Age(null, int $maxAge)`

Validates ranges of years.

Expand Down
2 changes: 1 addition & 1 deletion docs/AllOf.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AllOf

- `v::allOf(v $v1, v $v2, v $v3...)`
- `AllOf(Validatable ...$rule)`

Will validate if all inner validators validates.

Expand Down
4 changes: 2 additions & 2 deletions docs/Alnum.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Alnum

- `v::alnum()`
- `v::alnum(string $additionalChars)`
- `Alnum()`
- `Alnum(string $additionalChars)`

Validates alphanumeric characters from a-Z and 0-9.

Expand Down
6 changes: 3 additions & 3 deletions docs/Alpha.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Alpha

- `v::alpha()`
- `v::alpha(string $additionalChars)`
- `Alpha()`
- `Alpha(string $additionalChars)`

This is similar to `v::alnum()`, but it doesn't allow numbers.
This is similar to `Alnum()`, but it doesn't allow numbers.

***
See also:
Expand Down
2 changes: 1 addition & 1 deletion docs/AlwaysInvalid.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AlwaysInvalid

- `v::alwaysInvalid()`
- `AlwaysInvalid()`

Always return false.

Expand Down
2 changes: 1 addition & 1 deletion docs/AlwaysValid.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AlwaysValid

- `v::alwaysValid()`
- `AlwaysValid()`

Always returns true.

Expand Down
9 changes: 4 additions & 5 deletions docs/AnyOf.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AnyOf

- `v::anyOf(v $v1, v $v2, v $v3...)`
- `AnyOf(Validatable ...$rule)`

This is a group validator that acts as an OR operator.

Expand All @@ -11,11 +11,10 @@ v::anyOf(
)->validate(15.5); // true
```

In the sample above, `v::intVal()` doesn't validates, but
`v::floatVal()` validates, so anyOf returns true.
In the sample above, `IntVal()` doesn't validates, but `FloatVal()` validates,
so `AnyOf()` returns true.

`v::anyOf` returns true if at least one inner validator
passes.
`AnyOf()` returns true if at least one inner validator passes.

***
See also:
Expand Down
2 changes: 1 addition & 1 deletion docs/ArrayType.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ArrayType

- `v::arrayType()`
- `ArrayType()`

Validates whether the type of an input is array.

Expand Down
2 changes: 1 addition & 1 deletion docs/ArrayVal.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ArrayVal

- `v::arrayVal()`
- `ArrayVal()`

Validates if the input is an array or if the input can be used as an array
(instance of `ArrayAccess` or `SimpleXMLElement`).
Expand Down
6 changes: 3 additions & 3 deletions docs/Attribute.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Attribute

- `v::attribute(string $name)`
- `v::attribute(string $name, v $validator)`
- `v::attribute(string $name, v $validator, bool $mandatory = true)`
- `Attribute(string $name)`
- `Attribute(string $name, Validatable $rule)`
- `Attribute(string $name, Validatable $rule, bool $mandatory)`

Validates an object attribute.

Expand Down
2 changes: 1 addition & 1 deletion docs/Bank.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Bank

- `v::bank(string $countryCode)`
- `Bank(string $countryCode)`

Validates a bank.

Expand Down
2 changes: 1 addition & 1 deletion docs/BankAccount.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BankAccount

- `v::bankAccount(string $countryCode, string $bank)`
- `BankAccount(string $countryCode, string $bank)`

Validates a bank account for a given bank.

Expand Down
4 changes: 2 additions & 2 deletions docs/Between.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Between

- `v::between(mixed $start, mixed $end)`
- `v::between(mixed $start, mixed $end, bool $inclusive = true)`
- `Between(mixed $start, mixed $end)`
- `Between(mixed $start, mixed $end, bool $inclusive)`

Validates ranges. Most simple example:

Expand Down
2 changes: 1 addition & 1 deletion docs/Bic.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Bic

- `v::bic(string $countryCode)`
- `Bic(string $countryCode)`

Validates a BIC (Bank Identifier Code) for a given country.

Expand Down
2 changes: 1 addition & 1 deletion docs/BoolType.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BoolType

- `v::boolType()`
- `BoolType()`

Validates if the input is a boolean value:

Expand Down
2 changes: 1 addition & 1 deletion docs/BoolVal.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BoolVal

- `v::boolVal()`
- `BoolVal()`

Validates if the input results in a boolean value:

Expand Down
2 changes: 1 addition & 1 deletion docs/Bsn.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Bsn

- `v::bsn()`
- `Bsn()`

Validates a Dutch citizen service number ([BSN](https://nl.wikipedia.org/wiki/Burgerservicenummer)).

Expand Down
4 changes: 2 additions & 2 deletions docs/Call.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Call

- `v::call(callable $callback)`
- `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:
Expand All @@ -26,7 +26,7 @@ v::arrayVal()->key('scheme', v::startsWith('http'))
->key('query', v::notEmpty());
```

Using `v::call()` you can do this in a single chain:
Using `Call()` you can do this in a single chain:

```php
v::call(
Expand Down
2 changes: 1 addition & 1 deletion docs/CallableType.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CallableType

- `v::callableType()`
- `CallableType()`

Validates if the input is a callable value.

Expand Down
6 changes: 3 additions & 3 deletions docs/Callback.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Callback

- `v::callback(callable $callback)`
- `Callback(callable $callback)`

This is a wildcard validator, it uses a function name, method or closure
to validate something:
Expand All @@ -9,9 +9,9 @@ to validate something:
v::callback('is_int')->validate(10); // true
```

(Please note that this is a sample, the `v::intVal()` validator is much better).
(Please note that this is a sample, the `IntVal()` validator is much better).

As in `v::call()`, you can pass a method or closure to it.
As in `Call()`, you can pass a method or closure to it.

***
See also:
Expand Down
2 changes: 1 addition & 1 deletion docs/Charset.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Charset

- `v::charset(mixed $charset)`
- `Charset(mixed $charset)`

Validates if a string is in a specific charset.

Expand Down
2 changes: 1 addition & 1 deletion docs/Cnh.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cnh

- `v::cnh()`
- `Cnh()`

Validates a Brazillian driver's license.

Expand Down
2 changes: 1 addition & 1 deletion docs/Cnpj.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cnpj

- `v::cnpj()`
- `Cnpj()`

Validates the Brazillian CNPJ number. Ignores non-digit chars, so
use `->digit()` if needed.
Expand Down
6 changes: 3 additions & 3 deletions docs/Cntrl.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Cntrl

- `v::cntrl()`
- `v::cntrl(string $additionalChars)`
- `Cntrl()`
- `Cntrl(string $additionalChars)`

This is similar to `v::alnum()`, but only accepts control characters:
This is similar to `Alnum()`, but only accepts control characters:

```php
v::cntrl()->validate("\n\r\t"); // true
Expand Down
6 changes: 3 additions & 3 deletions docs/Consonant.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Consonant

- `v::consonant()`
- `v::consonant(string $additionalChars)`
- `Consonant()`
- `Consonant(string $additionalChars)`

Similar to `v::alnum()`. Validates strings that contain only consonants:
Similar to `Alnum()`. Validates strings that contain only consonants:

```php
v::consonant()->validate('xkcd'); // true
Expand Down
4 changes: 2 additions & 2 deletions docs/Contains.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contains

- `v::contains(mixed $value)`
- `v::contains(mixed $value, bool $identical = false)`
- `Contains(mixed $value)`
- `Contains(mixed $value, bool $identical)`

For strings:

Expand Down
2 changes: 1 addition & 1 deletion docs/Countable.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Countable

- `v::countable()`
- `Countable()`

Validates if the input is countable, in other words, if you're allowed to use
[count()](http://php.net/count) function on it.
Expand Down
2 changes: 1 addition & 1 deletion docs/CountryCode.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CountryCode

- `v::countryCode()`
- `CountryCode()`

Validates an ISO country code like US or BR.

Expand Down
2 changes: 1 addition & 1 deletion docs/Cpf.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cpf

- `v::cpf()`
- `Cpf()`

Validates a Brazillian CPF number.

Expand Down
4 changes: 2 additions & 2 deletions docs/CreditCard.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CreditCard

- `v::creditCard()`
- `v::creditCard(string $brand)`
- `CreditCard()`
- `CreditCard(string $brand)`

Validates a credit card number.

Expand Down
2 changes: 1 addition & 1 deletion docs/CurrencyCode.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CurrencyCode

- `v::currencyCode()`
- `CurrencyCode()`

Validates an [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code like GBP or EUR.

Expand Down
4 changes: 2 additions & 2 deletions docs/Date.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Date

- `v::date()`
- `v::date(string $format)`
- `Date()`
- `Date(string $format)`

Validates if input is a date:

Expand Down
4 changes: 2 additions & 2 deletions docs/Digit.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Digit

- `v::digit()`
- `Digit()`

This is similar to `v::alnum()`, but it doesn't allow a-Z.
This is similar to `Alnum()`, but it doesn't allow a-Z.

***
See also:
Expand Down
2 changes: 1 addition & 1 deletion docs/Directory.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Directory

- `v::directory()`
- `Directory()`

Validates directories.

Expand Down
4 changes: 2 additions & 2 deletions docs/Domain.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Domain

- `v::domain()`
- `v::domain(bool $tldCheck = true)`
- `Domain()`
- `Domain(bool $tldCheck)`

Validates domain names.

Expand Down
6 changes: 3 additions & 3 deletions docs/Each.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Each

- `v::each(v $validatorForValue)`
- `v::each(null, v $validatorForKey)`
- `v::each(v $validatorForValue, v $validatorForKey)`
- `Each(Validatable $ruleForValue)`
- `Each(null, Validatable $ruleForKey)`
- `Each(Validatable $ruleForValue, Validatable $ruleForKey)`

Iterates over an array or Iterator and validates the value or key
of each entry:
Expand Down
2 changes: 1 addition & 1 deletion docs/Email.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Email

- `v::email()`
- `Email()`

Validates an email address.

Expand Down
6 changes: 3 additions & 3 deletions docs/EndsWith.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# EndsWith

- `v::endsWith(mixed $value)`
- `v::endsWith(mixed $value, bool $identical = false)`
- `EndsWith(mixed $value)`
- `EndsWith(mixed $value, bool $identical)`

This validator is similar to `v::contains()`, but validates
This validator is similar to `Contains()`, but validates
only if the value is at the end of the input.

For strings:
Expand Down
2 changes: 1 addition & 1 deletion docs/Equals.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Equals

- `v::equals(mixed $value)`
- `Equals(mixed $value)`

Validates if the input is equal to some value.

Expand Down
Loading

0 comments on commit 2a2e1d5

Please sign in to comment.