Passed
Push — master ( f5217d...111314 )
by Tom
03:09
created

StancyServiceProvider   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
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 33
ccs 16
cts 16
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 5 1
A registerFeed() 0 3 1
A registerSitemap() 0 3 1
A provides() 0 7 1
A registerPage() 0 4 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 1
    public function provides(): array
0 ignored issues
show
introduced by Gummibeer
Method \Astrotomic\Stancy\StancyServiceProvider::provides() does not have @return annotation for its traversable return value.
Loading history...
26
    {
27
        return [
28 1
            PageFactoryContract::class,
29
            PageContract::class,
30
            FeedFactoryContract::class,
31
            SitemapFactoryContract::class,
32
        ];
33
    }
34
35 44
    protected function registerPage(): void
36
    {
37 44
        $this->app->singleton(PageFactoryContract::class, PageFactory::class);
38 44
        $this->app->bind(PageContract::class, Page::class);
39 44
    }
40
41 44
    protected function registerFeed(): void
42
    {
43 44
        $this->app->singleton(FeedFactoryContract::class, FeedFactory::class);
44 44
    }
45
46 44
    protected function registerSitemap(): void
47
    {
48 44
        $this->app->singleton(SitemapFactoryContract::class, SitemapFactory::class);
49 44
    }
50
}
51