@@ 838-854 (lines=17) @@ | ||
835 | * @return Assert |
|
836 | * @throws AssertionFailedException |
|
837 | */ |
|
838 | public function notEmpty($message = null, $propertyPath = null) |
|
839 | { |
|
840 | if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) |
|
841 | { |
|
842 | return $this; |
|
843 | } |
|
844 | if ( ( is_object($this->value) && empty((array)$this->value) ) || empty($this->value) ) |
|
845 | { |
|
846 | $message = $message ?: $this->overrideError; |
|
847 | $message = sprintf( |
|
848 | $message ?: 'Value "%s" is empty, but non empty value was expected.', |
|
849 | $this->stringify($this->value) |
|
850 | ); |
|
851 | throw $this->createException($message, $this->overrideCode ?: self::VALUE_EMPTY, $propertyPath); |
|
852 | } |
|
853 | return $this; |
|
854 | } |
|
855 | ||
856 | /** |
|
857 | * Assert that value is empty |
|
@@ 1670-1686 (lines=17) @@ | ||
1667 | * @return Assert |
|
1668 | * @throws AssertionFailedException |
|
1669 | */ |
|
1670 | public function notBlank($message = null, $propertyPath = null) |
|
1671 | { |
|
1672 | if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) |
|
1673 | { |
|
1674 | return $this; |
|
1675 | } |
|
1676 | if ( false === $this->value || ( empty( $this->value ) && '0' != $this->value ) ) |
|
1677 | { |
|
1678 | $message = $message ?: $this->overrideError; |
|
1679 | $message = sprintf( |
|
1680 | $message ?: 'Value "%s" is blank, but was expected to contain a value.', |
|
1681 | $this->stringify($this->value) |
|
1682 | ); |
|
1683 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_BLANK, $propertyPath); |
|
1684 | } |
|
1685 | return $this; |
|
1686 | } |
|
1687 | ||
1688 | /** |
|
1689 | * Assert that value is instance of given class-name. |