Browse Source

[ZF-8969] Manual:

- added section for Zend_Validate_Between

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21251 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas 16 years ago
parent
commit
c45c685ad7

+ 104 - 0
documentation/manual/en/module_specs/Zend_Validate-Between.xml

@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect2 id="zend.validate.set.between">
+    <title>Between</title>
+
+    <para>
+        <classname>Zend_Validate_Between</classname> allows you to validate if a given value is
+        between two other values.
+    </para>
+
+    <note>
+        <title>Zend_Validate_Between supports only number validation</title>
+
+        <para>
+            It should be noted that Zend_Validate_Between supports only the validation of numbers.
+            Strings or dates can not be validated with this validator.
+        </para>
+    </note>
+
+    <sect3 id="zend.validate.set.between.options">
+        <title>Supported options for Zend_Validate_Between</title>
+
+        <para>
+            The following options are supported for <classname>Zend_Validate_Between</classname>:
+        </para>
+
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <emphasis><property>inclusive</property></emphasis>: Defines if the validation
+                    is inclusive the minimum and maximum border values or exclusive. It defaults
+                    to <constant>TRUE</constant>.
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis><property>min</property></emphasis>: Sets the minimum border for the
+                    validation.
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis><property>max</property></emphasis>: Sets the maximum border for the
+                    validation.
+                </para>
+            </listitem>
+        </itemizedlist>
+    </sect3>
+
+    <sect3 id="zend.validate.set.between.basic">
+        <title>Default behaviour for Zend_Validate_Between</title>
+
+        <para>
+            Per default this validator checks if a value is between <property>min</property> and
+            <property>max</property> where both border values are allowed as value.
+        </para>
+
+        <programlisting language="php"><![CDATA[
+$valid  = new Zend_Validate_Between(array('min' => 0, 'max' => 10));
+$value  = 10;
+$result = $valid->isValid($value);
+// returns true
+]]></programlisting>
+
+        <para>
+            In the above example the result is <constant>TRUE</constant> due to the reason that per
+            default the search is inclusively the border values. This means in our case that any
+            value from '0' to '10' is allowed. And values like '-1' and '11' will return
+            <constant>FALSE</constant>.
+        </para>
+    </sect3>
+
+    <sect3 id="zend.validate.set.between.inclusively">
+        <title>Validation exclusive the border values</title>
+
+        <para>
+            Sometimes it is useful to validate a value by excluding the border values. See the
+            following example:
+        </para>
+
+        <programlisting language="php"><![CDATA[
+$valid  = new Zend_Validate_Between(
+    array(
+        'min' => 0,
+        'max' => 10,
+        'inclusive' => false
+    )
+);
+$value  = 10;
+$result = $valid->isValid($value);
+// returns false
+]]></programlisting>
+
+        <para>
+            The example is almost equal to our first example but we excluded the border value. Now
+            the values '0' and '10' are no longer allowed and will return <constant>FALSE</constant>.
+        </para>
+    </sect3>
+</sect2>
+<!--
+vim:se ts=4 sw=4 et:
+-->

+ 1 - 18
documentation/manual/en/module_specs/Zend_Validate-Set.xml

@@ -38,30 +38,13 @@
     </sect2>
 
     <xi:include href="Zend_Validate-Barcode.xml" />
-
-    <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>
-
+    <xi:include href="Zend_Validate-Between.xml" />
     <xi:include href="Zend_Validate-Callback.xml" />
     <xi:include href="Zend_Validate-CreditCard.xml" />
 
     <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>
-
         <note>
             <para>
                 The <classname>Ccnum</classname> validator has been deprecated in favor of the