Passed
Push — main ( bd6751...4aef09 )
by Miaad
10:17
created

user   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
c 0
b 0
f 0
dl 0
loc 58
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 2
A fullName() 0 2 2
A inviteLink() 0 2 1
A getProfiles() 0 2 1
1
<?php
2
3
namespace BPT\types;
4
5
use BPT\telegram\telegram;
6
use BPT\tools;
7
use stdClass;
8
9
/**
10
 * This object represents a Telegram user or bot.
11
 */
12
class user extends types {
0 ignored issues
show
Bug introduced by
The type BPT\types\types was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
    /** Keep all of properties which has sub properties */
14
    private const subs = [];
15
16
    /**
17
     * Unique identifier for this user or bot. This number may have more than 32 significant bits and some
18
     * programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant
19
     * bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
20
     */
21
    public int $id;
22
23
    /** True, if this user is a bot */
24
    public null|bool $is_bot = null;
25
26
    /** User's or bot's first name */
27
    public null|string $first_name = null;
28
29
    /** Optional. User's or bot's last name */
30
    public null|string $last_name = null;
31
32
    /** Optional. User's or bot's username */
33
    public null|string $username = null;
34
35
    /** Optional. IETF language tag of the user's language */
36
    public null|string $language_code = null;
37
38
    /** Optional. True, if this user is a Telegram Premium user */
39
    public null|bool $is_premium = null;
40
41
    /** Optional. True, if this user added the bot to the attachment menu */
42
    public null|bool $added_to_attachment_menu = null;
43
44
    /** Optional. True, if the bot can be invited to groups. Returned only in getMe. */
45
    public null|bool $can_join_groups = null;
46
47
    /** Optional. True, if privacy mode is disabled for the bot. Returned only in getMe. */
48
    public null|bool $can_read_all_group_messages = null;
49
50
    /** Optional. True, if the bot supports inline queries. Returned only in getMe. */
51
    public null|bool $supports_inline_queries = null;
52
53
54
    public function __construct(stdClass|null $object = null) {
55
        if ($object != null) {
56
            parent::__construct($object, self::subs);
57
        }
58
    }
59
60
    public function inviteLink(): string {
61
        return tools::inviteLink($this->id);
62
    }
63
64
    public function fullName(bool $nameFirst = true): string {
65
        return trim($nameFirst ? $this->first_name . ' ' . $this->last_name : $this->last_name . ' ' . $this->first_name);
66
    }
67
68
    public function getProfiles(int|null $offset = null, int|null $limit = null): userProfilePhotos|responseError {
69
        return telegram::getUserProfilePhotos($this->id,$offset,$limit);
70
    }
71
}
72