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