PHP Class WPLib_List_Base, wplib

See also: https://github.com/wplib/wplib/commit/8dc27c368e84f7ba6e1448753e1b1f082a60ac6d#commitcomment-11026937
Inheritance: extends WPLib_Base, implements IteratorAggregate, implements ArrayAccess, implements Serializable, implements Countable
Show file Open project: wplib/wplib Class Usage Examples

Protected Properties

Property Type Description
$_elements array
$_index_by string

Public Methods

Method Description
__construct ( array $elements = [], array $args = [] )
clear_elements ( )
count ( ) : integer
elements ( ) : array
getIterator ( ) : ArrayIterator
get_element_index ( object $element ) : boolean | mixed Get index value for an object stored in a list.
get_template_html ( string $template, array $args = [] ) : string
offsetExists ( mixed $offset ) : boolean
offsetGet ( mixed $offset ) : null
offsetSet ( mixed $offset, mixed $value )
offsetUnset ( mixed $offset )
serialize ( ) : string
set_elements ( array $elements )
the_template ( string $template, array $args = [] )
unserialize ( string $serialized )

Private Methods

Method Description
_reindex_elements ( )

Method Details

__construct() public method

public __construct ( array $elements = [], array $args = [] )
$elements array
$args array

clear_elements() public method

public clear_elements ( )

count() public method

public count ( ) : integer
return integer

elements() public method

public elements ( ) : array
return array

getIterator() public method

get_element_index() public method

Either a property of a method can generate an index value, or a subclass can generate a different one. Returns false it $this->_index_by not set.
public get_element_index ( object $element ) : boolean | mixed
$element object
return boolean | mixed

get_template_html() public method

public get_template_html ( string $template, array $args = [] ) : string
$template string
$args array
return string

offsetExists() public method

public offsetExists ( mixed $offset ) : boolean
$offset mixed
return boolean

offsetGet() public method

public offsetGet ( mixed $offset ) : null
$offset mixed
return null

offsetSet() public method

public offsetSet ( mixed $offset, mixed $value )
$offset mixed
$value mixed

offsetUnset() public method

public offsetUnset ( mixed $offset )
$offset mixed

serialize() public method

public serialize ( ) : string
return string

set_elements() public method

public set_elements ( array $elements )
$elements array

the_template() public method

public the_template ( string $template, array $args = [] )
$template string
$args array

unserialize() public method

public unserialize ( string $serialized )
$serialized string

Property Details

$_elements protected property

protected array $_elements
return array

$_index_by protected property

protected string $_index_by
return string