|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is the main class of the keinos/mastodon-streaming-api-config package. |
|
5
|
|
|
* |
|
6
|
|
|
* - Reference of the public methods of this class to use: |
|
7
|
|
|
* - See: ./ConfigInterface.php |
|
8
|
|
|
* - Authors, copyright, license, usage and etc.: |
|
9
|
|
|
* - See: https://github.com/KEINOS/Mastodon_StreamingAPI_Config/ |
|
10
|
|
|
* |
|
11
|
|
|
* Note: |
|
12
|
|
|
* - Non static public methods or properties must be defined here. |
|
13
|
|
|
* - Only the public method "__construct()" is defined in "ConfigProtectedMethods". |
|
14
|
|
|
* - Static methods and properties must be defined in "ConfigStaticMethods". |
|
15
|
|
|
* - Protected methods/properties must be defined in "ConfigProtectedMethods". |
|
16
|
|
|
* - Class constants must be defined in "ConfigConstants". |
|
17
|
|
|
* |
|
18
|
|
|
* Debug: |
|
19
|
|
|
* - To test and analyze the scripts: |
|
20
|
|
|
* - Run: `$ composer test all verbose` (Composer is required) |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
declare(strict_types=1); |
|
24
|
|
|
|
|
25
|
|
|
namespace KEINOS\MSTDN_TOOLS; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* This class holds and provides Mastodon server, a.k.a instance, information to |
|
29
|
|
|
* receive server-sent messages from Mastodon Streaming API. |
|
30
|
|
|
*/ |
|
31
|
|
|
final class Config extends ConfigProtectedMethods implements ConfigInterface |
|
32
|
|
|
{ |
|
33
|
|
|
// The "__construct()" method is defined in "ConfigProtectedMethods". |
|
34
|
|
|
//public function __construct(string $url_host) |
|
35
|
|
|
|
|
36
|
|
|
public function getUrlHost(): string |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->url_host; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @return array<mixed,mixed> |
|
43
|
|
|
*/ |
|
44
|
|
|
public function getInfoServer(): array |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->info_server; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function getUriWebSocket() |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->info_server['urls']['streaming_api']; |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|