1 | <?php |
||
23 | class TermList implements Countable, IteratorAggregate, Comparable { |
||
24 | |||
25 | /** |
||
26 | * @var Term[] |
||
27 | */ |
||
28 | private $terms = array(); |
||
29 | |||
30 | /** |
||
31 | * @param Term[] $terms |
||
32 | * @throws InvalidArgumentException |
||
33 | */ |
||
34 | public function __construct( array $terms = array() ) { |
||
43 | |||
44 | /** |
||
45 | * @see Countable::count |
||
46 | * @return int |
||
47 | */ |
||
48 | public function count() { |
||
51 | |||
52 | /** |
||
53 | * Returns an array with language codes as keys and the term text as values. |
||
54 | * |
||
55 | * @return string[] |
||
56 | */ |
||
57 | public function toTextArray() { |
||
66 | |||
67 | /** |
||
68 | * @see IteratorAggregate::getIterator |
||
69 | * @return Traversable|Term[] |
||
70 | */ |
||
71 | public function getIterator() { |
||
74 | |||
75 | /** |
||
76 | * @param string $languageCode |
||
77 | * |
||
78 | * @return Term |
||
79 | * @throws OutOfBoundsException |
||
80 | */ |
||
81 | public function getByLanguage( $languageCode ) { |
||
88 | |||
89 | /** |
||
90 | * @since 2.5 |
||
91 | * |
||
92 | * @param string[] $languageCodes |
||
93 | * |
||
94 | * @return self |
||
95 | */ |
||
96 | public function getWithLanguages( array $languageCodes ) { |
||
99 | |||
100 | /** |
||
101 | * @param string $languageCode |
||
102 | */ |
||
103 | public function removeByLanguage( $languageCode ) { |
||
106 | |||
107 | /** |
||
108 | * @param string $languageCode |
||
109 | * |
||
110 | * @return bool |
||
111 | */ |
||
112 | public function hasTermForLanguage( $languageCode ) { |
||
115 | |||
116 | /** |
||
117 | * Replaces non-empty or removes empty terms. |
||
118 | * |
||
119 | * @param Term $term |
||
120 | */ |
||
121 | public function setTerm( Term $term ) { |
||
129 | |||
130 | /** |
||
131 | * @since 0.8 |
||
132 | * |
||
133 | * @param string $languageCode |
||
134 | * @param string $termText |
||
135 | */ |
||
136 | public function setTextForLanguage( $languageCode, $termText ) { |
||
139 | |||
140 | /** |
||
141 | * @see Comparable::equals |
||
142 | * |
||
143 | * @since 0.7.4 |
||
144 | * |
||
145 | * @param mixed $target |
||
146 | * |
||
147 | * @return bool |
||
148 | */ |
||
149 | public function equals( $target ) { |
||
168 | |||
169 | /** |
||
170 | * @since 2.4.0 |
||
171 | * |
||
172 | * @return bool |
||
173 | */ |
||
174 | public function isEmpty() { |
||
177 | |||
178 | /** |
||
179 | * @since 0.7.4 |
||
180 | * |
||
181 | * @param Term $term |
||
182 | * |
||
183 | * @return boolean |
||
184 | */ |
||
185 | public function hasTerm( Term $term ) { |
||
189 | |||
190 | } |
||
191 |