| Total Complexity | 7 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Collection extends \ArrayIterator |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var array |
||
| 15 | */ |
||
| 16 | private $elementHashes = []; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Needs to be called due to an extbase bug. |
||
| 20 | * Hides optional parameters of parent constructor. |
||
| 21 | */ |
||
| 22 | 14 | public function __construct() |
|
| 23 | { |
||
| 24 | 14 | parent::__construct(); |
|
| 25 | 14 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * @param \Aoe\Asdis\Domain\Model\Asset $asset |
||
| 29 | */ |
||
| 30 | 8 | public function append($asset) |
|
| 31 | { |
||
| 32 | 8 | $elementHash = $asset->getHash(); |
|
| 33 | 8 | if (in_array($elementHash, $this->elementHashes)) { |
|
| 34 | 1 | return; |
|
| 35 | } |
||
| 36 | 8 | $this->elementHashes[] = $elementHash; |
|
| 37 | 8 | parent::append($asset); |
|
| 38 | 8 | } |
|
| 39 | |||
| 40 | /** |
||
| 41 | * @param \Aoe\Asdis\Domain\Model\Asset\Collection $assetCollection |
||
| 42 | * @return \Aoe\Asdis\Domain\Model\Asset\Collection |
||
| 43 | */ |
||
| 44 | 7 | public function merge(AssetCollection $assetCollection) { |
|
| 45 | 7 | foreach($assetCollection as $asset) { |
|
| 46 | 1 | $this->append($asset); |
|
| 47 | } |
||
| 48 | 7 | return $this; |
|
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return \Aoe\Asdis\Content\Replacement\Map |
||
| 53 | */ |
||
| 54 | 1 | public function getReplacementMap() { |
|
| 64 | } |
||
| 65 | } |