WebhookProcessor   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Fenerum\Webhooks;
6
7
use Illuminate\Support\Str;
8
9
class WebhookProcessor
10
{
11
    /**
12
     * @param string $event
13
     * @param array $data
14
     * @return bool
15
     */
16
    public static function handle(string $event, array $data): bool
17
    {
18
        $class = 'Fenerum\\Webhooks\\Events\\'.Str::studly(str_replace('.', '_', $event));
19
        if (\class_exists($class)) {
20
            event(new $class($event, $data));
21
22
            return true;
23
        }
24
25
        return false;
26
    }
27
}
28