PostcodesServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 22
ccs 13
cts 13
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 20 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JustSteveKing\LaravelPostcodes;
6
7
use GuzzleHttp\Client;
8
use Illuminate\Validation\Rule;
9
use Illuminate\Support\ServiceProvider;
10
use JustSteveKing\LaravelPostcodes\Rules\Postcode;
11
use JustSteveKing\LaravelPostcodes\Service\PostcodeService;
12
13 66
class PostcodesServiceProvider extends ServiceProvider
14
{
15 66
    public function register()
16 66
    {
17 66
        $this->mergeConfigFrom(
18
            __DIR__ . '/../config/services.php',
19
            'services'
20 66
        );
21 66
22 66
        $this->mergeConfigFrom(
23
            __DIR__ . '/../config/postcodes.php',
24
            'postcodes'
25
        );
26 3
27 3
        $this->app->bind(PostcodeService::class, function () {
28
            return new PostcodeService(
29 66
                new Client()
30
            );
31
        });
32 3
33 66
        Rule::macro('postcode', function () {
34 66
            return new Postcode(resolve(PostcodeService::class));
35
        });
36 66
    }
37
}
38