Completed
Push — master ( 11971b...eeafb3 )
by Nate
01:16
created

DeleteElementTrait::performAction()   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-ember/blob/master/LICENSE
6
 * @link       https://github.com/flipboxfactory/craft-ember/
7
 */
8
9
namespace flipbox\craft\ember\actions\elements;
10
11
use Craft;
12
use craft\base\ElementInterface;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 2.0.0
17
 *
18
 * @property int $statusCodeSuccess
19
 */
20
trait DeleteElementTrait
21
{
22
    use ManageElementTrait;
23
24
    /**
25
     * @inheritdoc
26
     */
27
    protected function statusCodeSuccess(): int
28
    {
29
        return $this->statusCodeSuccess ?? 204;
30
    }
31
32
    /**
33
     * @inheritdoc
34
     * @param ElementInterface $element
35
     * @throws \Throwable
36
     */
37
    protected function performAction(ElementInterface $element): bool
38
    {
39
        return Craft::$app->getElements()->deleteElement($element);
40
    }
41
}
42