@@ 776-792 (lines=17) @@ | ||
773 | * @return Assert |
|
774 | * @throws AssertionFailedException |
|
775 | */ |
|
776 | public function notEmpty($message = null, $propertyPath = null) |
|
777 | { |
|
778 | if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) |
|
779 | { |
|
780 | return $this; |
|
781 | } |
|
782 | if ( ( is_object($this->value) && empty((array)$this->value) ) || empty($this->value) ) |
|
783 | { |
|
784 | $message = $message ?: $this->overrideError; |
|
785 | $message = sprintf( |
|
786 | $message ?: 'Value "%s" is empty, but non empty value was expected.', |
|
787 | $this->stringify($this->value) |
|
788 | ); |
|
789 | throw $this->createException($message, $this->overrideCode ?: self::VALUE_EMPTY, $propertyPath); |
|
790 | } |
|
791 | return $this; |
|
792 | } |
|
793 | ||
794 | /** |
|
795 | * Assert that value is empty |
|
@@ 1608-1624 (lines=17) @@ | ||
1605 | * @return Assert |
|
1606 | * @throws AssertionFailedException |
|
1607 | */ |
|
1608 | public function notBlank($message = null, $propertyPath = null) |
|
1609 | { |
|
1610 | if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) ) |
|
1611 | { |
|
1612 | return $this; |
|
1613 | } |
|
1614 | if ( false === $this->value || ( empty( $this->value ) && '0' != $this->value ) ) |
|
1615 | { |
|
1616 | $message = $message ?: $this->overrideError; |
|
1617 | $message = sprintf( |
|
1618 | $message ?: 'Value "%s" is blank, but was expected to contain a value.', |
|
1619 | $this->stringify($this->value) |
|
1620 | ); |
|
1621 | throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_BLANK, $propertyPath); |
|
1622 | } |
|
1623 | return $this; |
|
1624 | } |
|
1625 | ||
1626 | /** |
|
1627 | * Assert that value is instance of given class-name. |