mirror of
https://github.com/xPaw/PHP-Source-Query.git
synced 2026-05-18 13:53:35 +02:00
Add more type info
This commit is contained in:
+10
-11
@@ -29,20 +29,19 @@
|
||||
{
|
||||
/**
|
||||
* Points to socket class
|
||||
*
|
||||
* @var Socket
|
||||
*/
|
||||
private $Socket;
|
||||
private BaseSocket $Socket;
|
||||
|
||||
/** @var resource */
|
||||
private $RconSocket;
|
||||
private $RconRequestId;
|
||||
private int $RconRequestId = 0;
|
||||
|
||||
public function __construct( $Socket )
|
||||
public function __construct( BaseSocket $Socket )
|
||||
{
|
||||
$this->Socket = $Socket;
|
||||
}
|
||||
|
||||
public function Close( )
|
||||
public function Close( ) : void
|
||||
{
|
||||
if( $this->RconSocket )
|
||||
{
|
||||
@@ -54,7 +53,7 @@
|
||||
$this->RconRequestId = 0;
|
||||
}
|
||||
|
||||
public function Open( )
|
||||
public function Open( ) : void
|
||||
{
|
||||
if( !$this->RconSocket )
|
||||
{
|
||||
@@ -70,7 +69,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
public function Write( $Header, $String = '' )
|
||||
public function Write( int $Header, string $String = '' ) : bool
|
||||
{
|
||||
// Pack the packet together
|
||||
$Command = Pack( 'VV', ++$this->RconRequestId, $Header ) . $String . "\x00\x00";
|
||||
@@ -82,7 +81,7 @@
|
||||
return $Length === FWrite( $this->RconSocket, $Command, $Length );
|
||||
}
|
||||
|
||||
public function Read( )
|
||||
public function Read( ) : Buffer
|
||||
{
|
||||
$Buffer = new Buffer( );
|
||||
$Buffer->Set( FRead( $this->RconSocket, 4 ) );
|
||||
@@ -122,7 +121,7 @@
|
||||
return $Buffer;
|
||||
}
|
||||
|
||||
public function Command( $Command )
|
||||
public function Command( string $Command ) : string
|
||||
{
|
||||
$this->Write( SourceQuery::SERVERDATA_EXECCOMMAND, $Command );
|
||||
$Buffer = $this->Read( );
|
||||
@@ -174,7 +173,7 @@
|
||||
return rtrim( $Data, "\0" );
|
||||
}
|
||||
|
||||
public function Authorize( $Password )
|
||||
public function Authorize( string $Password ) : void
|
||||
{
|
||||
$this->Write( SourceQuery::SERVERDATA_AUTH, $Password );
|
||||
$Buffer = $this->Read( );
|
||||
|
||||
Reference in New Issue
Block a user