mirror of
https://github.com/xPaw/PHP-Source-Query.git
synced 2026-06-11 00:13:14 +02:00
Use autoloading.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/../SourceQuery/bootstrap.php';
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use xPaw\SourceQuery\SourceQuery;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/../SourceQuery/bootstrap.php';
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use xPaw\SourceQuery\SourceQuery;
|
||||
|
||||
|
||||
+3
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__ . '/../SourceQuery/bootstrap.php';
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use xPaw\SourceQuery\SourceQuery;
|
||||
|
||||
@@ -115,6 +115,8 @@ $Timer = number_format(microtime(true) - $Timer, 4, '.', '');
|
||||
echo 'true';
|
||||
} elseif ($InfoValue === false) {
|
||||
echo 'false';
|
||||
} elseif (is_int($InfoValue)) {
|
||||
echo $InfoValue;
|
||||
} else {
|
||||
echo htmlspecialchars($InfoValue);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ use xPaw\SourceQuery\Exception\SocketException;
|
||||
abstract class BaseSocket
|
||||
{
|
||||
/**
|
||||
* @var resource
|
||||
* @var resource|null
|
||||
*/
|
||||
public $Socket;
|
||||
|
||||
|
||||
@@ -33,10 +33,10 @@ final class Socket extends BaseSocket
|
||||
*/
|
||||
public function Close(): void
|
||||
{
|
||||
if ($this->Socket !== null) {
|
||||
if ($this->Socket !== null && $this->Socket !== 0) {
|
||||
fclose($this->Socket);
|
||||
|
||||
$this->Socket = 0;
|
||||
$this->Socket = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,13 @@ final class Socket extends BaseSocket
|
||||
public function Read(int $Length = 1400): Buffer
|
||||
{
|
||||
$Buffer = new Buffer();
|
||||
$Buffer->Set(fread($this->Socket, $Length));
|
||||
$data = fread($this->Socket, $Length);
|
||||
|
||||
if (!$data) {
|
||||
throw new SocketException('Failed to open socket.');
|
||||
}
|
||||
|
||||
$Buffer->Set($data);
|
||||
|
||||
$this->ReadInternal($Buffer, $Length, [ $this, 'Sherlock' ]);
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Library to query servers that implement Source Engine Query protocol.
|
||||
*
|
||||
* Special thanks to koraktor for his awesome Steam Condenser class,
|
||||
* I used it as a reference at some points.
|
||||
*
|
||||
* @author Pavel Djundik
|
||||
*
|
||||
* @link https://xpaw.me
|
||||
* @link https://github.com/xPaw/PHP-Source-Query
|
||||
*
|
||||
* @license GNU Lesser General Public License, version 2.1
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/Exception/SourceQueryException.php';
|
||||
require_once __DIR__ . '/Exception/AuthenticationException.php';
|
||||
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
|
||||
require_once __DIR__ . '/Exception/SocketException.php';
|
||||
require_once __DIR__ . '/Exception/InvalidPacketException.php';
|
||||
|
||||
require_once __DIR__ . '/Buffer.php';
|
||||
require_once __DIR__ . '/BaseSocket.php';
|
||||
require_once __DIR__ . '/Socket.php';
|
||||
require_once __DIR__ . '/SourceRcon.php';
|
||||
require_once __DIR__ . '/GoldSourceRcon.php';
|
||||
require_once __DIR__ . '/SourceQuery.php';
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit colors="true"
|
||||
bootstrap="../SourceQuery/bootstrap.php"
|
||||
verbose="true">
|
||||
<phpunit colors="true" verbose="true">
|
||||
<testsuites>
|
||||
<testsuite name="Tests">
|
||||
<file>./Tests.php</file>
|
||||
|
||||
+3
-3
@@ -19,9 +19,9 @@
|
||||
"require":
|
||||
{
|
||||
"php": ">=7.4",
|
||||
"ext-bz2": ">7.*",
|
||||
"ext-gmp": ">7.*",
|
||||
"ext-json": ">7.*"
|
||||
"ext-bz2": ">=7.4",
|
||||
"ext-gmp": ">=7.4",
|
||||
"ext-json": ">=7.4"
|
||||
},
|
||||
"require-dev":
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user