Passed
Push — master ( 9bd6cb...5aafeb )
by Karel
07:55
created

ChuckTemplateServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 0
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 2
rs 10
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() {
0 ignored issues
show
Bug introduced by
The method bind() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
        $this->app->/** @scrutinizer ignore-call */ 
28
                    bind('ChuckTemplate', function() {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
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
            return new \Chuckbe\Chuckcms\Chuck\Accessors\Template($template->slug);
33
        });
34
    }
35
}