PostmarkServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 39
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A guzzle() 0 4 1
A boot() 0 19 2
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 31
    public function boot()
16
    {
17 31
        $this->publishes([
18 31
            __DIR__.'/../config/postmark.php' => config_path('postmark.php'),
19 31
        ], 'config');
20
21 31
        if ($this->app['config']['mail.driver'] !== 'postmark') {
22 1
            return;
23
        }
24
25 30
        $this->mergeConfigFrom(__DIR__.'/../config/postmark.php', 'postmark');
26
27 30
        $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