mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +00:00
Fixed broken logic for recursive counts of ListTag
This commit is contained in:
parent
d4cc7d13cd
commit
2e480b5ea1
@ -98,18 +98,16 @@ class ListTag extends NamedTag implements \ArrayAccess, \Countable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function count($mode = COUNT_NORMAL){
|
public function count($mode = COUNT_NORMAL){
|
||||||
for($i = 0; true; $i++){
|
$count = 0;
|
||||||
if(!isset($this->{$i})){
|
for($i = 0; isset($this->{$i}); $i++){
|
||||||
return $i;
|
if($mode === COUNT_RECURSIVE and $this->{$i} instanceof \Countable){
|
||||||
}
|
$count += count($this->{$i});
|
||||||
if($mode === COUNT_RECURSIVE){
|
}else{
|
||||||
if($this->{$i} instanceof \Countable){
|
$count++;
|
||||||
$i += count($this->{$i});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $i;
|
return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType(){
|
public function getType(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user