PrepareUserQuery   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
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 17
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 10 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\elements\db\UserQuery;
12
use craft\events\CancelableEvent;
13
use flipbox\organizations\queries\OrganizationAttributesToUserQueryBehavior;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 */
19
class PrepareUserQuery
20
{
21
    /**
22
     * @param CancelableEvent $event
23
     * @throws \craft\db\QueryAbortedException
24
     */
25
    public static function handle(CancelableEvent $event)
26
    {
27
        /** @var UserQuery $query */
28
        $query = $event->sender;
29
30
        /** @var OrganizationAttributesToUserQueryBehavior $behavior */
31
        if (null !== ($behavior = $query->getBehavior('organization'))) {
32
            $behavior->applyOrganizationParams($query);
33
        }
34
    }
35
}
36