AirtableServiceProvider::getDefaultTable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Tapp\Airtable;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class AirtableServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12
    public function boot()
13
    {
14
        if ($this->app->runningInConsole()) {
15
            $this->publishes([
16
                __DIR__.'/../config/config.php' => config_path('airtable.php'),
17
            ], 'config');
18
19
            // Registering package commands.
20
            // $this->commands([]);
21
        }
22
    }
23
24
    /**
25
     * Register the application services.
26
     */
27
    public function register()
28
    {
29
        // Automatically apply the package configuration
30
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'airtable');
31
32
        // Register the main class to use with the facade
33
        $this->app->singleton('airtable', function ($app) {
34
            return new AirtableManager($app);
35
        });
36
37
        // Register the main class to use with the facade
38
        $this->app->singleton('airtable.table', function () {
39
            return $this->app['airtable']->table($this->getDefaultTable());
40
        });
41
    }
42
43
    /**
44
     * Get the default file driver.
45
     *
46
     * @return string
47
     */
48
    protected function getDefaultTable()
49
    {
50
        return $this->app['config']['airtable.default'];
51
    }
52
}
53