src/Charcoal/Property/StringProperty.php
public function validateMinLength()
    {
        $val = $this->val();

        if ($val === null) {
            return $this->allowNull();
        }

        $minLength = $this->minLength();
        if ($minLength == 0) {
            return true;
        }

        if ($val === '' && $this->allowEmpty()) {
            // Don't check empty string if they are allowed
            return true;
        }

        if (is_string($val)) {
            $valid = (mb_strlen($val) >= $minLength);
            if (!$valid) {
                $this->validator()->error('Minimum length error', 'minLength');
            }
        } else {
            $valid = true;
            foreach ($val as $v) {
                $valid = (mb_strlen($v) >= $minLength);
                if (!$valid) {
                    $this->validator()->error('Minimum length error', 'minLength');
                    return $valid;
                }
            }
        }

        return $valid;
    }
public function validateMinLength()
    {
        $val = $this->val();

        if ($val === null) {
            return $this->allowNull();
        }

        $minLength = $this->minLength();
        if ($minLength == 0) {
            return true;
        }

        if ($val === '' && $this->allowEmpty()) {
            // Don't check empty string if they are allowed
            return true;
        }

        if (is_string($val)) {
            $valid = (mb_strlen($val) >= $minLength);
            if (!$valid) {
                $this->validator()->error('Minimum length error', 'minLength');
            }
        } else {
            $valid = true;
            foreach ($val as $v) {
                $valid = (mb_strlen($v) >= $minLength);
                if (!$valid) {
                    $this->validator()->error('Minimum length error', 'minLength');
                    return $valid;
                }
            }
        }

        return $valid;
    }
public function validateMinLength ( ) { $ val = $ this -> val ( ) ; if ( $ val === null ) { return $ this -> allowNull ( ) ; } $ minLength = $ this -> minLength ( ) ; if ( $ minLength == 0 ) { return true ; } if ( $ val === '' && $ this -> allowEmpty ( ) ) { // Don't check empty string if they are allowed return true ; } if ( is_string ( $ val ) ) { $ valid = ( mb_strlen ( $ val ) >= $ minLength ) ; if ( ! $ valid ) { $ this -> validator ( ) -> error ( 'Minimum length error' , 'minLength' ) ; } } else { $ valid = true ; foreach ( $ val as $ v ) { $ valid = ( mb_strlen ( $ v ) >= $ minLength ) ; if ( ! $ valid ) { $ this -> validator ( ) -> error ( 'Minimum length error' , 'minLength' ) ; return $ valid ; } } } return $ valid ; }
Validate if the property's value satisfies the minimum length.

@todo   Support `multiple` / `l10n`
@return boolean
Validate if the property s value satisfies the minimum length .