Files
abcParser/src/Domain/Core/TuneCollection.php
richard 2cdf7dd1cf
Some checks failed
abc-api/abcParser/pipeline/head There was a failure building this commit
update webpatser/laravel-uuid to version 3
2020-06-20 12:36:34 -04:00

33 lines
726 B
PHP
Executable File

<?php
namespace XaiCorp\AbcParser\Domain\Core;
class TuneCollection extends Collection
{
/**
* Get the value of the first element in this collection.
*
* @throws \Enzyme\Collection\CollectionException If the collection is empty.
*
* @return \XaiCorp\AbcParser\Domain\Core\Tune
*/
public function first()
{
return parent::first();
}
public function unique()
{
$result = [];
/**
* @var int $key
* @var Tune $tune
*/
foreach ($this->items as $key => $tune) {
$tuneId = $tune->getETag();
$result[$tuneId] = $tune;
}
return new TuneCollection(array_values($result));
}
}