Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
23 | public function findOrCreateFromMessage(Message $message): Account |
||
24 | { |
||
25 | if (null === $account = $this->accountRepo->findOneBy(['id' => $message->from->id])) { |
||
26 | $account = new Account($message->from->id); |
||
27 | $this->accountRepo->add($account); |
||
28 | } |
||
29 | |||
30 | // Setting/updating account data |
||
31 | $account->updateFromMessageData( |
||
32 | $message->from->first_name, |
||
33 | $message->from->last_name, |
||
34 | $message->from->username, |
||
35 | $message->chat->id |
||
36 | ); |
||
37 | |||
38 | return $account; |
||
39 | } |
||
40 | } |