QueryBuilderServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
A boot() 0 10 3
A provides() 0 8 1
1
<?php
2
3
namespace Spatie\QueryBuilder;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class QueryBuilderServiceProvider extends ServiceProvider
8
{
9
    public function boot()
10
    {
11
        if ($this->app->runningInConsole() && function_exists('config_path')) {
12
            $this->publishes([
13
                __DIR__.'/../config/query-builder.php' => config_path('query-builder.php'),
14
            ], 'config');
15
        }
16
17
        $this->mergeConfigFrom(__DIR__.'/../config/query-builder.php', 'query-builder');
18
    }
19
20
    public function register()
21
    {
22
        $this->app->bind(QueryBuilderRequest::class, function ($app) {
23
            return QueryBuilderRequest::fromRequest($app['request']);
24
        });
25
    }
26
27
    public function provides()
28
    {
29
        // TODO: implement DeferrableProvider when Laravel 5.7 support is dropped.
30
31
        return [
32
            QueryBuilderRequest::class,
33
        ];
34
    }
35
}
36