diff --git a/src/GameQ/Autoloader.php b/src/GameQ/Autoloader.php index 7c8eb415..81be63c7 100644 --- a/src/GameQ/Autoloader.php +++ b/src/GameQ/Autoloader.php @@ -30,7 +30,6 @@ * @codeCoverageIgnore */ spl_autoload_register(function ($class) { - // project-specific namespace prefix $prefix = 'GameQ\\'; diff --git a/src/GameQ/Buffer.php b/src/GameQ/Buffer.php index b48b6699..cc061043 100644 --- a/src/GameQ/Buffer.php +++ b/src/GameQ/Buffer.php @@ -35,7 +35,6 @@ */ class Buffer { - /** * Constants for the byte code types we need to read as */ @@ -79,7 +78,6 @@ class Buffer */ public function __construct($data, $number_type = self::NUMBER_TYPE_LITTLEENDIAN) { - $this->number_type = $number_type; $this->data = $data; $this->length = strlen($data); @@ -92,7 +90,6 @@ public function __construct($data, $number_type = self::NUMBER_TYPE_LITTLEENDIAN */ public function getData() { - return $this->data; } @@ -103,7 +100,6 @@ public function getData() */ public function getBuffer() { - return substr($this->data, $this->index); } @@ -114,7 +110,6 @@ public function getBuffer() */ public function getLength() { - return max($this->length - $this->index, 0); } @@ -128,7 +123,6 @@ public function getLength() */ public function read($length = 1) { - if (($length + $this->index) > $this->length) { throw new Exception("Unable to read length={$length} from buffer. Bad protocol format or return?"); } @@ -149,7 +143,6 @@ public function read($length = 1) */ public function readLast() { - $len = strlen($this->data); $string = $this->data[strlen($this->data) - 1]; $this->data = substr($this->data, 0, $len - 1); @@ -167,7 +160,6 @@ public function readLast() */ public function lookAhead($length = 1) { - return substr($this->data, $this->index, $length); } @@ -178,7 +170,6 @@ public function lookAhead($length = 1) */ public function skip($length = 1) { - $this->index += $length; } @@ -190,7 +181,6 @@ public function skip($length = 1) */ public function jumpto($index) { - $this->index = min($index, $this->length - 1); } @@ -201,7 +191,6 @@ public function jumpto($index) */ public function getPosition() { - return $this->index; } @@ -217,7 +206,6 @@ public function getPosition() */ public function readString($delim = "\x00") { - // Get position of delimiter $len = strpos($this->data, $delim, min($this->index, $this->length)); @@ -244,7 +232,6 @@ public function readString($delim = "\x00") */ public function readPascalString($offset = 0, $read_offset = false) { - // Get the proper offset $len = $this->readInt8(); $offset = max($len - $offset, 0); @@ -272,7 +259,6 @@ public function readPascalString($offset = 0, $read_offset = false) */ public function readStringMulti($delims, &$delimfound = null) { - // Get position of delimiters $pos = []; foreach ($delims as $delim) { @@ -302,7 +288,6 @@ public function readStringMulti($delims, &$delimfound = null) */ public function readInt8() { - $int = unpack('Cint', $this->read(1)); return $int['int']; @@ -316,7 +301,6 @@ public function readInt8() */ public function readInt8Signed() { - $int = unpack('cint', $this->read(1)); return $int['int']; @@ -330,7 +314,6 @@ public function readInt8Signed() */ public function readInt16() { - // Change the integer type we are looking up switch ($this->number_type) { case self::NUMBER_TYPE_BIGENDIAN: @@ -358,7 +341,6 @@ public function readInt16() */ public function readInt16Signed() { - // Read the data into a string $string = $this->read(2); @@ -416,7 +398,6 @@ public function readInt32($length = 4) */ public function readInt32Signed() { - // Read the data into a string $string = $this->read(4); @@ -440,7 +421,6 @@ public function readInt32Signed() */ public function readInt64() { - // We have the pack 64-bit codes available. See: http://php.net/manual/en/function.pack.php if (version_compare(PHP_VERSION, '5.6.3') >= 0 && PHP_INT_SIZE == 8) { // Change the integer type we are looking up @@ -488,7 +468,6 @@ public function readInt64() */ public function readFloat32() { - // Read the data into a string $string = $this->read(4); diff --git a/src/GameQ/Filters/Base.php b/src/GameQ/Filters/Base.php index 5f76e314..06f4252d 100644 --- a/src/GameQ/Filters/Base.php +++ b/src/GameQ/Filters/Base.php @@ -41,7 +41,6 @@ abstract class Base */ public function __construct(array $options = []) { - $this->options = $options; } diff --git a/src/GameQ/Filters/Normalize.php b/src/GameQ/Filters/Normalize.php index e3f6019d..be3bbb41 100644 --- a/src/GameQ/Filters/Normalize.php +++ b/src/GameQ/Filters/Normalize.php @@ -56,24 +56,24 @@ class Normalize extends Base */ public function apply(array $result, Server $server) { - /* Determine if there is data to be processed */ + // Determine if there is data to be processed if (! empty($result)) { - /* Handle unit test data generation */ + // Handle unit test data generation if ($this->writeTestData) { - /* Initialize potential data for unit testing **/ + // Initialize potential data for unit testing $unitTestData = [ ]; - /* Add the initial result to the unit test data */ + // Add the initial result to the unit test data $unitTestData['raw'][$server->id()] = $result; } - /* Grab the normalize definition from the server's protocol */# + /* Grab the normalize definition from the server's protocol */// $this->normalize = $server->protocol()->getNormalize(); - /* Normalize general information */ + // Normalize general information $result = array_merge($result, $this->check('general', $result)); - /* Normalize player information */ + // Normalize player information if (isset($result['players']) && count($result['players']) > 0) { foreach ($result['players'] as $key => $player) { $result['players'][$key] = array_merge($player, $this->check('player', $player)); @@ -82,7 +82,7 @@ public function apply(array $result, Server $server) $result['players'] = []; } - /* Normalize team information */ + // Normalize team information if (isset($result['teams']) && count($result['teams']) > 0) { foreach ($result['teams'] as $key => $team) { $result['teams'][$key] = array_merge($team, $this->check('team', $team)); @@ -91,12 +91,12 @@ public function apply(array $result, Server $server) $result['teams'] = []; } - /* Handle unit test data generation */ + // Handle unit test data generation if ($this->writeTestData) { - /* Add the filtered result to the unit test data */ + // Add the filtered result to the unit test data $unitTestData['filtered'][$server->id()] = $result; - /* Persist the collected data to the tests directory */ + // Persist the collected data to the tests directory file_put_contents( sprintf('%s/../../../tests/Filters/Providers/Normalize/%s_1.json', __DIR__, $server->protocol()->getProtocol()), json_encode($unitTestData, JSON_UNESCAPED_UNICODE | JSON_PARTIAL_OUTPUT_ON_ERROR) @@ -104,7 +104,7 @@ public function apply(array $result, Server $server) } } - /* Return the filtered result */ + // Return the filtered result return $result; } @@ -118,35 +118,35 @@ public function apply(array $result, Server $server) */ protected function check($section, array $data) { - /* Initialize the normalized output */ + // Initialize the normalized output $normalized = []; - /* Ensure the provided section is defined */ + // Ensure the provided section is defined if (isset($this->normalize[$section])) { - /* Process each mapping individually */ + // Process each mapping individually foreach ($this->normalize[$section] as $target => $source) { - /* Treat explicit source like implicit sources */ + // Treat explicit source like implicit sources if (! is_array($source)) { $source = [$source]; } - /* Find the first possible source */ + // Find the first possible source foreach ($source as $s) { - /* Determine if the current source does exist */ + // Determine if the current source does exist if (array_key_exists($s, $data)) { - /* Add the normalized mapping */ + // Add the normalized mapping $normalized['gq_'.$target] = $data[$s]; break; } } - /* Write null in case no source was found */ + // Write null in case no source was found // TODO: Remove this in the next major version. $normalized['gq_'.$target] = isset($normalized['gq_'.$target]) ? $normalized['gq_'.$target] : null; } } - /* Return the normalized data */ + // Return the normalized data return $normalized; } } diff --git a/src/GameQ/Filters/Secondstohuman.php b/src/GameQ/Filters/Secondstohuman.php index db3cac2d..02dab4b4 100644 --- a/src/GameQ/Filters/Secondstohuman.php +++ b/src/GameQ/Filters/Secondstohuman.php @@ -35,7 +35,6 @@ */ class Secondstohuman extends Base { - /** * The options key for setting the data key(s) to look for to convert */ @@ -85,21 +84,21 @@ public function apply(array $result, Server $server) { return Arr::recursively($result, function ($value, $key, RecursiveArrayIterator $iterator) { if ( - /* Only process whitelisted keys */ + // Only process whitelisted keys (in_array($key, $this->options[self::OPTION_TIMEKEYS])) && - /* Only process numeric values (float, integer, string) */ + // Only process numeric values (float, integer, string) (is_numeric($value)) ) { - /* Ensure the value is float */ + // Ensure the value is float if (! is_float($value)) { $value = floatval($value); } - /* Add a new element to the result */ + // Add a new element to the result $iterator->offsetSet( - /* Modify the current key */ + // Modify the current key sprintf(self::RESULT_KEY, $key), - /* Format the provided time */ + // Format the provided time sprintf( '%02d:%02d:%02d', (int)floor($value / 3600), // Hours diff --git a/src/GameQ/Filters/Stripcolors.php b/src/GameQ/Filters/Stripcolors.php index ab7d3707..7ed8c095 100644 --- a/src/GameQ/Filters/Stripcolors.php +++ b/src/GameQ/Filters/Stripcolors.php @@ -21,7 +21,6 @@ use Closure; use GameQ\Helpers\Arr; use GameQ\Server; -use ReflectionMethod; /** * Class Strip Colors @@ -52,24 +51,24 @@ class Stripcolors extends Base */ public function apply(array $result, Server $server) { - /* Prevent working on empty results */ + // Prevent working on empty results if (! empty($result)) { - /* Handle unit test data generation */ + // Handle unit test data generation if ($this->writeTestData) { - /* Initialize potential data for unit testing **/ + // Initialize potential data for unit testing $unitTestData = []; - /* Add the initial result to the unit test data */ + // Add the initial result to the unit test data $unitTestData['raw'][$server->id()] = $result; } - /* Determine the executor defined for the current Protocol */ + // Determine the executor defined for the current Protocol if ($executor = $this->getExecutor($server)) { - /* Apply the executor to the result recursively */ + // Apply the executor to the result recursively $result = Arr::recursively($result, function (&$value) use ($executor) { - /* The executor may only be applied to strings */ + // The executor may only be applied to strings if (is_string($value)) { - /* Strip the colors and update the value by reference */ + // Strip the colors and update the value by reference $value = $executor($value); } elseif (! is_array($value)) { $value = (string) $value; // TODO: Remove this in the next major version. @@ -77,12 +76,12 @@ public function apply(array $result, Server $server) }); } - /* Handle unit test data generation */ + // Handle unit test data generation if ($this->writeTestData) { - /* Add the filtered result to the unit test data */ + // Add the filtered result to the unit test data $unitTestData['filtered'][$server->id()] = $result; - /* Persist the collected data to the tests directory */ + // Persist the collected data to the tests directory file_put_contents( sprintf( '%s/../../../tests/Filters/Providers/Stripcolors\%s_1.json', @@ -94,7 +93,7 @@ public function apply(array $result, Server $server) } } - /* Return the filtered result */ + // Return the filtered result return $result; } @@ -138,23 +137,23 @@ protected function stripUnreal($string) */ protected function getExecutor(Server $server) { - /* Determine the correct executor for the current Protocol instance */ + // Determine the correct executor for the current Protocol instance switch ($server->protocol()->getProtocol()) { - /* Strip Protocols using Quake color tags */ + // Strip Protocols using Quake color tags case 'quake2': case 'quake3': case 'doom3': case 'gta5m': return [$this, 'stripQuake']; - /* Strip Protocols using Unreal color tags */ + // Strip Protocols using Unreal color tags case 'unreal2': case 'ut3': case 'gamespy3': // not sure if gamespy3 supports ut colors but won't hurt case 'gamespy2': return [$this, 'stripUnreal']; - /* Strip Protocols using Source color tags */ + // Strip Protocols using Source color tags case 'source': return [$this, 'stripSource']; diff --git a/src/GameQ/Filters/Test.php b/src/GameQ/Filters/Test.php index 836ddf3d..b51a0035 100644 --- a/src/GameQ/Filters/Test.php +++ b/src/GameQ/Filters/Test.php @@ -41,7 +41,6 @@ class Test extends Base */ public function apply(array $result, Server $server) { - return $result; } } diff --git a/src/GameQ/GameQ.php b/src/GameQ/GameQ.php index 229031dc..e60d0588 100644 --- a/src/GameQ/GameQ.php +++ b/src/GameQ/GameQ.php @@ -41,12 +41,10 @@ */ class GameQ { - /* - * Constants - */ + // Constants const PROTOCOLS_DIRECTORY = __DIR__ . '/Protocols'; - /* Static Section */ + // Static Section /** * Holds the instance of itself @@ -62,7 +60,6 @@ class GameQ */ public static function factory() { - // Create a new instance self::$instance = new self(); @@ -70,7 +67,7 @@ public static function factory() return self::$instance; } - /* Dynamic Section */ + // Dynamic Section /** * Default options @@ -126,7 +123,6 @@ public static function factory() */ public function __get($option) { - return isset($this->options[$option]) ? $this->options[$option] : null; } @@ -140,7 +136,6 @@ public function __get($option) */ public function __set($option, $value) { - $this->options[$option] = $value; return true; @@ -166,7 +161,6 @@ public function getOptions() */ public function setOption($var, $value) { - // Use magic $this->{$var} = $value; @@ -182,7 +176,6 @@ public function setOption($var, $value) */ public function addServer(array $server_info = []) { - // Add and validate the server $this->servers[uniqid()] = new Server($server_info); @@ -198,7 +191,6 @@ public function addServer(array $server_info = []) */ public function addServers(array $servers = []) { - // Loop through all the servers and add them foreach ($servers as $server_info) { $this->addServer($server_info); @@ -219,7 +211,6 @@ public function addServers(array $servers = []) */ public function addServersFromFiles($files = []) { - // Since we expect an array let us turn a string (i.e. single file) into an array if (!is_array($files)) { $files = [$files]; @@ -254,7 +245,6 @@ public function addServersFromFiles($files = []) */ public function clearServers() { - // Reset all the servers $this->servers = []; @@ -325,7 +315,6 @@ public function listFilters() */ public function process() { - // Initialize the query library we are using $class = new \ReflectionClass($this->queryLibrary); @@ -347,7 +336,7 @@ public function process() // Now we should have some information to process for each server foreach ($this->servers as $server) { - /* @var $server \GameQ\Server */ + // @var $server \GameQ\Server // Parse the responses for this server $result = $this->doParseResponse($server); @@ -370,7 +359,6 @@ public function process() */ protected function doChallenges() { - // Initialize the sockets for reading $sockets = []; @@ -379,7 +367,7 @@ protected function doChallenges() // Do challenge packets foreach ($this->servers as $server_id => $server) { - /* @var $server \GameQ\Server */ + // @var $server \GameQ\Server // This protocol has a challenge packet that needs to be sent if ($server->protocol()->hasChallenge()) { @@ -437,7 +425,7 @@ protected function doChallenges() $challenge = new Buffer(implode('', $response)); // Grab the server instance - /* @var $server \GameQ\Server */ + // @var $server \GameQ\Server $server = $this->servers[$server_id]; // Apply the challenge @@ -457,13 +445,12 @@ protected function doChallenges() */ protected function doQueries() { - // Initialize the array of sockets $sockets = []; // Iterate over the server list foreach ($this->servers as $server_id => $server) { - /* @var $server \GameQ\Server */ + // @var $server \GameQ\Server // Invoke the beforeSend method $server->protocol()->beforeSend($server); @@ -532,7 +519,7 @@ protected function doQueries() $server_id = $sockets[$socket_id]['server_id']; // Grab the server instance - /* @var $server \GameQ\Server */ + // @var $server \GameQ\Server $server = $this->servers[$server_id]; // Save the response from this packet @@ -543,7 +530,7 @@ protected function doQueries() // Now we need to close all of the sockets foreach ($sockets as $socketInfo) { - /* @var $socket \GameQ\Query\Core */ + // @var $socket \GameQ\Query\Core $socket = $socketInfo['socket']; // Close the socket @@ -565,7 +552,6 @@ protected function doQueries() */ protected function doParseResponse(Server $server) { - try { // @codeCoverageIgnoreStart // We want to save this server's response to a file (useful for unit testing) @@ -621,7 +607,6 @@ protected function doParseResponse(Server $server) */ protected function doApplyFilters(array $results, Server $server) { - // Loop over the filters foreach ($this->options['filters'] as $filterOptions) { // Try to do this filter diff --git a/src/GameQ/Helpers/Arr.php b/src/GameQ/Helpers/Arr.php index 05fc5483..9c45c715 100644 --- a/src/GameQ/Helpers/Arr.php +++ b/src/GameQ/Helpers/Arr.php @@ -43,34 +43,34 @@ class Arr */ public static function recursively(array $data, Closure $callback) { - /* Initialize the RecursiveArrayIterator for the provided data */ + // Initialize the RecursiveArrayIterator for the provided data $arrayIterator = new RecursiveArrayIterator($data); - /* Configure the Iterator for the RecursiveIterator */ + // Configure the Iterator for the RecursiveIterator $recursiveIterator = new RecursiveIteratorIterator($arrayIterator); - /* Traverse the provided data */ + // Traverse the provided data foreach ($recursiveIterator as $key => $value) { - /* Get the current sub iterator with Type hinting */ + // Get the current sub iterator with Type hinting /** @var RecursiveArrayIterator */ $subIterator = $recursiveIterator->getSubIterator(); - /* Wrap the implementation to handle PHP < 8.1 behaviour */ + // Wrap the implementation to handle PHP < 8.1 behaviour static::handleArrayIteratorCopyOrReference( $data, $recursiveIterator, $subIterator, function () use ($callback, &$value, $key, $subIterator) { - /* Execute the callback */ + // Execute the callback $callback($value, $key, $subIterator); - /* Update the modified value */ + // Update the modified value $subIterator->offsetSet($key, $value); } ); } - /* Return the processed data */ + // Return the processed data return static::getArrayIteratorCopyOrReference($data, $arrayIterator); } @@ -85,13 +85,13 @@ public static function hashes(array $array) { $hashes = []; - /* Process the provided array */ + // Process the provided array foreach ($array as $key => $value) { - /* Serialze and hash each value individually */ + // Serialze and hash each value individually $hashes[$key] = md5(serialize($value)); } - /* Return array containing the hashes */ + // Return array containing the hashes return $hashes; } @@ -107,24 +107,24 @@ public static function set(array &$array, array $path, $value) { $current = &$array; - /* Process the path until the last element */ + // Process the path until the last element foreach ($path as $i => $element) { - /* Remove the element from the path */ + // Remove the element from the path unset($path[$i]); - /* Create missing key */ + // Create missing key if (! isset($current[$element])) { $current[$element] = []; } - /* Set current to a reference of next */ + // Set current to a reference of next $current = &$current[$element]; } - /* Finally set the value using the last key */ + // Finally set the value using the last key $current = $value; - /* Return the current, modified array (level) */ + // Return the current, modified array (level) return $array; } @@ -138,14 +138,14 @@ public static function set(array &$array, array $path, $value) */ public static function shift(&...$args) { - /* Get the array keys to ensure numeric index */ + // Get the array keys to ensure numeric index $keys = array_keys($args); - /* Iterate the provided arguments keys in order */ + // Iterate the provided arguments keys in order foreach ($keys as $i => $key) { - /* Process until the last argument */ + // Process until the last argument if ($i < count($keys) - 1) { - /* Shift next into current */ + // Shift next into current $args[$key] = $args[$keys[$i + 1]]; } } diff --git a/src/GameQ/Helpers/Arr/Recursively.php b/src/GameQ/Helpers/Arr/Recursively.php index 0deb8256..1db876bd 100644 --- a/src/GameQ/Helpers/Arr/Recursively.php +++ b/src/GameQ/Helpers/Arr/Recursively.php @@ -47,30 +47,30 @@ protected static function handleArrayIteratorCopyOrReference( RecursiveArrayIterator $iterator, Closure $callback ) { - /* ArrayIterator before PHP 8.1 does use a copy instead of reference */ + // ArrayIterator before PHP 8.1 does use a copy instead of reference if (PHP_VERSION_ID < 80100) { - /* Hash the current state of the iterator */ + // Hash the current state of the iterator $hashes = static::hashes((array) $iterator); - /* Continue with the provided callback */ + // Continue with the provided callback $callback(); - /* Determine if the current iterator has been modified */ + // Determine if the current iterator has been modified if (! empty($diff = array_diff_assoc(static::hashes((array) $iterator), $hashes))) { - /* Determine path to the current iterator */ + // Determine path to the current iterator $path = []; for ($depth = 0; $depth < $recursiveIterator->getDepth(); $depth++) { $path[] = $recursiveIterator->getSubIterator($depth)->key(); } - /* Process all modified values */ + // Process all modified values foreach (array_keys($diff) as $modified) { - /* Write the modified value to the original array */ + // Write the modified value to the original array static::set($data, array_merge($path, [$modified]), $iterator->offsetGet($modified)); } } } else { - /* There is no need to write back any changes when ArrayIterator does use a reference */ + // There is no need to write back any changes when ArrayIterator does use a reference $callback(); } } @@ -78,10 +78,10 @@ protected static function handleArrayIteratorCopyOrReference( protected static function getArrayIteratorCopyOrReference(array &$data, ArrayIterator $arrayIterator) { if (PHP_VERSION_ID < 80100) { - /* Return the actual array reference */ + // Return the actual array reference return $data; } else { - /* Return the ArrayIterator's internal reference */ + // Return the ArrayIterator's internal reference return $arrayIterator->getArrayCopy(); } } diff --git a/src/GameQ/Protocol.php b/src/GameQ/Protocol.php index dcfd9e91..aae2e217 100644 --- a/src/GameQ/Protocol.php +++ b/src/GameQ/Protocol.php @@ -214,7 +214,6 @@ abstract class Protocol */ public function __construct(array $options = []) { - // Set the options for this specific instance of the class $this->options = $options; } @@ -226,7 +225,6 @@ public function __construct(array $options = []) */ public function __toString() { - return $this->name; } @@ -237,7 +235,6 @@ public function __toString() */ public function portDiff() { - return $this->port_diff; } @@ -252,7 +249,6 @@ public function portDiff() */ public function findQueryPort($clientPort) { - return $clientPort + $this->port_diff; } @@ -263,7 +259,6 @@ public function findQueryPort($clientPort) */ public function joinLink() { - return $this->join_link; } @@ -274,7 +269,6 @@ public function joinLink() */ public function name() { - return $this->name; } @@ -285,7 +279,6 @@ public function name() */ public function nameLong() { - return $this->name_long; } @@ -296,7 +289,6 @@ public function nameLong() */ public function state() { - return $this->state; } @@ -307,7 +299,6 @@ public function state() */ public function getProtocol() { - return $this->protocol; } @@ -320,7 +311,6 @@ public function getProtocol() */ public function transport($type = null) { - // Act as setter if (!is_null($type)) { $this->transport = $type; @@ -338,7 +328,6 @@ public function transport($type = null) */ public function options($options = []) { - // Act as setter if (!empty($options)) { $this->options = $options; @@ -348,9 +337,7 @@ public function options($options = []) } - /* - * Packet Section - */ + // Packet Section /** * Return specific packet(s) @@ -361,7 +348,6 @@ public function options($options = []) */ public function getPacket($type = []) { - $packets = []; @@ -403,7 +389,6 @@ public function getPacket($type = []) */ public function packetResponse(array $response = []) { - // Act as setter if (!empty($response)) { $this->packets_response = $response; @@ -413,9 +398,7 @@ public function packetResponse(array $response = []) } - /* - * Challenge section - */ + // Challenge section /** * Determine whether or not this protocol has a challenge needed before querying @@ -452,7 +435,6 @@ public function challengeParseAndApply(Buffer $challenge_buffer) */ protected function challengeApply($challenge_string) { - // Let's loop through all the packets and append the challenge where it is needed foreach ($this->packets as $packet_type => $packet) { $this->packets[$packet_type] = sprintf($packet, $challenge_string); @@ -468,13 +450,10 @@ protected function challengeApply($challenge_string) */ public function getNormalize() { - return $this->normalize; } - /* - * General - */ + // General /** * Generic method to allow protocol classes to do work right before the query is sent diff --git a/src/GameQ/Protocols/Aa3.php b/src/GameQ/Protocols/Aa3.php index 1ba45a6e..7ce62ca7 100644 --- a/src/GameQ/Protocols/Aa3.php +++ b/src/GameQ/Protocols/Aa3.php @@ -26,7 +26,6 @@ */ class Aa3 extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Arkse.php b/src/GameQ/Protocols/Arkse.php index d36380aa..4f144d00 100644 --- a/src/GameQ/Protocols/Arkse.php +++ b/src/GameQ/Protocols/Arkse.php @@ -26,7 +26,6 @@ */ class Arkse extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Armedassault2oa.php b/src/GameQ/Protocols/Armedassault2oa.php index 67d13dd3..b2aa593a 100644 --- a/src/GameQ/Protocols/Armedassault2oa.php +++ b/src/GameQ/Protocols/Armedassault2oa.php @@ -26,7 +26,6 @@ */ class Armedassault2oa extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Ase.php b/src/GameQ/Protocols/Ase.php index a37e6b9c..8b745bd3 100644 --- a/src/GameQ/Protocols/Ase.php +++ b/src/GameQ/Protocols/Ase.php @@ -18,8 +18,8 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; +use GameQ\Protocol; use GameQ\Result; /** @@ -30,7 +30,6 @@ */ class Ase extends Protocol { - /** * Array of packets we want to look up. * Each key should correspond to a defined method in this or a parent class @@ -140,9 +139,7 @@ public function processResponse() return $result->fetch(); } - /* - * Internal methods - */ + // Internal methods /** * Handles processing the extra key/value pairs for server settings @@ -153,7 +150,6 @@ public function processResponse() */ protected function processKeyValuePairs(Buffer &$buffer, Result &$result) { - // Key / value pairs while ($buffer->getLength()) { $key = $buffer->readPascalString(1, true); @@ -182,7 +178,6 @@ protected function processKeyValuePairs(Buffer &$buffer, Result &$result) */ protected function processPlayersAndTeams(Buffer &$buffer, Result &$result) { - // Players and team info while ($buffer->getLength()) { // Get the flags diff --git a/src/GameQ/Protocols/Atlas.php b/src/GameQ/Protocols/Atlas.php index 306c3298..dbec4aa8 100644 --- a/src/GameQ/Protocols/Atlas.php +++ b/src/GameQ/Protocols/Atlas.php @@ -26,7 +26,6 @@ */ class Atlas extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Batt1944.php b/src/GameQ/Protocols/Batt1944.php index def04c97..4e1957e7 100644 --- a/src/GameQ/Protocols/Batt1944.php +++ b/src/GameQ/Protocols/Batt1944.php @@ -26,7 +26,6 @@ */ class Batt1944 extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Bf1942.php b/src/GameQ/Protocols/Bf1942.php index ae6f23ed..aaebf0e6 100644 --- a/src/GameQ/Protocols/Bf1942.php +++ b/src/GameQ/Protocols/Bf1942.php @@ -26,7 +26,6 @@ */ class Bf1942 extends Gamespy { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Bf2.php b/src/GameQ/Protocols/Bf2.php index c6a0c829..25662b72 100644 --- a/src/GameQ/Protocols/Bf2.php +++ b/src/GameQ/Protocols/Bf2.php @@ -26,7 +26,6 @@ */ class Bf2 extends Gamespy3 { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Bf3.php b/src/GameQ/Protocols/Bf3.php index c32dded3..e696a041 100644 --- a/src/GameQ/Protocols/Bf3.php +++ b/src/GameQ/Protocols/Bf3.php @@ -18,10 +18,10 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; +use GameQ\Protocol; +use GameQ\Result; /** * Battlefield 3 Protocol Class @@ -33,7 +33,6 @@ */ class Bf3 extends Protocol { - /** * Array of packets we want to query. * @@ -127,7 +126,6 @@ class Bf3 extends Protocol */ public function processResponse() { - // Holds the results sent back $results = []; @@ -183,9 +181,7 @@ public function processResponse() return $results; } - /* - * Internal Methods - */ + // Internal Methods /** * Decode the buffer into a usable format @@ -197,7 +193,6 @@ public function processResponse() */ protected function decode(Buffer $buffer) { - $items = []; // Get the number of words in this buffer @@ -224,7 +219,6 @@ protected function decode(Buffer $buffer) */ protected function processDetails(Buffer $buffer) { - // Decode into items $items = $this->decode($buffer); @@ -291,7 +285,6 @@ protected function processDetails(Buffer $buffer) */ protected function processVersion(Buffer $buffer) { - // Decode into items $items = $this->decode($buffer); @@ -315,7 +308,6 @@ protected function processVersion(Buffer $buffer) */ protected function processPlayers(Buffer $buffer) { - // Decode into items $items = $this->decode($buffer); diff --git a/src/GameQ/Protocols/Bf4.php b/src/GameQ/Protocols/Bf4.php index ee29c84c..2072e385 100644 --- a/src/GameQ/Protocols/Bf4.php +++ b/src/GameQ/Protocols/Bf4.php @@ -31,7 +31,6 @@ */ class Bf4 extends Bf3 { - /** * String name of this protocol class * @@ -56,7 +55,6 @@ class Bf4 extends Bf3 */ protected function processDetails(Buffer $buffer) { - // Decode into items $items = $this->decode($buffer); diff --git a/src/GameQ/Protocols/Bfbc2.php b/src/GameQ/Protocols/Bfbc2.php index ccf27506..f4bb3f08 100644 --- a/src/GameQ/Protocols/Bfbc2.php +++ b/src/GameQ/Protocols/Bfbc2.php @@ -18,10 +18,10 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; +use GameQ\Protocol; +use GameQ\Result; /** * Battlefield Bad Company 2 Protocol Class @@ -36,7 +36,6 @@ */ class Bfbc2 extends Protocol { - /** * Array of packets we want to query. * @@ -164,9 +163,7 @@ public function processResponse() return $results; } - /* - * Internal Methods - */ + // Internal Methods /** * Decode the buffer into a usable format diff --git a/src/GameQ/Protocols/Cfx.php b/src/GameQ/Protocols/Cfx.php index 35e304de..8727630c 100644 --- a/src/GameQ/Protocols/Cfx.php +++ b/src/GameQ/Protocols/Cfx.php @@ -145,9 +145,7 @@ public function processResponse() return $results; } - /* - * Internal methods - */ + // Internal methods /** * Handle processing the status response diff --git a/src/GameQ/Protocols/Cfxplayers.php b/src/GameQ/Protocols/Cfxplayers.php index 02897c38..3afc4a19 100644 --- a/src/GameQ/Protocols/Cfxplayers.php +++ b/src/GameQ/Protocols/Cfxplayers.php @@ -20,7 +20,6 @@ namespace GameQ\Protocols; use GameQ\Exception\Protocol as Exception; -use GameQ\Protocols\Http; /** * GTA Five M Protocol Class diff --git a/src/GameQ/Protocols/Codmw3.php b/src/GameQ/Protocols/Codmw3.php index 816e7cc2..2d10ab4f 100644 --- a/src/GameQ/Protocols/Codmw3.php +++ b/src/GameQ/Protocols/Codmw3.php @@ -26,7 +26,6 @@ */ class Codmw3 extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Cs15.php b/src/GameQ/Protocols/Cs15.php index b10633d1..f94801b9 100644 --- a/src/GameQ/Protocols/Cs15.php +++ b/src/GameQ/Protocols/Cs15.php @@ -28,7 +28,6 @@ */ class Cs15 extends Won { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Cs16.php b/src/GameQ/Protocols/Cs16.php index 399048fb..96b1d373 100644 --- a/src/GameQ/Protocols/Cs16.php +++ b/src/GameQ/Protocols/Cs16.php @@ -26,7 +26,6 @@ */ class Cs16 extends Source { - /** * String name of this protocol class * @@ -53,7 +52,6 @@ class Cs16 extends Source */ protected function processPackets($packet_id, array $packets = []) { - // The response is gold source if the packets are split $this->source_engine = self::GOLDSOURCE_ENGINE; diff --git a/src/GameQ/Protocols/Cs2d.php b/src/GameQ/Protocols/Cs2d.php index 5909f424..2ffe0ef2 100644 --- a/src/GameQ/Protocols/Cs2d.php +++ b/src/GameQ/Protocols/Cs2d.php @@ -18,11 +18,11 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; /** * Counter-Strike 2d Protocol Class @@ -34,7 +34,6 @@ */ class Cs2d extends Protocol { - /** * Array of packets we want to query. * @@ -225,7 +224,6 @@ protected function processDetails(Buffer $buffer) */ protected function processPlayers(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); diff --git a/src/GameQ/Protocols/Cscz.php b/src/GameQ/Protocols/Cscz.php index bde20914..1f998d37 100644 --- a/src/GameQ/Protocols/Cscz.php +++ b/src/GameQ/Protocols/Cscz.php @@ -28,7 +28,6 @@ */ class Cscz extends Cs16 { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Csgo.php b/src/GameQ/Protocols/Csgo.php index db41d01f..57983b3b 100644 --- a/src/GameQ/Protocols/Csgo.php +++ b/src/GameQ/Protocols/Csgo.php @@ -26,7 +26,6 @@ */ class Csgo extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Dal.php b/src/GameQ/Protocols/Dal.php index f208d315..d09a4d06 100644 --- a/src/GameQ/Protocols/Dal.php +++ b/src/GameQ/Protocols/Dal.php @@ -26,7 +26,6 @@ */ class Dal extends Arkse { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Dayz.php b/src/GameQ/Protocols/Dayz.php index d7d16595..29779ab6 100644 --- a/src/GameQ/Protocols/Dayz.php +++ b/src/GameQ/Protocols/Dayz.php @@ -26,7 +26,6 @@ */ class Dayz extends Source { - /** * String name of this protocol class * @@ -50,7 +49,6 @@ class Dayz extends Source */ public function findQueryPort($clientPort) { - /* * Port layout: * 2302 - 27016 diff --git a/src/GameQ/Protocols/Dayzmod.php b/src/GameQ/Protocols/Dayzmod.php index a3c9a130..a2fee875 100644 --- a/src/GameQ/Protocols/Dayzmod.php +++ b/src/GameQ/Protocols/Dayzmod.php @@ -27,7 +27,6 @@ */ class Dayzmod extends Armedassault2oa { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Dod.php b/src/GameQ/Protocols/Dod.php index 311aaf8c..e56387c3 100644 --- a/src/GameQ/Protocols/Dod.php +++ b/src/GameQ/Protocols/Dod.php @@ -28,7 +28,6 @@ */ class Dod extends Cs16 { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Dow.php b/src/GameQ/Protocols/Dow.php index 438cea17..7f8f27da 100644 --- a/src/GameQ/Protocols/Dow.php +++ b/src/GameQ/Protocols/Dow.php @@ -18,8 +18,6 @@ namespace GameQ\Protocols; -use GameQ\Buffer; - /** * Class Dow * diff --git a/src/GameQ/Protocols/Egs.php b/src/GameQ/Protocols/Egs.php index fc32afb2..1f55baa8 100644 --- a/src/GameQ/Protocols/Egs.php +++ b/src/GameQ/Protocols/Egs.php @@ -27,7 +27,6 @@ */ class Egs extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Etqw.php b/src/GameQ/Protocols/Etqw.php index 7150b7b1..7003bf3b 100644 --- a/src/GameQ/Protocols/Etqw.php +++ b/src/GameQ/Protocols/Etqw.php @@ -30,7 +30,6 @@ */ class Etqw extends Protocol { - /** * Array of packets we want to look up. * Each key should correspond to a defined method in this or a parent class @@ -122,9 +121,7 @@ public function processResponse() return $results; } - /* - * Internal methods - */ + // Internal methods /** * Handle processing the status response diff --git a/src/GameQ/Protocols/Ffe.php b/src/GameQ/Protocols/Ffe.php index 2594f473..f2f0730e 100644 --- a/src/GameQ/Protocols/Ffe.php +++ b/src/GameQ/Protocols/Ffe.php @@ -26,7 +26,6 @@ */ class Ffe extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Ffow.php b/src/GameQ/Protocols/Ffow.php index bdfb2964..b61455f9 100644 --- a/src/GameQ/Protocols/Ffow.php +++ b/src/GameQ/Protocols/Ffow.php @@ -3,10 +3,10 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; +use GameQ\Protocol; +use GameQ\Result; /** * Frontlines Fuel of War Protocol Class @@ -206,8 +206,7 @@ protected function processRules(Buffer $buffer) // Check for map if (strstr($key, "Map:")) { $result->addSub("maplist", "name", $buffer->readString()); - } else // Regular rule - { + } else { // Regular rule $result->add($key, $buffer->readString()); } } diff --git a/src/GameQ/Protocols/Gamespy.php b/src/GameQ/Protocols/Gamespy.php index 0581702f..f03cb4e7 100644 --- a/src/GameQ/Protocols/Gamespy.php +++ b/src/GameQ/Protocols/Gamespy.php @@ -18,11 +18,11 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; -use \GameQ\Exception\Protocol as Exception; +use GameQ\Exception\Protocol as Exception; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; /** * GameSpy Protocol class @@ -31,7 +31,6 @@ */ class Gamespy extends Protocol { - /** * Array of packets we want to look up. * Each key should correspond to a defined method in this or a parent class @@ -97,9 +96,7 @@ public function processResponse() return $this->processStatus(new Buffer(implode('', $processed))); } - /* - * Internal methods - */ + // Internal methods /** * Handle processing the status buffer diff --git a/src/GameQ/Protocols/Gamespy2.php b/src/GameQ/Protocols/Gamespy2.php index 5400f790..3dcccdf0 100644 --- a/src/GameQ/Protocols/Gamespy2.php +++ b/src/GameQ/Protocols/Gamespy2.php @@ -18,11 +18,11 @@ namespace GameQ\Protocols; +use GameQ\Buffer; use GameQ\Exception\Protocol as Exception; +use GameQ\Helpers\Str; use GameQ\Protocol; -use GameQ\Buffer; use GameQ\Result; -use GameQ\Helpers\Str; /** * GameSpy2 Protocol class @@ -35,7 +35,6 @@ */ class Gamespy2 extends Protocol { - /** * Define the state of this class * @@ -114,7 +113,6 @@ class Gamespy2 extends Protocol */ public function processResponse() { - // Will hold the packets after sorting $packets = []; @@ -152,9 +150,7 @@ public function processResponse() return $results; } - /* - * Internal methods - */ + // Internal methods /** * Handles processing the details data into a usable format @@ -167,7 +163,6 @@ public function processResponse() */ protected function processDetails(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); @@ -196,7 +191,6 @@ protected function processDetails(Buffer $buffer) */ protected function processPlayers(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); @@ -226,7 +220,6 @@ protected function processPlayers(Buffer $buffer) */ protected function parsePlayerTeam($dataType, Buffer &$buffer, Result &$result) { - // Do count $result->add('num_' . $dataType, $buffer->readInt8()); diff --git a/src/GameQ/Protocols/Gamespy3.php b/src/GameQ/Protocols/Gamespy3.php index 149f3021..131dea4a 100644 --- a/src/GameQ/Protocols/Gamespy3.php +++ b/src/GameQ/Protocols/Gamespy3.php @@ -18,10 +18,10 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; /** * GameSpy3 Protocol class @@ -34,7 +34,6 @@ */ class Gamespy3 extends Protocol { - /** * Array of packets we want to look up. * Each key should correspond to a defined method in this or a parent class @@ -115,7 +114,6 @@ public function challengeParseAndApply(Buffer $challenge_buffer) */ public function processResponse() { - // Holds the processed packets $processed = []; @@ -174,9 +172,7 @@ public function processResponse() return $result->fetch(); } - /* - * Internal methods - */ + // Internal methods /** * Handles cleaning up packets since the responses can be a bit "dirty" @@ -188,7 +184,6 @@ public function processResponse() */ protected function cleanPackets(array $packets = []) { - // Get the number of packets $packetCount = count($packets); @@ -243,7 +238,6 @@ protected function cleanPackets(array $packets = []) */ protected function processDetails(Buffer &$buffer, Result &$result) { - // We go until we hit an empty key while ($buffer->getLength()) { $key = $buffer->readString(); diff --git a/src/GameQ/Protocols/Had2.php b/src/GameQ/Protocols/Had2.php index 04b0ae4e..7254556e 100644 --- a/src/GameQ/Protocols/Had2.php +++ b/src/GameQ/Protocols/Had2.php @@ -25,7 +25,6 @@ */ class Had2 extends Gamespy2 { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Halo.php b/src/GameQ/Protocols/Halo.php index 8f3e9c83..1d6b86bc 100644 --- a/src/GameQ/Protocols/Halo.php +++ b/src/GameQ/Protocols/Halo.php @@ -25,7 +25,6 @@ */ class Halo extends Gamespy2 { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Justcause3.php b/src/GameQ/Protocols/Justcause3.php index 8454627c..684e3ed0 100644 --- a/src/GameQ/Protocols/Justcause3.php +++ b/src/GameQ/Protocols/Justcause3.php @@ -26,7 +26,6 @@ */ class Justcause3 extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Killingfloor.php b/src/GameQ/Protocols/Killingfloor.php index ad117c84..ec75d88e 100644 --- a/src/GameQ/Protocols/Killingfloor.php +++ b/src/GameQ/Protocols/Killingfloor.php @@ -19,8 +19,8 @@ namespace GameQ\Protocols; use GameQ\Buffer; -use GameQ\Result; use GameQ\Helpers\Str; +use GameQ\Result; /** * Class Killing floor @@ -30,7 +30,6 @@ */ class Killingfloor extends Unreal2 { - /** * String name of this protocol class * @@ -69,7 +68,6 @@ class Killingfloor extends Unreal2 */ protected function processDetails(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); diff --git a/src/GameQ/Protocols/Killingfloor2.php b/src/GameQ/Protocols/Killingfloor2.php index 5f1f72a9..2074e279 100644 --- a/src/GameQ/Protocols/Killingfloor2.php +++ b/src/GameQ/Protocols/Killingfloor2.php @@ -26,7 +26,6 @@ */ class Killingfloor2 extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Lhmp.php b/src/GameQ/Protocols/Lhmp.php index ff237fc2..fa1faad7 100644 --- a/src/GameQ/Protocols/Lhmp.php +++ b/src/GameQ/Protocols/Lhmp.php @@ -18,11 +18,11 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; /** * Lost Heaven Protocol class @@ -33,7 +33,6 @@ */ class Lhmp extends Protocol { - /** * Array of packets we want to look up. * Each key should correspond to a defined method in this or a parent class @@ -150,9 +149,7 @@ public function processResponse() return $results; } - /* - * Internal methods - */ + // Internal methods /** * Handles processing the details data into a usable format @@ -164,7 +161,6 @@ public function processResponse() */ protected function processDetails(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); @@ -191,7 +187,6 @@ protected function processDetails(Buffer $buffer) */ protected function processPlayers(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); diff --git a/src/GameQ/Protocols/M2mp.php b/src/GameQ/Protocols/M2mp.php index 4908b013..9b4d24c2 100644 --- a/src/GameQ/Protocols/M2mp.php +++ b/src/GameQ/Protocols/M2mp.php @@ -18,11 +18,11 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; /** * Mafia 2 Multiplayer Protocol Class diff --git a/src/GameQ/Protocols/Minecraft.php b/src/GameQ/Protocols/Minecraft.php index 941e5bcf..5235d0c3 100644 --- a/src/GameQ/Protocols/Minecraft.php +++ b/src/GameQ/Protocols/Minecraft.php @@ -40,7 +40,6 @@ */ class Minecraft extends Gamespy3 { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Minecraftbe.php b/src/GameQ/Protocols/Minecraftbe.php index 7bbd1e33..1895b017 100644 --- a/src/GameQ/Protocols/Minecraftbe.php +++ b/src/GameQ/Protocols/Minecraftbe.php @@ -27,7 +27,6 @@ */ class Minecraftbe extends Raknet { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Minecraftpe.php b/src/GameQ/Protocols/Minecraftpe.php index fa1f9644..d0afff6d 100644 --- a/src/GameQ/Protocols/Minecraftpe.php +++ b/src/GameQ/Protocols/Minecraftpe.php @@ -27,7 +27,6 @@ */ class Minecraftpe extends Minecraft { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Mordhau.php b/src/GameQ/Protocols/Mordhau.php index dbb3cc01..16531ba6 100644 --- a/src/GameQ/Protocols/Mordhau.php +++ b/src/GameQ/Protocols/Mordhau.php @@ -26,7 +26,6 @@ */ class Mordhau extends Source { - /** * String name of this protocol class * @@ -41,7 +40,7 @@ class Mordhau extends Source */ protected $name_long = "MORDHAU"; - #protected $port = 7777; + //protected $port = 7777; /** * query_port = client_port + 19238 @@ -49,5 +48,5 @@ class Mordhau extends Source * * @var int */ - #protected $port_diff = 19238; + //protected $port_diff = 19238; } diff --git a/src/GameQ/Protocols/Mta.php b/src/GameQ/Protocols/Mta.php index f042e2f2..cd4717d8 100644 --- a/src/GameQ/Protocols/Mta.php +++ b/src/GameQ/Protocols/Mta.php @@ -28,7 +28,6 @@ */ class Mta extends Ase { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Mumble.php b/src/GameQ/Protocols/Mumble.php index aa7a0e7d..ff544731 100644 --- a/src/GameQ/Protocols/Mumble.php +++ b/src/GameQ/Protocols/Mumble.php @@ -18,9 +18,9 @@ namespace GameQ\Protocols; +use GameQ\Exception\Protocol as Exception; use GameQ\Protocol; use GameQ\Result; -use GameQ\Exception\Protocol as Exception; /** * Mumble Protocol class @@ -32,7 +32,6 @@ */ class Mumble extends Protocol { - /** * Array of packets we want to look up. * Each key should correspond to a defined method in this or a parent class @@ -120,7 +119,6 @@ class Mumble extends Protocol */ public function processResponse() { - // Try to json_decode, make it into an array if (($data = json_decode(implode('', $this->packets_response), true)) === null) { throw new Exception(__METHOD__ . " Unable to decode JSON data."); @@ -154,9 +152,7 @@ public function processResponse() return $result->fetch(); } - /* - * Internal methods - */ + // Internal methods /** * Handles processing the the channels and user info @@ -166,7 +162,6 @@ public function processResponse() */ protected function processChannelsAndUsers(array $data, Result &$result) { - // Let's add all of the channel information foreach ($data as $key => $value) { // We will handle these later diff --git a/src/GameQ/Protocols/Openttd.php b/src/GameQ/Protocols/Openttd.php index 40308a84..2b0b78d7 100644 --- a/src/GameQ/Protocols/Openttd.php +++ b/src/GameQ/Protocols/Openttd.php @@ -18,10 +18,10 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; +use GameQ\Protocol; +use GameQ\Result; /** * OpenTTD Protocol Class @@ -128,7 +128,7 @@ protected function processServerInfo(Buffer $buffer) switch ($protocol_version) { case 4: - $num_grfs = $buffer->readInt8(); #number of grfs + $num_grfs = $buffer->readInt8(); //number of grfs $result->add('num_grfs', $num_grfs); //$buffer->skip ($num_grfs * 20); #skip grfs id and md5 hash @@ -136,16 +136,18 @@ protected function processServerInfo(Buffer $buffer) $result->add('grfs_'.$i.'_ID', strtoupper(bin2hex($buffer->read(4)))); $result->add('grfs_'.$i.'_MD5', strtoupper(bin2hex($buffer->read(16)))); } - // No break, cascades all the down even if case is meet + // no break, cascades all the down even if case is meet case 3: $result->add('game_date', $buffer->readInt32()); $result->add('start_date', $buffer->readInt32()); // Cascades all the way down even if case is meet + // no break case 2: $result->add('companies_max', $buffer->readInt8()); $result->add('companies_on', $buffer->readInt8()); $result->add('spectators_max', $buffer->readInt8()); // Cascades all the way down even if case is meet + // no break case 1: $result->add('hostname', $buffer->readString()); $result->add('version', $buffer->readString()); @@ -159,7 +161,7 @@ protected function processServerInfo(Buffer $buffer) $result->add('clients', $buffer->readInt8()); $result->add('spectators', $buffer->readInt8()); if ($protocol_version < 3) { - $days = ( 365 * 1920 + 1920 / 4 - 1920 / 100 + 1920 / 400 ); + $days = (365 * 1920 + 1920 / 4 - 1920 / 100 + 1920 / 400); $result->add('game_date', $buffer->readInt16() + $days); $result->add('start_date', $buffer->readInt16() + $days); } diff --git a/src/GameQ/Protocols/Pixark.php b/src/GameQ/Protocols/Pixark.php index 1f3eafe7..848b3e9b 100644 --- a/src/GameQ/Protocols/Pixark.php +++ b/src/GameQ/Protocols/Pixark.php @@ -26,7 +26,6 @@ */ class Pixark extends Arkse { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Projectrealitybf2.php b/src/GameQ/Protocols/Projectrealitybf2.php index 0eb710df..fe5aec5c 100644 --- a/src/GameQ/Protocols/Projectrealitybf2.php +++ b/src/GameQ/Protocols/Projectrealitybf2.php @@ -28,7 +28,6 @@ */ class Projectrealitybf2 extends Bf2 { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Quake2.php b/src/GameQ/Protocols/Quake2.php index 690648fe..d90993fe 100644 --- a/src/GameQ/Protocols/Quake2.php +++ b/src/GameQ/Protocols/Quake2.php @@ -3,11 +3,11 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; /** * Quake2 Protocol Class diff --git a/src/GameQ/Protocols/Quake3.php b/src/GameQ/Protocols/Quake3.php index 54356931..6b13b4ce 100644 --- a/src/GameQ/Protocols/Quake3.php +++ b/src/GameQ/Protocols/Quake3.php @@ -3,11 +3,11 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; /** * Quake3 Protocol Class diff --git a/src/GameQ/Protocols/Quake4.php b/src/GameQ/Protocols/Quake4.php index c6f6959b..c38b5310 100644 --- a/src/GameQ/Protocols/Quake4.php +++ b/src/GameQ/Protocols/Quake4.php @@ -19,8 +19,8 @@ namespace GameQ\Protocols; use GameQ\Buffer; -use GameQ\Result; use GameQ\Helpers\Str; +use GameQ\Result; /** * Quake 4 Protocol Class diff --git a/src/GameQ/Protocols/Risingstorm2.php b/src/GameQ/Protocols/Risingstorm2.php index 77052536..1159100d 100644 --- a/src/GameQ/Protocols/Risingstorm2.php +++ b/src/GameQ/Protocols/Risingstorm2.php @@ -26,7 +26,6 @@ */ class Risingstorm2 extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Rust.php b/src/GameQ/Protocols/Rust.php index 8c6fb684..63bb668f 100644 --- a/src/GameQ/Protocols/Rust.php +++ b/src/GameQ/Protocols/Rust.php @@ -28,7 +28,6 @@ */ class Rust extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Samp.php b/src/GameQ/Protocols/Samp.php index 61281230..4812d523 100644 --- a/src/GameQ/Protocols/Samp.php +++ b/src/GameQ/Protocols/Samp.php @@ -18,12 +18,12 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; -use GameQ\Server; use GameQ\Exception\Protocol as Exception; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; +use GameQ\Server; /** * San Andreas Multiplayer Protocol Class (samp) @@ -143,7 +143,6 @@ public function beforeSend(Server $server) */ public function processResponse() { - // Results that will be returned $results = []; @@ -185,9 +184,7 @@ public function processResponse() return $results; } - /* - * Internal methods - */ + // Internal methods /** * Handles processing the server status data @@ -198,7 +195,6 @@ public function processResponse() */ protected function processStatus(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); diff --git a/src/GameQ/Protocols/Serioussam.php b/src/GameQ/Protocols/Serioussam.php index 730a9b99..af902ad6 100644 --- a/src/GameQ/Protocols/Serioussam.php +++ b/src/GameQ/Protocols/Serioussam.php @@ -25,7 +25,6 @@ */ class Serioussam extends Gamespy { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Ship.php b/src/GameQ/Protocols/Ship.php index fb8cae6a..7ab9f523 100644 --- a/src/GameQ/Protocols/Ship.php +++ b/src/GameQ/Protocols/Ship.php @@ -31,7 +31,6 @@ */ class Ship extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Soldat.php b/src/GameQ/Protocols/Soldat.php index 80528d51..21de6769 100644 --- a/src/GameQ/Protocols/Soldat.php +++ b/src/GameQ/Protocols/Soldat.php @@ -28,7 +28,6 @@ */ class Soldat extends Ase { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Source.php b/src/GameQ/Protocols/Source.php index 027700c6..840c0e91 100644 --- a/src/GameQ/Protocols/Source.php +++ b/src/GameQ/Protocols/Source.php @@ -35,10 +35,7 @@ */ class Source extends Protocol { - - /* - * Source engine type constants - */ + // Source engine type constants const SOURCE_ENGINE = 0, GOLDSOURCE_ENGINE = 1; @@ -224,9 +221,7 @@ public function processResponse() return $results; } - /* - * Internal methods - */ + // Internal methods /** * Process the split packets and decompress if necessary @@ -240,7 +235,6 @@ public function processResponse() */ protected function processPackets($packet_id, array $packets = []) { - // Init array so we can order $packs = []; @@ -343,7 +337,6 @@ protected function processPackets($packet_id, array $packets = []) */ protected function processDetails(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); @@ -461,7 +454,6 @@ protected function processDetailsGoldSource(Buffer $buffer) */ protected function processPlayers(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); @@ -498,7 +490,6 @@ protected function processPlayers(Buffer $buffer) */ protected function processRules(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); diff --git a/src/GameQ/Protocols/Starmade.php b/src/GameQ/Protocols/Starmade.php index 977bf956..e127ce27 100644 --- a/src/GameQ/Protocols/Starmade.php +++ b/src/GameQ/Protocols/Starmade.php @@ -18,10 +18,10 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; +use GameQ\Protocol; +use GameQ\Result; /** * StarMade Protocol Class @@ -150,7 +150,6 @@ public function processResponse() */ protected function parseServerParameters(Buffer &$buffer) { - // Init the parsed data array $parsed = []; @@ -168,17 +167,17 @@ protected function parseServerParameters(Buffer &$buffer) $parsed[$i] = $buffer->readInt32Signed(); break; - // 64-bit int + // 64-bit int case 2: $parsed[$i] = $buffer->readInt64(); break; - // Float + // Float case 3: $parsed[$i] = $buffer->readFloat32(); break; - // String + // String case 4: // The first 2 bytes are the string length $strLength = $buffer->readInt16Signed(); @@ -189,22 +188,22 @@ protected function parseServerParameters(Buffer &$buffer) unset($strLength); break; - // Boolean + // Boolean case 5: $parsed[$i] = (bool)$buffer->readInt8Signed(); break; - // 8-bit int + // 8-bit int case 6: $parsed[$i] = $buffer->readInt8Signed(); break; - // 16-bit int + // 16-bit int case 7: $parsed[$i] = $buffer->readInt16Signed(); break; - // Array + // Array case 8: // Not implemented throw new Exception("StarMade array parsing is not implemented!"); diff --git a/src/GameQ/Protocols/Stationeers.php b/src/GameQ/Protocols/Stationeers.php index 25a60610..1cfcdeaa 100644 --- a/src/GameQ/Protocols/Stationeers.php +++ b/src/GameQ/Protocols/Stationeers.php @@ -118,11 +118,11 @@ class Stationeers extends Http */ public function beforeSend(Server $server) { - /* Determine the connection information to be used for the "Metaserver" */ + // Determine the connection information to be used for the "Metaserver" $metaServerHost = $server->getOption('meta_host') ? $server->getOption('meta_host') : self::SERVER_LIST_HOST; $metaServerPort = $server->getOption('meta_port') ? $server->getOption('meta_port') : self::SERVER_LIST_PORT; - /* Save the real connection information and overwrite the properties with the "Metaserver" connection information */ + // Save the real connection information and overwrite the properties with the "Metaserver" connection information Arr::shift($this->realIp, $server->ip, $metaServerHost); Arr::shift($this->realPortQuery, $server->port_query, $metaServerPort); } @@ -135,7 +135,7 @@ public function beforeSend(Server $server) */ public function processResponse() { - /* Ensure there is a reply from the "Metaserver" */ + // Ensure there is a reply from the "Metaserver" if (empty($this->packets_response)) { return []; } @@ -160,10 +160,10 @@ public function processResponse() } } - /* Send to the garbage collector */ + // Send to the garbage collector unset($matches, $serverEntry, $json); - /* Ensure the provided Server has been found in the list provided by the "Metaserver" */ + // Ensure the provided Server has been found in the list provided by the "Metaserver" if (! $server) { throw new Exception(sprintf( '%s Unable to find the server "%s:%d" in the Stationeer Metaservers server list', @@ -173,7 +173,7 @@ public function processResponse() )); } - /* Build the Result from the parsed JSON */ + // Build the Result from the parsed JSON $result = new Result(); $result->add('dedicated', 1); // Server is always dedicated $result->add('hostname', $server->Name); @@ -187,7 +187,7 @@ public function processResponse() $result->add('maxplayers', $server->MaxPlayers); $result->add('type', $server->Type); - /* Send to the garbage collector */ + // Send to the garbage collector unset($server); return $result->fetch(); diff --git a/src/GameQ/Protocols/Teamspeak2.php b/src/GameQ/Protocols/Teamspeak2.php index 46de9784..d7ac8ea6 100644 --- a/src/GameQ/Protocols/Teamspeak2.php +++ b/src/GameQ/Protocols/Teamspeak2.php @@ -18,12 +18,12 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; -use GameQ\Server; use GameQ\Exception\Protocol as Exception; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; +use GameQ\Server; /** * Teamspeak 2 Protocol Class @@ -37,7 +37,6 @@ */ class Teamspeak2 extends Protocol { - /** * Array of packets we want to look up. * Each key should correspond to a defined method in this or a parent class @@ -121,7 +120,6 @@ class Teamspeak2 extends Protocol */ public function beforeSend(Server $server) { - // Check to make sure we have a query_port because it is required if (!isset($this->options[Server::SERVER_OPTIONS_QUERY_PORT]) || empty($this->options[Server::SERVER_OPTIONS_QUERY_PORT]) @@ -144,7 +142,6 @@ public function beforeSend(Server $server) */ public function processResponse() { - // Make a new buffer out of all of the packets $buffer = new Buffer(implode('', $this->packets_response)); @@ -155,7 +152,6 @@ public function processResponse() // Split this buffer as the data blocks are bound by "OK" and drop any empty values $sections = array_filter(explode("OK", $buffer->getBuffer()), function ($value) { - $value = trim($value); return !empty($value); @@ -190,9 +186,7 @@ public function processResponse() return $result->fetch(); } - /* - * Internal methods - */ + // Internal methods /** @@ -269,7 +263,6 @@ protected function processChannels($data, Result &$result) */ protected function processPlayers($data, Result &$result) { - // Create a buffer $buffer = new Buffer($data); diff --git a/src/GameQ/Protocols/Teamspeak3.php b/src/GameQ/Protocols/Teamspeak3.php index 8cb78d02..4bafcbcb 100644 --- a/src/GameQ/Protocols/Teamspeak3.php +++ b/src/GameQ/Protocols/Teamspeak3.php @@ -18,12 +18,12 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; -use GameQ\Server; use GameQ\Exception\Protocol as Exception; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; +use GameQ\Server; /** * Teamspeak 3 Protocol Class @@ -37,7 +37,6 @@ */ class Teamspeak3 extends Protocol { - /** * Array of packets we want to look up. * Each key should correspond to a defined method in this or a parent class @@ -121,7 +120,6 @@ class Teamspeak3 extends Protocol */ public function beforeSend(Server $server) { - // Check to make sure we have a query_port because it is required if (!isset($this->options[Server::SERVER_OPTIONS_QUERY_PORT]) || empty($this->options[Server::SERVER_OPTIONS_QUERY_PORT]) @@ -144,7 +142,6 @@ public function beforeSend(Server $server) */ public function processResponse() { - // Make a new buffer out of all of the packets $buffer = new Buffer(implode('', $this->packets_response)); @@ -168,7 +165,6 @@ public function processResponse() // Explode the sections and filter to remove empty, junk ones $sections = array_filter(explode("\n", $raw), function ($value) { - $value = trim($value); // Not empty string or a message response for "error id=\d" @@ -204,9 +200,7 @@ public function processResponse() return $result->fetch(); } - /* - * Internal methods - */ + // Internal methods /** * Process the properties of the data. @@ -218,7 +212,6 @@ public function processResponse() */ protected function processProperties($data) { - // Will hold the properties we are sending back $properties = []; @@ -254,7 +247,6 @@ protected function processProperties($data) */ protected function processDetails($data, Result &$result) { - // Offload the parsing for these values $properties = $this->processProperties($data); @@ -284,7 +276,6 @@ protected function processDetails($data, Result &$result) */ protected function processChannels($data, Result &$result) { - // We need to split the data at the pipe $channels = explode('|', $data); @@ -311,7 +302,6 @@ protected function processChannels($data, Result &$result) */ protected function processPlayers($data, Result &$result) { - // We need to split the data at the pipe $players = explode('|', $data); diff --git a/src/GameQ/Protocols/Teeworlds.php b/src/GameQ/Protocols/Teeworlds.php index 2f4c7d1d..0bcfe5cb 100644 --- a/src/GameQ/Protocols/Teeworlds.php +++ b/src/GameQ/Protocols/Teeworlds.php @@ -18,10 +18,10 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; +use GameQ\Protocol; +use GameQ\Result; /** * Teeworlds Protocol class @@ -33,7 +33,6 @@ */ class Teeworlds extends Protocol { - /** * Array of packets we want to look up. * Each key should correspond to a defined method in this or a parent class diff --git a/src/GameQ/Protocols/Terraria.php b/src/GameQ/Protocols/Terraria.php index ab95cc10..5332d696 100644 --- a/src/GameQ/Protocols/Terraria.php +++ b/src/GameQ/Protocols/Terraria.php @@ -27,7 +27,6 @@ */ class Terraria extends Tshock { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Theforrest.php b/src/GameQ/Protocols/Theforrest.php index f8706266..d78f27e9 100644 --- a/src/GameQ/Protocols/Theforrest.php +++ b/src/GameQ/Protocols/Theforrest.php @@ -26,7 +26,6 @@ */ class Theforrest extends Source { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Tibia.php b/src/GameQ/Protocols/Tibia.php index 5085c61d..5ae2e625 100644 --- a/src/GameQ/Protocols/Tibia.php +++ b/src/GameQ/Protocols/Tibia.php @@ -18,10 +18,9 @@ namespace GameQ\Protocols; +use GameQ\Exception\Protocol as Exception; use GameQ\Protocol; -use GameQ\Buffer; use GameQ\Result; -use GameQ\Exception\Protocol as Exception; /** * Tibia Protocol Class @@ -35,7 +34,6 @@ */ class Tibia extends Protocol { - /** * Array of packets we want to query. * diff --git a/src/GameQ/Protocols/Unreal2.php b/src/GameQ/Protocols/Unreal2.php index 1e5f2e4b..9f218851 100644 --- a/src/GameQ/Protocols/Unreal2.php +++ b/src/GameQ/Protocols/Unreal2.php @@ -18,11 +18,11 @@ namespace GameQ\Protocols; -use GameQ\Protocol; use GameQ\Buffer; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; /** * Unreal 2 Protocol class @@ -31,7 +31,6 @@ */ class Unreal2 extends Protocol { - /** * Array of packets we want to look up. * Each key should correspond to a defined method in this or a parent class @@ -108,7 +107,6 @@ class Unreal2 extends Protocol */ public function processResponse() { - // Will hold the packets after sorting $packets = []; @@ -146,9 +144,7 @@ public function processResponse() return $results; } - /* - * Internal methods - */ + // Internal methods /** * Handles processing the details data into a usable format @@ -160,7 +156,6 @@ public function processResponse() */ protected function processDetails(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); @@ -189,7 +184,6 @@ protected function processDetails(Buffer $buffer) */ protected function processPlayers(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); @@ -222,7 +216,6 @@ protected function processPlayers(Buffer $buffer) */ protected function processRules(Buffer $buffer) { - // Set the result to a new result instance $result = new Result(); diff --git a/src/GameQ/Protocols/Ut.php b/src/GameQ/Protocols/Ut.php index 328b227b..f332378b 100644 --- a/src/GameQ/Protocols/Ut.php +++ b/src/GameQ/Protocols/Ut.php @@ -25,7 +25,6 @@ */ class Ut extends Gamespy { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Ut2004.php b/src/GameQ/Protocols/Ut2004.php index 2db5f7c0..11310342 100644 --- a/src/GameQ/Protocols/Ut2004.php +++ b/src/GameQ/Protocols/Ut2004.php @@ -25,7 +25,6 @@ */ class Ut2004 extends Unreal2 { - /** * String name of this protocol class * diff --git a/src/GameQ/Protocols/Ut3.php b/src/GameQ/Protocols/Ut3.php index 5bb7986d..6a427ef3 100644 --- a/src/GameQ/Protocols/Ut3.php +++ b/src/GameQ/Protocols/Ut3.php @@ -29,7 +29,6 @@ */ class Ut3 extends Gamespy3 { - /** * String name of this protocol class * @@ -109,7 +108,6 @@ public function processResponse() */ protected function renameResult(array &$result, $old, $new) { - // Check to see if the old item is there if (isset($result[$old])) { $result[$new] = $result[$old]; @@ -125,7 +123,6 @@ protected function renameResult(array &$result, $old, $new) */ protected function deleteResult(array &$result, array $array) { - foreach ($array as $key) { unset($result[$key]); } diff --git a/src/GameQ/Protocols/Ventrilo.php b/src/GameQ/Protocols/Ventrilo.php index 19a2b9ac..632d9555 100644 --- a/src/GameQ/Protocols/Ventrilo.php +++ b/src/GameQ/Protocols/Ventrilo.php @@ -18,10 +18,10 @@ namespace GameQ\Protocols; -use GameQ\Protocol; -use GameQ\Result; use GameQ\Exception\Protocol as Exception; use GameQ\Helpers\Str; +use GameQ\Protocol; +use GameQ\Result; /** * Ventrilo Protocol Class @@ -37,7 +37,6 @@ */ class Ventrilo extends Protocol { - /** * Array of packets we want to look up. * Each key should correspond to a defined method in this or a parent class @@ -639,7 +638,6 @@ class Ventrilo extends Protocol */ public function processResponse() { - // We need to decrypt the packets $decrypted = $this->decryptPackets($this->packets_response); @@ -647,7 +645,6 @@ public function processResponse() $decrypted = preg_replace_callback( '|%([0-9A-F]{2})|', function ($matches) { - // Pack this into ascii return pack('H*', $matches[1]); }, @@ -712,17 +709,17 @@ function ($matches) { $this->processChannel($value, $channelFields, $result); break; - // Find the number of fields for the channels + // Find the number of fields for the channels case 'channelfields': $channelFields = count(explode(',', $value)); break; - // Find the number of fields for the players + // Find the number of fields for the players case 'clientfields': $playerFields = count(explode(',', $value)); break; - // By default we just add they key as an item + // By default we just add they key as an item default: $result->add($key, Str::isoToUtf8($value)); break; @@ -735,9 +732,7 @@ function ($matches) { return $result->fetch(); } - /* - * Internal methods - */ + // Internal methods /** * Decrypt the incoming packets @@ -750,12 +745,11 @@ function ($matches) { */ protected function decryptPackets(array $packets = []) { - // This will be returned $decrypted = []; foreach ($packets as $packet) { - # Header : + // Header : $header = substr($packet, 0, 20); $header_items = []; @@ -805,7 +799,7 @@ protected function decryptPackets(array $packets = []) throw new Exception(__METHOD__ . ": Too few packets received"); } - # Data : + // Data : $table = $this->data_encrypt_table; $a1 = $header_items['datakey'] & 0xFF; $a2 = $header_items['datakey'] >> 8; @@ -841,7 +835,6 @@ protected function decryptPackets(array $packets = []) */ protected function processChannel($data, $fieldCount, Result &$result) { - // Split the items on the comma $items = explode(",", $data, $fieldCount); @@ -864,7 +857,6 @@ protected function processChannel($data, $fieldCount, Result &$result) */ protected function processPlayer($data, $fieldCount, Result &$result) { - // Split the items on the comma $items = explode(",", $data, $fieldCount); diff --git a/src/GameQ/Protocols/Warsow.php b/src/GameQ/Protocols/Warsow.php index ac24640a..7c4786f3 100644 --- a/src/GameQ/Protocols/Warsow.php +++ b/src/GameQ/Protocols/Warsow.php @@ -19,8 +19,8 @@ namespace GameQ\Protocols; use GameQ\Buffer; -use GameQ\Result; use GameQ\Helpers\Str; +use GameQ\Result; /** * Warsow Protocol Class diff --git a/src/GameQ/Query/Core.php b/src/GameQ/Query/Core.php index aaab7032..cbe1adc9 100644 --- a/src/GameQ/Query/Core.php +++ b/src/GameQ/Query/Core.php @@ -25,7 +25,6 @@ */ abstract class Core { - /** * The socket used by this resource * @@ -74,7 +73,6 @@ abstract class Core */ public function __clone() { - // Reset the properties for this class when cloned $this->reset(); } @@ -90,7 +88,6 @@ public function __clone() */ public function set($transport, $ip, $port, $timeout = 3, $blocking = false) { - $this->transport = $transport; $this->ip = $ip; @@ -107,7 +104,6 @@ public function set($transport, $ip, $port, $timeout = 3, $blocking = false) */ public function reset() { - $this->transport = null; $this->ip = null; diff --git a/src/GameQ/Query/Native.php b/src/GameQ/Query/Native.php index 24200b0c..af65884e 100644 --- a/src/GameQ/Query/Native.php +++ b/src/GameQ/Query/Native.php @@ -35,7 +35,6 @@ class Native extends Core */ public function get() { - // No socket for this server, make one if (is_null($this->socket)) { $this->create(); @@ -54,7 +53,6 @@ public function get() */ public function write($data) { - try { // No socket for this server, make one if (is_null($this->socket)) { @@ -73,7 +71,6 @@ public function write($data) */ public function close() { - if ($this->socket) { fclose($this->socket); $this->socket = null; @@ -87,7 +84,6 @@ public function close() */ protected function create() { - // Create the remote address $remote_addr = sprintf("%s://%s:%d", $this->transport, $this->ip, $this->port); @@ -144,7 +140,6 @@ protected function create() */ public function getResponses(array $sockets, $timeout, $stream_timeout) { - // Set the loop to active $loop_active = true; @@ -157,7 +152,7 @@ public function getResponses(array $sockets, $timeout, $stream_timeout) // Loop and pull out all the actual sockets we need to listen on foreach ($sockets as $socket_id => $socket_data) { // Get the socket - /* @var $socket \GameQ\Query\Core */ + // @var $socket \GameQ\Query\Core $socket = $socket_data['socket']; // Append the actual socket we are listening to @@ -196,7 +191,7 @@ public function getResponses(array $sockets, $timeout, $stream_timeout) // Loop the sockets that received data back foreach ($read as $socket) { - /* @var $socket resource */ + // @var $socket resource // See if we have a response if (($response = fread($socket, 32768)) === false) { diff --git a/src/GameQ/Result.php b/src/GameQ/Result.php index 7023f17a..ff88f209 100644 --- a/src/GameQ/Result.php +++ b/src/GameQ/Result.php @@ -26,7 +26,6 @@ */ class Result { - /** * Formatted server response * @@ -42,7 +41,6 @@ class Result */ public function add($name, $value) { - $this->result[$name] = $value; } @@ -54,7 +52,6 @@ public function add($name, $value) */ public function addPlayer($name, $value) { - $this->addSub('players', $name, $value); } @@ -66,7 +63,6 @@ public function addPlayer($name, $value) */ public function addTeam($name, $value) { - $this->addSub('teams', $name, $value); } @@ -79,7 +75,6 @@ public function addTeam($name, $value) */ public function addSub($sub, $key, $value) { - // Nothing of this type yet, set an empty array if (!isset($this->result[$sub]) or !is_array($this->result[$sub])) { $this->result[$sub] = []; @@ -111,7 +106,6 @@ public function addSub($sub, $key, $value) */ public function fetch() { - return $this->result; } @@ -124,7 +118,6 @@ public function fetch() */ public function get($var) { - return isset($this->result[$var]) ? $this->result[$var] : null; } } diff --git a/src/GameQ/Server.php b/src/GameQ/Server.php index b914f6a7..fd1dca76 100644 --- a/src/GameQ/Server.php +++ b/src/GameQ/Server.php @@ -27,9 +27,7 @@ */ class Server { - /* - * Server array keys - */ + // Server array keys const SERVER_TYPE = 'type'; const SERVER_HOST = 'host'; @@ -38,13 +36,9 @@ class Server const SERVER_OPTIONS = 'options'; - /* - * Server options keys - */ + // Server options keys - /* - * Use this option when the query_port and client connect ports are different - */ + // Use this option when the query_port and client connect ports are different const SERVER_OPTIONS_QUERY_PORT = 'query_port'; /** @@ -221,7 +215,6 @@ protected function checkAndSetIpPort($ip_address) */ protected function checkAndSetServerOptions() { - // Specific query port defined if (array_key_exists(self::SERVER_OPTIONS_QUERY_PORT, $this->options)) { $this->port_query = (int)$this->options[self::SERVER_OPTIONS_QUERY_PORT]; @@ -241,7 +234,6 @@ protected function checkAndSetServerOptions() */ public function setOption($key, $value) { - $this->options[$key] = $value; return $this; // Make chainable @@ -256,7 +248,6 @@ public function setOption($key, $value) */ public function getOption($key) { - return (array_key_exists($key, $this->options)) ? $this->options[$key] : null; } @@ -272,7 +263,6 @@ public function getOptions() */ public function id() { - return $this->id; } @@ -283,7 +273,6 @@ public function id() */ public function ip() { - return $this->ip; } @@ -294,7 +283,6 @@ public function ip() */ public function portClient() { - return $this->port_client; } @@ -305,7 +293,6 @@ public function portClient() */ public function portQuery() { - return $this->port_query; } @@ -316,7 +303,6 @@ public function portQuery() */ public function protocol() { - return $this->protocol; } @@ -327,21 +313,19 @@ public function protocol() */ public function getJoinLink() { - /* Read the joinLink template defined by the Protocol */ + // Read the joinLink template defined by the Protocol $joinLink = $this->protocol->joinLink(); - /* Ensure the Protocol provides a joinLink template */ + // Ensure the Protocol provides a joinLink template if (is_null($joinLink)) { return null; } - /* Fill the template to build the final joinLink */ + // Fill the template to build the final joinLink return sprintf($joinLink, $this->ip, $this->portClient()); } - /* - * Socket holding - */ + // Socket holding /** * Add a socket for this server to be reused @@ -352,7 +336,6 @@ public function getJoinLink() */ public function socketAdd(Query\Core $socket) { - $this->sockets[] = $socket; } @@ -365,7 +348,6 @@ public function socketAdd(Query\Core $socket) */ public function socketGet() { - $socket = null; if (count($this->sockets) > 0) { @@ -382,10 +364,9 @@ public function socketGet() */ public function socketCleanse() { - // Close all of the sockets available foreach ($this->sockets as $socket) { - /* @var $socket \GameQ\Query\Core */ + // @var $socket \GameQ\Query\Core $socket->close(); } diff --git a/tests/Buffer.php b/tests/Buffer.php index 87457716..2d32b04a 100644 --- a/tests/Buffer.php +++ b/tests/Buffer.php @@ -35,7 +35,6 @@ class Buffer extends TestBase */ protected function buildBuffer($data, $number_type = 'm') { - return new \GameQ\Buffer($data, $number_type); } @@ -47,7 +46,6 @@ protected function buildBuffer($data, $number_type = 'm') */ public function integerDataProvider() { - // Make the base path for the data to test since it has to be in ascii form $basePath = sprintf('%s/Providers/Buffer', __DIR__); diff --git a/tests/Filters/Base.php b/tests/Filters/Base.php index c7d0f3d4..2fca6ded 100644 --- a/tests/Filters/Base.php +++ b/tests/Filters/Base.php @@ -27,7 +27,6 @@ */ class Base extends TestBase { - /** * Load up the provider data for the specific filter type * @@ -35,7 +34,6 @@ class Base extends TestBase */ public function loadData() { - // Explode the class that called to avoid strict error $class = explode('\\', get_called_class()); @@ -82,16 +80,13 @@ public function loadData() return $providers; } - /* - * Real Base tests here - */ + // Real Base tests here /** * Test options setting on construct */ public function testOptions() { - $options = [ 'option1' => 'value1', 'option2' => 'value2', diff --git a/tests/Filters/Normalize.php b/tests/Filters/Normalize.php index ee884cd2..63fe01e4 100644 --- a/tests/Filters/Normalize.php +++ b/tests/Filters/Normalize.php @@ -25,7 +25,6 @@ */ class Normalize extends Base { - /** * Test the filter for Normalize * @@ -37,7 +36,6 @@ class Normalize extends Base */ public function testFiltered($protocol, $raw, $filtered) { - // Pop the key from the raw response $host = key($raw); @@ -65,7 +63,6 @@ public function testFiltered($protocol, $raw, $filtered) */ public function testEmpty() { - // Create a mock server $server = $this->getMockBuilder('\GameQ\Server') ->setConstructorArgs([ diff --git a/tests/Filters/Secondstohuman.php b/tests/Filters/Secondstohuman.php index 36b171cd..b4c922c8 100644 --- a/tests/Filters/Secondstohuman.php +++ b/tests/Filters/Secondstohuman.php @@ -25,7 +25,6 @@ */ class Secondstohuman extends Base { - /** * Test default filter settings */ diff --git a/tests/Filters/Stripcolors.php b/tests/Filters/Stripcolors.php index 54c93c9f..98d18883 100644 --- a/tests/Filters/Stripcolors.php +++ b/tests/Filters/Stripcolors.php @@ -25,7 +25,6 @@ */ class Stripcolors extends Base { - /** * Test the filter for Stripcolors * @@ -37,7 +36,6 @@ class Stripcolors extends Base */ public function testFiltered($protocol, $raw, $filtered) { - // Pop the key from the raw response $host = key($raw); diff --git a/tests/GameQ.php b/tests/GameQ.php index cf5827e3..cd8b1670 100644 --- a/tests/GameQ.php +++ b/tests/GameQ.php @@ -25,7 +25,6 @@ */ class GameQ extends TestBase { - /** * Holds stub on setup * @@ -47,7 +46,6 @@ public function customSetUp() */ public function testFactory() { - $this->assertInstanceOf('\GameQ\GameQ', \GameQ\GameQ::factory()); } @@ -76,7 +74,6 @@ public function testGetSetOptions() */ public function testAddServer() { - // Define some servers $servers = [ [ @@ -118,7 +115,6 @@ public function testAddServer() */ public function testAddServersFromFiles() { - // Test single file $this->stub->addServersFromFiles(__DIR__ . '/Protocols/Providers/server_list1.json'); @@ -159,7 +155,6 @@ public function testAddServersFromFiles() */ public function testFiltersAddRemove() { - // Add filter $this->stub->addFilter('test_filter'); @@ -198,7 +193,6 @@ public function testFiltersAddRemove() */ public function testFilterApply() { - // Define some fake results $fakeResults = [ 'key1' => 'val1', @@ -234,7 +228,6 @@ public function testFilterApply() */ public function testBadFilterException() { - // Define some fake results $fakeResults = [ 'key1' => 'val1', diff --git a/tests/Issues/Issue307.php b/tests/Issues/Issue307.php index 33d87ba4..fe624c92 100644 --- a/tests/Issues/Issue307.php +++ b/tests/Issues/Issue307.php @@ -37,7 +37,6 @@ class Issue307 extends TestBase */ public function test1() { - $filePath = sprintf('%s/Providers/307.txt', __DIR__); $testResult = $this->queryTest('127.0.0.1:27015', 'csgo', explode(PHP_EOL . '||' . PHP_EOL, file_get_contents($filePath))); diff --git a/tests/Protocol.php b/tests/Protocol.php index 2755ca56..659953b7 100644 --- a/tests/Protocol.php +++ b/tests/Protocol.php @@ -25,7 +25,6 @@ */ class Protocol extends TestBase { - /** * Holds stub on setup * @@ -49,7 +48,6 @@ class Protocol extends TestBase */ public function customSetUp() { - $this->stub = $this->getMockForAbstractClass('\GameQ\Protocol', [ $this->options ]); } @@ -58,7 +56,6 @@ public function customSetUp() */ public function testGeneral() { - $name = 'Test name'; $nameLong = 'Test name bigger, longer'; $portDiff = 5454; @@ -102,7 +99,6 @@ public function testGeneral() */ public function testPackets() { - $packets = [ \GameQ\Protocol::PACKET_CHALLENGE => 'Do you even lift?', \GameQ\Protocol::PACKET_RULES => 'There are no rules!!', diff --git a/tests/Protocols/Atlas.php b/tests/Protocols/Atlas.php index 76106c6c..8ce7f184 100644 --- a/tests/Protocols/Atlas.php +++ b/tests/Protocols/Atlas.php @@ -35,7 +35,6 @@ class Atlas extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); // Splited to later be compared with query port diff --git a/tests/Protocols/Batt1944.php b/tests/Protocols/Batt1944.php index 6273162c..2f94fb58 100644 --- a/tests/Protocols/Batt1944.php +++ b/tests/Protocols/Batt1944.php @@ -35,7 +35,6 @@ class Batt1944 extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Bfh.php b/tests/Protocols/Bfh.php index d8488761..64197e05 100644 --- a/tests/Protocols/Bfh.php +++ b/tests/Protocols/Bfh.php @@ -20,7 +20,6 @@ class Bfh extends Base { - /** * Test responses for Battlefield Hardline * diff --git a/tests/Protocols/Codmw2.php b/tests/Protocols/Codmw2.php index 93f9d28f..a00d46f9 100644 --- a/tests/Protocols/Codmw2.php +++ b/tests/Protocols/Codmw2.php @@ -35,7 +35,6 @@ class Codmw2 extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Doom3.php b/tests/Protocols/Doom3.php index d43e6d78..67ed9440 100644 --- a/tests/Protocols/Doom3.php +++ b/tests/Protocols/Doom3.php @@ -35,7 +35,6 @@ class Doom3 extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Gta5m.php b/tests/Protocols/Gta5m.php index 1b155596..4abe3849 100644 --- a/tests/Protocols/Gta5m.php +++ b/tests/Protocols/Gta5m.php @@ -20,7 +20,6 @@ class Gta5m extends Base { - /** * Holds stub on setup * diff --git a/tests/Protocols/Had2.php b/tests/Protocols/Had2.php index 118ba36d..aa773fe4 100644 --- a/tests/Protocols/Had2.php +++ b/tests/Protocols/Had2.php @@ -35,7 +35,6 @@ class Had2 extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Halo.php b/tests/Protocols/Halo.php index 65152e91..ceab3583 100644 --- a/tests/Protocols/Halo.php +++ b/tests/Protocols/Halo.php @@ -35,7 +35,6 @@ class Halo extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Hll.php b/tests/Protocols/Hll.php index 92aed03a..d5f19d39 100644 --- a/tests/Protocols/Hll.php +++ b/tests/Protocols/Hll.php @@ -35,7 +35,6 @@ class Hll extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/M2mp.php b/tests/Protocols/M2mp.php index 0e68cbef..a5ed3850 100644 --- a/tests/Protocols/M2mp.php +++ b/tests/Protocols/M2mp.php @@ -35,7 +35,6 @@ class M2mp extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Miscreated.php b/tests/Protocols/Miscreated.php index 70b00b30..0e341676 100644 --- a/tests/Protocols/Miscreated.php +++ b/tests/Protocols/Miscreated.php @@ -35,7 +35,6 @@ class Miscreated extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Openttd.php b/tests/Protocols/Openttd.php index beccaf2c..ecbd7494 100644 --- a/tests/Protocols/Openttd.php +++ b/tests/Protocols/Openttd.php @@ -35,7 +35,6 @@ class Openttd extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Postscriptum.php b/tests/Protocols/Postscriptum.php index b7f2de4c..1e621e02 100644 --- a/tests/Protocols/Postscriptum.php +++ b/tests/Protocols/Postscriptum.php @@ -35,7 +35,6 @@ class Postscriptum extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Quake2.php b/tests/Protocols/Quake2.php index 00c55624..9fbcfa22 100644 --- a/tests/Protocols/Quake2.php +++ b/tests/Protocols/Quake2.php @@ -20,7 +20,6 @@ class Quake2 extends Base { - /** * Holds stub on setup * @@ -44,7 +43,6 @@ class Quake2 extends Base */ public function customSetUp() { - // Create the stub class $this->stub = new \GameQ\Protocols\Quake2(); } @@ -54,7 +52,6 @@ public function customSetUp() */ public function testPackets() { - // Test to make sure packets are defined properly $this->assertEquals($this->packets, $this->stub->getPacket()); } @@ -64,7 +61,6 @@ public function testPackets() */ public function testInvalidPacketType() { - // Read in a quake 2 source file $source = file_get_contents(sprintf('%s/Providers/Quake2/1_response.txt', __DIR__)); diff --git a/tests/Protocols/Quake3.php b/tests/Protocols/Quake3.php index da753cb2..a91c0446 100644 --- a/tests/Protocols/Quake3.php +++ b/tests/Protocols/Quake3.php @@ -20,7 +20,6 @@ class Quake3 extends Base { - /** * Holds stub on setup * diff --git a/tests/Protocols/Quake4.php b/tests/Protocols/Quake4.php index 60999cd0..4a2e681e 100644 --- a/tests/Protocols/Quake4.php +++ b/tests/Protocols/Quake4.php @@ -35,7 +35,6 @@ class Quake4 extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Rf2.php b/tests/Protocols/Rf2.php index 8594eb75..0fee8551 100644 --- a/tests/Protocols/Rf2.php +++ b/tests/Protocols/Rf2.php @@ -35,7 +35,6 @@ class Rf2 extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Rfactor.php b/tests/Protocols/Rfactor.php index ddf7ade6..fc44c279 100644 --- a/tests/Protocols/Rfactor.php +++ b/tests/Protocols/Rfactor.php @@ -35,7 +35,6 @@ class Rfactor extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Protocols/Rfactor2.php b/tests/Protocols/Rfactor2.php index f43db283..49d1305d 100644 --- a/tests/Protocols/Rfactor2.php +++ b/tests/Protocols/Rfactor2.php @@ -35,7 +35,6 @@ class Rfactor2 extends Base */ public function testResponses($responses, $result) { - // Pull the first key off the array this is the server ip:port $server = key($result); diff --git a/tests/Query/Core.php b/tests/Query/Core.php index 079b1296..e89b42bc 100644 --- a/tests/Query/Core.php +++ b/tests/Query/Core.php @@ -32,7 +32,6 @@ class Core extends TestBase */ public function testSet() { - $stub = $this->getMockForAbstractClass('\GameQ\Query\Core', [ ]); // Set the properties diff --git a/tests/Server.php b/tests/Server.php index f917a9c1..6d7bad2c 100644 --- a/tests/Server.php +++ b/tests/Server.php @@ -87,7 +87,6 @@ public function testSetServerOptions() */ public function testServerId() { - $id = '127.0.0.1:27015'; // Create a server with id diff --git a/tests/TestBase.php b/tests/TestBase.php index 9b22b76c..419b29f3 100644 --- a/tests/TestBase.php +++ b/tests/TestBase.php @@ -20,7 +20,6 @@ class TestBase extends \PHPUnit\Framework\TestCase { - /** * TestBase constructor overload. *