public function setConfig($config)
    {
        if (0 == count($config)) {
            throw new HTML_QuickForm2_InvalidArgumentException(
                'Compare Rule requires an argument to compare with'
            );
        }
        $config = self::toCanonicalForm($config);

        $config += array('operator' => '===');
        if (!in_array($config['operator'], $this->operators)) {
            throw new HTML_QuickForm2_InvalidArgumentException(
                'Compare Rule requires a valid comparison operator, ' .
                preg_replace('/\s+/', ' ', var_export($config['operator'], true)) . ' given'
            );
        }
        if (in_array($config['operator'], array('==', '!='))) {
            $config['operator'] .= '=';
        }

        return parent::setConfig($config);
    }
public function setConfig($config)
    {
        if (0 == count($config)) {
            throw new HTML_QuickForm2_InvalidArgumentException(
                'Compare Rule requires an argument to compare with'
            );
        }
        $config = self::toCanonicalForm($config);

        $config += array('operator' => '===');
        if (!in_array($config['operator'], $this->operators)) {
            throw new HTML_QuickForm2_InvalidArgumentException(
                'Compare Rule requires a valid comparison operator, ' .
                preg_replace('/\s+/', ' ', var_export($config['operator'], true)) . ' given'
            );
        }
        if (in_array($config['operator'], array('==', '!='))) {
            $config['operator'] .= '=';
        }

        return parent::setConfig($config);
    }
public function setConfig ( $ config ) { if ( 0 == count ( $ config ) ) { throw new HTML_QuickForm2_InvalidArgumentException ( 'Compare Rule requires an argument to compare with' ) ; } $ config = self :: toCanonicalForm ( $ config ) ; $ config += array ( 'operator' => '===' ) ; if ( ! in_array ( $ config [ 'operator' ] , $ this -> operators ) ) { throw new HTML_QuickForm2_InvalidArgumentException ( 'Compare Rule requires a valid comparison operator, ' . preg_replace ( '/\s+/' , ' ' , var_export ( $ config [ 'operator' ] , true ) ) . ' given' ) ; } if ( in_array ( $ config [ 'operator' ] , array ( '==' , '!=' ) ) ) { $ config [ 'operator' ] .= '=' ; } return parent :: setConfig ( $ config ) ; }
Sets the comparison operator and operand to compare to

$config can be either of the following
- operand
- array([operator, ]operand)
- array(['operator' => operator, ]['operand' => operand])
If operator is missing it will default to '==='

@param    mixed   Configuration data
@return   HTML_QuickForm2_Rule
@throws   HTML_QuickForm2_InvalidArgumentException if a bogus comparison
operator is used for configuration, if an operand is missing
Sets the comparison operator and operand to compare to