diff --git a/src/AbstractValidator.php b/src/AbstractValidator.php index 6c79742cc..e3262e1ac 100644 --- a/src/AbstractValidator.php +++ b/src/AbstractValidator.php @@ -468,9 +468,7 @@ public function getTranslatorTextDomain() * @return void * @throws Exception\InvalidArgumentException */ - public static function setDefaultTranslator( - Translator\TranslatorInterface $translator = null, $textDomain = null - ) + public static function setDefaultTranslator(Translator\TranslatorInterface $translator = null, $textDomain = null) { static::$defaultTranslator = $translator; if (null !== $textDomain) { @@ -575,8 +573,6 @@ protected function translateMessage($messageKey, $message) return $message; } - return $translator->translate( - $message, $this->getTranslatorTextDomain() - ); + return $translator->translate($message, $this->getTranslatorTextDomain()); } } diff --git a/src/Barcode/Code128.php b/src/Barcode/Code128.php index 2e95551dc..8dcfc0afd 100644 --- a/src/Barcode/Code128.php +++ b/src/Barcode/Code128.php @@ -129,13 +129,13 @@ public function hasValidCharacters($value) switch ($char) { // Function definition - case 'Ç' : - case 'ü' : - case 'å' : + case 'Ç': + case 'ü': + case 'å': break; // Switch 1 char between A and B - case 'é' : + case 'é': if ($set == 'A') { $read = 'B'; } elseif ($set == 'B') { @@ -144,32 +144,32 @@ public function hasValidCharacters($value) break; // Switch to C - case 'â' : + case 'â': $set = 'C'; $read = 'C'; break; // Switch to B - case 'ä' : + case 'ä': $set = 'B'; $read = 'B'; break; // Switch to A - case 'à' : + case 'à': $set = 'A'; $read = 'A'; break; // Doubled start character - case '‡' : - case 'ˆ' : - case '‰' : + case '‡': + case 'ˆ': + case '‰': return false; break; // Chars after the stop character - case 'Š' : + case 'Š': break 2; default: @@ -227,15 +227,15 @@ protected function code128($value) switch ($char) { // Function definition - case 'Ç' : - case 'ü' : - case 'å' : + case 'Ç': + case 'ü': + case 'å': $sum += ($pos * $this->ord128($char, $set)); break; - case 'é' : + case 'é': $sum += ($pos * $this->ord128($char, $set)); - if ($set == 'A') { + if ($set == 'A') { $read = 'B'; } elseif ($set == 'B') { $read = 'A'; @@ -243,29 +243,29 @@ protected function code128($value) break; // Switch to C - case 'â' : + case 'â': $sum += ($pos * $this->ord128($char, $set)); $set = 'C'; $read = 'C'; break; // Switch to B - case 'ä' : + case 'ä': $sum += ($pos * $this->ord128($char, $set)); $set = 'B'; $read = 'B'; break; // Switch to A - case 'à' : + case 'à': $sum += ($pos * $this->ord128($char, $set)); $set = 'A'; $read = 'A'; break; - case '‡' : - case 'ˆ' : - case '‰' : + case '‡': + case 'ˆ': + case '‰': return false; break; @@ -311,13 +311,13 @@ protected function getCodingSet($value) { $value = $this->getUtf8StringWrapper()->substr($value, 0, 1); switch ($value) { - case '‡' : + case '‡': return 'A'; break; - case 'ˆ' : + case 'ˆ': return 'B'; break; - case '‰' : + case '‰': return 'C'; break; } diff --git a/src/Date.php b/src/Date.php index 044a6ce34..c7f5c2906 100644 --- a/src/Date.php +++ b/src/Date.php @@ -55,7 +55,6 @@ class Date extends AbstractValidator */ protected $format = self::FORMAT_DEFAULT; - /** * Sets validator options * diff --git a/src/DateStep.php b/src/DateStep.php index 701be0bd1..7e657c652 100644 --- a/src/DateStep.php +++ b/src/DateStep.php @@ -235,7 +235,7 @@ public function isValid($value) if (in_array($intervalUnit, array('years', 'months', 'days'))) { switch ($intervalUnit) { case 'years': - if ( 0 == $diffParts['months'] && 0 == $diffParts['days'] + if (0 == $diffParts['months'] && 0 == $diffParts['days'] && 0 == $diffParts['hours'] && 0 == $diffParts['minutes'] && 0 == $diffParts['seconds'] ) { @@ -245,7 +245,7 @@ public function isValid($value) } break; case 'months': - if ( 0 == $diffParts['days'] && 0 == $diffParts['hours'] + if (0 == $diffParts['days'] && 0 == $diffParts['hours'] && 0 == $diffParts['minutes'] && 0 == $diffParts['seconds'] ) { $months = ($diffParts['years'] * 12) + $diffParts['months']; @@ -255,7 +255,7 @@ public function isValid($value) } break; case 'days': - if ( 0 == $diffParts['hours'] && 0 == $diffParts['minutes'] + if (0 == $diffParts['hours'] && 0 == $diffParts['minutes'] && 0 == $diffParts['seconds'] ) { $days = $timeDiff->format('%a'); // Total days diff --git a/src/Exception/BadMethodCallException.php b/src/Exception/BadMethodCallException.php index 0e36e037e..133169752 100644 --- a/src/Exception/BadMethodCallException.php +++ b/src/Exception/BadMethodCallException.php @@ -9,6 +9,6 @@ namespace Zend\Validator\Exception; -class BadMethodCallException extends \BadMethodCallException - implements ExceptionInterface -{} +class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface +{ +} diff --git a/src/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php index 0bc6317b7..6fb223fb3 100644 --- a/src/Exception/ExceptionInterface.php +++ b/src/Exception/ExceptionInterface.php @@ -10,4 +10,5 @@ namespace Zend\Validator\Exception; interface ExceptionInterface -{} +{ +} diff --git a/src/Exception/ExtensionNotLoadedException.php b/src/Exception/ExtensionNotLoadedException.php index f9c2bd8bd..02b2c3c81 100644 --- a/src/Exception/ExtensionNotLoadedException.php +++ b/src/Exception/ExtensionNotLoadedException.php @@ -10,4 +10,5 @@ namespace Zend\Validator\Exception; class ExtensionNotLoadedException extends RuntimeException -{} +{ +} diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index 7610dc390..5aa430bf5 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -9,6 +9,6 @@ namespace Zend\Validator\Exception; -class InvalidArgumentException extends \InvalidArgumentException - implements ExceptionInterface -{} +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ +} diff --git a/src/Exception/InvalidMagicMimeFileException.php b/src/Exception/InvalidMagicMimeFileException.php index b395ddd34..41baecc7c 100644 --- a/src/Exception/InvalidMagicMimeFileException.php +++ b/src/Exception/InvalidMagicMimeFileException.php @@ -10,4 +10,5 @@ namespace Zend\Validator\Exception; class InvalidMagicMimeFileException extends InvalidArgumentException -{} +{ +} diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index de98b3d0b..9b146c602 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -9,6 +9,6 @@ namespace Zend\Validator\Exception; -class RuntimeException extends \RuntimeException - implements ExceptionInterface -{} +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/src/File/Count.php b/src/File/Count.php index 0bbf6be6f..a52a0d694 100644 --- a/src/File/Count.php +++ b/src/File/Count.php @@ -121,8 +121,9 @@ public function setMin($min) $min = (int) $min; if (($this->getMax() !== null) && ($min > $this->getMax())) { - throw new Exception\InvalidArgumentException("The minimum must be less than or equal to the maximum file count, but $min >" - . " {$this->getMax()}"); + throw new Exception\InvalidArgumentException( + "The minimum must be less than or equal to the maximum file count, but {$min} > {$this->getMax()}" + ); } $this->options['min'] = $min; @@ -158,8 +159,9 @@ public function setMax($max) $max = (int) $max; if (($this->getMin() !== null) && ($max < $this->getMin())) { - throw new Exception\InvalidArgumentException("The maximum must be greater than or equal to the minimum file count, but " - . "$max < {$this->getMin()}"); + throw new Exception\InvalidArgumentException( + "The maximum must be greater than or equal to the minimum file count, but {$max} < {$this->getMin()}" + ); } $this->options['max'] = $max; diff --git a/src/File/Extension.php b/src/File/Extension.php index 2ceeebc73..1283a6f76 100644 --- a/src/File/Extension.php +++ b/src/File/Extension.php @@ -13,6 +13,7 @@ use Zend\Stdlib\ArrayUtils; use Zend\Validator\AbstractValidator; use Zend\Validator\Exception; + /** * Validator for the file extension of a file */ diff --git a/src/File/ImageSize.php b/src/File/ImageSize.php index 921abfb1f..6d1f85595 100644 --- a/src/File/ImageSize.php +++ b/src/File/ImageSize.php @@ -130,8 +130,10 @@ public function getMinWidth() public function setMinWidth($minWidth) { if (($this->getMaxWidth() !== null) && ($minWidth > $this->getMaxWidth())) { - throw new Exception\InvalidArgumentException("The minimum image width must be less than or equal to the " - . " maximum image width, but {$minWidth} > {$this->getMaxWidth()}"); + throw new Exception\InvalidArgumentException( + "The minimum image width must be less than or equal to the " + . " maximum image width, but {$minWidth} > {$this->getMaxWidth()}" + ); } $this->options['minWidth'] = (int) $minWidth; @@ -158,8 +160,10 @@ public function getMaxWidth() public function setMaxWidth($maxWidth) { if (($this->getMinWidth() !== null) && ($maxWidth < $this->getMinWidth())) { - throw new Exception\InvalidArgumentException("The maximum image width must be greater than or equal to the " - . "minimum image width, but {$maxWidth} < {$this->getMinWidth()}"); + throw new Exception\InvalidArgumentException( + "The maximum image width must be greater than or equal to the " + . "minimum image width, but {$maxWidth} < {$this->getMinWidth()}" + ); } $this->options['maxWidth'] = (int) $maxWidth; @@ -186,8 +190,10 @@ public function getMinHeight() public function setMinHeight($minHeight) { if (($this->getMaxHeight() !== null) && ($minHeight > $this->getMaxHeight())) { - throw new Exception\InvalidArgumentException("The minimum image height must be less than or equal to the " - . " maximum image height, but {$minHeight} > {$this->getMaxHeight()}"); + throw new Exception\InvalidArgumentException( + "The minimum image height must be less than or equal to the " + . " maximum image height, but {$minHeight} > {$this->getMaxHeight()}" + ); } $this->options['minHeight'] = (int) $minHeight; @@ -214,8 +220,10 @@ public function getMaxHeight() public function setMaxHeight($maxHeight) { if (($this->getMinHeight() !== null) && ($maxHeight < $this->getMinHeight())) { - throw new Exception\InvalidArgumentException("The maximum image height must be greater than or equal to the " - . "minimum image height, but {$maxHeight} < {$this->getMinHeight()}"); + throw new Exception\InvalidArgumentException( + "The maximum image height must be greater than or equal to the " + . "minimum image height, but {$maxHeight} < {$this->getMinHeight()}" + ); } $this->options['maxHeight'] = (int) $maxHeight; diff --git a/src/File/Size.php b/src/File/Size.php index d5cfd9bde..d07bdb4e5 100644 --- a/src/File/Size.php +++ b/src/File/Size.php @@ -149,8 +149,8 @@ public function setMin($min) $max = $this->getMax(true); if (($max !== null) && ($min > $max)) { throw new Exception\InvalidArgumentException( - 'The minimum must be less than or equal to the maximum file' - ." size, but $min > $max"); + "The minimum must be less than or equal to the maximum file size, but {$min} > {$max}" + ); } $this->options['min'] = $min; @@ -194,8 +194,8 @@ public function setMax($max) $min = $this->getMin(true); if (($min !== null) && ($max < $min)) { throw new Exception\InvalidArgumentException( - 'The maximum must be greater than or equal to the minimum file' - ." size, but $max < $min"); + "The maximum must be greater than or equal to the minimum file size, but {$max} < {$min}" + ); } $this->options['max'] = $max; @@ -365,6 +365,4 @@ protected function fromByteString($size) return $value; } - - } diff --git a/src/File/Upload.php b/src/File/Upload.php index 748b482ee..d855ab33b 100644 --- a/src/File/Upload.php +++ b/src/File/Upload.php @@ -115,7 +115,7 @@ public function setFiles($files = array()) $this->options['files'] = $files; } - if ($this->options['files'] === NULL) { + if ($this->options['files'] === null) { $this->options['files'] = array(); } diff --git a/src/File/WordCount.php b/src/File/WordCount.php index f3d58016d..142a8ea38 100644 --- a/src/File/WordCount.php +++ b/src/File/WordCount.php @@ -116,8 +116,8 @@ public function setMin($min) $min = (int) $min; if (($this->getMax() !== null) && ($min > $this->getMax())) { throw new Exception\InvalidArgumentException( - "The minimum must be less than or equal to the maximum word count, but $min >" - . " {$this->getMax()}"); + "The minimum must be less than or equal to the maximum word count, but {$min} > {$this->getMax()}" + ); } $this->options['min'] = $min; @@ -154,8 +154,8 @@ public function setMax($max) $max = (int) $max; if (($this->getMin() !== null) && ($max < $this->getMin())) { throw new Exception\InvalidArgumentException( - "The maximum must be greater than or equal to the minimum word count, but " - . "$max < {$this->getMin()}"); + "The maximum must be greater than or equal to the minimum word count, but {$max} < {$this->getMin()}" + ); } $this->options['max'] = $max; diff --git a/src/Hostname.php b/src/Hostname.php index 1536541f4..9f5434784 100644 --- a/src/Hostname.php +++ b/src/Hostname.php @@ -515,8 +515,7 @@ public function isValid($value) // Check input against DNS hostname schema if ((count($domainParts) > 1) && ($utf8StrWrapper->strlen($value) >= 4) - && ($utf8StrWrapper->strlen($value) <= 254)) - { + && ($utf8StrWrapper->strlen($value) <= 254)) { $status = false; do { diff --git a/src/InArray.php b/src/InArray.php index 6c34210e6..e1ea4f7f0 100644 --- a/src/InArray.php +++ b/src/InArray.php @@ -35,7 +35,6 @@ class InArray extends AbstractValidator */ const COMPARE_NOT_STRICT = -1; - /** * @var array */ diff --git a/src/StringLength.php b/src/StringLength.php index 53a162c6c..9d0490c73 100644 --- a/src/StringLength.php +++ b/src/StringLength.php @@ -87,8 +87,9 @@ public function getMin() public function setMin($min) { if (null !== $this->getMax() && $min > $this->getMax()) { - throw new Exception\InvalidArgumentException("The minimum must be less than or equal to the maximum length, but $min >" - . " " . $this->getMax()); + throw new Exception\InvalidArgumentException( + "The minimum must be less than or equal to the maximum length, but {$min} > {$this->getMax()}" + ); } $this->options['min'] = max(0, (int) $min); @@ -117,8 +118,9 @@ public function setMax($max) if (null === $max) { $this->options['max'] = null; } elseif ($max < $this->getMin()) { - throw new Exception\InvalidArgumentException("The maximum must be greater than or equal to the minimum length, but " - . "$max < " . $this->getMin()); + throw new Exception\InvalidArgumentException( + "The maximum must be greater than or equal to the minimum length, but {$max} < {$this->getMin()}" + ); } else { $this->options['max'] = (int) $max; }