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

DissociateUserFromOrganization   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 15
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A performAction() 0 8 1
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/organization/license
6
 * @link       https://www.flipboxfactory.com/software/organization/
7
 */
8
9
namespace flipbox\organizations\actions\users;
10
11
use craft\elements\User;
12
use flipbox\organizations\elements\Organization;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 1.0.0
17
 */
18
class DissociateUserFromOrganization extends AbstractUserAssociation
19
{
20
    /**
21
     * @inheritdoc
22
     * @throws \Throwable
23
     */
24
    protected function performAction(User $user, Organization $organization, int $sortOrder = null): bool
25
    {
26
        $query = Organization::find();
27
        $query->setCachedResult([$organization]);
28
29
        /** @noinspection PhpUndefinedMethodInspection */
30
        return $user->dissociateOrganizations($query);
31
    }
32
}
33