Completed
Push — master ( 74c577...c1ce98 )
by Kirill
06:10
created

GitterClientServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 6
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 17 1
1
<?php
2
/**
3
 * This file is part of GitterBot package.
4
 *
5
 * @author Serafim <[email protected]>
6
 * @date 09.04.2016 3:09
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
namespace Core\Providers;
12
13
use Gitter\Client;
14
use Illuminate\Config\Repository;
15
use Illuminate\Container\Container;
16
use Illuminate\Support\ServiceProvider;
17
18
/**
19
 * Class GitterClientServiceProvider
20
 * @package Core\Providers
21
 */
22
class GitterClientServiceProvider extends ServiceProvider
23
{
24
    /**
25
     *
26
     */
27
    public function register()
28
    {
29
        /** @var Repository $config */
30
        $config = $this->app->make(Repository::class);
31
32
33
        $this->app->singleton(Client::class, function (Container $app) use ($config) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
34
            return new Client($config->get('gitter.token'));
35
        });
36
37
38
        $this->app->singleton('bot', function (Container $app) {
39
            /** @var Client $client */
40
            $client = $app->make(Client::class);
41
            return $client->http->getCurrentUser()->wait();
42
        });
43
    }
44
}