| @@ 751-767 (lines=17) @@ | ||
| 748 | * @return Assert |
|
| 749 | * @throws AssertionFailedException |
|
| 750 | */ |
|
| 751 | public function notEmpty($message = null, $propertyPath = null) |
|
| 752 | { |
|
| 753 | if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) |
|
| 754 | { |
|
| 755 | return $this; |
|
| 756 | } |
|
| 757 | if ( ( is_object($this->value) && empty((array)$this->value) ) || empty($this->value) ) |
|
| 758 | { |
|
| 759 | $message = $message ?: $this->overrideError; |
|
| 760 | $message = sprintf( |
|
| 761 | $message ?: 'Value "%s" is empty, but non empty value was expected.', |
|
| 762 | $this->stringify($this->value) |
|
| 763 | ); |
|
| 764 | throw $this->createException($message, $this->overrideCode ?: self::VALUE_EMPTY, $propertyPath); |
|
| 765 | } |
|
| 766 | return $this; |
|
| 767 | } |
|
| 768 | ||
| 769 | /** |
|
| 770 | * Assert that value is empty |
|
| @@ 1583-1599 (lines=17) @@ | ||
| 1580 | * @return Assert |
|
| 1581 | * @throws AssertionFailedException |
|
| 1582 | */ |
|
| 1583 | public function notBlank($message = null, $propertyPath = null) |
|
| 1584 | { |
|
| 1585 | if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) |
|
| 1586 | { |
|
| 1587 | return $this; |
|
| 1588 | } |
|
| 1589 | if ( false === $this->value || ( empty( $this->value ) && '0' != $this->value ) ) |
|
| 1590 | { |
|
| 1591 | $message = $message ?: $this->overrideError; |
|
| 1592 | $message = sprintf( |
|
| 1593 | $message ?: 'Value "%s" is blank, but was expected to contain a value.', |
|
| 1594 | $this->stringify($this->value) |
|
| 1595 | ); |
|
| 1596 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_BLANK, $propertyPath); |
|
| 1597 | } |
|
| 1598 | return $this; |
|
| 1599 | } |
|
| 1600 | ||
| 1601 | /** |
|
| 1602 | * Assert that value is instance of given class-name. |
|