Skip to content

Commit d450a67

Browse files
committed
[#1598] Tweaks to new Luhn validator entry
1 parent 0dcfe3c commit d450a67

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

reference/constraints/Luhn.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Luhn
22
======
33

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
66
payment gateway.
77

88
+----------------+-----------------------------------------------------------------------+
@@ -18,8 +18,8 @@ payment gateway.
1818
Basic Usage
1919
-----------
2020

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.
2323

2424
.. configuration-block::
2525

@@ -30,15 +30,15 @@ the creditcard number submission.
3030
properties:
3131
cardNumber:
3232
- Luhn:
33-
message: Please check your creditcard number.
33+
message: Please check your credit card number.
3434
3535
.. code-block:: xml
3636
3737
<!-- src/Acme/SubscriptionBundle/Resources/config/validation.xml -->
3838
<class name="Acme\SubscriptionBundle\Entity\Transaction">
3939
<property name="cardNumber">
4040
<constraint name="Luhn">
41-
<option name="message">Please check your creditcard number.</option>
41+
<option name="message">Please check your credit card number.</option>
4242
</constraint>
4343
</property>
4444
</class>
@@ -51,7 +51,7 @@ the creditcard number submission.
5151
class Transaction
5252
{
5353
/**
54-
* @Assert\Luhn(message = "Please check your creditcard number.")
54+
* @Assert\Luhn(message = "Please check your credit card number.")
5555
*/
5656
protected $cardNumber;
5757
}
@@ -69,7 +69,7 @@ the creditcard number submission.
6969
public static function loadValidatorMetadata(ClassMetadata $metadata)
7070
{
7171
$metadata->addPropertyConstraint('luhn', new Luhn(array(
72-
'message' => 'Please check your creditcard number',
72+
'message' => 'Please check your credit card number',
7373
)));
7474
}
7575
}
@@ -83,3 +83,5 @@ message
8383
**type**: ``string`` **default**: ``Invalid card number``
8484

8585
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

Comments
 (0)