|
@@ 642-648 (lines=7) @@
|
| 639 |
|
* @return Assert |
| 640 |
|
* @throws AssertionFailedException |
| 641 |
|
*/ |
| 642 |
|
public function id(string $message='', string $fieldName='') : Assert |
| 643 |
|
{ |
| 644 |
|
$message = $message ?: $this->overrideError; |
| 645 |
|
$message = $message ?: 'Value "%s" is not an integer id.'; |
| 646 |
|
|
| 647 |
|
return $this->nonEmptyInt($message, $fieldName)->range(1, PHP_INT_MAX, $message, $fieldName); |
| 648 |
|
} |
| 649 |
|
|
| 650 |
|
/** |
| 651 |
|
* Assert that value is a unsigned int (non-empty valid integer, can be zero). |
|
@@ 657-663 (lines=7) @@
|
| 654 |
|
* @return Assert |
| 655 |
|
* @throws AssertionFailedException |
| 656 |
|
*/ |
| 657 |
|
public function unsignedInt(string $message='', string $fieldName='') : Assert |
| 658 |
|
{ |
| 659 |
|
$message = $message ?: $this->overrideError; |
| 660 |
|
$message = $message ?: 'Value "%s" is not an integer id.'; |
| 661 |
|
|
| 662 |
|
return $this->int($message, $fieldName)->range(0, PHP_INT_MAX, $message, $fieldName); |
| 663 |
|
} |
| 664 |
|
|
| 665 |
|
/** |
| 666 |
|
* Assert that value is a valid flag (0 or 1). |
|
@@ 673-679 (lines=7) @@
|
| 670 |
|
* @return Assert |
| 671 |
|
* @throws AssertionFailedException |
| 672 |
|
*/ |
| 673 |
|
public function flag(string $message='', string $fieldName='') : Assert |
| 674 |
|
{ |
| 675 |
|
$message = $message ?: $this->overrideError; |
| 676 |
|
$message = $message ?: 'Value "%s" is not a 0 or 1.'; |
| 677 |
|
|
| 678 |
|
return $this->range(0, 1, $message, $fieldName); |
| 679 |
|
} |
| 680 |
|
|
| 681 |
|
/** |
| 682 |
|
* Assert that value is a valid status (-1, 0, or 1). |