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

ElementCreate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 27
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
newElement() 0 1 ?
A run() 0 4 1
A statusCodeSuccess() 0 4 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