Code Duplication    Length = 19-19 lines in 2 locations

src/Assert.php 2 locations

@@ 941-959 (lines=19) @@
938
     * @return Assert
939
     * @throws AssertionFailedException
940
     */
941
    public function notEmpty(string $message = '', string $fieldName = '') : Assert
942
    {
943
        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
944
        {
945
            return $this;
946
        }
947
        if ( ( is_object($this->value) && empty((array)$this->value) ) || empty($this->value) )
948
        {
949
            $message = $message ?: $this->overrideError;
950
            $message = sprintf(
951
                $message ?: 'Value "%s" is empty, but non empty value was expected.',
952
                $this->stringify($this->value)
953
            );
954
955
            throw $this->createException($message, $this->overrideCode ?: self::VALUE_EMPTY, $fieldName);
956
        }
957
958
        return $this;
959
    }
960
961
    /**
962
     * Assert that value is empty.
@@ 1842-1860 (lines=19) @@
1839
     * @return Assert
1840
     * @throws AssertionFailedException
1841
     */
1842
    public function notBlank(string $message = '', string $fieldName = '') : Assert
1843
    {
1844
        if ( $this->doAllOrNullOr(__FUNCTION__, func_get_args()) )
1845
        {
1846
            return $this;
1847
        }
1848
        if ( false === $this->value || ( empty( $this->value ) && '0' != $this->value ) )
1849
        {
1850
            $message = $message ?: $this->overrideError;
1851
            $message = sprintf(
1852
                $message ?: 'Value "%s" is blank, but was expected to contain a value.',
1853
                $this->stringify($this->value)
1854
            );
1855
1856
            throw $this->createException($message, $this->overrideCode ?: self::INVALID_NOT_BLANK, $fieldName);
1857
        }
1858
1859
        return $this;
1860
    }
1861
1862
    /**
1863
     * Assert that value is an instance of a given class-name.