Conditions | 2 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
69 | private function resolveByEmailOrByNick(String $createdByIdentifier) |
||
70 | { |
||
71 | try { |
||
72 | $email = new EmailAddress($createdByIdentifier->toNative()); |
||
|
|||
73 | $userId = $this->users->byEmail($email); |
||
74 | } catch (InvalidNativeArgumentException $e) { |
||
75 | $userId = $this->users->byNick($createdByIdentifier); |
||
76 | } |
||
77 | |||
78 | return $userId; |
||
79 | } |
||
80 | } |
||
81 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: