AbstractWebhook   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 18
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getWebhook() 0 11 2
1
<?php
2
3
namespace dokuwiki\plugin\swarmwebhook\webhooks;
4
5
abstract class AbstractWebhook
6
{
7
    abstract public function run($json);
8
9
    /**
10
     * @return AbstractWebhook
11
     */
12
    public static function getWebhook()
13
    {
14
        global $INPUT;
15
16
        if ($INPUT->server->str('HTTP_USER_AGENT') === 'Zapier') {
17
            return new Zapier();
18
        }
19
20
        // TODO: we currently have no positive key for IFTTT. Find one.
21
        // That would be better than just having it as default.
22
        return new IFTTT();
23
    }
24
}
25