Completed
Push — master ( 1b3dfc...3e655f )
by Elf
05:19 queued 02:52
created

ApiServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.0156

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 3
cts 4
cp 0.75
crap 1.0156
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Contracts\Routing\ResponseFactory;
6
use Illuminate\Support\ServiceProvider;
7
use App\Http\ApiResponse;
8
9
class ApiServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the service provider.
13
     *
14
     * @param  \Illuminate\Contracts\Routing\ResponseFactory  $response
15
     * @return void
16
     */
17
    public function boot(ResponseFactory $response)
18
    {
19 1
        $response->macro('api', function ($data = null, $code = null, $headers = [], $options = 0) {
20
            return new ApiResponse($data, $code, $headers, $options);
21 1
        });
22 1
    }
23
}
24