Code Duplication    Length = 6-7 lines in 2 locations

src/Entities/Chat.php 1 location

@@ 54-60 (lines=7) @@
51
    public function tryMention()
52
    {
53
        if ($this->isPrivateChat()) {
54
            if ($this->username === null) {
55
                if ($this->last_name !== null) {
56
                    return $this->first_name . ' ' . $this->last_name;
57
                }
58
59
                return $this->first_name;
60
            }
61
62
            return '@' . $this->username;
63
        }

src/Entities/User.php 1 location

@@ 37-42 (lines=6) @@
34
     */
35
    public function tryMention()
36
    {
37
        if ($this->username === null) {
38
            if ($this->last_name !== null) {
39
                return $this->first_name . ' ' . $this->last_name;
40
            }
41
            return $this->first_name;
42
        }
43
        return '@' . $this->username;
44
    }
45
}