Completed
Push — master ( b42419...6b3685 )
by Tom
06:30
created

src/Factories/FeedFactory.php (2 issues)

Severity
1
<?php
2
3
namespace Astrotomic\Stancy\Factories;
4
5
use Astrotomic\Stancy\Contracts\FeedFactory as FeedFactoryContract;
6
use Astrotomic\Stancy\Contracts\Page as PageContract;
7
use Astrotomic\Stancy\Contracts\PageFactory as PageFactoryContract;
8
use Spatie\Sheets\Facades\Sheets;
9
use Spatie\Sheets\Repository as SheetRepository;
10
use Spatie\Sheets\Sheet;
11
12
class FeedFactory implements FeedFactoryContract
13
{
14
    /** @var PageFactoryContract */
15
    protected $pageFactory;
16
17 4
    public function __construct(PageFactoryContract $pageFactory)
18
    {
19 4
        $this->pageFactory = $pageFactory;
20 4
    }
21
22 2
    public function makeFromSheetCollectionName(string $name): array
0 ignored issues
show
Method \Astrotomic\Stancy\Factories\FeedFactory::makeFromSheetCollectionName() does not have @return annotation for its traversable return value.
Loading history...
23
    {
24 2
        $collection = Sheets::collection($name);
25
26 2
        return $this->makeFromSheetCollection($collection);
27
    }
28
29 2
    protected function makeFromSheetCollection(SheetRepository $collection): array
0 ignored issues
show
Method \Astrotomic\Stancy\Factories\FeedFactory::makeFromSheetCollection() does not have @return annotation for its traversable return value.
Loading history...
30
    {
31
        return $collection->all()->map(function (Sheet $sheet): PageContract {
32 2
            return $this->pageFactory->makeFromSheet($sheet);
33 2
        })->all();
34
    }
35
}
36