Refactor isUserChanged to hasUserChanged

This commit is contained in:
Dariusz Górecki 2012-01-02 12:36:42 +01:00
parent 56db4a1d26
commit 3682f62a07

View File

@ -89,7 +89,7 @@ abstract class AbstractToken implements TokenInterface
if (!$user instanceof UserInterface) { if (!$user instanceof UserInterface) {
$changed = true; $changed = true;
} else { } else {
$changed = !$this->isUserChanged($user); $changed = !$this->hasUserChanged($user);
} }
} elseif ($user instanceof UserInterface) { } elseif ($user instanceof UserInterface) {
$changed = true; $changed = true;
@ -223,10 +223,10 @@ abstract class AbstractToken implements TokenInterface
return sprintf('%s(user="%s", authenticated=%s, roles="%s")', $class, $this->getUsername(), json_encode($this->authenticated), implode(', ', $roles)); return sprintf('%s(user="%s", authenticated=%s, roles="%s")', $class, $this->getUsername(), json_encode($this->authenticated), implode(', ', $roles));
} }
private function isUserChanged(UserInterface $user) private function hasUserChanged(UserInterface $user)
{ {
if (!($this->user instanceof UserInterface)) { if (!($this->user instanceof UserInterface)) {
throw new \BadMethodCallException('Method "compareUser" should be called when current user class is instance of "UserInterface".'); throw new \BadMethodCallException('Method "hasUserChanged" should be called when current user class is instance of "UserInterface".');
} }
if ($this->user instanceof EquatableInterface) { if ($this->user instanceof EquatableInterface) {