1
0
mirror of https://github.com/xPaw/PHP-Source-Query.git synced 2026-06-10 23:33:15 +02:00

Remove engine from the Sockets.

Docblock changes.
Reorder methods to be logical.
This commit is contained in:
Anthony Birkett
2021-05-31 11:52:18 +01:00
parent b01c1f643f
commit d9bab8aa25
17 changed files with 369 additions and 408 deletions
+8 -16
View File
@@ -6,29 +6,21 @@ require __DIR__ . '/../vendor/autoload.php';
use xPaw\SourceQuery\SourceQuery;
use xPaw\SourceQuery\Socket\SourceSocket;
use xPaw\SourceQuery\Socket\SocketType;
// For the sake of this example
header('Content-Type: text/plain');
header('X-Content-Type-Options: nosniff');
// Edit this ->
define('SQ_SERVER_ADDR', 'localhost');
define('SQ_SERVER_PORT', 27015);
define('SQ_TIMEOUT', 1);
define('SQ_ENGINE', SocketType::SOURCE);
// Edit this <-
$Query = new SourceQuery(new SourceSocket());
$query = new SourceQuery(new SourceSocket());
try {
$Query->connect(SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE);
$query->connect('localhost', 27015, 1);
print_r($Query->getInfo());
print_r($Query->getPlayers());
print_r($Query->getRules());
} catch (Exception $e) {
echo $e->getMessage();
print_r($query->getInfo());
print_r($query->getPlayers());
print_r($query->getRules());
} catch (Exception $exception) {
echo $exception->getMessage();
} finally {
$Query->disconnect();
$query->disconnect();
}