getHasRecoveryEmailAddress()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace PHPTdGram\Schema;
10
11
/**
12
 * The user has been authorized, but needs to enter a password to start using the application.
13
 */
14
class AuthorizationStateWaitPassword extends AuthorizationState
15
{
16
    public const TYPE_NAME = 'authorizationStateWaitPassword';
17
18
    /**
19
     * Hint for the password; may be empty.
20
     */
21
    protected string $passwordHint;
22
23
    /**
24
     * True, if a recovery email address has been set up.
25
     */
26
    protected bool $hasRecoveryEmailAddress;
27
28
    /**
29
     * Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent.
30
     */
31
    protected string $recoveryEmailAddressPattern;
32
33
    public function __construct(string $passwordHint, bool $hasRecoveryEmailAddress, string $recoveryEmailAddressPattern)
34
    {
35
        parent::__construct();
36
37
        $this->passwordHint                = $passwordHint;
38
        $this->hasRecoveryEmailAddress     = $hasRecoveryEmailAddress;
39
        $this->recoveryEmailAddressPattern = $recoveryEmailAddressPattern;
40
    }
41
42
    public static function fromArray(array $array): AuthorizationStateWaitPassword
43
    {
44
        return new static(
45
            $array['password_hint'],
46
            $array['has_recovery_email_address'],
47
            $array['recovery_email_address_pattern'],
48
        );
49
    }
50
51
    public function typeSerialize(): array
52
    {
53
        return [
54
            '@type'                          => static::TYPE_NAME,
55
            'password_hint'                  => $this->passwordHint,
56
            'has_recovery_email_address'     => $this->hasRecoveryEmailAddress,
57
            'recovery_email_address_pattern' => $this->recoveryEmailAddressPattern,
58
        ];
59
    }
60
61
    public function getPasswordHint(): string
62
    {
63
        return $this->passwordHint;
64
    }
65
66
    public function getHasRecoveryEmailAddress(): bool
67
    {
68
        return $this->hasRecoveryEmailAddress;
69
    }
70
71
    public function getRecoveryEmailAddressPattern(): string
72
    {
73
        return $this->recoveryEmailAddressPattern;
74
    }
75
}
76