Passed
Push — main ( f82312...487838 )
by Miaad
10:48 queued 13s
created

userShared::getInfo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
1
<?php
2
3
namespace BPT\types;
4
5
use BPT\telegram\telegram;
6
use stdClass;
7
8
/**
9
 * This object contains information about the user whose identifier was shared with the bot using a
10
 * KeyboardButtonRequestUser button.
11
 */
12
class userShared 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
    /** Identifier of the request */
17
    public int $request_id;
18
19
    /**
20
     * Identifier of the shared user. This number may have more than 32 significant bits and some programming
21
     * languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a
22
     * 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have
23
     * access to the user and could be unable to use this identifier, unless the user is already known to the bot by
24
     * some other means.
25
     */
26
    public int $user_id;
27
28
29
    public function __construct(stdClass|null $object = null) {
30
        if ($object != null) {
31
            parent::__construct($object, self::subs);
32
        }
33
    }
34
35
    /**
36
     * Get shared user info by using getChat method
37
     *
38
     * @param bool|null $answer
39
     *
40
     * @return responseError|chat
41
     */
42
    public function getInfo (bool $answer = null): responseError|chat {
43
        return telegram::getChat($this->user_id, answer: $answer);
44
    }
45
}
46