EnableToken::performAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
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://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