Skip to content

Commit

Permalink
2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecc-business-account committed Sep 28, 2024
1 parent 9ed557e commit a02b8d0
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 86 deletions.
112 changes: 75 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,40 @@ $max=$this->set($arr)->min('col',true); // returns the key where is the min valu
#### Parameters:
* **$colName** the column (mixed)
* **$getKey** param bool $getKey (bool)

### Method minRow()
It finds the minimum value of a specific column and returns one or many values<br>
**Example:**
```
$max=$this->set($arr)->minRow('col'); // returns the min row of the column 'col'
$max=$this->set($arr)->minRow('col','all'); // returns min max values (rows)
$max=$this->set($arr)->minRow('col','all',true); // returns min max values (indexes)
```
#### Parameters:
* **$colName** the name of the column to find a value (mixed)
* **$returnType** =['first','last','random','all'][$i] <br>
* **first** returns the first min value<br>
* **last** returns the last min value<br>
* **random** if there are many min values, then it returns one randomly<br>
* **all** returns all the values that have the min value (string)
* **$getKey** (default is false) if it returns the keys(indexs). If false it returns the columns (bool)
### Method maxRow()
It finds the minimum value of a specific column and returns one or many values<br>
**Example:**
```
$max=$this->set($arr)->maxRow('col'); // returns the max row of the column 'col'
$max=$this->set($arr)->maxRow('col','all'); // returns all max values (rows)
$max=$this->set($arr)->maxRow('col','all',true); // returns all max values (indexes)
```
#### Parameters:
* **$colName** the name of the column to find a value (mixed)
* **$returnType** =['first','last','random','all'][$i] <br>
* **first** returns the first min value<br>
* **last** returns the last min value<br>
* **random** if there are many min values, then it returns one randomly<br>
* **all** returns all the values that have the min value (string)
* **$getKey** (default is false) if it returns the keys(indexs). If false it returns the columns (bool)

### Method modCol()
It adds or modify a column.
**Example:**
Expand Down Expand Up @@ -729,43 +763,43 @@ 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"](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 | | | |
| 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:

Expand All @@ -776,6 +810,10 @@ ValidateOne


## versions
* 2.6.1 2024-09-28
* [fixed]
* In 2.6 and lower, many functions detected when the array is null to avoid to do the operation.
* In 2.6.1, many functions detects when the array is empty (including null) to avoid to do the operation.
* 2.6 2024-09-26
* [new] minRow()
* [new] maxRow()
Expand Down
Loading

0 comments on commit a02b8d0

Please sign in to comment.