Skip to content

Commit f56d346

Browse files
committed
Add less than and more than validations
1 parent c40a0e2 commit f56d346

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Inp.php

+20
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,26 @@ public function equal($str): bool
492492
return ($this->value === $str);
493493
}
494494

495+
/**
496+
* IF value is less than to parameter
497+
* @param $num
498+
* @return bool
499+
*/
500+
public function lessThan($num): bool
501+
{
502+
return ($this->value < (float)$num);
503+
}
504+
505+
/**
506+
* IF value is more than to parameter
507+
* @param $num
508+
* @return bool
509+
*/
510+
public function moreThan($num): bool
511+
{
512+
return ($this->value > (float)$num);
513+
}
514+
495515
/**
496516
* Checks if a string contains a given substring
497517
*

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ Inp::value("Lorem ipsum dolor")->equal("Lorem ipsum dolor");
5757
```php
5858
Inp::value("Lorem ipsum dolor")->notEqual("Lorem ipsum");
5959
```
60+
- **More than**:
61+
```php
62+
Inp::value(200)->moreThan(100);
63+
```
64+
- **Less than**:
65+
```php
66+
Inp::value(100)->lessThan(200);
67+
```
6068
- **Contains**:
6169
```php
6270
Inp::value("Lorem ipsum dolor")->contains("ipsum");

0 commit comments

Comments
 (0)