Completed
Push — master ( f031a6...a6ed1e )
by Elf
03:15
created

ServiceProvider::isLumen()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 0
cp 0
crap 2
rs 10
1
<?php
2
3
namespace ElfSundae\BearyChat\Laravel;
4
5
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
6
7
class ServiceProvider extends LaravelServiceProvider
8
{
9
    /**
10
     * Indicates if loading of the provider is deferred.
11
     *
12
     * @var bool
13
     */
14
    protected $defer = true;
15
16
    /**
17
     * Register the service provider.
18
     *
19
     * @return void
20
     */
21 5
    public function register()
22
    {
23 5
        $this->mergeConfigFrom($from = __DIR__.'/../config/bearychat.php', 'bearychat');
24
25 5
        if ($this->app->runningInConsole()) {
26 5
            $to = (function_exists('config_path')) ? config_path('bearychat.php') : base_path('config/bearychat.php');
27 5
            $this->publishes([$from => $to], 'bearychat');
28
        }
29
30 5
        $this->app->singleton('bearychat', function ($app) {
31 5
            return (new ClientManager)
32 5
                ->setDefaultName($app['config']->get('bearychat.default'))
33 5
                ->setClientsDefaults($app['config']->get('bearychat.clients_defaults'))
34 5
                ->setClientsConfig($app['config']->get('bearychat.clients'));
35 5
        });
36
37 5
        $this->app->alias('bearychat', ClientManager::class);
38 5
    }
39
40
    /**
41
     * Get the services provided by the provider.
42
     *
43
     * @return string[]
44
     */
45 1
    public function provides()
46
    {
47 1
        return ['bearychat', ClientManager::class];
48
    }
49
}
50