Completed
Push — master ( b27204...a2c64d )
by Nate
05:15 queued 02:48
created

SetUserTableAttributeHtml   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 19
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 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\events\SetElementTableAttributeHtmlEvent;
12
13
/**
14
 * @author Flipbox Factory <[email protected]>
15
 * @since 1.0.0
16
 */
17
class SetUserTableAttributeHtml
18
{
19
    /**
20
     * @param SetElementTableAttributeHtmlEvent $event
21
     * @throws \Twig_Error_Loader
22
     * @throws \yii\base\Exception
23
     */
24
    public static function handle(SetElementTableAttributeHtmlEvent $event)
25
    {
26
        if ($event->attribute === 'organizations') {
27
            $event->html = \Craft::$app->getView()->renderTemplate(
28
                'organizations/_components/tableAttributes/organizations',
29
                [
30
                    'organizations' => $event->sender->getOrganizations(['status' => null])->all()
31
                ]
32
            );
33
        }
34
    }
35
}
36