ChuckSiteServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 4
Bugs 2 Features 0
Metric Value
eloc 6
c 4
b 2
f 0
dl 0
loc 26
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 2 1
A register() 0 9 2
1
<?php
2
3
namespace Chuckbe\Chuckcms\Providers;
4
5
use Chuckbe\Chuckcms\Chuck\ModuleRepository;
6
use Chuckbe\Chuckcms\Chuck\SiteRepository;
7
use Chuckbe\Chuckcms\Models\Site;
8
use Exception;
9
use Illuminate\Support\ServiceProvider;
10
11
class ChuckSiteServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Bootstrap the application services.
15
     *
16
     * @return void
17
     */
18
    public function boot()
19
    {
20
        //
21
    }
22
23
    /**
24
     * Register the application services.
25
     *
26
     * @return void
27
     */
28
    public function register()
29
    {
30
        $this->app->singleton('ChuckSite', function () {
31
            $site = Site::first();
32
            if ($site == null) {
33
                throw new Exception('Whoops! No Site Defined...');
34
            }
35
36
            return new \Chuckbe\Chuckcms\Chuck\Accessors\Site($site, \App::make(SiteRepository::class), \App::make(ModuleRepository::class));
37
        });
38
    }
39
}
40