Completed
Push — develop ( 0fe799...8d013c )
by Nate
02:38
created

Enable   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
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

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\integration\records\IntegrationConnection;
12
use flipbox\ember\actions\record\traits\Lookup;
13
use flipbox\ember\actions\record\traits\Manage;
14
use yii\base\Action;
15
16
/**
17
 * @author Flipbox Factory <[email protected]>
18
 * @since 1.1.1
19
 */
20
abstract class Enable extends Action
21
{
22
    use Manage, Lookup {
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