summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/TypedData/ListInterface.php
blob: 53f5eac68d9c44e48c0a23efae3cd2e655a7580f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php

/**
 * @file
 * Contains \Drupal\Core\TypedData\ListInterface.
 */

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
 * contain duplicates. Note that the data type of a list is always 'list'.
 *
 * When implementing this interface which extends Traversable, make sure to list
 * IteratorAggregate or Iterator before this interface in the implements clause.
 */
interface ListInterface extends TypedDataInterface, \ArrayAccess, \Countable, \Traversable {

  /**
   * 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.
   *
   * @return \Drupal\Core\TypedData\DataDefinitionInterface
   *   The data definition of contained items.
   */
  public function getItemDefinition();

  /**
   * React to changes to a child item.
   *
   * Note that this is invoked after any changes have been applied.
   *
   * @param $delta
   *   The delta of the item which is changed.
   */
  public function onChange($delta);
}