Test Failed
Pull Request — master (#33)
by
unknown
03:56
created

FeedFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
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 2
    public function __construct(PageFactoryContract $pageFactory)
18
    {
19 2
        $this->pageFactory = $pageFactory;
20 2
    }
21
22
    public function makeFromSheetCollectionName(string $name): array
0 ignored issues
show
introduced by
Method \Astrotomic\Stancy\Factories\FeedFactory::makeFromSheetCollectionName() does not have @return annotation for its traversable return value.
Loading history...
23
    {
24
        $collection = Sheets::collection($name);
25
26
        return $this->makeFromSheetCollection($collection);
27
    }
28
29
    protected function makeFromSheetCollection(SheetRepository $collection): array
0 ignored issues
show
introduced by
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
            return $this->pageFactory->makeFromSheet($sheet);
33
        })->all();
34
    }
35
}
36