From: Thalia Date: Thu, 21 Mar 2019 22:23:31 +0000 (+0000) Subject: Simplify Block::getBy and Block::getByName X-Git-Tag: 1.34.0-rc.0~2358^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=8b77749599823bb1294f0dd36b5898961857723e;p=lhc%2Fweb%2Fwiklou.git Simplify Block::getBy and Block::getByName Block::getBlocker always returns a User, so there is no need for these methods to check. Change-Id: I0319f0aee8d3fb3c89e8f63ee2f4ba05c8d36482 --- diff --git a/includes/Block.php b/includes/Block.php index 0693650238..40a48ceb20 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -1032,10 +1032,7 @@ class Block { * @return int (0 for foreign users) */ public function getBy() { - $blocker = $this->getBlocker(); - return ( $blocker instanceof User ) - ? $blocker->getId() - : 0; + return $this->getBlocker()->getId(); } /** @@ -1044,10 +1041,7 @@ class Block { * @return string */ public function getByName() { - $blocker = $this->getBlocker(); - return ( $blocker instanceof User ) - ? $blocker->getName() - : (string)$blocker; // username + return $this->getBlocker()->getName(); } /**