Conditions | 3 |
Paths | 4 |
Total Lines | 27 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | 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 | } |
||
51 | catch (Exception $e) { |
||
52 | $this->logger->error( |
||
53 | sprintf( |
||
54 | 'An unexpected error occurred while resolving user with identifier %s', |
||
55 | $createdByIdentifier |
||
56 | ), |
||
57 | [ |
||
58 | 'exception' => $e, |
||
59 | ] |
||
60 | ); |
||
61 | } |
||
62 | |||
63 | return $userId; |
||
64 | } |
||
65 | |||
82 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: