1
0
mirror of https://github.com/xPaw/PHP-Source-Query.git synced 2026-05-18 12:53:34 +02:00

Rename some variables for clarity

This commit is contained in:
Pavel Djundik
2015-10-22 11:58:33 +03:00
parent 8b475d2649
commit 2bbe339458
5 changed files with 17 additions and 23 deletions
+2 -2
View File
@@ -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 );
+3 -3
View File
@@ -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 )
{
+10 -11
View File
@@ -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
+1 -1
View File
@@ -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 )
{