StancyServiceProvider   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 6
eloc 12
dl 0
loc 36
ccs 22
cts 22
cp 1
rs 10
c 4
b 0
f 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A registerFeed() 0 3 1
A registerSitemap() 0 3 1
A registerPage() 0 4 1
A register() 0 6 1
A boot() 0 4 1
A registerExporter() 0 3 1
1
<?php
2
3
namespace Astrotomic\Stancy;
4
5
use Astrotomic\Stancy\Commands\MakePageCommand;
6
use Astrotomic\Stancy\Contracts\ExportFactory as ExportFactoryContract;
7
use Astrotomic\Stancy\Contracts\FeedFactory as FeedFactoryContract;
8
use Astrotomic\Stancy\Contracts\Page as PageContract;
9
use Astrotomic\Stancy\Contracts\PageFactory as PageFactoryContract;
10
use Astrotomic\Stancy\Contracts\SitemapFactory as SitemapFactoryContract;
11
use Astrotomic\Stancy\Factories\ExportFactory;
12
use Astrotomic\Stancy\Factories\FeedFactory;
13
use Astrotomic\Stancy\Factories\PageFactory;
14
use Astrotomic\Stancy\Factories\SitemapFactory;
15
use Astrotomic\Stancy\Models\Page;
16
use Illuminate\Support\ServiceProvider;
17
18
class StancyServiceProvider extends ServiceProvider
19
{
20 58
    public function boot(): void
21
    {
22 58
        $this->commands([
23 58
            MakePageCommand::class,
24
        ]);
25 58
    }
26
27 58
    public function register(): void
28
    {
29 58
        $this->registerPage();
30 58
        $this->registerFeed();
31 58
        $this->registerSitemap();
32 58
        $this->registerExporter();
33 58
    }
34
35 58
    protected function registerPage(): void
36
    {
37 58
        $this->app->singleton(PageFactoryContract::class, PageFactory::class);
38 58
        $this->app->bind(PageContract::class, Page::class);
39 58
    }
40
41 58
    protected function registerFeed(): void
42
    {
43 58
        $this->app->singleton(FeedFactoryContract::class, FeedFactory::class);
44 58
    }
45
46 58
    protected function registerSitemap(): void
47
    {
48 58
        $this->app->singleton(SitemapFactoryContract::class, SitemapFactory::class);
49 58
    }
50
51 58
    protected function registerExporter(): void
52
    {
53 58
        $this->app->singleton(ExportFactoryContract::class, ExportFactory::class);
54 58
    }
55
}
56