1 | <?php namespace FreedomCore\TrinityCore\Console\Abstracts; |
||
7 | abstract class BaseClient |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * Package Version |
||
12 | * @var string |
||
13 | */ |
||
14 | const VERSION = '1.0.4'; |
||
15 | |||
16 | /** |
||
17 | * Server Address |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $serverAddress = '127.0.0.1'; |
||
21 | |||
22 | /** |
||
23 | * Server Port |
||
24 | * @var int |
||
25 | */ |
||
26 | protected $serverPort = 7878; |
||
27 | |||
28 | /** |
||
29 | * SoapClient Instance |
||
30 | * @var null|\SoapClient |
||
31 | */ |
||
32 | protected $client = null; |
||
33 | |||
34 | /** |
||
35 | * Username used to connect to the server |
||
36 | * @var null|string |
||
37 | */ |
||
38 | private $username = null; |
||
39 | |||
40 | /** |
||
41 | * Password used to connect to the server |
||
42 | * @var null|string |
||
43 | */ |
||
44 | private $password = null; |
||
45 | |||
46 | /** |
||
47 | * BaseClient constructor. |
||
48 | * @param string $username Username used to connect to the server |
||
49 | * @param string $password Password used to connect to the server |
||
50 | * @param boolean $createNow Should the connection be created as soon as possible |
||
51 | * @throws \Exception |
||
52 | */ |
||
53 | public function __construct(string $username, string $password, bool $createNow = true) |
||
63 | |||
64 | /** |
||
65 | * Set username variable |
||
66 | * @param string $username |
||
67 | */ |
||
68 | public function setUsername(string $username) |
||
72 | |||
73 | /** |
||
74 | * Get username variable |
||
75 | * @return string |
||
76 | */ |
||
77 | public function getUsername() : string |
||
81 | |||
82 | /** |
||
83 | * Set password variable |
||
84 | * @param string $password |
||
85 | */ |
||
86 | public function setPassword(string $password) |
||
90 | |||
91 | /** |
||
92 | * Get password variable |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getPassword() : string |
||
99 | |||
100 | /** |
||
101 | * Set Server Address |
||
102 | * @param string $serverAddress |
||
103 | * @return BaseClient |
||
104 | */ |
||
105 | public function setAddress(string $serverAddress) : BaseClient |
||
110 | |||
111 | /** |
||
112 | * Get Server Address |
||
113 | * @return string |
||
114 | */ |
||
115 | public function getAddress() : string |
||
119 | |||
120 | /** |
||
121 | * Set Server Port |
||
122 | * @param int $serverPort |
||
123 | * @return BaseClient |
||
124 | */ |
||
125 | public function setPort(int $serverPort) : BaseClient |
||
130 | |||
131 | /** |
||
132 | * Get Server Port |
||
133 | * @return int |
||
134 | */ |
||
135 | public function getPort() : int |
||
139 | |||
140 | /** |
||
141 | * Get Client Version |
||
142 | * @return string |
||
143 | */ |
||
144 | public function getVersion() : string |
||
148 | |||
149 | /** |
||
150 | * Initialize Connection To The Server |
||
151 | */ |
||
152 | public function createConnection() |
||
163 | |||
164 | /** |
||
165 | * Get Client Instance |
||
166 | * @return \SoapClient |
||
167 | */ |
||
168 | public function getClient() : \SoapClient |
||
172 | |||
173 | /** |
||
174 | * Check if SOAP extension is enabled |
||
175 | * @throws \Exception |
||
176 | * @codeCoverageIgnore |
||
177 | */ |
||
178 | protected function isSoapEnabled() |
||
184 | |||
185 | /** |
||
186 | * Validate Connection Settings |
||
187 | * @codeCoverageIgnore |
||
188 | */ |
||
189 | protected function validateSettings() |
||
204 | } |
||
205 |