Passed
Push — master ( ddfabf...6c2ee4 )
by Tom
03:14 queued 10s
created

StancyServiceProvider   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 6
eloc 16
c 4
b 0
f 1
dl 0
loc 41
ccs 18
cts 18
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
A registerFeed() 0 3 1
A registerSitemap() 0 3 1
A provides() 0 8 1
A registerPage() 0 4 1
A registerExporter() 0 3 1
1
<?php
2
3
namespace Astrotomic\Stancy;
4
5
use Astrotomic\Stancy\Contracts\ExportFactory as ExportFactoryContract;
6
use Astrotomic\Stancy\Contracts\FeedFactory as FeedFactoryContract;
7
use Astrotomic\Stancy\Contracts\Page as PageContract;
8
use Astrotomic\Stancy\Contracts\PageFactory as PageFactoryContract;
9
use Astrotomic\Stancy\Contracts\SitemapFactory as SitemapFactoryContract;
10
use Astrotomic\Stancy\Factories\ExportFactory;
11
use Astrotomic\Stancy\Factories\FeedFactory;
12
use Astrotomic\Stancy\Factories\PageFactory;
13
use Astrotomic\Stancy\Factories\SitemapFactory;
14
use Astrotomic\Stancy\Models\Page;
15
use Illuminate\Contracts\Support\DeferrableProvider;
16
use Illuminate\Support\ServiceProvider;
17
18
class StancyServiceProvider extends ServiceProvider implements DeferrableProvider
19
{
20 51
    public function register(): void
21
    {
22 51
        $this->registerPage();
23 51
        $this->registerFeed();
24 51
        $this->registerSitemap();
25 51
        $this->registerExporter();
26 51
    }
27
28
    /** @codeCoverageIgnore */
29
    public function provides(): array
0 ignored issues
show
introduced by
Method \Astrotomic\Stancy\StancyServiceProvider::provides() does not have @return annotation for its traversable return value.
Loading history...
introduced by
Method \Astrotomic\Stancy\StancyServiceProvider::provides() does not need documentation comment.
Loading history...
30
    {
31
        return [
32
            PageFactoryContract::class,
33
            PageContract::class,
34
            FeedFactoryContract::class,
35
            ExportFactoryContract::class,
36
            SitemapFactoryContract::class,
37
        ];
38
    }
39
40 51
    protected function registerPage(): void
41
    {
42 51
        $this->app->singleton(PageFactoryContract::class, PageFactory::class);
43 51
        $this->app->bind(PageContract::class, Page::class);
44 51
    }
45
46 51
    protected function registerFeed(): void
47
    {
48 51
        $this->app->singleton(FeedFactoryContract::class, FeedFactory::class);
49 51
    }
50
51 51
    protected function registerSitemap(): void
52
    {
53 51
        $this->app->singleton(SitemapFactoryContract::class, SitemapFactory::class);
54 51
    }
55
56 51
    protected function registerExporter(): void
57
    {
58 51
        $this->app->singleton(ExportFactoryContract::class, ExportFactory::class);
59 51
    }
60
}
61