@@ 790-806 (lines=17) @@ | ||
787 | * @return Assert |
|
788 | * @throws AssertionFailedException |
|
789 | */ |
|
790 | public function notEmpty($message = null, $propertyPath = null) |
|
791 | { |
|
792 | if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) |
|
793 | { |
|
794 | return $this; |
|
795 | } |
|
796 | if ( ( is_object($this->value) && empty((array)$this->value) ) || empty($this->value) ) |
|
797 | { |
|
798 | $message = $message ?: $this->overrideError; |
|
799 | $message = sprintf( |
|
800 | $message ?: 'Value "%s" is empty, but non empty value was expected.', |
|
801 | $this->stringify($this->value) |
|
802 | ); |
|
803 | throw $this->createException($message, $this->overrideCode ?: self::VALUE_EMPTY, $propertyPath); |
|
804 | } |
|
805 | return $this; |
|
806 | } |
|
807 | ||
808 | /** |
|
809 | * Assert that value is empty |
|
@@ 1622-1638 (lines=17) @@ | ||
1619 | * @return Assert |
|
1620 | * @throws AssertionFailedException |
|
1621 | */ |
|
1622 | public function notBlank($message = null, $propertyPath = null) |
|
1623 | { |
|
1624 | if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) |
|
1625 | { |
|
1626 | return $this; |
|
1627 | } |
|
1628 | if ( false === $this->value || ( empty( $this->value ) && '0' != $this->value ) ) |
|
1629 | { |
|
1630 | $message = $message ?: $this->overrideError; |
|
1631 | $message = sprintf( |
|
1632 | $message ?: 'Value "%s" is blank, but was expected to contain a value.', |
|
1633 | $this->stringify($this->value) |
|
1634 | ); |
|
1635 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_BLANK, $propertyPath); |
|
1636 | } |
|
1637 | return $this; |
|
1638 | } |
|
1639 | ||
1640 | /** |
|
1641 | * Assert that value is instance of given class-name. |