Conditions | 3 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
38 | public function resolveCreatedByToUserId(String $createdByIdentifier) |
||
39 | { |
||
40 | $userId = null; |
||
41 | |||
42 | try { |
||
43 | $userId = $this->resolveByEmailOrByNick($createdByIdentifier); |
||
44 | |||
45 | if (!$userId) { |
||
46 | $this->logger->warning( |
||
47 | 'Unable to find user with identifier ' . $createdByIdentifier |
||
48 | ); |
||
49 | } |
||
50 | } catch (Exception $e) { |
||
51 | $this->logger->error( |
||
52 | sprintf( |
||
53 | 'An unexpected error occurred while resolving user with identifier %s', |
||
54 | $createdByIdentifier |
||
55 | ), |
||
56 | [ |
||
57 | 'exception' => $e, |
||
58 | ] |
||
59 | ); |
||
60 | } |
||
61 | |||
62 | return $userId; |
||
63 | } |
||
64 | |||
81 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: