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 |
|
|
|
|
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
|
|
|
|