Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
29 / 29 |
|
100.00% |
15 / 15 |
CRAP | |
100.00% |
1 / 1 |
| Server | |
100.00% |
29 / 29 |
|
100.00% |
15 / 15 |
15 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| twilly | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| twig | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| artix | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| sepulchure | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| gravelyn | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| safiria | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| sir_ver | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| swordhaven | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| galanoth | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| alteon | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| yorumi | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| yokai | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| espada | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| all | |
100.00% |
15 / 15 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AqwSocketClient; |
| 6 | |
| 7 | /** |
| 8 | * Represents an Adventure Quest Worlds (AQW) server. |
| 9 | * |
| 10 | * This class provides a simple representation of a server, including its hostname, port, and name. |
| 11 | * It also includes predefined factory methods for known servers. |
| 12 | * @mago-ignore lint:too-many-methods |
| 13 | */ |
| 14 | final class Server |
| 15 | { |
| 16 | /** |
| 17 | * @param string $name The server's name. |
| 18 | * @param string $hostname The hostname or IP address of the server. |
| 19 | * @param int $port The port used to connect to the server. |
| 20 | */ |
| 21 | public function __construct( |
| 22 | public readonly string $name, |
| 23 | public readonly string $hostname, |
| 24 | public readonly int $port, |
| 25 | ) {} |
| 26 | |
| 27 | public static function twilly(): Server |
| 28 | { |
| 29 | return new self('Twilly', 'sockett4.aq.com', 5593); |
| 30 | } |
| 31 | |
| 32 | public static function twig(): Server |
| 33 | { |
| 34 | return new self('Twig', 'sockett5.aq.com', 5589); |
| 35 | } |
| 36 | |
| 37 | public static function artix(): Server |
| 38 | { |
| 39 | return new self('Artix', 'sockett4.aq.com', 5588); |
| 40 | } |
| 41 | |
| 42 | public static function sepulchure(): Server |
| 43 | { |
| 44 | return new self('Sepulchure', 'sockett4.aq.com', 5591); |
| 45 | } |
| 46 | |
| 47 | public static function gravelyn(): Server |
| 48 | { |
| 49 | return new self('Gravelyn', 'sockett5.aq.com', 5590); |
| 50 | } |
| 51 | |
| 52 | public static function safiria(): Server |
| 53 | { |
| 54 | return new self('Safiria', 'sockett4.aq.com', 5594); |
| 55 | } |
| 56 | |
| 57 | public static function sir_ver(): Server |
| 58 | { |
| 59 | return new self('Sir Ver', 'sockett4.aq.com', 5589); |
| 60 | } |
| 61 | |
| 62 | public static function swordhaven(): Server |
| 63 | { |
| 64 | return new self('Swordhaven (EU)', 'euro.aqw.artix.com', 5588); |
| 65 | } |
| 66 | |
| 67 | public static function galanoth(): Server |
| 68 | { |
| 69 | return new self('Galanoth', 'sockett5.aq.com', 5593); |
| 70 | } |
| 71 | |
| 72 | public static function alteon(): Server |
| 73 | { |
| 74 | return new self('Alteon', 'sockett5.aq.com', 5591); |
| 75 | } |
| 76 | |
| 77 | public static function yorumi(): Server |
| 78 | { |
| 79 | return new self('Yorumi', 'sockett5.aq.com', 5588); |
| 80 | } |
| 81 | |
| 82 | public static function yokai(): Server |
| 83 | { |
| 84 | return new self('Yokai (SEA)', 'asia.game.artix.com', 5588); |
| 85 | } |
| 86 | |
| 87 | public static function espada(): Server |
| 88 | { |
| 89 | return new self('Espada', 'sockett4.aq.com', 5592); |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Returns an array of all known servers. |
| 94 | * |
| 95 | * @return Server[] |
| 96 | */ |
| 97 | public static function all(): array |
| 98 | { |
| 99 | return [ |
| 100 | self::twilly(), |
| 101 | self::twig(), |
| 102 | self::artix(), |
| 103 | self::sepulchure(), |
| 104 | self::gravelyn(), |
| 105 | self::safiria(), |
| 106 | self::sir_ver(), |
| 107 | self::swordhaven(), |
| 108 | self::galanoth(), |
| 109 | self::alteon(), |
| 110 | self::yorumi(), |
| 111 | self::yokai(), |
| 112 | self::espada(), |
| 113 | ]; |
| 114 | } |
| 115 | } |