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

LakerServiceProvider::setUpBitbucketIssueTracker()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 15
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
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