<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.validate.set" xmlns:xi="http://www.w3.org/2001/XInclude">

    <title>Standard Validation Classes</title>

    <para>
        Zend Framework comes with a standard set of validation classes, which are ready for you to
        use.
    </para>

    <sect2 id="zend.validate.set.alnum">
        <title>Alnum</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> contains only alphabetic
            and digit characters. This validator includes an option to also consider white space
            characters as valid.
        </para>

        <note>
            <para>
                The alphabetic characters mean characters that makes up words in each language.
                However, the English alphabet is treated as the alphabetic characters in following
                languages: Chinese, Japanese, Korean. The language is specified by Zend_Locale.
            </para>
        </note>

    </sect2>

    <sect2 id="zend.validate.set.alpha">
        <title>Alpha</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> contains only alphabetic
            characters. This validator includes an option to also consider white space characters
            as valid.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.barcode">
        <title>Barcode</title>
        <para>
            This validator is instantiated with a barcode type against which you wish to validate a
            barcode value. It currently supports "<code>UPC-A</code>" (Universal Product Code) and
            "<code>EAN-13</code>" (European Article Number) barcode types, and the
            <methodname>isValid()</methodname> method returns true if and only if the input successfully
            validates against the barcode validation algorithm. You should remove all characters
            other than the digits zero through nine (0-9) from the input value before passing it on
            to the validator.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.between">
        <title>Between</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> is between the minimum and
            maximum boundary values. The comparison is inclusive by default (<varname>$value</varname> may
            equal a boundary value), though this may be overridden in order to do a strict
            comparison, where <varname>$value</varname> must be strictly greater than the minimum and
            strictly less than the maximum.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.ccnum">
        <title>Ccnum</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> follows the Luhn algorithm
            (mod-10 checksum) for credit card numbers.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.date">
        <title>Date</title>
        <para>
            Returns <constant>TRUE</constant> if <varname>$value</varname> is a valid date of the format
            <code>YYYY-MM-DD</code>. If the optional <code>locale</code> option is set then the date
            will be validated according to the set locale. And if the optional <code>format</code>
            option is set this format is used for the validation. for details about the optional
            parameters see <link
                linkend="zend.date.others.comparison.table">Zend_Date::isDate()</link>.
        </para>
    </sect2>

    <xi:include href="Zend_Validate-Db.xml" />

    <sect2 id="zend.validate.set.digits">
        <title>Digits</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> only contains digit
            characters.
        </para>
    </sect2>

    <xi:include href="Zend_Validate-EmailAddress.xml" />

    <sect2 id="zend.validate.set.float">
        <title>Float</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> is a floating-point value.
            Since Zend Framework 1.8 this validator takes into account the actual locale from
            browser, environment or application wide set locale. You can of course use the
            get/setLocale accessors to change the used locale or give it while creating a instance
            of this validator.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.greater_than">
        <title>GreaterThan</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> is greater than the minimum
            boundary.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.hex">
        <title>Hex</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> contains only hexadecimal
            digit characters.
        </para>
    </sect2>

    <xi:include href="Zend_Validate-Hostname.xml" />

    <sect2 id="zend.validate.set.iban">
        <title>Iban</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> contains a valid IBAN
            (International Bank Account Number). IBAN numbers are validated against the country
            where they are used and by a checksum.
        </para>
        <para>
            There are two ways to validate IBAN numbers. As first way you can give a locale which
            represents a country. Any given IBAN number will then be validated against this country.
        </para>
        <programlisting language="php"><![CDATA[
$validator = new Zend_Validate_Iban('de_AT');
$iban = 'AT611904300234573201';
if ($validator->isValid($iban)) {
    // IBAN appears to be valid
} else {
    // IBAN is invalid
    foreach ($validator->getMessages() as $message) {
        echo "$message\n";
    }
}
]]></programlisting>
        <para>
            This should be done when you want to validate IBAN numbers for a single countries. The
            simpler way of validation is not to give a locale like shown in the next example.
        </para>
        <programlisting language="php"><![CDATA[
$validator = new Zend_Validate_Iban();
$iban = 'AT611904300234573201';
if ($validator->isValid($iban)) {
    // IBAN appears to be valid
} else {
    // IBAN is invalid
}
]]></programlisting>
        <para>
            But this shows one big problem: When you have to accept only IBAN numbers from one
            single country, for example france, then IBAN numbers from other countries would also be
            valid. Therefor just remember: When you have to validate a IBAN number against a defined
            country you should give the locale. And when you accept all IBAN numbers regardless of
            any country omit the locale for simplicity.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.identical">
        <title>Identical</title>
        <para>
            Returns <constant>TRUE</constant> if and only if a given token is identical
            with <varname>$value</varname>. This validator can handle any given type.
        </para>

        <para>
            The token to validate against can eighter be set as parameter at initiation,
            or by using the <methodname>setToken()</methodname> method.
        </para>

        <programlisting language="php"><![CDATA[
// Setting the token at initiation
$validator = new Zend_Validate_Identical(array('one' => 'two'));
if ($validator->isValid(array('one' => 'two'))) { // token valid
    // do something
}

// Setting the token by using setToken()
$validator->setToken(true);
if ($validator->isValid(1)) { // token invalid
    // do something
}
]]></programlisting>
    </sect2>

    <sect2 id="zend.validate.set.in_array">
        <title>InArray</title>
        <para>
            Returns <constant>TRUE</constant> if and only if a "needle" <varname>$value</varname> is contained in
            a "haystack" array. If the strict option is <constant>TRUE</constant>, then the type of
            <varname>$value</varname> is also checked.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.int">
        <title>Int</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> is a valid integer. Since
            Zend Framework 1.8 this validator takes into account the actual locale from browser,
            environment or application wide set locale. You can of course use the get/setLocale
            accessors to change the used locale or give it while creating a instance of this
            validator.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.ip">
        <title>Ip</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> is a valid IP address.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.less_than">
        <title>LessThan</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> is less than the maximum
            boundary.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.not_empty">
        <title>NotEmpty</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> is not an empty value.
        </para>
    </sect2>

    <sect2 id="zend.validate.set.regex">
        <title>Regex</title>
        <para>
            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> matches against a regular
            expression pattern.
        </para>
    </sect2>

    <xi:include href="Zend_Validate-Sitemap.xml" />

    <sect2 id="zend.validate.set.string_length">
        <title>StringLength</title>
        <para>
            Returns <constant>TRUE</constant> if and only if the string length of <varname>$value</varname> is at
            least a minimum and no greater than a maximum (when the max option is not
            <constant>NULL</constant>). The <methodname>setMin()</methodname> method throws an exception if the minimum
            length is set to a value greater than the set maximum length, and the
            <methodname>setMax()</methodname> method throws an exception if the maximum length is set to a
            value less than the set minimum length. This class supports UTF-8 and other
            character encodings, based on the current value of <ulink
                url="http://www.php.net/manual/en/ref.iconv.php#iconv.configuration"><code>iconv.internal_encoding</code></ulink>.
            If you need a different encoding you can set it with the accessor methods getEncoding
            and setEncoding.
        </para>
    </sect2>

</sect1>
<!--
vim:se ts=4 sw=4 et:
-->
