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

WebhookEventsController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A all() 0 9 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