Completed
Push — develop ( 009567...fb0a26 )
by Nate
08:31
created

EnableConnection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 23
c 0
b 0
f 0
ccs 0
cts 9
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 4 1
A performAction() 0 5 1
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipboxfactory/craft-integration/blob/master/LICENSE
6
 * @link       https://github.com/flipboxfactory/craft-integration/
7
 */
8
9
namespace flipbox\craft\integration\actions\connections;
10
11
use flipbox\craft\ember\actions\records\LookupRecordTrait;
12
use flipbox\craft\ember\actions\records\ManageRecordTrait;
13
use flipbox\craft\integration\records\IntegrationConnection;
14
use yii\base\Action;
15
16
/**
17
 * @author Flipbox Factory <[email protected]>
18
 * @since 2.0.0
19
 */
20
abstract class EnableConnection extends Action
21
{
22
    use ManageRecordTrait, LookupRecordTrait {
23
        run as traitRun;
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function run($connection)
30
    {
31
        return $this->traitRun($connection);
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    protected function performAction(IntegrationConnection $record): bool
38
    {
39
        $record->enabled = true;
40
        return $record->save(true, ['enabled']);
41
    }
42
}
43