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

PrepareUserQuery::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 7
cp 0
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
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
     */
24
    public static function handle(CancelableEvent $event)
25
    {
26
        /** @var UserQuery $query */
27
        $query = $event->sender;
28
29
        /** @var OrganizationAttributesToUserQueryBehavior $behavior */
30
        if (null !== ($behavior = $query->getBehavior('organization'))) {
31
            $behavior->applyOrganizationParams($query);
32
        }
33
    }
34
}
35