1
0
mirror of https://github.com/xPaw/PHP-Source-Query.git synced 2026-06-11 01:53:16 +02:00

Use autoloading.

This commit is contained in:
Anthony Birkett
2021-05-30 11:30:29 +01:00
parent b5d355514b
commit a2f7834ef5
8 changed files with 19 additions and 43 deletions
+9 -3
View File
@@ -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' ]);