Replace empty() usages with count()

This commit is contained in:
Dylan K. Taylor
2019-12-18 11:06:28 +00:00
parent b08c38f8f9
commit 494660102e
23 changed files with 58 additions and 43 deletions

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\permission;
use function array_shift;
use function count;
use function explode;
use function implode;
use function strlen;
@ -161,17 +162,17 @@ class BanEntry{
$str = explode("|", trim($str));
$entry = new BanEntry(trim(array_shift($str)));
do{
if(empty($str)){
if(count($str) === 0){
break;
}
$entry->setCreated(self::parseDate(array_shift($str)));
if(empty($str)){
if(count($str) === 0){
break;
}
$entry->setSource(trim(array_shift($str)));
if(empty($str)){
if(count($str) === 0){
break;
}
@ -179,7 +180,7 @@ class BanEntry{
if($expire !== "" and strtolower($expire) !== "forever"){
$entry->setExpires(self::parseDate($expire));
}
if(empty($str)){
if(count($str) === 0){
break;
}

View File

@ -168,7 +168,7 @@ class PermissionManager{
public function unsubscribeFromAllPermissions(Permissible $permissible) : void{
foreach($this->permSubs as $permission => &$subs){
unset($subs[spl_object_hash($permissible)]);
if(empty($subs)){
if(count($subs) === 0){
unset($this->permSubs[$permission]);
}
}