EnableToken   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 24
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://flipboxfactory.com/software/patron/license
6
 * @link       https://www.flipboxfactory.com/software/patron/
7
 */
8
9
namespace flipbox\patron\actions\token;
10
11
use flipbox\craft\ember\actions\LookupTrait;
12
use flipbox\craft\ember\actions\ManageTrait;
13
use flipbox\patron\records\Token;
14
use yii\base\Action;
15
16
/**
17
 * @author Flipbox Factory <[email protected]>
18
 * @since 1.0.0
19
 */
20
class EnableToken extends Action
21
{
22
    use ManageTrait, LookupTrait, LookupTokenTrait {
23
        run as traitRun;
24
    }
25
26
    /**
27
     * @param string|int $token
28
     * @inheritdoc
29
     */
30
    public function run($token)
31
    {
32
        return $this->traitRun($token);
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    protected function performAction(Token $token): bool
39
    {
40
        $token->enabled = true;
41
        return $token->save(true, ['enabled']);
42
    }
43
}
44