Skip to content

Commit

Permalink
2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecc-business-account committed Sep 26, 2024
1 parent 8bd2a52 commit 9ed557e
Show file tree
Hide file tree
Showing 3 changed files with 272 additions and 150 deletions.
116 changes: 43 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ What it does? Filter, order, renaming column, grouping, validating, amongst many
* [Parameters:](#parameters-41)
* [versions](#versions)
* [License](#license)
<!-- TOC -->
<!-- TOC -->

## Basic examples

Expand Down Expand Up @@ -729,86 +729,56 @@ ValidateOne
->validate('field'=>'fn:test') // or ->validate('field'=>[['fn','test']])
->all();
```
| condition | description | example work | example fail | expression |
|-----------------------|----------------------------------------------------------------------------------------|----------------|--------------|------------|
| not**\<condition>** | negates any comparison, excepting nullable and custom functions. Example: "notint" | | | |
| "hello" | 20 | notint | | |
| nullable | the value **CAN** be a null. **If the value is null, then it ignores other | | | |
| validations** | null | | nullable | |
| f:**\<namefunction>** | It calls a **custom function** defined in the service class. See example | | | |
| "hello" | | f:test | | |
| contain like | if a text is contained in | | | |
| "helloworld" | "hello" | contain;world | | |
| alpha | if the value is alphabetic | | | |
| "hello" | "hello33" | alpha | | |
| alphanumunder | if the value is alphanumeric or under-case | | | |
| "hello_33" | "hello!33" | alphanumunder | | |
| alphanum | if the value is alphanumeric | | | |
| "hello33" | "hello!33" | alphanum | | |
| text | if the value is a text | | | |
| "hello" | true | text | | |
| regexp | if the value match a regular expression. You can't use comma in the regular | | | |
| expression. | "abc123" | "xyz123" | regexp; | |
| email | if the value is an email | | | |
| "aaa@bbb.com" | "aaa.bbb.com" | email | | |
| url | if the value is an url | | | |
| https://www.nic.cl | "aaaa" | url | | |
| domain | if the value is a domain | | | |
| www.nic.cl | "….." | domain | | |
| minlen | the value must have a minimum length | | | |
| "hello" | "h" | minlen;3 | | |
| maxlen | the value must have a maximum lenght | | | |
| "h" | "hello" | maxlen;3 | | |
| betweenlen | if the value has a size between | | | |
| "hello" | "h" | betweenlen;4,5 | | |
| exist | if the value exists | | | |
| "hi" | null | exist | | |
| missing | if the value not exist | | | |
| null | "hi" | missing | | |
| req,required | if the value is required | | | |
| "hi" | null | req,required | | |
| eq == | if the value is equals to | | | |
| 1 | 0 | eq;1 | | |
| ne != <> | if the value is not equals to | | | |
| 1 | 0 | ne;0 | | |
| null | The value **MUST** be null. It is different to **nullable** because **nullable** is a | | | |
| "**CAN**" | null | "hello" | null | |
| empty | if the value is empty | | | |
| "" | "hello" | empty | | |
| lt | if the value is less than | | | |
| 1 | 10 | lt;5 | | |
| lte/le | if the value is less or equals than | | | |
| 1 | 10 | lte;5 | | |
| gt | if the value is great than | | | |
| 10 | 1 | gt;5 | | |
| gte/ge | if the value is great or equals than | | | |
| 10 | 1 | gte;5 | | |
| between | if the value is between | | | |
| 5 | 0 | between;4,5 | | |
| true | if the value is true or 1 | | | |
| true | false | true | | |
| false | if the value is false, or 0 | | | |
| false | true | false | | |
| array | if the value is an array | | | |
| [1,2,3] | 1 | array | | |
| int | if the value is an integer | | | |
| 1 | "hello" | int | | |
| string | if the value is a string | | | |
| "hello" | true | string | | |
| float | if the value is a float | | | |
| 333.3 | "hello" | float | | |
| object | if the value is an object | | | |
| new stdClass() | 1 | object | | |
| in | the value must be in a list | | | |
| condition | description | example work | example fail | expression |
|------------------|-------------------------------------------------------------------------------------|-------------------------------------------|------------------------|----------------|
| not<condition> | negates any comparison, excepting nullable and custom functions. Example: "notint" | "hello" | 20 | notint |
| nullable | the value CAN be a null. **If the value is null, then it ignores other | validations** | null | nullable |
| f:<namefunction> | It calls a custom function defined in the service class. See example | "hello" | | f:test |
| contain like | if a text is contained in | "helloworld" | "hello" | contain;world |
| alpha | if the value is alphabetic | "hello" | "hello33" | alpha |
| alphanumunder | if the value is alphanumeric or under-case | "hello_33" | "hello!33" | alphanumunder |
| alphanum | if the value is alphanumeric | "hello33" | "hello!33" | alphanum |
| text | if the value is a text | "hello" | true | text |
| regexp | if the value match a regular expression. You can't use comma in the regular | expression. | "abc123" "xyz123" | regexp; |
| email | if the value is an email | ["aaa@bbb.com"](mailto:aaa@bbb.com) | "aaa.bbb.com" | email |
| url | if the value is an url | [https://www.nic.cl](https://www.nic.cl/) | "aaaa" | url |
| domain | if the value is a domain | [www.nic.cl](www.nic.cl) | "….." | domain |
| minlen | the value must have a minimum length | "hello" | "h" | minlen;3 |
| maxlen | the value must have a maximum lenght | "h" | "hello" | maxlen;3 |
| betweenlen | if the value has a size between | "hello" | "h" | betweenlen;4,5 |
| exist | if the value exists | "hi" | null | exist |
| missing | if the value not exist | null | "hi" | missing |
| req,required | if the value is required | "hi" | null | req,required |
| eq == | if the value is equals to | 1 | 0 | eq;1 |
| ne != <> | if the value is not equals to | 1 | 0 | ne;0 |
| null | The value MUST be null. It is different to nullable because nullable is a | "CAN" | null | null |
| empty | if the value is empty | "" | "hello" | empty |
| lt | if the value is less than | 1 | 10 | lt;5 |
| lte/le | if the value is less or equals than | 1 | 10 | lte;5 |
| gt | if the value is great than | 10 | 1 | gt;5 |
| gte/ge | if the value is great or equals than | 10 | 1 | gte;5 |
| between | if the value is between | 5 | 0 | between;4,5 |
| true | if the value is true or 1 | true | false | true |
| false | if the value is false, or 0 | false | true | false |
| array | if the value is an array | [1,2,3] | 1 | array |
| int | if the value is an integer | 1 | "hello" | int |
| string | if the value is a string | "hello" | true | string |
| float | if the value is a float | 333.3 | "hello" | float |
| object | if the value is an object | new stdClass() | 1 | object |
| in | the value must be in a list | | | |

#### Parameters:

* **$comparisonTable** see table (array)
* **$extraFieldError** if true and the current array has more values than comparison table, then
it returns an error. (bool)



## versions
* 2.6 2024-09-26
* [new] minRow()
* [new] maxRow()
* 2.5.1 2024-09-20
* [new] keepCol()
* [new] coolRename()
Expand All @@ -826,7 +796,7 @@ ValidateOne
* removeDuplicate(),group() now accepts multiples columns.
* 2.00 2024-03-10
* nav() and currentArray() are removed from 2.0. The library was optimized and streamlined, and those functions are redundant.
**migration:**
**migration:**
```php
// before:
$r=ArrayOne::set($array)->nav('field')->...->all();
Expand Down
Loading

0 comments on commit 9ed557e

Please sign in to comment.