RecaptchaServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 18 2
A register() 0 10 1
1
<?php
2
3
namespace Guiliredu\LaravelSimpleRecaptcha;
4
5
use Illuminate\Support\Facades\Validator;
6
use Illuminate\Support\ServiceProvider;
7
8
class RecaptchaServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        // Translations
16
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'recaptcha');
17
18
        // Views
19
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'recaptcha');
20
21
        // Configuration
22
        if ($this->app->runningInConsole()) {
23
            $this->publishes([
24
                __DIR__.'/../config/config.php' => config_path('recaptcha.php'),
25
            ], 'config');
26
        }
27
28
        // Custom Validator
29
        Validator::extend('recaptcha', 'Guiliredu\LaravelSimpleRecaptcha\RecaptchaValidator@validate');
30
    }
31
32
    /**
33
     * Register the application services.
34
     */
35
    public function register()
36
    {
37
        // Automatically apply the package configuration
38
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'recaptcha');
39
40
        // Register the main class to use with the facade
41
        $this->app->singleton('recaptcha', function () {
42
            return new Recaptcha;
43
        });
44
    }
45
}
46