SetUserTableAttributeHtml   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
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 20
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\LoaderError
22
     * @throws \Twig\Error\RuntimeError
23
     * @throws \Twig\Error\SyntaxError
24
     */
25
    public static function handle(SetElementTableAttributeHtmlEvent $event)
26
    {
27
        if ($event->attribute === 'organizations') {
28
            $event->html = \Craft::$app->getView()->renderTemplate(
29
                'organizations/_components/tableAttributes/organizations',
30
                [
31
                    'organizations' => $event->sender->getOrganizations()
32
                ]
33
            );
34
        }
35
    }
36
}
37