WebhooksController::behaviors()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 0
cts 15
cp 0
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/force/license
6
 * @link       https://www.flipboxfactory.com/software/force/
7
 */
8
9
namespace flipbox\craft\salesforce\controllers;
10
11
use craft\helpers\ArrayHelper;
12
use flipbox\craft\ember\controllers\AbstractController;
13
use flipbox\craft\salesforce\actions\webhooks\Process;
14
use flipbox\craft\salesforce\filters\WebhookAuth;
15
16
/**
17
 * @author Flipbox Factory <[email protected]>
18
 * @since 1.2.0
19
 */
20
class WebhooksController extends AbstractController
21
{
22
23
    /**
24
     * @inheritdoc
25
     */
26
    protected $allowAnonymous = ['process'];
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public $enableCsrfValidation = false;
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function behaviors()
37
    {
38
        return ArrayHelper::merge(
39
            parent::behaviors(),
40
            [
41
                'authenticator' => [
42
                    'class' => WebhookAuth::class,
43
                    'except' => [
44
                        'options',
45
                        'head'
46
                    ]
47
                ]
48
            ]
49
        );
50
    }
51
52
    /**
53
     * @return array
54
     */
55
    public function actions()
56
    {
57
        return ArrayHelper::merge(
58
            parent::actions(),
59
            [
60
                'process' => [
61
                    'class' => Process::class
62
                ]
63
            ]
64
        );
65
    }
66
67
    /**
68
     * @inheritdoc
69
     */
70
    protected function verbs(): array
71
    {
72
        return array_merge(
73
            parent::verbs(),
74
            [
75
                'process' => ['POST', 'PATCH', 'PUT']
76
            ]
77
        );
78
    }
79
}
80