Completed
Push — master ( 170568...94cd06 )
by Craig
03:13
created

PostmarkServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 34
ccs 13
cts 13
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 11 1
A guzzle() 0 8 1
1
<?php
2
3
namespace Coconuts\Mail;
4
5
use GuzzleHttp\Client as HttpClient;
6
use Illuminate\Support\Arr;
7
use Illuminate\Support\ServiceProvider;
8
9
class PostmarkServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap any application services.
13
     *
14
     * @return void
15
     */
16 5
    public function boot()
17
    {
18 5
        $config = $this->app['config']->get('services.postmark', []);
19
20 5
        $this->app['swift.transport']->extend('postmark', function () use ($config) {
21 1
            return new PostmarkTransport(
22 1
                $this->guzzle($config),
23 1
                $config['secret']
24
            );
25 5
        });
26 5
    }
27
28
    /**
29
     * Get a fresh Guzzle HTTP client instance.
30
     *
31
     * @param  array  $config
32
     * @return \GuzzleHttp\Client
33
     */
34 1
    protected function guzzle($config)
35
    {
36 1
        return new HttpClient(array_add(
37 1
            array_get($config, 'guzzle', []),
38 1
            'connect_timeout',
39 1
            60
40
        ));
41
    }
42
}
43