Completed
Push — master ( 193c3c...281dde )
by Nate
07:20
created

ElementCreate::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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
nc 1
cc 1
eloc 2
nop 0
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\ember\actions\element;
10
11
use craft\base\ElementInterface;
12
use yii\base\Action;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 1.0.0
17
 */
18
abstract class ElementCreate extends Action
19
{
20
    use traits\Save;
21
22
    /**
23
     * @inheritdoc
24
     * @return ElementInterface
25
     */
26
    abstract protected function newElement(array $config = []): ElementInterface;
27
28
    /**
29
     * @inheritdoc
30
     * @return ElementInterface
31
     */
32
    public function run()
33
    {
34
        return $this->runInternal($this->newElement());
35
    }
36
37
    /**
38
     * @inheritdoc
39
     */
40
    public function statusCodeSuccess(): int
41
    {
42
        return $this->statusCodeSuccess ?: 201;
43
    }
44
}
45