diff --git a/src/AbstractValidator.php b/src/AbstractValidator.php index 22ece1e75..3852e391f 100644 --- a/src/AbstractValidator.php +++ b/src/AbstractValidator.php @@ -248,21 +248,17 @@ public function __get($property) if (array_key_exists($property, $this->abstractOptions['messageVariables'])) { $result = $this->abstractOptions['messageVariables'][$property]; if (is_array($result)) { - $result = $this->{key($result)}[current($result)]; - } else { - $result = $this->{$result}; + return $this->{key($result)}[current($result)]; } - return $result; + return $this->{$result}; } if (isset($this->messageVariables) && array_key_exists($property, $this->messageVariables)) { $result = $this->{$this->messageVariables[$property]}; if (is_array($result)) { - $result = $this->{key($result)}[current($result)]; - } else { - $result = $this->{$result}; + return $this->{key($result)}[current($result)]; } - return $result; + return $this->{$result}; } throw new Exception\InvalidArgumentException("No property exists by the name '$property'"); diff --git a/src/Explode.php b/src/Explode.php index 8c0ba0efc..9a26f7f4d 100644 --- a/src/Explode.php +++ b/src/Explode.php @@ -185,8 +185,6 @@ public function isValid($value) $values = array($value); } - $retval = true; - $messages = array(); $validator = $this->getValidator(); if (!$validator) { @@ -198,17 +196,14 @@ public function isValid($value) foreach ($values as $value) { if (!$validator->isValid($value)) { - $messages[] = $validator->getMessages(); - $retval = false; + $this->abstractOptions['messages'][] = $validator->getMessages(); if ($this->isBreakOnFirstFailure()) { - break; + return false; } } } - $this->abstractOptions['messages'] = $messages; - - return $retval; + return count($this->abstractOptions['messages']) == 0; } }