Completed
Push — master ( d683f2...a4cc9e )
by Tom
03:19
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\PageFactory as PageFactoryContract;
7
use Spatie\Sheets\Facades\Sheets;
8
use Spatie\Sheets\Repository as SheetRepository;
9
use Spatie\Sheets\Sheet;
10
11
class FeedFactory implements FeedFactoryContract
12
{
13
    /** @var PageFactoryContract */
14
    protected $pageFactory;
15
16 3
    public function __construct(PageFactoryContract $pageFactory)
17
    {
18 3
        $this->pageFactory = $pageFactory;
19 3
    }
20
21 1
    public 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...
22
    {
23
        return $collection->all()->map(function(Sheet $sheet) {
0 ignored issues
show
introduced by
You should change the following
<fg=red>- return $collection->all()->map(function(Sheet $sheet) {
</><fg=green>+ return $collection->all()->map(function (Sheet $sheet) {
</>
Loading history...
24 1
            return $this->pageFactory->makeFromSheet($sheet);
25 1
        })->all();
26
    }
27
28 1
    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...
29
    {
30 1
        $collection = Sheets::collection($name);
31
32 1
        return $this->makeFromSheetCollection($collection);
33
    }
34
}
35