add ExtractTune use case

This commit is contained in:
2018-04-30 17:24:02 -04:00
parent 3817394951
commit e8c8709976
42 changed files with 1388 additions and 5047 deletions

View File

@@ -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));
}
}