Rename some variables for clarity

pull/94/head
Pavel Djundik 9 years ago
parent 8b475d2649
commit 2bbe339458

@ -26,7 +26,7 @@
public $Socket;
public $Engine;
public $Ip;
public $Address;
public $Port;
public $Timeout;
@ -36,7 +36,7 @@
}
abstract public function Close( );
abstract public function Open( $Ip, $Port, $Timeout, $Engine );
abstract public function Open( $Address, $Port, $Timeout, $Engine );
abstract public function Write( $Header, $String = '' );
abstract public function Read( $Length = 1400 );

@ -35,14 +35,14 @@
}
}
public function Open( $Ip, $Port, $Timeout, $Engine )
public function Open( $Address, $Port, $Timeout, $Engine )
{
$this->Timeout = $Timeout;
$this->Engine = $Engine;
$this->Port = $Port;
$this->Ip = $Ip;
$this->Address = $Address;
$this->Socket = @FSockOpen( 'udp://' . $Ip, $Port, $ErrNo, $ErrStr, $Timeout );
$this->Socket = @FSockOpen( 'udp://' . $Address, $Port, $ErrNo, $ErrStr, $Timeout );
if( $ErrNo || $this->Socket === false )
{

@ -122,7 +122,7 @@
/**
* Opens connection to server
*
* @param string $Ip Server ip
* @param string $Address Server ip
* @param int $Port Server port
* @param int $Timeout Timeout period
* @param int $Engine Engine the server runs on (goldsource, source)
@ -130,7 +130,7 @@
* @throws InvalidArgumentException
* @throws SocketException
*/
public function Connect( $Ip, $Port, $Timeout = 3, $Engine = self::SOURCE )
public function Connect( $Address, $Port, $Timeout = 3, $Engine = self::SOURCE )
{
$this->Disconnect( );
@ -139,7 +139,7 @@
throw new InvalidArgumentException( 'Timeout must be an integer.', InvalidArgumentException::TIMEOUT_NOT_INTEGER );
}
$this->Socket->Open( $Ip, (int)$Port, $Timeout, (int)$Engine );
$this->Socket->Open( $Address, (int)$Port, $Timeout, (int)$Engine );
$this->Connected = true;
}
@ -309,18 +309,17 @@
// You can use https://github.com/xPaw/SteamID.php
if( $Flags & 0x10 )
{
$a = $Buffer->GetUnsignedLong( );
$b = $Buffer->GetUnsignedLong( );
$SteamIDLower = $Buffer->GetUnsignedLong( );
$SteamIDInstance = $Buffer->GetUnsignedLong( ); // This gets shifted by 32 bits, which should be steamid instance
$SteamID = 0;
if( PHP_INT_SIZE === 4 )
{
if( extension_loaded( 'gmp' ) )
{
$a = gmp_abs( $a );
$b = gmp_abs( $b );
$SteamID = gmp_strval( gmp_or( $a, gmp_mul( $b, gmp_pow( 2, 32 ) ) ) );
$SteamIDLower = gmp_abs( $SteamIDLower );
$SteamIDInstance = gmp_abs( $SteamIDInstance );
$SteamID = gmp_strval( gmp_or( $SteamIDLower, gmp_mul( $SteamIDInstance, gmp_pow( 2, 32 ) ) ) );
}
else
{
@ -329,12 +328,12 @@
}
else
{
$SteamID = $a | ( $b << 32 );
$SteamID = $SteamIDLower | ( $SteamIDInstance << 32 );
}
$Server[ 'SteamID' ] = $SteamID;
unset( $a, $b, $SteamID );
unset( $SteamIDLower, $SteamIDInstance, $SteamID );
}
// The spectator port and then the spectator server name

@ -58,7 +58,7 @@
{
if( !$this->RconSocket )
{
$this->RconSocket = @FSockOpen( $this->Socket->Ip, $this->Socket->Port, $ErrNo, $ErrStr, $this->Socket->Timeout );
$this->RconSocket = @FSockOpen( $this->Socket->Address, $this->Socket->Port, $ErrNo, $ErrStr, $this->Socket->Timeout );
if( $ErrNo || !$this->RconSocket )
{

@ -25,7 +25,7 @@
//
}
public function Open( $Ip, $Port, $Timeout, $Engine )
public function Open( $Address, $Port, $Timeout, $Engine )
{
//
}
@ -37,11 +37,6 @@
public function Read( $Length = 1400 )
{
if( $this->PacketQueue->Count === 0 )
{
throw new InvalidPacketException( 'Buffer is empty', InvalidPacketException::BUFFER_EMPTY );
}
$Buffer = new Buffer( );
$Buffer->Set( $this->PacketQueue->pop() );

Loading…
Cancel
Save