diff --git a/src/Alnum.php b/src/Alnum.php index 3a5effbab..d657d2f27 100644 --- a/src/Alnum.php +++ b/src/Alnum.php @@ -48,8 +48,8 @@ class Alnum extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String, integer or float expected", - self::NOT_ALNUM => "'%value%' contains characters which are non alphabetic and no digits", - self::STRING_EMPTY => "'%value%' is an empty string", + self::NOT_ALNUM => "The input contains characters which are non alphabetic and no digits", + self::STRING_EMPTY => "The input is an empty string", ); /** diff --git a/src/Alpha.php b/src/Alpha.php index 8e4184836..9d3d80ad2 100644 --- a/src/Alpha.php +++ b/src/Alpha.php @@ -55,8 +55,8 @@ class Alpha extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String expected", - self::NOT_ALPHA => "'%value%' contains non alphabetic characters", - self::STRING_EMPTY => "'%value%' is an empty string" + self::NOT_ALPHA => "The input contains non alphabetic characters", + self::STRING_EMPTY => "The input is an empty string" ); /** diff --git a/src/Barcode.php b/src/Barcode.php index 8e9001d22..ed6c3f5ea 100644 --- a/src/Barcode.php +++ b/src/Barcode.php @@ -36,9 +36,9 @@ class Barcode extends AbstractValidator const INVALID_LENGTH = 'barcodeInvalidLength'; protected $messageTemplates = array( - self::FAILED => "'%value%' failed checksum validation", - self::INVALID_CHARS => "'%value%' contains invalid characters", - self::INVALID_LENGTH => "'%value%' should have a length of %length% characters", + self::FAILED => "The input failed checksum validation", + self::INVALID_CHARS => "The input contains invalid characters", + self::INVALID_LENGTH => "The input should have a length of %length% characters", self::INVALID => "Invalid type given. String expected", ); diff --git a/src/Between.php b/src/Between.php index f7cf41f7c..542b34c10 100644 --- a/src/Between.php +++ b/src/Between.php @@ -40,8 +40,8 @@ class Between extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::NOT_BETWEEN => "'%value%' is not between '%min%' and '%max%', inclusively", - self::NOT_BETWEEN_STRICT => "'%value%' is not strictly between '%min%' and '%max%'" + self::NOT_BETWEEN => "The input is not between '%min%' and '%max%', inclusively", + self::NOT_BETWEEN_STRICT => "The input is not strictly between '%min%' and '%max%'" ); /** diff --git a/src/Callback.php b/src/Callback.php index fd952d9ed..3b4d82a81 100644 --- a/src/Callback.php +++ b/src/Callback.php @@ -44,7 +44,7 @@ class Callback extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::INVALID_VALUE => "'%value%' is not valid", + self::INVALID_VALUE => "The input is not valid", self::INVALID_CALLBACK => "An exception has been raised within the callback", ); diff --git a/src/CreditCard.php b/src/CreditCard.php index b84a5d21c..14a44dae2 100644 --- a/src/CreditCard.php +++ b/src/CreditCard.php @@ -63,13 +63,13 @@ class CreditCard extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::CHECKSUM => "'%value%' seems to contain an invalid checksum", - self::CONTENT => "'%value%' must contain only digits", + self::CHECKSUM => "The input seems to contain an invalid checksum", + self::CONTENT => "The input must contain only digits", self::INVALID => "Invalid type given. String expected", - self::LENGTH => "'%value%' contains an invalid amount of digits", - self::PREFIX => "'%value%' is not from an allowed institute", - self::SERVICE => "'%value%' seems to be an invalid creditcard number", - self::SERVICEFAILURE => "An exception has been raised while validating '%value%'", + self::LENGTH => "The input contains an invalid amount of digits", + self::PREFIX => "The input is not from an allowed institute", + self::SERVICE => "The input seems to be an invalid creditcard number", + self::SERVICEFAILURE => "An exception has been raised while validating the input.", ); /** diff --git a/src/Date.php b/src/Date.php index 3add27db1..bae5c1c85 100644 --- a/src/Date.php +++ b/src/Date.php @@ -42,8 +42,8 @@ class Date extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String, integer, array or DateTime expected", - self::INVALID_DATE => "'%value%' does not appear to be a valid date", - self::FALSEFORMAT => "'%value%' does not fit the date format '%format%'", + self::INVALID_DATE => "The input does not appear to be a valid date", + self::FALSEFORMAT => "The input does not fit the date format '%format%'", ); /** diff --git a/src/DateStep.php b/src/DateStep.php index 5808df77c..596b7f47e 100644 --- a/src/DateStep.php +++ b/src/DateStep.php @@ -45,8 +45,8 @@ class DateStep extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String, integer, array or DateTime expected", - self::INVALID_DATE => "'%value%' does not appear to be a valid date", - self::NOT_STEP => "'%value%' is not a valid step." + self::INVALID_DATE => "The input does not appear to be a valid date", + self::NOT_STEP => "The input is not a valid step." ); /** diff --git a/src/Db/AbstractDb.php b/src/Db/AbstractDb.php index 219d737e7..4c1e39e9f 100644 --- a/src/Db/AbstractDb.php +++ b/src/Db/AbstractDb.php @@ -48,8 +48,8 @@ abstract class AbstractDb extends AbstractValidator * @var array Message templates */ protected $messageTemplates = array( - self::ERROR_NO_RECORD_FOUND => "No record matching '%value%' was found", - self::ERROR_RECORD_FOUND => "A record matching '%value%' was found", + self::ERROR_NO_RECORD_FOUND => "No record matching the input was found", + self::ERROR_RECORD_FOUND => "A record matching the input was found", ); /** diff --git a/src/Digits.php b/src/Digits.php index 632a105aa..a921e5ae0 100644 --- a/src/Digits.php +++ b/src/Digits.php @@ -47,8 +47,8 @@ class Digits extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::NOT_DIGITS => "'%value%' must contain only digits", - self::STRING_EMPTY => "'%value%' is an empty string", + self::NOT_DIGITS => "The input must contain only digits", + self::STRING_EMPTY => "The input is an empty string", self::INVALID => "Invalid type given. String, integer or float expected", ); diff --git a/src/EmailAddress.php b/src/EmailAddress.php index 447f225e0..4f4442643 100644 --- a/src/EmailAddress.php +++ b/src/EmailAddress.php @@ -43,14 +43,14 @@ class EmailAddress extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String expected", - self::INVALID_FORMAT => "'%value%' is not a valid email address. Use the basic format local-part@hostname", - self::INVALID_HOSTNAME => "'%hostname%' is not a valid hostname for email address '%value%'", - self::INVALID_MX_RECORD => "'%hostname%' does not appear to have a valid MX record for the email address '%value%'", - self::INVALID_SEGMENT => "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network", + self::INVALID_FORMAT => "The input is not a valid email address. Use the basic format local-part@hostname", + self::INVALID_HOSTNAME => "'%hostname%' is not a valid hostname for the email address", + self::INVALID_MX_RECORD => "'%hostname%' does not appear to have a valid MX record for the email address", + self::INVALID_SEGMENT => "'%hostname%' is not in a routable network segment. The email address should not be resolved from public network", self::DOT_ATOM => "'%localPart%' can not be matched against dot-atom format", self::QUOTED_STRING => "'%localPart%' can not be matched against quoted-string format", - self::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for email address '%value%'", - self::LENGTH_EXCEEDED => "'%value%' exceeds the allowed length", + self::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for the email address", + self::LENGTH_EXCEEDED => "The input exceeds the allowed length", ); /** diff --git a/src/Float.php b/src/Float.php index 60149291f..2d4917423 100644 --- a/src/Float.php +++ b/src/Float.php @@ -40,7 +40,7 @@ class Float extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String, integer or float expected", - self::NOT_FLOAT => "'%value%' does not appear to be a float", + self::NOT_FLOAT => "The input does not appear to be a float", ); /** diff --git a/src/GreaterThan.php b/src/GreaterThan.php index 804d276c6..a00f09cda 100644 --- a/src/GreaterThan.php +++ b/src/GreaterThan.php @@ -40,8 +40,8 @@ class GreaterThan extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::NOT_GREATER => "'%value%' is not greater than '%min%'", - self::NOT_GREATER_INCLUSIVE => "'%value' is not greater or equal than '%min%'" + self::NOT_GREATER => "The input is not greater than '%min%'", + self::NOT_GREATER_INCLUSIVE => "The input is not greater or equal than '%min%'" ); /** diff --git a/src/Hex.php b/src/Hex.php index 47783f968..75ceb5966 100644 --- a/src/Hex.php +++ b/src/Hex.php @@ -38,7 +38,7 @@ class Hex extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String expected", - self::NOT_HEX => "'%value%' has not only hexadecimal digit characters", + self::NOT_HEX => "The input contains non-hexadecimal characters", ); /** diff --git a/src/Hostname.php b/src/Hostname.php index cff428c2f..9b4b4b5c0 100644 --- a/src/Hostname.php +++ b/src/Hostname.php @@ -53,17 +53,17 @@ class Hostname extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::CANNOT_DECODE_PUNYCODE => "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded", + self::CANNOT_DECODE_PUNYCODE => "The input appears to be a DNS hostname but the given punycode notation cannot be decoded", self::INVALID => "Invalid type given. String expected", - self::INVALID_DASH => "'%value%' appears to be a DNS hostname but contains a dash in an invalid position", - self::INVALID_HOSTNAME => "'%value%' does not match the expected structure for a DNS hostname", - self::INVALID_HOSTNAME_SCHEMA => "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'", - self::INVALID_LOCAL_NAME => "'%value%' does not appear to be a valid local network name", - self::INVALID_URI => "'%value%' does not appear to be a valid URI hostname", - self::IP_ADDRESS_NOT_ALLOWED => "'%value%' appears to be an IP address, but IP addresses are not allowed", - self::LOCAL_NAME_NOT_ALLOWED => "'%value%' appears to be a local network name but local network names are not allowed", - self::UNDECIPHERABLE_TLD => "'%value%' appears to be a DNS hostname but cannot extract TLD part", - self::UNKNOWN_TLD => "'%value%' appears to be a DNS hostname but cannot match TLD against known list", + self::INVALID_DASH => "The input appears to be a DNS hostname but contains a dash in an invalid position", + self::INVALID_HOSTNAME => "The input does not match the expected structure for a DNS hostname", + self::INVALID_HOSTNAME_SCHEMA => "The input appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'", + self::INVALID_LOCAL_NAME => "The input does not appear to be a valid local network name", + self::INVALID_URI => "The input does not appear to be a valid URI hostname", + self::IP_ADDRESS_NOT_ALLOWED => "The input appears to be an IP address, but IP addresses are not allowed", + self::LOCAL_NAME_NOT_ALLOWED => "The input appears to be a local network name but local network names are not allowed", + self::UNDECIPHERABLE_TLD => "The input appears to be a DNS hostname but cannot extract TLD part", + self::UNKNOWN_TLD => "The input appears to be a DNS hostname but cannot match TLD against known list", ); /** diff --git a/src/Iban.php b/src/Iban.php index 1b7a6d687..f4119f9dd 100644 --- a/src/Iban.php +++ b/src/Iban.php @@ -44,9 +44,9 @@ class Iban extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::NOTSUPPORTED => "Unknown country within the IBAN '%value%'", - self::FALSEFORMAT => "'%value%' has a false IBAN format", - self::CHECKFAILED => "'%value%' has failed the IBAN check", + self::NOTSUPPORTED => "Unknown country within the IBAN", + self::FALSEFORMAT => "The input has a false IBAN format", + self::CHECKFAILED => "The input has failed the IBAN check", ); /** diff --git a/src/InArray.php b/src/InArray.php index c4c28dcf9..b180a9564 100644 --- a/src/InArray.php +++ b/src/InArray.php @@ -37,7 +37,7 @@ class InArray extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::NOT_IN_ARRAY => "'%value%' was not found in the haystack", + self::NOT_IN_ARRAY => "The input was not found in the haystack", ); /** diff --git a/src/Int.php b/src/Int.php index c74552d95..4f6fd85e8 100644 --- a/src/Int.php +++ b/src/Int.php @@ -41,7 +41,7 @@ class Int extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String or integer expected", - self::NOT_INT => "'%value%' does not appear to be an integer", + self::NOT_INT => "The input does not appear to be an integer", ); protected $locale; diff --git a/src/Ip.php b/src/Ip.php index 7bdae9394..d1ebb0504 100644 --- a/src/Ip.php +++ b/src/Ip.php @@ -39,7 +39,7 @@ class Ip extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => 'Invalid type given. String expected', - self::NOT_IP_ADDRESS => "'%value%' does not appear to be a valid IP address", + self::NOT_IP_ADDRESS => "The input does not appear to be a valid IP address", ); /** diff --git a/src/Isbn.php b/src/Isbn.php index d2183fb27..3c52272f8 100644 --- a/src/Isbn.php +++ b/src/Isbn.php @@ -41,7 +41,7 @@ class Isbn extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String or integer expected", - self::NO_ISBN => "'%value%' is not a valid ISBN number", + self::NO_ISBN => "The input is not a valid ISBN number", ); protected $options = array( diff --git a/src/LessThan.php b/src/LessThan.php index 190f1a5b8..208e1d719 100644 --- a/src/LessThan.php +++ b/src/LessThan.php @@ -40,8 +40,8 @@ class LessThan extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::NOT_LESS => "'%value%' is not less than '%max%'", - self::NOT_LESS_INCLUSIVE => "'%value%' is not less or equal than '%max%'" + self::NOT_LESS => "The input is not less than '%max%'", + self::NOT_LESS_INCLUSIVE => "The input is not less or equal than '%max%'" ); /** diff --git a/src/PostCode.php b/src/PostCode.php index 8b297afa4..a0e988784 100644 --- a/src/PostCode.php +++ b/src/PostCode.php @@ -41,9 +41,9 @@ class PostCode extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String or integer expected", - self::NO_MATCH => "'%value%' does not appear to be a postal code", - self::SERVICE => "'%value%' does not appear to be a postal code", - self::SERVICEFAILURE => "An exception has been raised while validating '%value%'", + self::NO_MATCH => "The input does not appear to be a postal code", + self::SERVICE => "The input does not appear to be a postal code", + self::SERVICEFAILURE => "An exception has been raised while validating the input.", ); /** diff --git a/src/Regex.php b/src/Regex.php index 3630be98d..537405c1b 100644 --- a/src/Regex.php +++ b/src/Regex.php @@ -40,7 +40,7 @@ class Regex extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String, integer or float expected", - self::NOT_MATCH => "'%value%' does not match against pattern '%pattern%'", + self::NOT_MATCH => "The input does not match against pattern '%pattern%'", self::ERROROUS => "There was an internal error while using the pattern '%pattern%'", ); diff --git a/src/Sitemap/Changefreq.php b/src/Sitemap/Changefreq.php index 71cbe0d16..28fbb87a7 100644 --- a/src/Sitemap/Changefreq.php +++ b/src/Sitemap/Changefreq.php @@ -49,7 +49,7 @@ class Changefreq extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::NOT_VALID => "'%value%' is not a valid sitemap changefreq", + self::NOT_VALID => "The input is not a valid sitemap changefreq", self::INVALID => "Invalid type given. String expected", ); diff --git a/src/Sitemap/Lastmod.php b/src/Sitemap/Lastmod.php index 6097c96c9..8c0655b40 100644 --- a/src/Sitemap/Lastmod.php +++ b/src/Sitemap/Lastmod.php @@ -55,7 +55,7 @@ class Lastmod extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::NOT_VALID => "'%value%' is not a valid sitemap lastmod", + self::NOT_VALID => "The input is not a valid sitemap lastmod", self::INVALID => "Invalid type given. String expected", ); diff --git a/src/Sitemap/Loc.php b/src/Sitemap/Loc.php index fac78ae01..d2487c970 100644 --- a/src/Sitemap/Loc.php +++ b/src/Sitemap/Loc.php @@ -51,7 +51,7 @@ class Loc extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::NOT_VALID => "'%value%' is not a valid sitemap location", + self::NOT_VALID => "The input is not a valid sitemap location", self::INVALID => "Invalid type given. String expected", ); diff --git a/src/Sitemap/Priority.php b/src/Sitemap/Priority.php index 03de858f0..f576bd8de 100644 --- a/src/Sitemap/Priority.php +++ b/src/Sitemap/Priority.php @@ -49,7 +49,7 @@ class Priority extends AbstractValidator * @var array */ protected $messageTemplates = array( - self::NOT_VALID => "'%value%' is not a valid sitemap priority", + self::NOT_VALID => "The input is not a valid sitemap priority", self::INVALID => "Invalid type given. Numeric string, integer or float expected", ); diff --git a/src/Step.php b/src/Step.php index af7e706c6..e85f9bb00 100644 --- a/src/Step.php +++ b/src/Step.php @@ -38,7 +38,7 @@ class Step extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid value given. Scalar expected.", - self::NOT_STEP => "'%value%' is not a valid step." + self::NOT_STEP => "The input is not a valid step." ); /** diff --git a/src/StringLength.php b/src/StringLength.php index 44253bcaf..226ae682e 100644 --- a/src/StringLength.php +++ b/src/StringLength.php @@ -37,8 +37,8 @@ class StringLength extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String expected", - self::TOO_SHORT => "'%value%' is less than %min% characters long", - self::TOO_LONG => "'%value%' is more than %max% characters long", + self::TOO_SHORT => "The input is less than %min% characters long", + self::TOO_LONG => "The input is more than %max% characters long", ); /** diff --git a/src/Uri.php b/src/Uri.php index df63a7889..97a11445c 100644 --- a/src/Uri.php +++ b/src/Uri.php @@ -40,7 +40,7 @@ class Uri extends AbstractValidator */ protected $messageTemplates = array( self::INVALID => "Invalid type given. String expected", - self::NOT_URI => "'%value%' does not appear to be a valid Uri", + self::NOT_URI => "The input does not appear to be a valid Uri", ); /** diff --git a/test/AlnumTest.php b/test/AlnumTest.php index c3a78369e..27b119dfd 100644 --- a/test/AlnumTest.php +++ b/test/AlnumTest.php @@ -119,7 +119,7 @@ public function testEmptyStringValueResultsInProperValidationFailureMessages() $this->assertFalse($this->validator->isValid('')); $messages = $this->validator->getMessages(); $arrayExpected = array( - Alnum::STRING_EMPTY => '\'\' is an empty string' + Alnum::STRING_EMPTY => 'The input is an empty string' ); $this->assertThat($messages, $this->identicalTo($arrayExpected)); } @@ -132,7 +132,7 @@ public function testInvalidValueResultsInProperValidationFailureMessages() $this->assertFalse($this->validator->isValid('#')); $messages = $this->validator->getMessages(); $arrayExpected = array( - Alnum::NOT_ALNUM => '\'#\' contains characters which are non alphabetic and no digits' + Alnum::NOT_ALNUM => 'The input contains characters which are non alphabetic and no digits' ); $this->assertThat($messages, $this->identicalTo($arrayExpected)); } diff --git a/test/DigitsTest.php b/test/DigitsTest.php index 6bdf08d74..c153a32f5 100644 --- a/test/DigitsTest.php +++ b/test/DigitsTest.php @@ -84,7 +84,7 @@ public function testEmptyStringValueResultsInProperValidationFailureMessages() $this->assertFalse($this->validator->isValid('')); $messages = $this->validator->getMessages(); $arrayExpected = array( - Digits::STRING_EMPTY => '\'\' is an empty string' + Digits::STRING_EMPTY => 'The input is an empty string' ); $this->assertThat($messages, $this->identicalTo($arrayExpected)); } @@ -97,7 +97,7 @@ public function testInvalidValueResultsInProperValidationFailureMessages() $this->assertFalse($this->validator->isValid('#')); $messages = $this->validator->getMessages(); $arrayExpected = array( - Digits::NOT_DIGITS => '\'#\' must contain only digits' + Digits::NOT_DIGITS => 'The input must contain only digits' ); $this->assertThat($messages, $this->identicalTo($arrayExpected)); } @@ -116,4 +116,4 @@ public function testEqualsMessageTemplates() $this->assertAttributeEquals($validator->getOption('messageTemplates'), 'messageTemplates', $validator); } -} \ No newline at end of file +} diff --git a/test/MessageTest.php b/test/MessageTest.php index 6cce6d35d..dc0fb49b9 100644 --- a/test/MessageTest.php +++ b/test/MessageTest.php @@ -54,7 +54,7 @@ public function testSetMessage() $inputInvalid = 'abcdefghij'; $this->assertFalse($this->validator->isValid($inputInvalid)); $messages = $this->validator->getMessages(); - $this->assertEquals("'$inputInvalid' is more than 8 characters long", current($messages)); + $this->assertEquals("The input is more than 8 characters long", current($messages)); $this->validator->setMessage( 'Your value is too long', @@ -271,4 +271,4 @@ public function testEqualsMessageVariables() $this->assertAttributeEquals($validator->getOption('messageVariables'), 'messageVariables', $validator); } -} \ No newline at end of file +}