LiberationServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 3 1
A boot() 0 2 1
A registerMacro() 0 5 1
1
<?php
2
3
namespace Liberation;
4
5
use Illuminate\Database\Query\Builder;
6
use Illuminate\Support\Facades\DB;
7
use Illuminate\Support\ServiceProvider;
8
9
class LiberationServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Register services.
13
     *
14
     * @return void
15
     */
16
    public function register()
17
    {
18
        $this->registerMacro();
19
    }
20
21
    /**
22
     * Bootstrap services.
23
     *
24
     * @return void
25
     */
26
    public function boot()
27
    {
28
        //
29
    }
30
31
    protected function registerMacro()
32
    {
33
        Builder::macro('sql', function ($name, $queryParams = [], $bladeParams = []) {
34
            $sql = Liberation::sql($name, $bladeParams);
0 ignored issues
show
Bug introduced by
The method sql() does not exist on Liberation\Liberation. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
            /** @scrutinizer ignore-call */ 
35
            $sql = Liberation::sql($name, $bladeParams);
Loading history...
35
            return Db::select($sql, $queryParams);
36
        });
37
    }
38
}
39