Completed
Push — master ( 9c04b9...73f018 )
by Marcel
06:33
created

WebhookEventsController::all()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6666
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
namespace Mpociot\CaptainHook\Http;
4
5
use Illuminate\Http\Request;
6
use Laravel\Spark\Http\Controllers\Controller;
7
8
class WebhookEventsController extends Controller
9
{
10
11
    /**
12
     * Create a new controller instance.
13
     *
14
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
15
     */
16
    public function __construct()
17
    {
18
        $this->middleware('auth');
19
    }
20
21
    /**
22
     * Get all of the available webhook events.
23
     *
24
     * @return Response
25
     */
26
    public function all(Request $request)
27
    {
28
        return collect(config('captain_hook.listeners', []))->transform(function ($key, $value) {
29
            return [
30
                'name' => $value,
31
                'event' => $key
32
            ];
33
        })->values();
34
    }
35
}
36