Completed
Push — master ( 8f37b5...6bb7e3 )
by Craig
01:42
created

PostmarkServiceProvider::guzzle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Coconuts\Mail;
4
5
use GuzzleHttp\Client as HttpClient;
6
use Illuminate\Support\ServiceProvider;
7
8
class PostmarkServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Boot the service provider.
12
     *
13
     * @return void
14
     */
15 30
    public function boot()
16
    {
17 30
        $this->publishes([
18 30
            __DIR__ . '/../config/postmark.php' => config_path('postmark.php')
19 30
        ], 'config');
20
21 30
        if ($this->app['config']['mail.driver'] !== 'postmark') {
22
            return;
23
        }
24
25 30
        $this->mergeConfigFrom(__DIR__ . '/../config/postmark.php', 'postmark');
26
27
        $this->app['swift.transport']->extend('postmark', function () {
28 30
            return new PostmarkTransport(
29 30
                $this->guzzle(config('postmark.guzzle', [])),
30 30
                config('postmark.secret', config('services.postmark.secret'))
31
            );
32 30
        });
33 30
    }
34
35
    /**
36
     * Get a fresh Guzzle HTTP client instance.
37
     *
38
     * @param array $config
39
     *
40
     * @return \GuzzleHttp\Client
41
     */
42 30
    protected function guzzle($config)
43
    {
44 30
        return new HttpClient($config);
45
    }
46
}
47