Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
25 | protected function getElement(): ElementInterface |
||
26 | { |
||
27 | if ($this->element instanceof ElementInterface) { |
||
28 | return $this->element; |
||
29 | } |
||
30 | |||
31 | if (is_numeric($this->element)) { |
||
32 | return $this->element = Craft::$app->getUsers()->getUserById($this->element); |
||
33 | } |
||
34 | |||
35 | if (is_string($this->element)) { |
||
36 | return $this->element = Craft::$app->getUsers()->getUserByUsernameOrEmail($this->element); |
||
37 | } |
||
38 | |||
39 | throw new ElementNotFoundException("Unable to resolve element."); |
||
40 | } |
||
41 | } |
||
42 |