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

LookupElementTrait::findById()   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
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