protected function _sanitizeLength(AnConfig $config)
    {
        $property = $config->property;
        $value = $config->value;
        $options = AnConfig::unbox($config->options);
        //if a number is just passed then treat it as max
        if (!is_array($options)) {
            $options = array('max' => $options);
        }

        if ($property->isAttribute() && $property->isScalar() && isset($options['max'])) {
            $helper = new LibBaseTemplateHelperText(new AnConfig());
            $value = $helper->truncate($value, array('length' => $options['max'], 'consider_html' => true, 'ending' => ''));
        }

        return $value;
    }
protected function _sanitizeLength(AnConfig $config)
    {
        $property = $config->property;
        $value = $config->value;
        $options = AnConfig::unbox($config->options);
        //if a number is just passed then treat it as max
        if (!is_array($options)) {
            $options = array('max' => $options);
        }

        if ($property->isAttribute() && $property->isScalar() && isset($options['max'])) {
            $helper = new LibBaseTemplateHelperText(new AnConfig());
            $value = $helper->truncate($value, array('length' => $options['max'], 'consider_html' => true, 'ending' => ''));
        }

        return $value;
    }
protected function _sanitizeLength ( AnConfig $ config ) { $ property = $ config -> property ; $ value = $ config -> value ; $ options = AnConfig :: unbox ( $ config -> options ) ; //if a number is just passed then treat it as max if ( ! is_array ( $ options ) ) { $ options = array ( 'max' => $ options ) ; } if ( $ property -> isAttribute ( ) && $ property -> isScalar ( ) && isset ( $ options [ 'max' ] ) ) { $ helper = new LibBaseTemplateHelperText ( new AnConfig ( ) ) ; $ value = $ helper -> truncate ( $ value , array ( 'length' => $ options [ 'max' ] , 'consider_html' => true , 'ending' => '' ) ) ; } return $ value ; }
Sanitize length.

@param AnConfig $config Configuration. Contains keys property,value,entity

@return bool Return true if it's valid or false if it's not
Sanitize length .