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

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

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

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

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

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

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

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

        return $valid;
    }
public function validateMaxLength ( ) { $ val = $ this -> val ( ) ; if ( $ val === null && $ this -> allowNull ( ) ) { return true ; } $ maxLength = $ this -> maxLength ( ) ; if ( $ maxLength == 0 ) { return true ; } if ( is_string ( $ val ) ) { $ valid = ( mb_strlen ( $ val ) <= $ maxLength ) ; if ( ! $ valid ) { $ this -> validator ( ) -> error ( 'Maximum length error' , 'maxLength' ) ; } } else { $ valid = true ; foreach ( $ val as $ v ) { $ valid = ( mb_strlen ( $ v ) <= $ maxLength ) ; if ( ! $ valid ) { $ this -> validator ( ) -> error ( 'Maximum length error' , 'maxLength' ) ; return $ valid ; } } } return $ valid ; }
Validate if the property's value exceeds the maximum length.

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