TypedConfigInterface.php 1.93 KB
Newer Older
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
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
<?php

/**
 * @file
 * Contains \Drupal\Core\Config\Schema\TypedConfigInterface.
 */

namespace Drupal\Core\Config\Schema;

use Drupal\Core\TypedData\TraversableTypedDataInterface;

/**
 * Interface for a typed configuration object that contains multiple elements.
 *
 * A list of typed configuration contains any number of items whose type
 * will depend on the configuration schema but also on the configuration
 * data being parsed.
 *
 * When implementing this interface which extends Traversable, make sure to list
 * IteratorAggregate or Iterator before this interface in the implements clause.
 */
interface TypedConfigInterface extends TraversableTypedDataInterface {

  /**
   * Determines whether the data structure is empty.
   *
   * @return boolean
   *   TRUE if the data structure is empty, FALSE otherwise.
   */
  public function isEmpty();

  /**
   * Gets an array of contained elements.
   *
   * @return array
   *   Array of \Drupal\Core\TypedData\TypedDataInterface objects.
   */
  public function getElements();

  /**
   * Gets a contained typed configuration element.
   *
   * @param $name
   *   The name of the property to get; e.g., 'title' or 'name'. Nested
   *   elements can be get using multiple dot delimited names, for example,
   *   'page.front'.
   *
   * @throws \InvalidArgumentException
   *   If an invalid property name is given.
   *
   * @return \Drupal\Core\TypedData\TypedDataInterface
   *   The property object.
   */
  public function get($name);

  /**
   * Replaces the item at the specified position in this list.
   *
   * @param int|string $key
   *   Property name or index of the item to replace.
   * @param mixed $value
   *   Value to be stored at the specified position.
   *
   * @return $this
   */
  public function set($key, $value);

  /**
   * Returns an array of all property values.
   *
   * @return array
   *   An array of property values, keyed by property name.
   */
  public function toArray();

}