ApiServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Vinelab\Api;
4
5
/*
6
 * @author Mahmoud Zalt <[email protected]>
7
 * @author Abed Halawi <[email protected]>
8
 */
9
10
use Illuminate\Support\ServiceProvider;
11
12
class ApiServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Indicates if loading of the provider is deferred.
16
     *
17
     * @var bool
18
     */
19
    protected $defer = false;
20
21
    /**
22
     * Bootstrap the application events.
23
     */
24
    public function boot()
25
    {
26
        $this->publishes([
27
            __DIR__.'/../../config/api.php' => config_path('api.php'),
28
        ]);
29
    }
30
31
    /**
32
     * Register the service provider.
33
     */
34
    public function register()
35
    {
36
        // Register the 'Api' class using the container so that we can resolve it accordingly.
37
        $this->app['vinelab.api'] = $this->app->share(function () {
0 ignored issues
show
Bug introduced by
The method share() does not seem to exist on object<Illuminate\Contra...Foundation\Application>.

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...
38
            return $this->app->make('Vinelab\Api\Api');
39
        });
40
        // Shortcut so developers don't need to add an alias in app/config/app.php
41
        $this->app->booting(function () {
42
            $loader = \Illuminate\Foundation\AliasLoader::getInstance();
43
            $loader->alias('Api', 'Vinelab\Api\ApiFacadeAccessor');
44
        });
45
    }
46
47
    /**
48
     * Get the services provided by the provider.
49
     *
50
     * @return array
51
     */
52
    public function provides()
53
    {
54
        return array('vinelab.api');
55
    }
56
}
57