Completed
Push — master ( 4ab497...db9007 )
by Freek
01:47
created

MailableTestServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
namespace Spatie\Tail;
4
5
use Illuminate\Support\ServiceProvider;
6
use Spatie\MailableTest\ArgumentValueProvider;
7
use Spatie\MailableTest\MailableFactory;
8
use Spatie\MailableTest\SendTestMail;
9
10
class MailableTestServiceProvider extends ServiceProvider
11
{
12
    public function boot()
13
    {
14
        $this->publishes([
15
            __DIR__ . '/config/laravel-mailable-test.php' => config_path('laravel-mailable-test.php'),
16
        ], 'config');
17
    }
18
19
    public function register()
20
    {
21
        $this->bind(MailableFactory::class, function() {
0 ignored issues
show
Bug introduced by
The method bind() does not seem to exist on object<Spatie\Tail\MailableTestServiceProvider>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
22
            $argumentValueProviderClass = config('laravel-mailable-test.argument_value_provider_class');
23
24
            $argumentValueProvider = app($argumentValueProviderClass);
25
26
            return new MailableFactory($argumentValueProvider);
27
        });
28
29
        $this->bind(ArgumentValueProvider::class, function() {
0 ignored issues
show
Bug introduced by
The method bind() does not seem to exist on object<Spatie\Tail\MailableTestServiceProvider>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
           $faker = \Faker\Factory::create();
31
32
           return new ArgumentValueProvider($faker);
33
        });
34
35
        $this->commands([
36
            SendTestMail::class,
37
        ]);
38
    }
39
40
    public function provides()
41
    {
42
        return ['command.mail.send.test'];
43
    }
44
}
45