ChuckTemplateServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
eloc 6
c 2
b 1
f 1
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\Models\Template as TemplateModel;
6
use Illuminate\Support\ServiceProvider;
7
8
class ChuckTemplateServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        //
18
    }
19
20
    /**
21
     * Register the application services.
22
     *
23
     * @return void
24
     */
25
    public function register()
26
    {
27
        $this->app->bind('ChuckTemplate', function () {
28
            $template = TemplateModel::first();
29
            if ($template == null) {
30
                throw new Exception('Whoops! No Template Defined...');
0 ignored issues
show
Bug introduced by
The type Chuckbe\Chuckcms\Providers\Exception was not found. Did you mean Exception? If so, make sure to prefix the type with \.
Loading history...
31
            }
32
33
            return new \Chuckbe\Chuckcms\Chuck\Accessors\Template($template->slug);
34
        });
35
    }
36
}
37