| @@ 815-831 (lines=17) @@ | ||
| 812 | * @return Assert |
|
| 813 | * @throws AssertionFailedException |
|
| 814 | */ |
|
| 815 | public function notEmpty($message = null, $propertyPath = null) |
|
| 816 | { |
|
| 817 | if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) |
|
| 818 | { |
|
| 819 | return $this; |
|
| 820 | } |
|
| 821 | if ( ( is_object($this->value) && empty((array)$this->value) ) || empty($this->value) ) |
|
| 822 | { |
|
| 823 | $message = $message ?: $this->overrideError; |
|
| 824 | $message = sprintf( |
|
| 825 | $message ?: 'Value "%s" is empty, but non empty value was expected.', |
|
| 826 | $this->stringify($this->value) |
|
| 827 | ); |
|
| 828 | throw $this->createException($message, $this->overrideCode ?: self::VALUE_EMPTY, $propertyPath); |
|
| 829 | } |
|
| 830 | return $this; |
|
| 831 | } |
|
| 832 | ||
| 833 | /** |
|
| 834 | * Assert that value is empty |
|
| @@ 1647-1663 (lines=17) @@ | ||
| 1644 | * @return Assert |
|
| 1645 | * @throws AssertionFailedException |
|
| 1646 | */ |
|
| 1647 | public function notBlank($message = null, $propertyPath = null) |
|
| 1648 | { |
|
| 1649 | if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) |
|
| 1650 | { |
|
| 1651 | return $this; |
|
| 1652 | } |
|
| 1653 | if ( false === $this->value || ( empty( $this->value ) && '0' != $this->value ) ) |
|
| 1654 | { |
|
| 1655 | $message = $message ?: $this->overrideError; |
|
| 1656 | $message = sprintf( |
|
| 1657 | $message ?: 'Value "%s" is blank, but was expected to contain a value.', |
|
| 1658 | $this->stringify($this->value) |
|
| 1659 | ); |
|
| 1660 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_BLANK, $propertyPath); |
|
| 1661 | } |
|
| 1662 | return $this; |
|
| 1663 | } |
|
| 1664 | ||
| 1665 | /** |
|
| 1666 | * Assert that value is instance of given class-name. |
|