HoneypotServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 22 2
A register() 0 4 1
1
<?php
2
3
namespace Spatie\Honeypot;
4
5
use Illuminate\Support\Facades\Blade;
6
use Illuminate\Support\Facades\View;
7
use Illuminate\Support\ServiceProvider;
8
use Spatie\Honeypot\SpamResponder\SpamResponder;
9
10
class HoneypotServiceProvider extends ServiceProvider
11
{
12
    public function boot()
13
    {
14
        if ($this->app->runningInConsole()) {
15
            $this->publishes([
16
                __DIR__.'/../config/honeypot.php' => config_path('honeypot.php'),
17
            ], 'config');
18
19
            $this->publishes([
20
                __DIR__.'/../resources/views' => base_path('resources/views/vendor/honeypot'),
21
            ], 'views');
22
        }
23
24
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'honeypot');
25
26
        View::composer('honeypot::honeypotFormFields', HoneypotViewComposer::class);
27
28
        Blade::directive('honeypot', function () {
29
            return "<?php echo view('honeypot::honeypotFormFields'); ?>";
30
        });
31
32
        $this->app->bind(SpamResponder::class, config('honeypot.respond_to_spam_with'));
33
    }
34
35
    public function register()
36
    {
37
        $this->mergeConfigFrom(__DIR__.'/../config/honeypot.php', 'honeypot');
38
    }
39
}
40