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

chatInviteLink   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
c 0
b 0
f 0
dl 0
loc 46
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A revoke() 0 2 1
A __construct() 0 3 2
1
<?php
2
3
namespace BPT\types;
4
5
use BPT\telegram\telegram;
6
use stdClass;
7
8
/**
9
 * Represents an invite link for a chat.
10
 */
11
class chatInviteLink 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...
12
    /** Keep all of properties which has sub properties */
13
    private const subs = ['creator' => 'BPT\types\user'];
14
15
    /**
16
     * The invite link. If the link was created by another chat administrator, then the second part of the link will
17
     * be replaced with “…”.
18
     */
19
    public string $invite_link;
20
21
    /** Creator of the link */
22
    public user $creator;
23
24
    /** True, if users joining the chat via the link need to be approved by chat administrators */
25
    public bool $creates_join_request;
26
27
    /** True, if the link is primary */
28
    public bool $is_primary;
29
30
    /** True, if the link is revoked */
31
    public bool $is_revoked;
32
33
    /** Optional. Invite link name */
34
    public null|string $name = null;
35
36
    /** Optional. Point in time (Unix timestamp) when the link will expire or has been expired */
37
    public null|int $expire_date = null;
38
39
    /**
40
     * Optional. The maximum number of users that can be members of the chat simultaneously after joining the chat
41
     * via this invite link; 1-99999
42
     */
43
    public null|int $member_limit = null;
44
45
    /** Optional. Number of pending join requests created using this link */
46
    public null|int $pending_join_request_count = null;
47
48
49
    public function __construct(stdClass|null $object = null) {
50
        if ($object != null) {
51
            parent::__construct($object, self::subs);
52
        }
53
    }
54
55
    public function revoke(): self|responseError|bool {
56
        return $this->is_revoked ?? telegram::revokeChatInviteLink($this->invite_link);
57
    }
58
}
59