1
1
Luhn
2
2
======
3
3
4
- This constraint is used to ensure that a creditcard number passes the Luhn algorithm.
5
- It is useful as a first step to validating a creditcard, before communicating with a
4
+ This constraint is used to ensure that a credit card number passes the ` Luhn algorithm `_ .
5
+ It is useful as a first step to validating a credit card: before communicating with a
6
6
payment gateway.
7
7
8
8
+----------------+-----------------------------------------------------------------------+
@@ -18,8 +18,8 @@ payment gateway.
18
18
Basic Usage
19
19
-----------
20
20
21
- To use the Luhn validator, simply apply it to a property on an object that will contain
22
- the creditcard number submission .
21
+ To use the Luhn validator, simply apply it to a property on an object that
22
+ will contain a credit card number .
23
23
24
24
.. configuration-block ::
25
25
@@ -30,15 +30,15 @@ the creditcard number submission.
30
30
properties :
31
31
cardNumber :
32
32
- Luhn :
33
- message : Please check your creditcard number.
33
+ message : Please check your credit card number.
34
34
35
35
.. code-block :: xml
36
36
37
37
<!-- src/Acme/SubscriptionBundle/Resources/config/validation.xml -->
38
38
<class name =" Acme\SubscriptionBundle\Entity\Transaction" >
39
39
<property name =" cardNumber" >
40
40
<constraint name =" Luhn" >
41
- <option name =" message" >Please check your creditcard number.</option >
41
+ <option name =" message" >Please check your credit card number.</option >
42
42
</constraint >
43
43
</property >
44
44
</class >
@@ -51,7 +51,7 @@ the creditcard number submission.
51
51
class Transaction
52
52
{
53
53
/**
54
- * @Assert\Luhn(message = "Please check your creditcard number.")
54
+ * @Assert\Luhn(message = "Please check your credit card number.")
55
55
*/
56
56
protected $cardNumber;
57
57
}
@@ -69,7 +69,7 @@ the creditcard number submission.
69
69
public static function loadValidatorMetadata(ClassMetadata $metadata)
70
70
{
71
71
$metadata->addPropertyConstraint('luhn', new Luhn(array(
72
- 'message' => 'Please check your creditcard number',
72
+ 'message' => 'Please check your credit card number',
73
73
)));
74
74
}
75
75
}
@@ -83,3 +83,5 @@ message
83
83
**type **: ``string `` **default **: ``Invalid card number ``
84
84
85
85
The default message supplied when the value does not pass the Luhn check.
86
+
87
+ .. _`Luhn algorithm` : http://en.wikipedia.org/wiki/Luhn_algorithm
0 commit comments