From 8865bb73ba27c5e2c9021e4d1bcc587d0246a04d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 1 Nov 2021 15:52:55 +0000 Subject: [PATCH] BanEntry: remove useless do/while --- src/pocketmine/permission/BanEntry.php | 42 ++++++++++++-------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/src/pocketmine/permission/BanEntry.php b/src/pocketmine/permission/BanEntry.php index 44d8c03e1..397de1cc2 100644 --- a/src/pocketmine/permission/BanEntry.php +++ b/src/pocketmine/permission/BanEntry.php @@ -163,32 +163,28 @@ class BanEntry{ }else{ $str = explode("|", trim($str)); $entry = new BanEntry(trim(array_shift($str))); - do{ - if(count($str) === 0){ - break; - } + if(count($str) === 0){ + return $entry; + } - $entry->setCreated(self::parseDate(array_shift($str))); - if(count($str) === 0){ - break; - } + $entry->setCreated(self::parseDate(array_shift($str))); + if(count($str) === 0){ + return $entry; + } - $entry->setSource(trim(array_shift($str))); - if(count($str) === 0){ - break; - } - - $expire = trim(array_shift($str)); - if($expire !== "" and strtolower($expire) !== "forever"){ - $entry->setExpires(self::parseDate($expire)); - } - if(count($str) === 0){ - break; - } - - $entry->setReason(trim(array_shift($str))); - }while(false); + $entry->setSource(trim(array_shift($str))); + if(count($str) === 0){ + return $entry; + } + $expire = trim(array_shift($str)); + if($expire !== "" and strtolower($expire) !== "forever"){ + $entry->setExpires(self::parseDate($expire)); + } + if(count($str) === 0){ + return $entry; + } + $entry->setReason(trim(array_shift($str))); return $entry; } }