PocketMine-MP 5.14.2 git-50e2c469a547a16a23b2dc691e70a51d34e29395
pocketmine\nbt\tag\ListTag Class Reference
+ Inheritance diagram for pocketmine\nbt\tag\ListTag:
+ Collaboration diagram for pocketmine\nbt\tag\ListTag:

Public Member Functions

 __construct (array $value=[], int $tagType=NBT::TAG_End)
 
 __clone ()
 
 __toString ()
 
 count ()
 
 empty ()
 
 equals (Tag $that)
 
 first ()
 
 get (int $offset)
 
 getAllValues ()
 
 getCount ()
 
 getIterator ()
 
 getTagType ()
 
 getType ()
 
 getValue ()
 
 insert (int $offset, Tag $tag)
 
 isset (int $offset)
 
 last ()
 
 pop ()
 
 push (Tag $tag)
 
 remove (int $offset)
 
 safeClone ()
 
 set (int $offset, Tag $tag)
 
 setTagType (int $type)
 
 shift ()
 
 toString (int $indentation=0)
 
 unshift (Tag $tag)
 
 write (NbtStreamWriter $writer)
 

Static Public Member Functions

static read (NbtStreamReader $reader, ReaderTracker $tracker)
 

Protected Member Functions

 getTypeName ()
 
 makeCopy ()
 
 stringifyValue (int $indentation)
 

Static Protected Member Functions

static restrictArgCount (string $func, int $haveArgs, int $wantMaxArgs)
 

Protected Attributes

 $cloning = false
 

Detailed Description

@phpstan-implements \IteratorAggregate<int, Tag>

Definition at line 39 of file ListTag.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\nbt\tag\ListTag::__construct ( array  $value = [],
int  $tagType = NBT::TAG_End 
)
Parameters
Tag[]$value

Definition at line 53 of file ListTag.php.

References pocketmine\nbt\tag\ListTag\push().

+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

pocketmine\nbt\tag\ListTag::__clone ( )

Definition at line 280 of file ListTag.php.

◆ __toString()

pocketmine\nbt\tag\Tag::__toString ( )
inherited

Definition at line 43 of file Tag.php.

◆ count()

pocketmine\nbt\tag\ListTag::count ( )

Definition at line 88 of file ListTag.php.

◆ empty()

pocketmine\nbt\tag\ListTag::empty ( )

Returns whether there are any tags in the list.

Definition at line 191 of file ListTag.php.

◆ equals()

pocketmine\nbt\tag\ListTag::equals ( Tag  $that)

Compares this Tag to the given Tag and determines whether or not they are equal, based on type and value. Complex tag types should override this to provide proper value comparison.

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 305 of file ListTag.php.

◆ first()

pocketmine\nbt\tag\ListTag::first ( )

Returns the element in the first position of the list, without removing it.

Definition at line 160 of file ListTag.php.

◆ get()

pocketmine\nbt\tag\ListTag::get ( int  $offset)

Returns the tag at the specified offset.

Exceptions

OutOfRangeException if the offset is not within the bounds of the list

Definition at line 150 of file ListTag.php.

◆ getAllValues()

pocketmine\nbt\tag\ListTag::getAllValues ( )

Returns an array of tag values inserted into this list.

Returns
mixed[] @phpstan-return list<mixed>

Definition at line 79 of file ListTag.php.

◆ getCount()

pocketmine\nbt\tag\ListTag::getCount ( )

Definition at line 92 of file ListTag.php.

◆ getIterator()

pocketmine\nbt\tag\ListTag::getIterator ( )
Returns
\Generator|Tag[] @phpstan-return \Generator<int, Tag, void, void>

Definition at line 299 of file ListTag.php.

◆ getTagType()

pocketmine\nbt\tag\ListTag::getTagType ( )

Returns the type of tag contained in this list.

Definition at line 206 of file ListTag.php.

◆ getType()

pocketmine\nbt\tag\ListTag::getType ( )

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 199 of file ListTag.php.

◆ getTypeName()

pocketmine\nbt\tag\ListTag::getTypeName ( )
protected

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 195 of file ListTag.php.

◆ getValue()

pocketmine\nbt\tag\ListTag::getValue ( )
Returns
Tag[]

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 65 of file ListTag.php.

◆ insert()

pocketmine\nbt\tag\ListTag::insert ( int  $offset,
Tag  $tag 
)

Inserts a tag into the list between existing tags, at the specified offset. Later values in the list are moved up by 1 position.

Returns
void
Exceptions

OutOfRangeException if the offset is not within the bounds of the list

Definition at line 133 of file ListTag.php.

◆ isset()

pocketmine\nbt\tag\ListTag::isset ( int  $offset)

Returns whether a tag exists at the specified offset.

Definition at line 184 of file ListTag.php.

◆ last()

pocketmine\nbt\tag\ListTag::last ( )

Returns the element in the last position in the list (the end), without removing it.

Definition at line 167 of file ListTag.php.

◆ makeCopy()

pocketmine\nbt\tag\ListTag::makeCopy ( )
protected
Returns
static

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 291 of file ListTag.php.

◆ pop()

pocketmine\nbt\tag\ListTag::pop ( )

Removes the last tag from the list and returns it.

Definition at line 107 of file ListTag.php.

◆ push()

pocketmine\nbt\tag\ListTag::push ( Tag  $tag)

Appends the specified tag to the end of the list.

Definition at line 99 of file ListTag.php.

Referenced by pocketmine\nbt\tag\ListTag\__construct().

+ Here is the caller graph for this function:

◆ read()

static pocketmine\nbt\tag\ListTag::read ( NbtStreamReader  $reader,
ReaderTracker  $tracker 
)
static

Definition at line 241 of file ListTag.php.

◆ remove()

pocketmine\nbt\tag\ListTag::remove ( int  $offset)

Removes a value from the list. All later tags in the list are moved down by 1 position.

Definition at line 141 of file ListTag.php.

◆ restrictArgCount()

static pocketmine\nbt\tag\Tag::restrictArgCount ( string  $func,
int  $haveArgs,
int  $wantMaxArgs 
)
staticprotectedinherited

Definition at line 88 of file Tag.php.

◆ safeClone()

pocketmine\nbt\tag\Tag::safeClone ( )
inherited

Clones this tag safely, detecting recursive dependencies which would otherwise cause an infinite cloning loop. Used for cloning tags in tags that have children.

Exceptions

RuntimeException if a recursive dependency was detected

Definition at line 61 of file Tag.php.

◆ set()

pocketmine\nbt\tag\ListTag::set ( int  $offset,
Tag  $tag 
)

Overwrites the tag at the specified offset.

Exceptions

OutOfRangeException if the offset is not within the bounds of the list

Definition at line 176 of file ListTag.php.

◆ setTagType()

pocketmine\nbt\tag\ListTag::setTagType ( int  $type)

Sets the type of tag that can be added to this list. If TAG_End is used, the type will be auto-detected from the first tag added to the list.

Returns
void
Exceptions

LogicException if the list is not empty

Definition at line 217 of file ListTag.php.

◆ shift()

pocketmine\nbt\tag\ListTag::shift ( )

Removes the first tag from the list and returns it.

Definition at line 122 of file ListTag.php.

◆ stringifyValue()

pocketmine\nbt\tag\ListTag::stringifyValue ( int  $indentation)
protected

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 271 of file ListTag.php.

◆ toString()

pocketmine\nbt\tag\Tag::toString ( int  $indentation = 0)
finalinherited

Definition at line 47 of file Tag.php.

◆ unshift()

pocketmine\nbt\tag\ListTag::unshift ( Tag  $tag)

Adds the specified tag to the start of the list.

Definition at line 114 of file ListTag.php.

◆ write()

pocketmine\nbt\tag\ListTag::write ( NbtStreamWriter  $writer)

Reimplemented from pocketmine\nbt\tag\Tag.

Definition at line 262 of file ListTag.php.

Member Data Documentation

◆ $cloning

pocketmine\nbt\tag\Tag::$cloning = false
protectedinherited

Definition at line 34 of file Tag.php.


The documentation for this class was generated from the following file: