Copied!

RepeatedField is used by generated protocol message classes to manipulate repeated fields. It can be used like native PHP array.

  • template
  • implements \ArrayAccess<int,\T>
  • implements \IteratorAggregate<\T>
CloneableInstantiableIterable
  • Implements
    ArrayAccess
    Countable
    IteratorAggregate
    Traversable
Methods
public __construct( $type, $klass = NULL)
 

Constructs an instance of RepeatedField.

  • param int $type Type of the stored element.
  • param string|class-string<\T> $klass Message/Enum class name (message/enum fields only).
  • ignore
public __debugInfo()
public count() : int
 

Return the number of stored elements.

This will also be called for: count($arr)

  • return int The number of stored elements.
public getClass()
 
  • ignore
  • return string|class-string<\T>
public getIterator() : Traversable
 
  • ignore
public getType()
 
  • ignore
public offsetExists( $offset) : bool
 

Check the existence of the element at the given index.

This will also be called for: isset($arr)

  • param int $offset The index of the element to be removed.
  • return bool True if the element at the given offset exists.
  • throws \ErrorException Invalid type for index.
public offsetGet( $offset)
 

Return the element at the given index.

This will also be called for: $ele = $arr[0]

  • param int $offset The index of the element to be fetched.
  • return \T The stored element at given index.
  • throws \ErrorException Invalid type for index.
  • throws \ErrorException Non-existing index.
  • todo need to add return type mixed (require update php version to 8.0)
  • attribute ReturnTypeWillChange
public offsetSet( $offset, $value)
 

Assign the element at the given index.

This will also be called for: $arr []= $ele and $arr[0] = ele

  • param int|null $offset The index of the element to be assigned.
  • param \T $value The element to be assigned.
  • return void
  • throws \ErrorException Invalid type for index.
  • throws \ErrorException Non-existing index.
  • throws \ErrorException Incorrect type of the element.
  • todo need to add return type void (require update php version to 7.1)
  • attribute ReturnTypeWillChange
public offsetUnset( $offset)
 

Remove the element at the given index.

This will also be called for: unset($arr)

  • param int $offset The index of the element to be removed.
  • return void
  • throws \ErrorException Invalid type for index.
  • throws \ErrorException The element to be removed is not at the end of the RepeatedField.
  • todo need to add return type void (require update php version to 7.1)
  • attribute ReturnTypeWillChange
Properties
private $container = NULL
 
  • ignore
private $klass = NULL
 
  • ignore
  • var string|class-string<\T>
private $type = NULL
 
  • ignore
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration