Collection
Where a list of "items" have to be returned a
Brotkrueml\
object comes into the
game:
- List of authors of a feed or an item (
Collection<Author
)Interface> - List of attachments of an item (
Collection<Attachment
)Interface> - List of categories of a feed (
Collection<Category
)Interface> - List of items of a feed (
Collection<Item
)Interface>
A collection can be used like this:
// use Brotkrueml\\FeedGenerator\\Collection\\Collection
// use Brotkrueml\\FeedGenerator\\Contract\\AuthorInterface
/**
* @var Collection<AuthorInterface> $authorCollection
*/
$authorCollection = new Collection();
$authorCollection->add($author1);
// Also multiple authors can be added at once
$authorCollection->add($author2, $author3);
// ... same for the other items ...
Copied!