Completed
Push — master ( 42105c...ac8bed )
by Lucas Pires
02:12
created

LakerServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 8 1
A register() 0 4 1
A setUpBitbucketIssueTracker() 0 15 1
1
<?php
2
3
namespace FlyingLuscas\Laker;
4
5
use Bitbucket\API\Repositories\Issues;
6
use Bitbucket\API\Authentication\Basic;
7
use Illuminate\Support\ServiceProvider;
8
9
class LakerServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Perform post-registration booting of services.
13
     *
14
     * @return void
15
     */
16
    public function boot()
17
    {
18
        $this->mergeConfigFrom(__DIR__.'/config.php', 'laker');
19
20
        $this->publishes([
21
            __DIR__.'/config.php' => config_path('laker.php'),
22
        ]);
23
    }
24
25
    /**
26
     * Register bindings in the container.
27
     *
28
     * @return void
29
     */
30
    public function register()
31
    {
32
        $this->setUpBitbucketIssueTracker();
33
    }
34
35
    /**
36
     * Set up the Bitbucket issue tracker service.
37
     *
38
     * @return void
39
     */
40
    private function setUpBitbucketIssueTracker()
41
    {
42
        $this->app->singleton('BitbucketIssuesTracker', function () {
43
            $issues = new Issues;
44
45
            $username = config('laker.auth.username');
46
            $password = config('laker.auth.password');
47
48
            $basicAuth = new Basic($username, $password);
49
50
            $issues->setCredentials($basicAuth);
51
52
            return $issues;
53
        });
54
    }
55
}
56