RegisterOrganizationUserElementActions::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 0
cts 13
cp 0
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/patron/license
6
 * @link       https://www.flipboxfactory.com/software/patron/
7
 */
8
9
namespace flipbox\organizations\events\handlers;
10
11
use Craft;
12
use craft\events\RegisterElementActionsEvent;
13
use flipbox\organizations\elements\actions\DissociateUsersFromOrganizationAction;
14
use flipbox\organizations\elements\actions\EditUserAssociation;
15
16
/**
17
 * @author Flipbox Factory <[email protected]>
18
 * @since 1.0.0
19
 */
20
class RegisterOrganizationUserElementActions
21
{
22
    /**
23
     * @param RegisterElementActionsEvent $event
24
     */
25
    public static function handle(RegisterElementActionsEvent $event)
26
    {
27
        $event->actions = [
28
            [
29
                'type' => DissociateUsersFromOrganizationAction::class,
30
                'organization' => Craft::$app->getRequest()->getParam('organization')
31
            ],
32
            [
33
                'type' => EditUserAssociation::class,
34
                'organization' => Craft::$app->getRequest()->getParam('organization')
35
            ],
36
        ];
37
    }
38
}
39