mirror of
https://github.com/xPaw/PHP-Source-Query.git
synced 2026-06-10 23:03:15 +02:00
Use autoloading.
This commit is contained in:
@@ -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';
|
||||
Reference in New Issue
Block a user