mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 00:59:51 +00:00
Replace unnecessary strlen > 0 calls with !== "" checks
This commit is contained in:
parent
298259b473
commit
7dd53f2397
@ -49,7 +49,7 @@ class TeleportCommand extends VanillaCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$args = array_values(array_filter($args, function($arg){
|
$args = array_values(array_filter($args, function($arg){
|
||||||
return strlen($arg) > 0;
|
return $arg !== "";
|
||||||
}));
|
}));
|
||||||
if(count($args) < 1 or count($args) > 6){
|
if(count($args) < 1 or count($args) > 6){
|
||||||
throw new InvalidCommandSyntaxException();
|
throw new InvalidCommandSyntaxException();
|
||||||
|
@ -377,7 +377,7 @@ class LevelDB extends BaseLevelProvider{
|
|||||||
|
|
||||||
/** @var CompoundTag[] $entities */
|
/** @var CompoundTag[] $entities */
|
||||||
$entities = [];
|
$entities = [];
|
||||||
if(($entityData = $this->db->get($index . self::TAG_ENTITY)) !== false and strlen($entityData) > 0){
|
if(($entityData = $this->db->get($index . self::TAG_ENTITY)) !== false and $entityData !== ""){
|
||||||
$entities = $nbt->read($entityData, true);
|
$entities = $nbt->read($entityData, true);
|
||||||
if(!is_array($entities)){
|
if(!is_array($entities)){
|
||||||
$entities = [$entities];
|
$entities = [$entities];
|
||||||
@ -392,7 +392,7 @@ class LevelDB extends BaseLevelProvider{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tiles = [];
|
$tiles = [];
|
||||||
if(($tileData = $this->db->get($index . self::TAG_BLOCK_ENTITY)) !== false and strlen($tileData) > 0){
|
if(($tileData = $this->db->get($index . self::TAG_BLOCK_ENTITY)) !== false and $tileData !== ""){
|
||||||
$tiles = $nbt->read($tileData, true);
|
$tiles = $nbt->read($tileData, true);
|
||||||
if(!is_array($tiles)){
|
if(!is_array($tiles)){
|
||||||
$tiles = [$tiles];
|
$tiles = [$tiles];
|
||||||
@ -402,7 +402,7 @@ class LevelDB extends BaseLevelProvider{
|
|||||||
//TODO: extra data should be converted into blockstorage layers (first they need to be implemented!)
|
//TODO: extra data should be converted into blockstorage layers (first they need to be implemented!)
|
||||||
/*
|
/*
|
||||||
$extraData = [];
|
$extraData = [];
|
||||||
if(($extraRawData = $this->db->get($index . self::TAG_BLOCK_EXTRA_DATA)) !== false and strlen($extraRawData) > 0){
|
if(($extraRawData = $this->db->get($index . self::TAG_BLOCK_EXTRA_DATA)) !== false and $extraRawData !== ""){
|
||||||
$binaryStream->setBuffer($extraRawData, 0);
|
$binaryStream->setBuffer($extraRawData, 0);
|
||||||
$count = $binaryStream->getLInt();
|
$count = $binaryStream->getLInt();
|
||||||
for($i = 0; $i < $count; ++$i){
|
for($i = 0; $i < $count; ++$i){
|
||||||
|
@ -177,7 +177,7 @@ class RCONInstance extends Thread{
|
|||||||
$disconnect[$id] = $sock;
|
$disconnect[$id] = $sock;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(strlen($payload) > 0){
|
if($payload !== ""){
|
||||||
$this->cmd = ltrim($payload);
|
$this->cmd = ltrim($payload);
|
||||||
$this->synchronized(function(){
|
$this->synchronized(function(){
|
||||||
$this->notifier->wakeupSleeper();
|
$this->notifier->wakeupSleeper();
|
||||||
|
@ -168,7 +168,7 @@ class BanEntry{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$expire = trim(array_shift($str));
|
$expire = trim(array_shift($str));
|
||||||
if(strtolower($expire) !== "forever" and strlen($expire) > 0){
|
if($expire !== "" and strtolower($expire) !== "forever"){
|
||||||
$entry->setExpires(self::parseDate($expire));
|
$entry->setExpires(self::parseDate($expire));
|
||||||
}
|
}
|
||||||
if(empty($str)){
|
if(empty($str)){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user