Skip to content

Commit

Permalink
Multiple artists in MusicRecording
Browse files Browse the repository at this point in the history
  • Loading branch information
nokimaro authored Jun 15, 2017
1 parent 363e11f commit 42336c9
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/ContextTypes/MusicAbstractContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,26 @@ protected function setGenreAttribute($items)
/**
* Set artist attribute
*
* @param array|string $item
* @param array|string $items
* @return array
*/
protected function setByArtistAttribute($item)
protected function setByArtistAttribute($items)
{
if ( ! is_array($item))
if ( ! is_array($items))
{
return $item;
return $items;
}

return $this->getNestedContext(MusicGroup::class, $item);
//Check if not multidimensional array (for backward compatibility)
if((count($items) == count($items, COUNT_RECURSIVE)))
{
return $this->getNestedContext(MusicGroup::class, $items);
}

//multiple artists
return array_map(function ($item) {
return $this->getNestedContext(MusicGroup::class, $item);
}, $items);
}

/**
Expand Down

0 comments on commit 42336c9

Please sign in to comment.