Passed
Push — master ( 760241...fb0d0f )
by Tom
02:42
created

StancyServiceProvider   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 5
eloc 13
c 4
b 0
f 1
dl 0
loc 34
ccs 14
cts 14
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A registerFeed() 0 3 1
A registerPage() 0 4 1
A register() 0 5 1
A registerSitemap() 0 3 1
A provides() 0 7 1
1
<?php
2
3
namespace Astrotomic\Stancy;
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 Astrotomic\Stancy\Contracts\SitemapFactory as SitemapFactoryContract;
9
use Astrotomic\Stancy\Factories\FeedFactory;
10
use Astrotomic\Stancy\Factories\PageFactory;
11
use Astrotomic\Stancy\Factories\SitemapFactory;
12
use Astrotomic\Stancy\Models\Page;
13
use Illuminate\Contracts\Support\DeferrableProvider;
14
use Illuminate\Support\ServiceProvider;
15
16
class StancyServiceProvider extends ServiceProvider implements DeferrableProvider
17
{
18 44
    public function register(): void
19
    {
20 44
        $this->registerPage();
21 44
        $this->registerFeed();
22 44
        $this->registerSitemap();
23 44
    }
24
25
    /** @codeCoverageIgnore */
26
    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...
27
    {
28
        return [
29
            PageFactoryContract::class,
30
            PageContract::class,
31
            FeedFactoryContract::class,
32
            SitemapFactoryContract::class,
33
        ];
34
    }
35
36 44
    protected function registerPage(): void
37
    {
38 44
        $this->app->singleton(PageFactoryContract::class, PageFactory::class);
39 44
        $this->app->bind(PageContract::class, Page::class);
40 44
    }
41
42 44
    protected function registerFeed(): void
43
    {
44 44
        $this->app->singleton(FeedFactoryContract::class, FeedFactory::class);
45 44
    }
46
47 44
    protected function registerSitemap(): void
48
    {
49 44
        $this->app->singleton(SitemapFactoryContract::class, SitemapFactory::class);
50 44
    }
51
}
52