1
|
|
|
<?php namespace FreedomCore\TrinityCore\Console; |
2
|
|
|
|
3
|
|
|
use FreedomCore\TrinityCore\Console\Abstracts\BaseClient; |
4
|
|
|
use FreedomCore\TrinityCore\Console\Commands\Account; |
5
|
|
|
use FreedomCore\TrinityCore\Console\Commands\BNetAccount; |
6
|
|
|
use FreedomCore\TrinityCore\Console\Commands\GM; |
7
|
|
|
use FreedomCore\TrinityCore\Console\Commands\Guild; |
8
|
|
|
use FreedomCore\TrinityCore\Console\Commands\LFG; |
9
|
|
|
use FreedomCore\TrinityCore\Console\Commands\Character; |
10
|
|
|
use FreedomCore\TrinityCore\Console\Commands\Reset; |
11
|
|
|
use FreedomCore\TrinityCore\Console\Commands\Send; |
12
|
|
|
use FreedomCore\TrinityCore\Console\Commands\Server; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class Client |
16
|
|
|
* @package FreedomCore\TrinityCore\Console |
17
|
|
|
*/ |
18
|
|
|
class Client extends BaseClient |
19
|
|
|
{ |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Client constructor. |
23
|
|
|
* @param string $username Username used to connect to the server |
24
|
|
|
* @param string $password Password used to connect to the server |
25
|
|
|
* @param boolean $createNow Should the connection be created as soon as possible |
26
|
|
|
* @throws \Exception |
27
|
|
|
*/ |
28
|
38 |
|
public function __construct(string $username, string $password, bool $createNow = true) |
29
|
|
|
{ |
30
|
38 |
|
parent::__construct($username, $password, $createNow); |
31
|
38 |
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Get Account Command Instance |
35
|
|
|
* @return Account |
36
|
|
|
*/ |
37
|
2 |
|
public function account() : Account |
38
|
|
|
{ |
39
|
2 |
|
return (new Account($this->client)); |
|
|
|
|
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Get Bnet Command Instance |
44
|
|
|
* @return BNetAccount |
45
|
|
|
*/ |
46
|
2 |
|
public function bnet() : BNetAccount |
47
|
|
|
{ |
48
|
2 |
|
return (new BNetAccount($this->client)); |
|
|
|
|
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Get Character Command Instance |
53
|
|
|
* @return Character |
54
|
|
|
*/ |
55
|
2 |
|
public function character() : Character |
56
|
|
|
{ |
57
|
2 |
|
return (new Character($this->client)); |
|
|
|
|
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Get GM Command Instance |
62
|
|
|
* @return GM |
63
|
|
|
*/ |
64
|
2 |
|
public function gm() : GM |
65
|
|
|
{ |
66
|
2 |
|
return (new GM($this->client)); |
|
|
|
|
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Get Guild Command Instance |
71
|
|
|
* @return Guild |
72
|
|
|
*/ |
73
|
2 |
|
public function guild() : Guild |
74
|
|
|
{ |
75
|
2 |
|
return (new Guild($this->client)); |
|
|
|
|
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Get LFG Command Instance |
80
|
|
|
* @return LFG |
81
|
|
|
*/ |
82
|
2 |
|
public function lfg() : LFG |
83
|
|
|
{ |
84
|
2 |
|
return (new LFG($this->client)); |
|
|
|
|
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Get Reset Command Instance |
89
|
|
|
* @return Reset |
90
|
|
|
*/ |
91
|
2 |
|
public function reset() : Reset |
92
|
|
|
{ |
93
|
2 |
|
return (new Reset($this->client)); |
|
|
|
|
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Get Send Command Instance |
98
|
|
|
* @return Send |
99
|
|
|
*/ |
100
|
2 |
|
public function send() : Send |
101
|
|
|
{ |
102
|
2 |
|
return (new Send($this->client)); |
|
|
|
|
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Get Server Command Instance |
107
|
|
|
* @return Server |
108
|
|
|
*/ |
109
|
2 |
|
public function server() : Server |
110
|
|
|
{ |
111
|
2 |
|
return (new Server($this->client)); |
|
|
|
|
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
|
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: