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

Enable::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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