diff --git a/Examples/Example.php b/Examples/Example.php index 1064bd2..18f5d04 100644 --- a/Examples/Example.php +++ b/Examples/Example.php @@ -11,7 +11,7 @@ define( 'SQ_SERVER_ADDR', 'localhost' ); define( 'SQ_SERVER_PORT', 27015 ); define( 'SQ_TIMEOUT', 1 ); - define( 'SQ_ENGINE', SourceQuery :: SOURCE ); + define( 'SQ_ENGINE', SourceQuery::SOURCE ); // Edit this <- $Query = new SourceQuery( ); diff --git a/Examples/RconExample.php b/Examples/RconExample.php index 1cdd222..cd76e23 100644 --- a/Examples/RconExample.php +++ b/Examples/RconExample.php @@ -11,7 +11,7 @@ define( 'SQ_SERVER_ADDR', 'localhost' ); define( 'SQ_SERVER_PORT', 27015 ); define( 'SQ_TIMEOUT', 1 ); - define( 'SQ_ENGINE', SourceQuery :: SOURCE ); + define( 'SQ_ENGINE', SourceQuery::SOURCE ); // Edit this <- $Query = new SourceQuery( ); diff --git a/Examples/View.php b/Examples/View.php index 6d62e53..6bdfca1 100644 --- a/Examples/View.php +++ b/Examples/View.php @@ -7,7 +7,7 @@ define( 'SQ_SERVER_ADDR', 'localhost' ); define( 'SQ_SERVER_PORT', 27015 ); define( 'SQ_TIMEOUT', 3 ); - define( 'SQ_ENGINE', SourceQuery :: SOURCE ); + define( 'SQ_ENGINE', SourceQuery::SOURCE ); // Edit this <- $Timer = MicroTime( true ); diff --git a/SourceQuery/GoldSourceRcon.php b/SourceQuery/GoldSourceRcon.php index f4a27ef..dcbf8a1 100644 --- a/SourceQuery/GoldSourceRcon.php +++ b/SourceQuery/GoldSourceRcon.php @@ -77,7 +77,7 @@ // GoldSource RCON has same structure as Query $this->Socket->Read( ); - if( $this->Buffer->GetByte( ) !== SourceQuery :: S2A_RCON ) + if( $this->Buffer->GetByte( ) !== SourceQuery::S2A_RCON ) { return false; } @@ -102,7 +102,7 @@ { $this->Socket->Read( ); - $ReadMore = $this->Buffer->Remaining( ) > 0 && $this->Buffer->GetByte( ) === SourceQuery :: S2A_RCON; + $ReadMore = $this->Buffer->Remaining( ) > 0 && $this->Buffer->GetByte( ) === SourceQuery::S2A_RCON; if( $ReadMore ) { diff --git a/SourceQuery/Socket.php b/SourceQuery/Socket.php index 4ecc4b1..cb67082 100644 --- a/SourceQuery/Socket.php +++ b/SourceQuery/Socket.php @@ -115,7 +115,7 @@ switch( $this->Engine ) { - case SourceQuery :: GOLDSOURCE: + case SourceQuery::GOLDSOURCE: { $PacketCountAndNumber = $this->Buffer->GetByte( ); $PacketCount = $PacketCountAndNumber & 0xF; @@ -123,7 +123,7 @@ break; } - case SourceQuery :: SOURCE: + case SourceQuery::SOURCE: { $IsCompressed = ( $RequestID & 0x80000000 ) !== 0; $PacketCount = $this->Buffer->GetByte( ); diff --git a/SourceQuery/SourceQuery.php b/SourceQuery/SourceQuery.php index 96c46cf..03fb984 100644 --- a/SourceQuery/SourceQuery.php +++ b/SourceQuery/SourceQuery.php @@ -138,7 +138,7 @@ * @throws InvalidArgumentException * @throws TimeoutException */ - public function Connect( $Ip, $Port, $Timeout = 3, $Engine = self :: SOURCE ) + public function Connect( $Ip, $Port, $Timeout = 3, $Engine = self::SOURCE ) { $this->Disconnect( ); @@ -204,10 +204,10 @@ return false; } - $this->Socket->Write( self :: A2S_PING ); + $this->Socket->Write( self::A2S_PING ); $this->Socket->Read( ); - return $this->Buffer->GetByte( ) === self :: S2A_PING; + return $this->Buffer->GetByte( ) === self::S2A_PING; } /** @@ -224,7 +224,7 @@ return false; } - $this->Socket->Write( self :: A2S_INFO, "Source Engine Query\0" ); + $this->Socket->Write( self::A2S_INFO, "Source Engine Query\0" ); $this->Socket->Read( ); $Type = $this->Buffer->GetByte( ); @@ -235,7 +235,7 @@ } // Old GoldSource protocol, HLTV still uses it - if( $Type === self :: S2A_INFO_OLD && $this->Socket->Engine === self :: GOLDSOURCE ) + if( $Type === self::S2A_INFO_OLD && $this->Socket->Engine === self::GOLDSOURCE ) { /** * If we try to read data again, and we get the result with type S2A_INFO (0x49) @@ -278,7 +278,7 @@ return $Server; } - if( $Type !== self :: S2A_INFO ) + if( $Type !== self::S2A_INFO ) { throw new InvalidPacketException( 'GetInfo: Packet header mismatch. (0x' . DecHex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH ); } @@ -367,15 +367,15 @@ return false; } - switch( $this->GetChallenge( self :: A2S_PLAYER, self :: S2A_PLAYER ) ) + switch( $this->GetChallenge( self::A2S_PLAYER, self::S2A_PLAYER ) ) { - case self :: GETCHALLENGE_FAILED: + case self::GETCHALLENGE_FAILED: { return false; } - case self :: GETCHALLENGE_ALL_CLEAR: + case self::GETCHALLENGE_ALL_CLEAR: { - $this->Socket->Write( self :: A2S_PLAYER, $this->Challenge ); + $this->Socket->Write( self::A2S_PLAYER, $this->Challenge ); $this->Socket->Read( 14000 ); // Moronic Arma 3 developers do not split their packets, so we have to read more data // This violates the protocol spec, and they probably should fix it: https://developer.valvesoftware.com/wiki/Server_queries#Protocol @@ -385,7 +385,7 @@ { return false; } - else if( $Type !== self :: S2A_PLAYER ) + else if( $Type !== self::S2A_PLAYER ) { throw new InvalidPacketException( 'GetPlayers: Packet header mismatch. (0x' . DecHex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH ); } @@ -425,15 +425,15 @@ return false; } - switch( $this->GetChallenge( self :: A2S_RULES, self :: S2A_RULES ) ) + switch( $this->GetChallenge( self::A2S_RULES, self::S2A_RULES ) ) { - case self :: GETCHALLENGE_FAILED: + case self::GETCHALLENGE_FAILED: { return false; } - case self :: GETCHALLENGE_ALL_CLEAR: + case self::GETCHALLENGE_ALL_CLEAR: { - $this->Socket->Write( self :: A2S_RULES, $this->Challenge ); + $this->Socket->Write( self::A2S_RULES, $this->Challenge ); $this->Socket->Read( ); $Type = $this->Buffer->GetByte( ); @@ -442,7 +442,7 @@ { return false; } - else if( $Type !== self :: S2A_RULES ) + else if( $Type !== self::S2A_RULES ) { throw new InvalidPacketException( 'GetRules: Packet header mismatch. (0x' . DecHex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH ); } @@ -480,12 +480,12 @@ { if( $this->Challenge ) { - return self :: GETCHALLENGE_ALL_CLEAR; + return self::GETCHALLENGE_ALL_CLEAR; } if( $this->UseOldGetChallengeMethod ) { - $Header = self :: A2S_SERVERQUERY_GETCHALLENGE; + $Header = self::A2S_SERVERQUERY_GETCHALLENGE; } $this->Socket->Write( $Header, 0xFFFFFFFF ); @@ -495,21 +495,21 @@ switch( $Type ) { - case self :: S2A_CHALLENGE: + case self::S2A_CHALLENGE: { $this->Challenge = $this->Buffer->Get( 4 ); - return self :: GETCHALLENGE_ALL_CLEAR; + return self::GETCHALLENGE_ALL_CLEAR; } case $ExpectedResult: { // Goldsource (HLTV) - return self :: GETCHALLENGE_CONTAINS_ANSWER; + return self::GETCHALLENGE_CONTAINS_ANSWER; } case 0: { - return self :: GETCHALLENGE_FAILED; + return self::GETCHALLENGE_FAILED; } default: { @@ -534,13 +534,13 @@ switch( $this->Socket->Engine ) { - case SourceQuery :: GOLDSOURCE: + case SourceQuery::GOLDSOURCE: { $this->Rcon = new GoldSourceRcon( $this->Buffer, $this->Socket ); break; } - case SourceQuery :: SOURCE: + case SourceQuery::SOURCE: { $this->Rcon = new SourceRcon( $this->Buffer, $this->Socket ); diff --git a/SourceQuery/SourceRcon.php b/SourceQuery/SourceRcon.php index 581b960..4e08c83 100644 --- a/SourceQuery/SourceRcon.php +++ b/SourceQuery/SourceRcon.php @@ -129,7 +129,7 @@ public function Command( $Command ) { - $this->Write( SourceQuery :: SERVERDATA_EXECCOMMAND, $Command ); + $this->Write( SourceQuery::SERVERDATA_EXECCOMMAND, $Command ); $this->Read( ); @@ -137,11 +137,11 @@ $Type = $this->Buffer->GetLong( ); - if( $Type === SourceQuery :: SERVERDATA_AUTH_RESPONSE ) + if( $Type === SourceQuery::SERVERDATA_AUTH_RESPONSE ) { throw new AuthenticationException( 'Bad rcon_password.', AuthenticationException::BAD_PASSWORD ); } - else if( $Type !== SourceQuery :: SERVERDATA_RESPONSE_VALUE ) + else if( $Type !== SourceQuery::SERVERDATA_RESPONSE_VALUE ) { return false; } @@ -154,13 +154,13 @@ { do { - $this->Write( SourceQuery :: SERVERDATA_RESPONSE_VALUE ); + $this->Write( SourceQuery::SERVERDATA_RESPONSE_VALUE ); $this->Read( ); $this->Buffer->GetLong( ); // RequestID - if( $this->Buffer->GetLong( ) !== SourceQuery :: SERVERDATA_RESPONSE_VALUE ) + if( $this->Buffer->GetLong( ) !== SourceQuery::SERVERDATA_RESPONSE_VALUE ) { break; } @@ -182,7 +182,7 @@ public function Authorize( $Password ) { - $this->Write( SourceQuery :: SERVERDATA_AUTH, $Password ); + $this->Write( SourceQuery::SERVERDATA_AUTH, $Password ); $this->Read( ); $RequestID = $this->Buffer->GetLong( ); @@ -191,7 +191,7 @@ // If we receive SERVERDATA_RESPONSE_VALUE, then we need to read again // More info: https://developer.valvesoftware.com/wiki/Source_RCON_Protocol#Additional_Comments - if( $Type === SourceQuery :: SERVERDATA_RESPONSE_VALUE ) + if( $Type === SourceQuery::SERVERDATA_RESPONSE_VALUE ) { $this->Read( ); @@ -199,7 +199,7 @@ $Type = $this->Buffer->GetLong( ); } - if( $RequestID === -1 || $Type !== SourceQuery :: SERVERDATA_AUTH_RESPONSE ) + if( $RequestID === -1 || $Type !== SourceQuery::SERVERDATA_AUTH_RESPONSE ) { throw new AuthenticationException( 'RCON authorization failed.', AuthenticationException::BAD_PASSWORD ); }