Issues (14)

src/Laravel/Helpers/EventHelper.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Lyal\Checkr\Laravel\Helpers;
4
5
use Illuminate\Support\Str;
6
use Lyal\Checkr\Exceptions\UnhandledCheckrWebhook;
7
8
class EventHelper
9
{
10
    private $event;
11
12
    public function __construct($event)
13
    {
14
        $this->event = $event;
15
    }
16
17
    public function dispatch()
18
    {
19
        $className = '\\Lyal\\Checkr\\Laravel\\Events\\'.Str::studly(str_replace('.', '-', $this->event['type']));
20
        if (class_exists($className)) {
21
            event(new $className($this->event));
0 ignored issues
show
The function event was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
            /** @scrutinizer ignore-call */ 
22
            event(new $className($this->event));
Loading history...
22
        } else {
23
            throw new UnhandledCheckrWebhook($this->event);
24
        }
25
    }
26
27
    public function getEventHandler()
28
    {
29
    }
30
}
31