AbstractWebhook::getWebhook()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 11
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
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