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

LookupElementTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 20
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A findById() 0 4 1
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
use flipbox\craft\ember\actions\LookupTrait;
14
use yii\web\Response;
15
16
trait LookupElementTrait
17
{
18
    use LookupTrait;
19
20
    /**
21
     * @inheritdoc
22
     * @param ElementInterface $element
23
     * @return ElementInterface|Response
24
     */
25
    abstract protected function runInternal(ElementInterface $element);
26
27
    /**
28
     * @param int $id
29
     * @return null|ElementInterface
30
     */
31
    protected function findById(int $id)
32
    {
33
        return Craft::$app->getElements()->getElementById($id);
34
    }
35
}
36