Completed
Push — master ( 274f2b...afd0d4 )
by Freek
01:50
created

FractalServiceProvider::setDefaultSerializer()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\Fractal;
4
5
use Illuminate\Support\ServiceProvider;
6
use League\Fractal\Serializer\SerializerAbstract;
7
use Spatie\Fractal\Console\Commands\TransformerMakeCommand;
8
9
class FractalServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     */
14
    public function boot()
15
    {
16
        $this->publishes([
17
            __DIR__.'/../resources/config/laravel-fractal.php' => config_path('laravel-fractal.php'),
18
        ], 'config');
19
20
        if ($this->app->runningInConsole()) {
21
            $this->commands([
22
                TransformerMakeCommand::class,
23
            ]);
24
        }
25
    }
26
27
    /**
28
     * Register the application services.
29
     */
30
    public function register()
31
    {
32
        $this->mergeConfigFrom(__DIR__.'/../resources/config/laravel-fractal.php', 'laravel-fractal');
33
34
        $this->app->bind('laravel-fractal', function (...$arguments) {
35
            return fractal(...$arguments);
36
        });
37
    }
38
}
39