ActionEventTrait::getActionOfEvent()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 12
c 0
b 0
f 0
rs 10
cc 2
nc 2
nop 1
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