Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'cs/zendframework/zendframework#6921-remove-unused-varia…
Browse files Browse the repository at this point in the history
…ble-assignments' into develop

Close zendframework/zendframework#6921
Forward port zendframework/zendframework#6921
  • Loading branch information
Ocramius committed Nov 24, 2014
5 parents 07599d5 + a2ceda7 + 03ec649 + 70cd8e8 + cdec73e commit abcfcf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
12 changes: 4 additions & 8 deletions src/AbstractValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'");
Expand Down
11 changes: 3 additions & 8 deletions src/Explode.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ public function isValid($value)
$values = array($value);
}

$retval = true;
$messages = array();
$validator = $this->getValidator();

if (!$validator) {
Expand All @@ -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;
}
}

0 comments on commit abcfcf2

Please sign in to comment.