ActionEventTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 14
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getActionOfEvent() 0 12 2
1
<?php
2
3
namespace CSlant\TelegramGitNotifier\Trait;
4
5
trait ActionEventTrait
6
{
7
    public function getActionOfEvent(object $payload): string
8
    {
9
        $action = $payload->action
10
            ?? $payload->object_attributes?->action
11
            ?? $payload->object_attributes?->noteable_type
12
            ?? '';
13
14
        if (!empty($action)) {
15
            return tgn_convert_action_name($action);
16
        }
17
18
        return '';
19
    }
20
}
21