add ExtractTune use case
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
namespace XaiCorp\AbcParser\Domain\Core;
|
||||
|
||||
use Enzyme\Collection\Collection;
|
||||
|
||||
class TuneCollection extends Collection
|
||||
{
|
||||
/**
|
||||
@@ -16,4 +14,19 @@ class TuneCollection extends Collection
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user