ApiServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 10
Bugs 1 Features 2
Metric Value
wmc 3
c 10
b 1
f 2
lcom 1
cbo 2
dl 0
loc 45
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 1
A register() 0 12 1
A provides() 0 4 1
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