lyal /
checkr
| 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
Bug
introduced
by
Loading history...
|
|||
| 22 | } else { |
||
| 23 | throw new UnhandledCheckrWebhook($this->event); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | public function getEventHandler() |
||
| 28 | { |
||
| 29 | } |
||
| 30 | } |
||
| 31 |