public function validateObjectFieldValue($value, $fieldName, $targetObject, &$validatorParams, $validatorKey) {

        if (sizeof($validatorParams) < ($this->mode == self::MODE_RANGE ? 2 : 1)) {
            throw new MisconfiguredValidatorException($validatorKey, $fieldName, $targetObject);
        }

        if (!$value) return true;

        switch ($this->mode) {
            case self::MODE_MIN:
                return strlen($value) >= $validatorParams[0];
            case self::MODE_MAX:
                return strlen($value) <= $validatorParams[0];
            case self::MODE_RANGE:
                return strlen($value) <= $validatorParams[1] && strlen($value) >= $validatorParams[0];
        }

    }
public function validateObjectFieldValue($value, $fieldName, $targetObject, &$validatorParams, $validatorKey) {

        if (sizeof($validatorParams) < ($this->mode == self::MODE_RANGE ? 2 : 1)) {
            throw new MisconfiguredValidatorException($validatorKey, $fieldName, $targetObject);
        }

        if (!$value) return true;

        switch ($this->mode) {
            case self::MODE_MIN:
                return strlen($value) >= $validatorParams[0];
            case self::MODE_MAX:
                return strlen($value) <= $validatorParams[0];
            case self::MODE_RANGE:
                return strlen($value) <= $validatorParams[1] && strlen($value) >= $validatorParams[0];
        }

    }
public function validateObjectFieldValue ( $ value , $ fieldName , $ targetObject , & $ validatorParams , $ validatorKey ) { if ( sizeof ( $ validatorParams ) < ( $ this -> mode == self :: MODE_RANGE ? 2 : 1 ) ) { throw new MisconfiguredValidatorException ( $ validatorKey , $ fieldName , $ targetObject ) ; } if ( ! $ value ) return true ; switch ( $ this -> mode ) { case self :: MODE_MIN : return strlen ( $ value ) >= $ validatorParams [ 0 ] ; case self :: MODE_MAX : return strlen ( $ value ) <= $ validatorParams [ 0 ] ; case self :: MODE_RANGE : return strlen ( $ value ) <= $ validatorParams [ 1 ] && strlen ( $ value ) >= $ validatorParams [ 0 ] ; } }
Validate a range object

@param string $value
@param $fieldName
@param SerialisableObject $targetObject
@param array $validatorParams
@param $validatorKey
@return bool|mixed
@throws MisconfiguredValidatorException
Validate a range object