Newer
Older
Dries Buytaert
committed
<?php
/**
* @file
* Contains \Drupal\Core\TypedData\ListInterface.
Dries Buytaert
committed
*/
namespace Drupal\Core\TypedData;
/**
* Interface for a list of typed data.
*
* A list of typed data contains only items of the same type, is ordered and may
Angie Byron
committed
* contain duplicates. Note that the data type of a list is always 'list'.
Dries Buytaert
committed
*
* When implementing this interface which extends Traversable, make sure to list
* IteratorAggregate or Iterator before this interface in the implements clause.
*/
Angie Byron
committed
interface ListInterface extends TypedDataInterface, \ArrayAccess, \Countable, \Traversable {
Dries Buytaert
committed
/**
* Determines whether the list contains any non-empty items.
*
* @return boolean
* TRUE if the list is empty, FALSE otherwise.
*/
public function isEmpty();
/**
* Gets the definition of a contained item.
*
Angie Byron
committed
* @return \Drupal\Core\TypedData\DataDefinitionInterface
* The data definition of contained items.
*/
public function getItemDefinition();
catch
committed
/**
* React to changes to a child item.
*
* Note that this is invoked after any changes have been applied.
catch
committed
*
* @param $delta
* The delta of the item which is changed.
*/
public function onChange($delta);
Alex Pott
committed
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
* Returns the item at the specified position in this list.
*
* @param int $index
* Index of the item to return.
*
* @return \Drupal\Core\TypedData\TypedDataInterface
* The item at the specified position in this list. An empty item is created
* if it does not exist yet.
*/
public function get($index);
/**
* Replaces the item at the specified position in this list.
*
* @param int $index
* Index of the item to replace.
* @param mixed
* Item to be stored at the specified position.
*
* @return static
* Returns the list.
*/
public function set($index, $item);
/**
* Returns the first item in this list.
*
* @return \Drupal\Core\TypedData\TypedDataInterface
* The first item in this list.
*/
public function first();