public static function check($field, $input, array $options = null, $version = null)
    {
        $field = strtolower($field);
        switch($field)      // fall-through's are on purpose
        {
            case 'orgnlcdtrschmeid_id':
            case 'ci': return self::checkCreditorIdentifier($input);
            case 'msgid':
            case 'pmtid':   // next line
            case 'pmtinfid': return self::checkRestrictedIdentificationSEPA1($input);
            case 'orgnlmndtid':
            case 'mndtid': return $version === self::SEPA_PAIN_008_001_02
                                    || $version === self::SEPA_PAIN_008_001_02_GBIC
                            ? self::checkRestrictedIdentificationSEPA1($input)
                            : self::checkRestrictedIdentificationSEPA2($input);
            case 'initgpty':                                // cannot be empty (and the following things also)
            case 'cdtr':                                    // cannot be empty (and the following things also)
            case 'dbtr':
                if(empty($input))
                    return false;    // cannot be empty
            case 'orgid_id':
                return ( self::checkLength($input, self::TEXT_LENGTH_VERY_SHORT)
                    && self::checkCharset($input) )
                    ? $input : false;
            case 'orgnlcdtrschmeid_nm':
            case 'ultmtcdtr':
            case 'ultmtdbtr':
                return ( self::checkLength($input, self::TEXT_LENGTH_SHORT)
                    && self::checkCharset($input) )
                    ? $input : false;
            case 'rmtinf':
                return ( self::checkLength($input, self::TEXT_LENGTH_LONG)
                    && self::checkCharset($input) )
                    ? $input : false;
            case 'orgnldbtracct_iban':
            case 'iban': return self::checkIBAN($input,$options);
            case 'orgnldbtragt_bic':
            case 'orgid_bob':
            case 'bic': return self::checkBIC($input,$options);
            case 'ccy': return self::checkActiveOrHistoricCurrencyCode($input);
            case 'amdmntind':
            case 'btchbookg': return self::checkBoolean($input);
            case 'instdamt': return self::checkAmountFormat($input);
            case 'seqtp': return self::checkSeqType($input);
            case 'lclinstrm': return self::checkLocalInstrument($input, $options);
            case 'elctrncsgntr': return (self::checkLength($input, 1025) && self::checkCharset($input)) ? $input : false;
            case 'dtofsgntr':
            case 'reqdcolltndt':
            case 'reqdexctndt': return self::checkDateFormat($input);
            case 'purp': return self::checkPurpose($input);
            case 'ctgypurp': return self::checkCategoryPurpose($input);
            case 'orgnldbtragt': return $input;     // nothing to check here
            default: return false;
        }
    }
public static function check($field, $input, array $options = null, $version = null)
    {
        $field = strtolower($field);
        switch($field)      // fall-through's are on purpose
        {
            case 'orgnlcdtrschmeid_id':
            case 'ci': return self::checkCreditorIdentifier($input);
            case 'msgid':
            case 'pmtid':   // next line
            case 'pmtinfid': return self::checkRestrictedIdentificationSEPA1($input);
            case 'orgnlmndtid':
            case 'mndtid': return $version === self::SEPA_PAIN_008_001_02
                                    || $version === self::SEPA_PAIN_008_001_02_GBIC
                            ? self::checkRestrictedIdentificationSEPA1($input)
                            : self::checkRestrictedIdentificationSEPA2($input);
            case 'initgpty':                                // cannot be empty (and the following things also)
            case 'cdtr':                                    // cannot be empty (and the following things also)
            case 'dbtr':
                if(empty($input))
                    return false;    // cannot be empty
            case 'orgid_id':
                return ( self::checkLength($input, self::TEXT_LENGTH_VERY_SHORT)
                    && self::checkCharset($input) )
                    ? $input : false;
            case 'orgnlcdtrschmeid_nm':
            case 'ultmtcdtr':
            case 'ultmtdbtr':
                return ( self::checkLength($input, self::TEXT_LENGTH_SHORT)
                    && self::checkCharset($input) )
                    ? $input : false;
            case 'rmtinf':
                return ( self::checkLength($input, self::TEXT_LENGTH_LONG)
                    && self::checkCharset($input) )
                    ? $input : false;
            case 'orgnldbtracct_iban':
            case 'iban': return self::checkIBAN($input,$options);
            case 'orgnldbtragt_bic':
            case 'orgid_bob':
            case 'bic': return self::checkBIC($input,$options);
            case 'ccy': return self::checkActiveOrHistoricCurrencyCode($input);
            case 'amdmntind':
            case 'btchbookg': return self::checkBoolean($input);
            case 'instdamt': return self::checkAmountFormat($input);
            case 'seqtp': return self::checkSeqType($input);
            case 'lclinstrm': return self::checkLocalInstrument($input, $options);
            case 'elctrncsgntr': return (self::checkLength($input, 1025) && self::checkCharset($input)) ? $input : false;
            case 'dtofsgntr':
            case 'reqdcolltndt':
            case 'reqdexctndt': return self::checkDateFormat($input);
            case 'purp': return self::checkPurpose($input);
            case 'ctgypurp': return self::checkCategoryPurpose($input);
            case 'orgnldbtragt': return $input;     // nothing to check here
            default: return false;
        }
    }
public static function check ( $ field , $ input , array $ options = null , $ version = null ) { $ field = strtolower ( $ field ) ; switch ( $ field ) // fall-through's are on purpose { case 'orgnlcdtrschmeid_id' : case 'ci' : return self :: checkCreditorIdentifier ( $ input ) ; case 'msgid' : case 'pmtid' : // next line case 'pmtinfid' : return self :: checkRestrictedIdentificationSEPA1 ( $ input ) ; case 'orgnlmndtid' : case 'mndtid' : return $ version === self :: SEPA_PAIN_008_001_02 || $ version === self :: SEPA_PAIN_008_001_02_GBIC ? self :: checkRestrictedIdentificationSEPA1 ( $ input ) : self :: checkRestrictedIdentificationSEPA2 ( $ input ) ; case 'initgpty' : // cannot be empty (and the following things also) case 'cdtr' : // cannot be empty (and the following things also) case 'dbtr' : if ( empty ( $ input ) ) return false ; // cannot be empty case 'orgid_id' : return ( self :: checkLength ( $ input , self :: TEXT_LENGTH_VERY_SHORT ) && self :: checkCharset ( $ input ) ) ? $ input : false ; case 'orgnlcdtrschmeid_nm' : case 'ultmtcdtr' : case 'ultmtdbtr' : return ( self :: checkLength ( $ input , self :: TEXT_LENGTH_SHORT ) && self :: checkCharset ( $ input ) ) ? $ input : false ; case 'rmtinf' : return ( self :: checkLength ( $ input , self :: TEXT_LENGTH_LONG ) && self :: checkCharset ( $ input ) ) ? $ input : false ; case 'orgnldbtracct_iban' : case 'iban' : return self :: checkIBAN ( $ input , $ options ) ; case 'orgnldbtragt_bic' : case 'orgid_bob' : case 'bic' : return self :: checkBIC ( $ input , $ options ) ; case 'ccy' : return self :: checkActiveOrHistoricCurrencyCode ( $ input ) ; case 'amdmntind' : case 'btchbookg' : return self :: checkBoolean ( $ input ) ; case 'instdamt' : return self :: checkAmountFormat ( $ input ) ; case 'seqtp' : return self :: checkSeqType ( $ input ) ; case 'lclinstrm' : return self :: checkLocalInstrument ( $ input , $ options ) ; case 'elctrncsgntr' : return ( self :: checkLength ( $ input , 1025 ) && self :: checkCharset ( $ input ) ) ? $ input : false ; case 'dtofsgntr' : case 'reqdcolltndt' : case 'reqdexctndt' : return self :: checkDateFormat ( $ input ) ; case 'purp' : return self :: checkPurpose ( $ input ) ; case 'ctgypurp' : return self :: checkCategoryPurpose ( $ input ) ; case 'orgnldbtragt' : return $ input ; // nothing to check here default : return false ; } }
Checks if the input holds for the field.

@param string $field   Valid fields are: 'orgnlcdtrschmeid_id','ci','msgid','pmtid','pmtinfid',
'orgnlmndtid','mndtid','initgpty','cdtr','dbtr','orgnlcdtrschmeid_nm',
'ultmtcdrt','ultmtdebtr','rmtinf','orgnldbtracct_iban','iban','bic',
'ccy','amendment', 'btchbookg','instdamt','seqtp','lclinstrm',
'elctrncsgntr','reqdexctndt','purp','ctgypurp','orgnldbtragt'
@param mixed  $input
@param array  $options See `checkBIC()`, `checkIBAN()` and `checkLocalInstrument()` for details.
@param int    $version Can be used to specify one of the `SEPA_PAIN_*` constants.
@return false|mixed The checked input or false, if it is not valid
Checks if the input holds for the field .