1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral\Data;
14:
15: /**
16: * This class is the base implementation for LanguageInformationCollectionInterface.
17: *
18: * @package DcGeneral\Data
19: */
20: class DefaultLanguageInformationCollection
21: implements LanguageInformationCollectionInterface
22: {
23: /**
24: * The language information stored in this collection.
25: *
26: * @var LanguageInformationInterface[]
27: */
28: protected $languages = array();
29:
30: /**
31: * {@inheritDoc}
32: */
33: public function add(LanguageInformationInterface $language)
34: {
35: $this->languages[] = $language;
36:
37: return $this;
38: }
39:
40: /**
41: * Get a iterator for this collection.
42: *
43: * @return \IteratorAggregate
44: */
45: public function getIterator()
46: {
47: return new \ArrayIterator($this->languages);
48: }
49:
50: /**
51: * Count the contained language information.
52: *
53: * @return int
54: */
55: public function count()
56: {
57: return count($this->languages);
58: }
59: }
60: