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