BlueprintMacroServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 15
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace CleaniqueCoders\Blueprint\Macro;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class BlueprintMacroServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12
    public function boot()
13
    {
14
        collect(glob(__DIR__.'/Database/Schema/macros/*.php'))
0 ignored issues
show
Bug introduced by
glob(__DIR__ . '/Database/Schema/macros/*.php') of type array is incompatible with the type Illuminate\Contracts\Support\Arrayable expected by parameter $value of collect(). ( Ignorable by Annotation )

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

14
        collect(/** @scrutinizer ignore-type */ glob(__DIR__.'/Database/Schema/macros/*.php'))
Loading history...
15
            ->each(function ($path) {
16
                require $path;
17
            });
18
19
        /* A little hack to have Builder::hasMacro */
20
        \Illuminate\Database\Eloquent\Builder::macro('hasMacro', function ($name) {
21
            return isset(static::$macros[$name]);
0 ignored issues
show
Bug Best Practice introduced by
The property macros does not exist on CleaniqueCoders\Blueprin...intMacroServiceProvider. Did you maybe forget to declare it?
Loading history...
22
        });
23
24
        collect(glob(__DIR__.'/Models/macros/*.php'))
25
            ->each(function ($path) {
26
                require $path;
27
            });
28
    }
29
30
    /**
31
     * Register the application services.
32
     */
33
    public function register()
34
    {
35
    }
36
}
37