Passed
Push — main ( 36dc31...e0778d )
by Miaad
10:46
created

userShared   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
eloc 7
c 3
b 0
f 1
dl 0
loc 29
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 2
A getInfo() 0 2 1
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
 * @deprecated Use usersShared instead
13
 */
14
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...
15
    /** Keep all properties which has sub properties */
16
    private const subs = [];
17
    /** Identifier of the request */
18
    public int $request_id;
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
    public function __construct (stdClass|null $object = null) {
29
        if ($object != null) {
30
            parent::__construct($object, self::subs);
31
        }
32
    }
33
34
    /**
35
     * Get shared user info by using getChat method
36
     *
37
     * @param bool|null $answer
38
     *
39
     * @return responseError|chat
40
     */
41
    public function getInfo (bool $answer = null): responseError|chat {
42
        return telegram::getChat($this->user_id, answer: $answer);
43
    }
44
}
45