repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
Austinb/GameQ
src/GameQ/Protocols/Arma3.php
Arma3.processRules
protected function processRules(Buffer $buffer) { // Total number of packets, burn it $buffer->readInt16(); // Will hold the data string $data = ''; // Loop until we run out of strings while ($buffer->getLength()) { // Burn the delimiters (i.e. \x01\x04\...
php
protected function processRules(Buffer $buffer) { // Total number of packets, burn it $buffer->readInt16(); // Will hold the data string $data = ''; // Loop until we run out of strings while ($buffer->getLength()) { // Burn the delimiters (i.e. \x01\x04\...
[ "protected", "function", "processRules", "(", "Buffer", "$", "buffer", ")", "{", "// Total number of packets, burn it", "$", "buffer", "->", "readInt16", "(", ")", ";", "// Will hold the data string", "$", "data", "=", "''", ";", "// Loop until we run out of strings", ...
Process the rules since Arma3 changed their response for rules @param Buffer $buffer @return array @throws \GameQ\Exception\Protocol
[ "Process", "the", "rules", "since", "Arma3", "changed", "their", "response", "for", "rules" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Arma3.php#L80-L175
Austinb/GameQ
src/GameQ/Buffer.php
Buffer.read
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?"); } $string = substr($this->data, $this->index, $length); $this->index += $length; ...
php
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?"); } $string = substr($this->data, $this->index, $length); $this->index += $length; ...
[ "public", "function", "read", "(", "$", "length", "=", "1", ")", "{", "if", "(", "(", "$", "length", "+", "$", "this", "->", "index", ")", ">", "$", "this", "->", "length", ")", "{", "throw", "new", "Exception", "(", "\"Unable to read length={$length} ...
Read from the buffer @param int $length @return string @throws \GameQ\Exception\Protocol
[ "Read", "from", "the", "buffer" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Buffer.php#L129-L140
Austinb/GameQ
src/GameQ/Buffer.php
Buffer.readLast
public function readLast() { $len = strlen($this->data); $string = $this->data{strlen($this->data) - 1}; $this->data = substr($this->data, 0, $len - 1); $this->length -= 1; return $string; }
php
public function readLast() { $len = strlen($this->data); $string = $this->data{strlen($this->data) - 1}; $this->data = substr($this->data, 0, $len - 1); $this->length -= 1; return $string; }
[ "public", "function", "readLast", "(", ")", "{", "$", "len", "=", "strlen", "(", "$", "this", "->", "data", ")", ";", "$", "string", "=", "$", "this", "->", "data", "{", "strlen", "(", "$", "this", "->", "data", ")", "-", "1", "}", ";", "$", ...
Read the last character from the buffer Unlike the other read functions, this function actually removes the character from the buffer. @return string
[ "Read", "the", "last", "character", "from", "the", "buffer" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Buffer.php#L150-L159
Austinb/GameQ
src/GameQ/Buffer.php
Buffer.readString
public function readString($delim = "\x00") { // Get position of delimiter $len = strpos($this->data, $delim, min($this->index, $this->length)); // If it is not found then return whole buffer if ($len === false) { return $this->read(strlen($this->data) - $this->index); ...
php
public function readString($delim = "\x00") { // Get position of delimiter $len = strpos($this->data, $delim, min($this->index, $this->length)); // If it is not found then return whole buffer if ($len === false) { return $this->read(strlen($this->data) - $this->index); ...
[ "public", "function", "readString", "(", "$", "delim", "=", "\"\\x00\"", ")", "{", "// Get position of delimiter", "$", "len", "=", "strpos", "(", "$", "this", "->", "data", ",", "$", "delim", ",", "min", "(", "$", "this", "->", "index", ",", "$", "thi...
Read from buffer until delimiter is reached If not found, return everything @param string $delim @return string @throws \GameQ\Exception\Protocol
[ "Read", "from", "buffer", "until", "delimiter", "is", "reached" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Buffer.php#L218-L234
Austinb/GameQ
src/GameQ/Buffer.php
Buffer.readPascalString
public function readPascalString($offset = 0, $read_offset = false) { // Get the proper offset $len = $this->readInt8(); $offset = max($len - $offset, 0); // Read the data if ($read_offset) { return $this->read($offset); } else { return subst...
php
public function readPascalString($offset = 0, $read_offset = false) { // Get the proper offset $len = $this->readInt8(); $offset = max($len - $offset, 0); // Read the data if ($read_offset) { return $this->read($offset); } else { return subst...
[ "public", "function", "readPascalString", "(", "$", "offset", "=", "0", ",", "$", "read_offset", "=", "false", ")", "{", "// Get the proper offset", "$", "len", "=", "$", "this", "->", "readInt8", "(", ")", ";", "$", "offset", "=", "max", "(", "$", "le...
Reads a pascal string from the buffer @param int $offset Number of bits to cut off the end @param bool $read_offset True if the data after the offset is to be read @return string @throws \GameQ\Exception\Protocol
[ "Reads", "a", "pascal", "string", "from", "the", "buffer" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Buffer.php#L245-L258
Austinb/GameQ
src/GameQ/Buffer.php
Buffer.readStringMulti
public function readStringMulti($delims, &$delimfound = null) { // Get position of delimiters $pos = []; foreach ($delims as $delim) { if ($p = strpos($this->data, $delim, min($this->index, $this->length))) { $pos[] = $p; } } // If no...
php
public function readStringMulti($delims, &$delimfound = null) { // Get position of delimiters $pos = []; foreach ($delims as $delim) { if ($p = strpos($this->data, $delim, min($this->index, $this->length))) { $pos[] = $p; } } // If no...
[ "public", "function", "readStringMulti", "(", "$", "delims", ",", "&", "$", "delimfound", "=", "null", ")", "{", "// Get position of delimiters", "$", "pos", "=", "[", "]", ";", "foreach", "(", "$", "delims", "as", "$", "delim", ")", "{", "if", "(", "$...
Read from buffer until any of the delimiters is reached If not found, return everything @param $delims @param null $delimfound @return string @throws \GameQ\Exception\Protocol @todo: Check to see if this is even used anymore
[ "Read", "from", "buffer", "until", "any", "of", "the", "delimiters", "is", "reached" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Buffer.php#L273-L295
Austinb/GameQ
src/GameQ/Buffer.php
Buffer.readInt16
public function readInt16() { // Change the integer type we are looking up switch ($this->number_type) { case self::NUMBER_TYPE_BIGENDIAN: $type = 'nint'; break; case self::NUMBER_TYPE_LITTLEENDIAN: $type = 'vint'; ...
php
public function readInt16() { // Change the integer type we are looking up switch ($this->number_type) { case self::NUMBER_TYPE_BIGENDIAN: $type = 'nint'; break; case self::NUMBER_TYPE_LITTLEENDIAN: $type = 'vint'; ...
[ "public", "function", "readInt16", "(", ")", "{", "// Change the integer type we are looking up", "switch", "(", "$", "this", "->", "number_type", ")", "{", "case", "self", "::", "NUMBER_TYPE_BIGENDIAN", ":", "$", "type", "=", "'nint'", ";", "break", ";", "case"...
Read a 16-bit unsigned integer @return int @throws \GameQ\Exception\Protocol
[ "Read", "a", "16", "-", "bit", "unsigned", "integer" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Buffer.php#L331-L351
Austinb/GameQ
src/GameQ/Buffer.php
Buffer.readInt16Signed
public function readInt16Signed() { // Read the data into a string $string = $this->read(2); // For big endian we need to reverse the bytes if ($this->number_type == self::NUMBER_TYPE_BIGENDIAN) { $string = strrev($string); } $int = unpack('sint', $stri...
php
public function readInt16Signed() { // Read the data into a string $string = $this->read(2); // For big endian we need to reverse the bytes if ($this->number_type == self::NUMBER_TYPE_BIGENDIAN) { $string = strrev($string); } $int = unpack('sint', $stri...
[ "public", "function", "readInt16Signed", "(", ")", "{", "// Read the data into a string", "$", "string", "=", "$", "this", "->", "read", "(", "2", ")", ";", "// For big endian we need to reverse the bytes", "if", "(", "$", "this", "->", "number_type", "==", "self"...
Read a 16-bit signed integer @return int @throws \GameQ\Exception\Protocol
[ "Read", "a", "16", "-", "bit", "signed", "integer" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Buffer.php#L359-L375
Austinb/GameQ
src/GameQ/Buffer.php
Buffer.readInt64
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 switch ($this->number_type) { ...
php
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 switch ($this->number_type) { ...
[ "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", ")", "{", ...
Read a 64-bit unsigned integer @return int @throws \GameQ\Exception\Protocol
[ "Read", "a", "64", "-", "bit", "unsigned", "integer" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Buffer.php#L436-L476
Austinb/GameQ
src/GameQ/Buffer.php
Buffer.readFloat32
public function readFloat32() { // Read the data into a string $string = $this->read(4); // For big endian we need to reverse the bytes if ($this->number_type == self::NUMBER_TYPE_BIGENDIAN) { $string = strrev($string); } $float = unpack('ffloat', $stri...
php
public function readFloat32() { // Read the data into a string $string = $this->read(4); // For big endian we need to reverse the bytes if ($this->number_type == self::NUMBER_TYPE_BIGENDIAN) { $string = strrev($string); } $float = unpack('ffloat', $stri...
[ "public", "function", "readFloat32", "(", ")", "{", "// Read the data into a string", "$", "string", "=", "$", "this", "->", "read", "(", "4", ")", ";", "// For big endian we need to reverse the bytes", "if", "(", "$", "this", "->", "number_type", "==", "self", ...
Read a 32-bit float @return float @throws \GameQ\Exception\Protocol
[ "Read", "a", "32", "-", "bit", "float" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Buffer.php#L484-L500
Austinb/GameQ
src/GameQ/Protocols/Etqw.php
Etqw.processStatus
protected function processStatus(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Defaults $result->add('dedicated', 1); // Now burn the challenge, version and size $buffer->skip(16); // Key / value pairs while...
php
protected function processStatus(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Defaults $result->add('dedicated', 1); // Now burn the challenge, version and size $buffer->skip(16); // Key / value pairs while...
[ "protected", "function", "processStatus", "(", "Buffer", "$", "buffer", ")", "{", "// Set the result to a new result instance", "$", "result", "=", "new", "Result", "(", ")", ";", "// Defaults", "$", "result", "->", "add", "(", "'dedicated'", ",", "1", ")", ";...
Handle processing the status response @param Buffer $buffer @return array
[ "Handle", "processing", "the", "status", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Etqw.php#L136-L182
Austinb/GameQ
src/GameQ/Protocols/Etqw.php
Etqw.parsePlayers
protected function parsePlayers(Buffer &$buffer, Result &$result) { // By default there are 0 players $players = 0; // Iterate over the players until we run out while (($id = $buffer->readInt8()) != 32) { $result->addPlayer('id', $id); $result->addPlayer('pin...
php
protected function parsePlayers(Buffer &$buffer, Result &$result) { // By default there are 0 players $players = 0; // Iterate over the players until we run out while (($id = $buffer->readInt8()) != 32) { $result->addPlayer('id', $id); $result->addPlayer('pin...
[ "protected", "function", "parsePlayers", "(", "Buffer", "&", "$", "buffer", ",", "Result", "&", "$", "result", ")", "{", "// By default there are 0 players", "$", "players", "=", "0", ";", "// Iterate over the players until we run out", "while", "(", "(", "$", "id...
Parse players out of the status ex response @param Buffer $buffer @param Result $result
[ "Parse", "players", "out", "of", "the", "status", "ex", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Etqw.php#L190-L211
Austinb/GameQ
src/GameQ/Protocols/Etqw.php
Etqw.parsePlayersExtra
protected function parsePlayersExtra(Buffer &$buffer, Result &$result) { // Iterate over the extra player info while (($id = $buffer->readInt8()) != 32) { $result->addPlayer('total_xp', $buffer->readFloat32()); $result->addPlayer('teamname', $buffer->readString()); ...
php
protected function parsePlayersExtra(Buffer &$buffer, Result &$result) { // Iterate over the extra player info while (($id = $buffer->readInt8()) != 32) { $result->addPlayer('total_xp', $buffer->readFloat32()); $result->addPlayer('teamname', $buffer->readString()); ...
[ "protected", "function", "parsePlayersExtra", "(", "Buffer", "&", "$", "buffer", ",", "Result", "&", "$", "result", ")", "{", "// Iterate over the extra player info", "while", "(", "(", "$", "id", "=", "$", "buffer", "->", "readInt8", "(", ")", ")", "!=", ...
Handle parsing extra player data @param Buffer $buffer @param Result $result
[ "Handle", "parsing", "extra", "player", "data" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Etqw.php#L219-L233
Austinb/GameQ
src/GameQ/Protocols/Ut3.php
Ut3.processResponse
public function processResponse() { // Grab the result from the parent /** @type array $result */ $result = parent::processResponse(); // Move some stuff around $this->renameResult($result, 'OwningPlayerName', 'hostname'); $this->renameResult($result, 'p1073741825',...
php
public function processResponse() { // Grab the result from the parent /** @type array $result */ $result = parent::processResponse(); // Move some stuff around $this->renameResult($result, 'OwningPlayerName', 'hostname'); $this->renameResult($result, 'p1073741825',...
[ "public", "function", "processResponse", "(", ")", "{", "// Grab the result from the parent", "/** @type array $result */", "$", "result", "=", "parent", "::", "processResponse", "(", ")", ";", "// Move some stuff around", "$", "this", "->", "renameResult", "(", "$", ...
Overload the response process so we can make some changes @return array
[ "Overload", "the", "response", "process", "so", "we", "can", "make", "some", "changes" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ut3.php#L66-L101
Austinb/GameQ
src/GameQ/Protocols/Ut3.php
Ut3.renameResult
protected function renameResult(array &$result, $old, $new) { // Check to see if the old item is there if (isset($result[$old])) { $result[$new] = $result[$old]; unset($result[$old]); } }
php
protected function renameResult(array &$result, $old, $new) { // Check to see if the old item is there if (isset($result[$old])) { $result[$new] = $result[$old]; unset($result[$old]); } }
[ "protected", "function", "renameResult", "(", "array", "&", "$", "result", ",", "$", "old", ",", "$", "new", ")", "{", "// Check to see if the old item is there", "if", "(", "isset", "(", "$", "result", "[", "$", "old", "]", ")", ")", "{", "$", "result",...
Dirty hack to rename result entries into something more useful @param array $result @param string $old @param string $new
[ "Dirty", "hack", "to", "rename", "result", "entries", "into", "something", "more", "useful" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ut3.php#L110-L118
Austinb/GameQ
src/GameQ/Protocols/Bf3.php
Bf3.processResponse
public function processResponse() { // Holds the results sent back $results = []; // Holds the processed packets after having been reassembled $processed = []; // Start up the index for the processed $sequence_id_last = 0; foreach ($this->packets_response ...
php
public function processResponse() { // Holds the results sent back $results = []; // Holds the processed packets after having been reassembled $processed = []; // Start up the index for the processed $sequence_id_last = 0; foreach ($this->packets_response ...
[ "public", "function", "processResponse", "(", ")", "{", "// Holds the results sent back", "$", "results", "=", "[", "]", ";", "// Holds the processed packets after having been reassembled", "$", "processed", "=", "[", "]", ";", "// Start up the index for the processed", "$"...
Process the response for the StarMade server @return array @throws \GameQ\Exception\Protocol
[ "Process", "the", "response", "for", "the", "StarMade", "server" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Bf3.php#L135-L191
Austinb/GameQ
src/GameQ/Protocols/Bf3.php
Bf3.decode
protected function decode(Buffer $buffer) { $items = []; // Get the number of words in this buffer $itemCount = $buffer->readInt32(); // Loop over the number of items for ($i = 0; $i < $itemCount; $i++) { // Length of the string $buffer->readInt32()...
php
protected function decode(Buffer $buffer) { $items = []; // Get the number of words in this buffer $itemCount = $buffer->readInt32(); // Loop over the number of items for ($i = 0; $i < $itemCount; $i++) { // Length of the string $buffer->readInt32()...
[ "protected", "function", "decode", "(", "Buffer", "$", "buffer", ")", "{", "$", "items", "=", "[", "]", ";", "// Get the number of words in this buffer", "$", "itemCount", "=", "$", "buffer", "->", "readInt32", "(", ")", ";", "// Loop over the number of items", ...
Decode the buffer into a usable format @param \GameQ\Buffer $buffer @return array
[ "Decode", "the", "buffer", "into", "a", "usable", "format" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Bf3.php#L204-L222
Austinb/GameQ
src/GameQ/Protocols/Bf3.php
Bf3.processDetails
protected function processDetails(Buffer $buffer) { // Decode into items $items = $this->decode($buffer); // Set the result to a new result instance $result = new Result(); // Server is always dedicated $result->add('dedicated', 1); // These are the same n...
php
protected function processDetails(Buffer $buffer) { // Decode into items $items = $this->decode($buffer); // Set the result to a new result instance $result = new Result(); // Server is always dedicated $result->add('dedicated', 1); // These are the same n...
[ "protected", "function", "processDetails", "(", "Buffer", "$", "buffer", ")", "{", "// Decode into items", "$", "items", "=", "$", "this", "->", "decode", "(", "$", "buffer", ")", ";", "// Set the result to a new result instance", "$", "result", "=", "new", "Res...
Process the server details @param \GameQ\Buffer $buffer @return array
[ "Process", "the", "server", "details" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Bf3.php#L231-L288
Austinb/GameQ
src/GameQ/Protocols/Bf3.php
Bf3.processVersion
protected function processVersion(Buffer $buffer) { // Decode into items $items = $this->decode($buffer); // Set the result to a new result instance $result = new Result(); $result->add('version', $items[2]); unset($buffer, $items); return $result->fetch(...
php
protected function processVersion(Buffer $buffer) { // Decode into items $items = $this->decode($buffer); // Set the result to a new result instance $result = new Result(); $result->add('version', $items[2]); unset($buffer, $items); return $result->fetch(...
[ "protected", "function", "processVersion", "(", "Buffer", "$", "buffer", ")", "{", "// Decode into items", "$", "items", "=", "$", "this", "->", "decode", "(", "$", "buffer", ")", ";", "// Set the result to a new result instance", "$", "result", "=", "new", "Res...
Process the server version @param \GameQ\Buffer $buffer @return array
[ "Process", "the", "server", "version" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Bf3.php#L297-L311
Austinb/GameQ
src/GameQ/Protocols/Bf3.php
Bf3.processPlayers
protected function processPlayers(Buffer $buffer) { // Decode into items $items = $this->decode($buffer); // Set the result to a new result instance $result = new Result(); // Number of data points per player $numTags = $items[1]; // Grab the tags for each...
php
protected function processPlayers(Buffer $buffer) { // Decode into items $items = $this->decode($buffer); // Set the result to a new result instance $result = new Result(); // Number of data points per player $numTags = $items[1]; // Grab the tags for each...
[ "protected", "function", "processPlayers", "(", "Buffer", "$", "buffer", ")", "{", "// Decode into items", "$", "items", "=", "$", "this", "->", "decode", "(", "$", "buffer", ")", ";", "// Set the result to a new result instance", "$", "result", "=", "new", "Res...
Process the players @param \GameQ\Buffer $buffer @return array
[ "Process", "the", "players" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Bf3.php#L320-L347
Austinb/GameQ
src/GameQ/Protocols/Ventrilo.php
Ventrilo.processResponse
public function processResponse() { // We need to decrypt the packets $decrypted = $this->decryptPackets($this->packets_response); // Now let us convert special characters from hex to ascii all at once $decrypted = preg_replace_callback( '|%([0-9A-F]{2})|', ...
php
public function processResponse() { // We need to decrypt the packets $decrypted = $this->decryptPackets($this->packets_response); // Now let us convert special characters from hex to ascii all at once $decrypted = preg_replace_callback( '|%([0-9A-F]{2})|', ...
[ "public", "function", "processResponse", "(", ")", "{", "// We need to decrypt the packets", "$", "decrypted", "=", "$", "this", "->", "decryptPackets", "(", "$", "this", "->", "packets_response", ")", ";", "// Now let us convert special characters from hex to ascii all at ...
Process the response @return array @throws \GameQ\Exception\Protocol
[ "Process", "the", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ventrilo.php#L639-L735
Austinb/GameQ
src/GameQ/Protocols/Ventrilo.php
Ventrilo.decryptPackets
protected function decryptPackets(array $packets = []) { // This will be returned $decrypted = []; foreach ($packets as $packet) { # Header : $header = substr($packet, 0, 20); $header_items = []; $header_key = unpack("n1", $header); ...
php
protected function decryptPackets(array $packets = []) { // This will be returned $decrypted = []; foreach ($packets as $packet) { # Header : $header = substr($packet, 0, 20); $header_items = []; $header_key = unpack("n1", $header); ...
[ "protected", "function", "decryptPackets", "(", "array", "$", "packets", "=", "[", "]", ")", "{", "// This will be returned", "$", "decrypted", "=", "[", "]", ";", "foreach", "(", "$", "packets", "as", "$", "packet", ")", "{", "# Header :", "$", "header", ...
Decrypt the incoming packets @codeCoverageIgnore @param array $packets @return string @throws \GameQ\Exception\Protocol
[ "Decrypt", "the", "incoming", "packets" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ventrilo.php#L751-L832
Austinb/GameQ
src/GameQ/Protocols/Ventrilo.php
Ventrilo.processChannel
protected function processChannel($data, $fieldCount, Result &$result) { // Split the items on the comma $items = explode(",", $data, $fieldCount); // Iterate over the items for this channel foreach ($items as $item) { // Split the key=value pair list($key, ...
php
protected function processChannel($data, $fieldCount, Result &$result) { // Split the items on the comma $items = explode(",", $data, $fieldCount); // Iterate over the items for this channel foreach ($items as $item) { // Split the key=value pair list($key, ...
[ "protected", "function", "processChannel", "(", "$", "data", ",", "$", "fieldCount", ",", "Result", "&", "$", "result", ")", "{", "// Split the items on the comma", "$", "items", "=", "explode", "(", "\",\"", ",", "$", "data", ",", "$", "fieldCount", ")", ...
Process the channel listing @param string $data @param int $fieldCount @param \GameQ\Result $result
[ "Process", "the", "channel", "listing" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ventrilo.php#L841-L854
Austinb/GameQ
src/GameQ/Protocols/Ventrilo.php
Ventrilo.processPlayer
protected function processPlayer($data, $fieldCount, Result &$result) { // Split the items on the comma $items = explode(",", $data, $fieldCount); // Iterate over the items for this player foreach ($items as $item) { // Split the key=value pair list($key, $v...
php
protected function processPlayer($data, $fieldCount, Result &$result) { // Split the items on the comma $items = explode(",", $data, $fieldCount); // Iterate over the items for this player foreach ($items as $item) { // Split the key=value pair list($key, $v...
[ "protected", "function", "processPlayer", "(", "$", "data", ",", "$", "fieldCount", ",", "Result", "&", "$", "result", ")", "{", "// Split the items on the comma", "$", "items", "=", "explode", "(", "\",\"", ",", "$", "data", ",", "$", "fieldCount", ")", "...
Process the user listing @param string $data @param int $fieldCount @param \GameQ\Result $result
[ "Process", "the", "user", "listing" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ventrilo.php#L863-L876
Austinb/GameQ
src/GameQ/GameQ.php
GameQ.addServersFromFiles
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]; } // Iterate over the file(s) and add them foreach ($files as $file) { //...
php
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]; } // Iterate over the file(s) and add them foreach ($files as $file) { //...
[ "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", "=", "[", "$",...
Add a set of servers from a file or an array of files. Supported formats: JSON @param array $files @return $this @throws \Exception
[ "Add", "a", "set", "of", "servers", "from", "a", "file", "or", "an", "array", "of", "files", ".", "Supported", "formats", ":", "JSON" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/GameQ.php#L222-L250
Austinb/GameQ
src/GameQ/GameQ.php
GameQ.addFilter
public function addFilter($filterName, $options = []) { // Create the filter hash so we can run multiple versions of the same filter $filterHash = sprintf('%s_%s', strtolower($filterName), md5(json_encode($options))); // Add the filter $this->options['filters'][$filterHash] = [ ...
php
public function addFilter($filterName, $options = []) { // Create the filter hash so we can run multiple versions of the same filter $filterHash = sprintf('%s_%s', strtolower($filterName), md5(json_encode($options))); // Add the filter $this->options['filters'][$filterHash] = [ ...
[ "public", "function", "addFilter", "(", "$", "filterName", ",", "$", "options", "=", "[", "]", ")", "{", "// Create the filter hash so we can run multiple versions of the same filter", "$", "filterHash", "=", "sprintf", "(", "'%s_%s'", ",", "strtolower", "(", "$", "...
Add a filter to the processing list @param string $filterName @param array $options @return $this
[ "Add", "a", "filter", "to", "the", "processing", "list" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/GameQ.php#L274-L288
Austinb/GameQ
src/GameQ/GameQ.php
GameQ.removeFilter
public function removeFilter($filterHash) { // Make lower case $filterHash = strtolower($filterHash); // Remove this filter if it has been defined if (array_key_exists($filterHash, $this->options['filters'])) { unset($this->options['filters'][$filterHash]); } ...
php
public function removeFilter($filterHash) { // Make lower case $filterHash = strtolower($filterHash); // Remove this filter if it has been defined if (array_key_exists($filterHash, $this->options['filters'])) { unset($this->options['filters'][$filterHash]); } ...
[ "public", "function", "removeFilter", "(", "$", "filterHash", ")", "{", "// Make lower case", "$", "filterHash", "=", "strtolower", "(", "$", "filterHash", ")", ";", "// Remove this filter if it has been defined", "if", "(", "array_key_exists", "(", "$", "filterHash",...
Remove an added filter @param string $filterHash @return $this
[ "Remove", "an", "added", "filter" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/GameQ.php#L297-L310
Austinb/GameQ
src/GameQ/GameQ.php
GameQ.process
public function process() { // Initialize the query library we are using $class = new \ReflectionClass($this->queryLibrary); // Set the query pointer to the new instance of the library $this->query = $class->newInstance(); unset($class); // Define the return ...
php
public function process() { // Initialize the query library we are using $class = new \ReflectionClass($this->queryLibrary); // Set the query pointer to the new instance of the library $this->query = $class->newInstance(); unset($class); // Define the return ...
[ "public", "function", "process", "(", ")", "{", "// Initialize the query library we are using", "$", "class", "=", "new", "\\", "ReflectionClass", "(", "$", "this", "->", "queryLibrary", ")", ";", "// Set the query pointer to the new instance of the library", "$", "this",...
Main method used to actually process all of the added servers and return the information @return array @throws \Exception
[ "Main", "method", "used", "to", "actually", "process", "all", "of", "the", "added", "servers", "and", "return", "the", "information" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/GameQ.php#L328-L368
Austinb/GameQ
src/GameQ/GameQ.php
GameQ.doChallenges
protected function doChallenges() { // Initialize the sockets for reading $sockets = []; // By default we don't have any challenges to process $server_challenge = false; // Do challenge packets foreach ($this->servers as $server_id => $server) { /* @var...
php
protected function doChallenges() { // Initialize the sockets for reading $sockets = []; // By default we don't have any challenges to process $server_challenge = false; // Do challenge packets foreach ($this->servers as $server_id => $server) { /* @var...
[ "protected", "function", "doChallenges", "(", ")", "{", "// Initialize the sockets for reading", "$", "sockets", "=", "[", "]", ";", "// By default we don't have any challenges to process", "$", "server_challenge", "=", "false", ";", "// Do challenge packets", "foreach", "(...
Do server challenges, where required
[ "Do", "server", "challenges", "where", "required" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/GameQ.php#L373-L455
Austinb/GameQ
src/GameQ/GameQ.php
GameQ.doQueries
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 */ // Invoke the beforeSend method $server->prot...
php
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 */ // Invoke the beforeSend method $server->prot...
[ "protected", "function", "doQueries", "(", ")", "{", "// Initialize the array of sockets", "$", "sockets", "=", "[", "]", ";", "// Iterate over the server list", "foreach", "(", "$", "this", "->", "servers", "as", "$", "server_id", "=>", "$", "server", ")", "{",...
Run the actual queries and get the response(s)
[ "Run", "the", "actual", "queries", "and", "get", "the", "response", "(", "s", ")" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/GameQ.php#L460-L558
Austinb/GameQ
src/GameQ/GameQ.php
GameQ.doParseResponse
protected function doParseResponse(Server $server) { try { // @codeCoverageIgnoreStart // We want to save this server's response to a file (useful for unit testing) if (!is_null($this->capture_packets_file)) { file_put_contents( $this-...
php
protected function doParseResponse(Server $server) { try { // @codeCoverageIgnoreStart // We want to save this server's response to a file (useful for unit testing) if (!is_null($this->capture_packets_file)) { file_put_contents( $this-...
[ "protected", "function", "doParseResponse", "(", "Server", "$", "server", ")", "{", "try", "{", "// @codeCoverageIgnoreStart", "// We want to save this server's response to a file (useful for unit testing)", "if", "(", "!", "is_null", "(", "$", "this", "->", "capture_packet...
Parse the response for a specific server @param \GameQ\Server $server @return array @throws \Exception
[ "Parse", "the", "response", "for", "a", "specific", "server" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/GameQ.php#L568-L614
Austinb/GameQ
src/GameQ/GameQ.php
GameQ.doApplyFilters
protected function doApplyFilters(array $results, Server $server) { // Loop over the filters foreach ($this->options['filters'] as $filterOptions) { // Try to do this filter try { // Make a new reflection class $class = new \ReflectionClass(sp...
php
protected function doApplyFilters(array $results, Server $server) { // Loop over the filters foreach ($this->options['filters'] as $filterOptions) { // Try to do this filter try { // Make a new reflection class $class = new \ReflectionClass(sp...
[ "protected", "function", "doApplyFilters", "(", "array", "$", "results", ",", "Server", "$", "server", ")", "{", "// Loop over the filters", "foreach", "(", "$", "this", "->", "options", "[", "'filters'", "]", "as", "$", "filterOptions", ")", "{", "// Try to d...
Apply any filters to the results @param array $results @param \GameQ\Server $server @return array
[ "Apply", "any", "filters", "to", "the", "results" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/GameQ.php#L624-L646
Austinb/GameQ
src/GameQ/Protocols/Mumble.php
Mumble.processResponse
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."); } // Set the result to a new result insta...
php
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."); } // Set the result to a new result insta...
[ "public", "function", "processResponse", "(", ")", "{", "// Try to json_decode, make it into an array", "if", "(", "(", "$", "data", "=", "json_decode", "(", "implode", "(", "''", ",", "$", "this", "->", "packets_response", ")", ",", "true", ")", ")", "===", ...
Process the response @return array @throws \GameQ\Exception\Protocol
[ "Process", "the", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Mumble.php#L121-L155
Austinb/GameQ
src/GameQ/Protocols/Mumble.php
Mumble.processChannelsAndUsers
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 if (in_array($key, ['channels', 'users'])) { // skip conti...
php
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 if (in_array($key, ['channels', 'users'])) { // skip conti...
[ "protected", "function", "processChannelsAndUsers", "(", "array", "$", "data", ",", "Result", "&", "$", "result", ")", "{", "// Let's add all of the channel information", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "// We will ha...
Handles processing the the channels and user info @param array $data @param \GameQ\Result $result
[ "Handles", "processing", "the", "the", "channels", "and", "user", "info" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Mumble.php#L167-L193
Austinb/GameQ
src/GameQ/Protocols/Teeworlds.php
Teeworlds.processResponse
public function processResponse() { // Holds the results $results = []; // Iterate over the packets foreach ($this->packets_response as $response) { // Make a buffer $buffer = new Buffer($response); // Grab the header $header = $buffe...
php
public function processResponse() { // Holds the results $results = []; // Iterate over the packets foreach ($this->packets_response as $response) { // Make a buffer $buffer = new Buffer($response); // Grab the header $header = $buffe...
[ "public", "function", "processResponse", "(", ")", "{", "// Holds the results", "$", "results", "=", "[", "]", ";", "// Iterate over the packets", "foreach", "(", "$", "this", "->", "packets_response", "as", "$", "response", ")", "{", "// Make a buffer", "$", "b...
Process the response @return array @throws Exception
[ "Process", "the", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Teeworlds.php#L113-L141
Austinb/GameQ
src/GameQ/Protocols/Teeworlds.php
Teeworlds.processAll
protected function processAll(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Always dedicated $result->add('dedicated', 1); $result->add('version', $buffer->readString()); $result->add('hostname', $buffer->readString()); ...
php
protected function processAll(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Always dedicated $result->add('dedicated', 1); $result->add('version', $buffer->readString()); $result->add('hostname', $buffer->readString()); ...
[ "protected", "function", "processAll", "(", "Buffer", "$", "buffer", ")", "{", "// Set the result to a new result instance", "$", "result", "=", "new", "Result", "(", ")", ";", "// Always dedicated", "$", "result", "->", "add", "(", "'dedicated'", ",", "1", ")",...
Handle processing all of the data returned @param Buffer $buffer @return array
[ "Handle", "processing", "all", "of", "the", "data", "returned" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Teeworlds.php#L150-L180
Austinb/GameQ
src/GameQ/Protocols/Cs16.php
Cs16.processPackets
protected function processPackets($packet_id, array $packets = []) { // The response is gold source if the packets are split $this->source_engine = self::GOLDSOURCE_ENGINE; // Offload to the parent $packs = parent::processPackets($packet_id, $packets); // Reset the engine ...
php
protected function processPackets($packet_id, array $packets = []) { // The response is gold source if the packets are split $this->source_engine = self::GOLDSOURCE_ENGINE; // Offload to the parent $packs = parent::processPackets($packet_id, $packets); // Reset the engine ...
[ "protected", "function", "processPackets", "(", "$", "packet_id", ",", "array", "$", "packets", "=", "[", "]", ")", "{", "// The response is gold source if the packets are split", "$", "this", "->", "source_engine", "=", "self", "::", "GOLDSOURCE_ENGINE", ";", "// O...
In the case of cs 1.6 we offload split packets here because the split packet response for rules is in the old gold source format @param $packet_id @param array $packets @return string @throws \GameQ\Exception\Protocol
[ "In", "the", "case", "of", "cs", "1", ".", "6", "we", "offload", "split", "packets", "here", "because", "the", "split", "packet", "response", "for", "rules", "is", "in", "the", "old", "gold", "source", "format" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Cs16.php#L54-L68
Austinb/GameQ
src/GameQ/Protocols/Gamespy.php
Gamespy.processResponse
public function processResponse() { // Holds the processed packets so we can sort them in case they come in an unordered $processed = []; // Iterate over the packets foreach ($this->packets_response as $response) { // Check to see if we had a preg_match error ...
php
public function processResponse() { // Holds the processed packets so we can sort them in case they come in an unordered $processed = []; // Iterate over the packets foreach ($this->packets_response as $response) { // Check to see if we had a preg_match error ...
[ "public", "function", "processResponse", "(", ")", "{", "// Holds the processed packets so we can sort them in case they come in an unordered", "$", "processed", "=", "[", "]", ";", "// Iterate over the packets", "foreach", "(", "$", "this", "->", "packets_response", "as", ...
Process the response for this protocol @return array @throws Exception
[ "Process", "the", "response", "for", "this", "protocol" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Gamespy.php#L78-L104
Austinb/GameQ
src/GameQ/Protocols/Gamespy.php
Gamespy.processStatus
protected function processStatus(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // By default dedicted $result->add('dedicated', 1); // Lets peek and see if the data starts with a \ if ($buffer->lookAhead(1) == '\\') { ...
php
protected function processStatus(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // By default dedicted $result->add('dedicated', 1); // Lets peek and see if the data starts with a \ if ($buffer->lookAhead(1) == '\\') { ...
[ "protected", "function", "processStatus", "(", "Buffer", "$", "buffer", ")", "{", "// Set the result to a new result instance", "$", "result", "=", "new", "Result", "(", ")", ";", "// By default dedicted", "$", "result", "->", "add", "(", "'dedicated'", ",", "1", ...
Handle processing the status buffer @param Buffer $buffer @return array
[ "Handle", "processing", "the", "status", "buffer" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Gamespy.php#L117-L177
Austinb/GameQ
src/GameQ/Result.php
Result.addSub
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] = []; } // Find the first entry that doesn't have this variable $found = false; ...
php
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] = []; } // Find the first entry that doesn't have this variable $found = false; ...
[ "public", "function", "addSub", "(", "$", "sub", ",", "$", "key", ",", "$", "value", ")", "{", "// Nothing of this type yet, set an empty array", "if", "(", "!", "isset", "(", "$", "this", "->", "result", "[", "$", "sub", "]", ")", "or", "!", "is_array",...
Add a variable to a category @param $sub string The category @param $key string The variable name @param $value string The variable value
[ "Add", "a", "variable", "to", "a", "category" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Result.php#L80-L102
Austinb/GameQ
src/GameQ/Protocols/Tibia.php
Tibia.processResponse
public function processResponse() { // Merge the response packets $xmlString = implode('', $this->packets_response); // Check to make sure this is will decode into a valid XML Document if (($xmlDoc = @simplexml_load_string($xmlString)) === false) { throw new Exception(__...
php
public function processResponse() { // Merge the response packets $xmlString = implode('', $this->packets_response); // Check to make sure this is will decode into a valid XML Document if (($xmlDoc = @simplexml_load_string($xmlString)) === false) { throw new Exception(__...
[ "public", "function", "processResponse", "(", ")", "{", "// Merge the response packets", "$", "xmlString", "=", "implode", "(", "''", ",", "$", "this", "->", "packets_response", ")", ";", "// Check to make sure this is will decode into a valid XML Document", "if", "(", ...
Process the response for the Tibia server @return array @throws \GameQ\Exception\Protocol
[ "Process", "the", "response", "for", "the", "Tibia", "server" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Tibia.php#L108-L141
Austinb/GameQ
src/GameQ/Protocols/Eco.php
Eco.processResponse
public function processResponse() { if (empty($this->packets_response)) { return []; } // Implode and rip out the JSON preg_match('/\{(.*)\}/ms', implode('', $this->packets_response), $matches); // Return should be JSON, let's validate if (!isset($matche...
php
public function processResponse() { if (empty($this->packets_response)) { return []; } // Implode and rip out the JSON preg_match('/\{(.*)\}/ms', implode('', $this->packets_response), $matches); // Return should be JSON, let's validate if (!isset($matche...
[ "public", "function", "processResponse", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "packets_response", ")", ")", "{", "return", "[", "]", ";", "}", "// Implode and rip out the JSON", "preg_match", "(", "'/\\{(.*)\\}/ms'", ",", "implode", "(", ...
Process the response @return array @throws Exception
[ "Process", "the", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Eco.php#L98-L122
Austinb/GameQ
src/GameQ/Filters/Normalize.php
Normalize.apply
public function apply(array $result, Server $server) { // No result passed so just return if (empty($result)) { return $result; } //$data = [ ]; //$data['raw'][$server->id()] = $result; // Grab the normalize for this protocol for the specific server ...
php
public function apply(array $result, Server $server) { // No result passed so just return if (empty($result)) { return $result; } //$data = [ ]; //$data['raw'][$server->id()] = $result; // Grab the normalize for this protocol for the specific server ...
[ "public", "function", "apply", "(", "array", "$", "result", ",", "Server", "$", "server", ")", "{", "// No result passed so just return", "if", "(", "empty", "(", "$", "result", ")", ")", "{", "return", "$", "result", ";", "}", "//$data = [ ];", "//$data['ra...
Apply this filter @param array $result @param \GameQ\Server $server @return array
[ "Apply", "this", "filter" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Filters/Normalize.php#L46-L91
Austinb/GameQ
src/GameQ/Filters/Normalize.php
Normalize.check
protected function check($section, $data) { // Normalized return array $normalized = []; if (isset($this->normalize[$section]) && !empty($this->normalize[$section])) { foreach ($this->normalize[$section] as $property => $raw) { // Default the value for the new k...
php
protected function check($section, $data) { // Normalized return array $normalized = []; if (isset($this->normalize[$section]) && !empty($this->normalize[$section])) { foreach ($this->normalize[$section] as $property => $raw) { // Default the value for the new k...
[ "protected", "function", "check", "(", "$", "section", ",", "$", "data", ")", "{", "// Normalized return array", "$", "normalized", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "this", "->", "normalize", "[", "$", "section", "]", ")", "&&", "!", ...
Check a section for normalization @param $section @param $data @return array
[ "Check", "a", "section", "for", "normalization" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Filters/Normalize.php#L101-L132
Austinb/GameQ
src/GameQ/Protocols/Quake2.php
Quake2.processResponse
public function processResponse() { // Make a buffer $buffer = new Buffer(implode('', $this->packets_response)); // Grab the header $header = $buffer->readString("\x0A"); // Figure out which packet response this is if (empty($header) || !array_key_exists($header, $t...
php
public function processResponse() { // Make a buffer $buffer = new Buffer(implode('', $this->packets_response)); // Grab the header $header = $buffer->readString("\x0A"); // Figure out which packet response this is if (empty($header) || !array_key_exists($header, $t...
[ "public", "function", "processResponse", "(", ")", "{", "// Make a buffer", "$", "buffer", "=", "new", "Buffer", "(", "implode", "(", "''", ",", "$", "this", "->", "packets_response", ")", ")", ";", "// Grab the header", "$", "header", "=", "$", "buffer", ...
Handle response from the server @return mixed @throws Exception
[ "Handle", "response", "from", "the", "server" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Quake2.php#L98-L112
Austinb/GameQ
src/GameQ/Protocols/Quake2.php
Quake2.processStatus
protected function processStatus(Buffer $buffer) { // We need to split the data and offload $results = $this->processServerInfo(new Buffer($buffer->readString("\x0A"))); $results = array_merge_recursive( $results, $this->processPlayers(new Buffer($buffer->getBuffer()...
php
protected function processStatus(Buffer $buffer) { // We need to split the data and offload $results = $this->processServerInfo(new Buffer($buffer->readString("\x0A"))); $results = array_merge_recursive( $results, $this->processPlayers(new Buffer($buffer->getBuffer()...
[ "protected", "function", "processStatus", "(", "Buffer", "$", "buffer", ")", "{", "// We need to split the data and offload", "$", "results", "=", "$", "this", "->", "processServerInfo", "(", "new", "Buffer", "(", "$", "buffer", "->", "readString", "(", "\"\\x0A\"...
Process the status response @param Buffer $buffer @return array
[ "Process", "the", "status", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Quake2.php#L121-L135
Austinb/GameQ
src/GameQ/Protocols/Quake2.php
Quake2.processServerInfo
protected function processServerInfo(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Burn leading \ if one exists $buffer->readString('\\'); // Key / value pairs while ($buffer->getLength()) { // Add result ...
php
protected function processServerInfo(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Burn leading \ if one exists $buffer->readString('\\'); // Key / value pairs while ($buffer->getLength()) { // Add result ...
[ "protected", "function", "processServerInfo", "(", "Buffer", "$", "buffer", ")", "{", "// Set the result to a new result instance", "$", "result", "=", "new", "Result", "(", ")", ";", "// Burn leading \\ if one exists", "$", "buffer", "->", "readString", "(", "'\\\\'"...
Handle processing the server information @param Buffer $buffer @return array
[ "Handle", "processing", "the", "server", "information" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Quake2.php#L144-L167
Austinb/GameQ
src/GameQ/Protocols/Quake2.php
Quake2.processPlayers
protected function processPlayers(Buffer $buffer) { // Some games do not have a number of current players $playerCount = 0; // Set the result to a new result instance $result = new Result(); // Loop until we are out of data while ($buffer->getLength()) { ...
php
protected function processPlayers(Buffer $buffer) { // Some games do not have a number of current players $playerCount = 0; // Set the result to a new result instance $result = new Result(); // Loop until we are out of data while ($buffer->getLength()) { ...
[ "protected", "function", "processPlayers", "(", "Buffer", "$", "buffer", ")", "{", "// Some games do not have a number of current players", "$", "playerCount", "=", "0", ";", "// Set the result to a new result instance", "$", "result", "=", "new", "Result", "(", ")", ";...
Handle processing of player data @param Buffer $buffer @return array
[ "Handle", "processing", "of", "player", "data" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Quake2.php#L176-L218
Austinb/GameQ
src/GameQ/Query/Core.php
Core.set
public function set($transport, $ip, $port, $timeout = 3, $blocking = false) { $this->transport = $transport; $this->ip = $ip; $this->port = $port; $this->timeout = $timeout; $this->blocking = $blocking; }
php
public function set($transport, $ip, $port, $timeout = 3, $blocking = false) { $this->transport = $transport; $this->ip = $ip; $this->port = $port; $this->timeout = $timeout; $this->blocking = $blocking; }
[ "public", "function", "set", "(", "$", "transport", ",", "$", "ip", ",", "$", "port", ",", "$", "timeout", "=", "3", ",", "$", "blocking", "=", "false", ")", "{", "$", "this", "->", "transport", "=", "$", "transport", ";", "$", "this", "->", "ip"...
Set the connection information for the socket @param string $transport @param string $ip @param int $port @param int $timeout seconds @param bool $blocking
[ "Set", "the", "connection", "information", "for", "the", "socket" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Query/Core.php#L91-L103
Austinb/GameQ
src/GameQ/Query/Core.php
Core.reset
public function reset() { $this->transport = null; $this->ip = null; $this->port = null; $this->timeout = 3; $this->blocking = false; }
php
public function reset() { $this->transport = null; $this->ip = null; $this->port = null; $this->timeout = 3; $this->blocking = false; }
[ "public", "function", "reset", "(", ")", "{", "$", "this", "->", "transport", "=", "null", ";", "$", "this", "->", "ip", "=", "null", ";", "$", "this", "->", "port", "=", "null", ";", "$", "this", "->", "timeout", "=", "3", ";", "$", "this", "-...
Reset this instance's properties
[ "Reset", "this", "instance", "s", "properties" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Query/Core.php#L108-L120
Austinb/GameQ
src/GameQ/Protocols/Bfbc2.php
Bfbc2.processResponse
public function processResponse() { //print_r($this->packets_response); // Holds the results sent back $results = []; // Iterate over the response packets // @todo: This protocol has no packet ordering, ids or anyway to identify which packet coming back belongs to which in...
php
public function processResponse() { //print_r($this->packets_response); // Holds the results sent back $results = []; // Iterate over the response packets // @todo: This protocol has no packet ordering, ids or anyway to identify which packet coming back belongs to which in...
[ "public", "function", "processResponse", "(", ")", "{", "//print_r($this->packets_response);", "// Holds the results sent back", "$", "results", "=", "[", "]", ";", "// Iterate over the response packets", "// @todo: This protocol has no packet ordering, ids or anyway to identify which ...
Process the response for the StarMade server @return array @throws \GameQ\Exception\Protocol
[ "Process", "the", "response", "for", "the", "StarMade", "server" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Bfbc2.php#L137-L173
Austinb/GameQ
src/GameQ/Protocol.php
Protocol.transport
public function transport($type = null) { // Act as setter if (!is_null($type)) { $this->transport = $type; } return $this->transport; }
php
public function transport($type = null) { // Act as setter if (!is_null($type)) { $this->transport = $type; } return $this->transport; }
[ "public", "function", "transport", "(", "$", "type", "=", "null", ")", "{", "// Act as setter", "if", "(", "!", "is_null", "(", "$", "type", ")", ")", "{", "$", "this", "->", "transport", "=", "$", "type", ";", "}", "return", "$", "this", "->", "tr...
Get/set the transport type for this protocol @param string|null $type @return string
[ "Get", "/", "set", "the", "transport", "type", "for", "this", "protocol" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocol.php#L322-L331
Austinb/GameQ
src/GameQ/Protocol.php
Protocol.getPacket
public function getPacket($type = []) { $packets = []; // We want an array of packets back if (is_array($type) && !empty($type)) { // Loop the packets foreach ($this->packets as $packet_type => $packet_data) { // We want this packet ...
php
public function getPacket($type = []) { $packets = []; // We want an array of packets back if (is_array($type) && !empty($type)) { // Loop the packets foreach ($this->packets as $packet_type => $packet_data) { // We want this packet ...
[ "public", "function", "getPacket", "(", "$", "type", "=", "[", "]", ")", "{", "$", "packets", "=", "[", "]", ";", "// We want an array of packets back", "if", "(", "is_array", "(", "$", "type", ")", "&&", "!", "empty", "(", "$", "type", ")", ")", "{"...
Return specific packet(s) @param array $type @return array
[ "Return", "specific", "packet", "(", "s", ")" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocol.php#L363-L396
Austinb/GameQ
src/GameQ/Protocol.php
Protocol.packetResponse
public function packetResponse(array $response = null) { // Act as setter if (!empty($response)) { $this->packets_response = $response; } return $this->packets_response; }
php
public function packetResponse(array $response = null) { // Act as setter if (!empty($response)) { $this->packets_response = $response; } return $this->packets_response; }
[ "public", "function", "packetResponse", "(", "array", "$", "response", "=", "null", ")", "{", "// Act as setter", "if", "(", "!", "empty", "(", "$", "response", ")", ")", "{", "$", "this", "->", "packets_response", "=", "$", "response", ";", "}", "return...
Get/set the packet response @param array|null $response @return array
[ "Get", "/", "set", "the", "packet", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocol.php#L405-L414
Austinb/GameQ
src/GameQ/Protocol.php
Protocol.hasChallenge
public function hasChallenge() { return (isset($this->packets[self::PACKET_CHALLENGE]) && !empty($this->packets[self::PACKET_CHALLENGE])); }
php
public function hasChallenge() { return (isset($this->packets[self::PACKET_CHALLENGE]) && !empty($this->packets[self::PACKET_CHALLENGE])); }
[ "public", "function", "hasChallenge", "(", ")", "{", "return", "(", "isset", "(", "$", "this", "->", "packets", "[", "self", "::", "PACKET_CHALLENGE", "]", ")", "&&", "!", "empty", "(", "$", "this", "->", "packets", "[", "self", "::", "PACKET_CHALLENGE",...
Determine whether or not this protocol has a challenge needed before querying @return bool
[ "Determine", "whether", "or", "not", "this", "protocol", "has", "a", "challenge", "needed", "before", "querying" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocol.php#L426-L430
Austinb/GameQ
src/GameQ/Protocol.php
Protocol.challengeApply
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); } return tr...
php
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); } return tr...
[ "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", ")", "{", ...
Apply the challenge string to all the packets that need it. @param string $challenge_string @return bool
[ "Apply", "the", "challenge", "string", "to", "all", "the", "packets", "that", "need", "it", "." ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocol.php#L456-L465
Austinb/GameQ
src/GameQ/Protocols/Gta5m.php
Gta5m.processResponse
public function processResponse() { // In case it comes back as multiple packets (it shouldn't) $buffer = new Buffer(implode('', $this->packets_response)); // Figure out what packet response this is for $response_type = $buffer->readString(PHP_EOL); // Figure out which pack...
php
public function processResponse() { // In case it comes back as multiple packets (it shouldn't) $buffer = new Buffer(implode('', $this->packets_response)); // Figure out what packet response this is for $response_type = $buffer->readString(PHP_EOL); // Figure out which pack...
[ "public", "function", "processResponse", "(", ")", "{", "// In case it comes back as multiple packets (it shouldn't)", "$", "buffer", "=", "new", "Buffer", "(", "implode", "(", "''", ",", "$", "this", "->", "packets_response", ")", ")", ";", "// Figure out what packet...
Process the response @return array @throws \GameQ\Exception\Protocol
[ "Process", "the", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Gta5m.php#L103-L120
Austinb/GameQ
src/GameQ/Protocols/Gta5m.php
Gta5m.processStatus
protected function processStatus(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Lets peek and see if the data starts with a \ if ($buffer->lookAhead(1) == '\\') { // Burn the first one $buffer->skip(1); } ...
php
protected function processStatus(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Lets peek and see if the data starts with a \ if ($buffer->lookAhead(1) == '\\') { // Burn the first one $buffer->skip(1); } ...
[ "protected", "function", "processStatus", "(", "Buffer", "$", "buffer", ")", "{", "// Set the result to a new result instance", "$", "result", "=", "new", "Result", "(", ")", ";", "// Lets peek and see if the data starts with a \\", "if", "(", "$", "buffer", "->", "lo...
Handle processing the status response @param Buffer $buffer @return array
[ "Handle", "processing", "the", "status", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Gta5m.php#L133-L172
Austinb/GameQ
src/GameQ/Protocols/Ffow.php
Ffow.processResponse
public function processResponse() { // Init results $results = []; foreach ($this->packets_response as $response) { $buffer = new Buffer($response); // Figure out what packet response this is for $response_type = $buffer->read(6); // Figure ...
php
public function processResponse() { // Init results $results = []; foreach ($this->packets_response as $response) { $buffer = new Buffer($response); // Figure out what packet response this is for $response_type = $buffer->read(6); // Figure ...
[ "public", "function", "processResponse", "(", ")", "{", "// Init results", "$", "results", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "packets_response", "as", "$", "response", ")", "{", "$", "buffer", "=", "new", "Buffer", "(", "$", "respons...
Handle response from the server @return mixed @throws Exception
[ "Handle", "response", "from", "the", "server" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ffow.php#L130-L156
Austinb/GameQ
src/GameQ/Protocols/Ffow.php
Ffow.processInfo
protected function processInfo(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); $result->add('servername', $buffer->readString()); $result->add('mapname', $buffer->readString()); $result->add('modname', $buffer->readString()); $res...
php
protected function processInfo(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); $result->add('servername', $buffer->readString()); $result->add('mapname', $buffer->readString()); $result->add('modname', $buffer->readString()); $res...
[ "protected", "function", "processInfo", "(", "Buffer", "$", "buffer", ")", "{", "// Set the result to a new result instance", "$", "result", "=", "new", "Result", "(", ")", ";", "$", "result", "->", "add", "(", "'servername'", ",", "$", "buffer", "->", "readSt...
Handle processing the server information @param Buffer $buffer @return array
[ "Handle", "processing", "the", "server", "information" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ffow.php#L165-L191
Austinb/GameQ
src/GameQ/Protocols/Ffow.php
Ffow.processRules
protected function processRules(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Burn extra header $buffer->skip(1); // Read rules until we run out of buffer while ($buffer->getLength()) { $key = $buffer->readString...
php
protected function processRules(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Burn extra header $buffer->skip(1); // Read rules until we run out of buffer while ($buffer->getLength()) { $key = $buffer->readString...
[ "protected", "function", "processRules", "(", "Buffer", "$", "buffer", ")", "{", "// Set the result to a new result instance", "$", "result", "=", "new", "Result", "(", ")", ";", "// Burn extra header", "$", "buffer", "->", "skip", "(", "1", ")", ";", "// Read r...
Handle processing the server rules @param Buffer $buffer @return array
[ "Handle", "processing", "the", "server", "rules" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ffow.php#L200-L223
Austinb/GameQ
src/GameQ/Protocols/Ase.php
Ase.processResponse
public function processResponse() { // Create a new buffer $buffer = new Buffer(implode('', $this->packets_response)); // Burn the header $buffer->skip(4); // Create a new result $result = new Result(); // Variables $result->add('gamename', $buffer...
php
public function processResponse() { // Create a new buffer $buffer = new Buffer(implode('', $this->packets_response)); // Burn the header $buffer->skip(4); // Create a new result $result = new Result(); // Variables $result->add('gamename', $buffer...
[ "public", "function", "processResponse", "(", ")", "{", "// Create a new buffer", "$", "buffer", "=", "new", "Buffer", "(", "implode", "(", "''", ",", "$", "this", "->", "packets_response", ")", ")", ";", "// Burn the header", "$", "buffer", "->", "skip", "(...
Process the response @return array @throws \GameQ\Exception\Protocol
[ "Process", "the", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ase.php#L106-L139
Austinb/GameQ
src/GameQ/Protocols/Ase.php
Ase.processKeyValuePairs
protected function processKeyValuePairs(Buffer &$buffer, Result &$result) { // Key / value pairs while ($buffer->getLength()) { $key = $buffer->readPascalString(1, true); // If we have an empty key, we've reached the end if (empty($key)) { break;...
php
protected function processKeyValuePairs(Buffer &$buffer, Result &$result) { // Key / value pairs while ($buffer->getLength()) { $key = $buffer->readPascalString(1, true); // If we have an empty key, we've reached the end if (empty($key)) { break;...
[ "protected", "function", "processKeyValuePairs", "(", "Buffer", "&", "$", "buffer", ",", "Result", "&", "$", "result", ")", "{", "// Key / value pairs", "while", "(", "$", "buffer", "->", "getLength", "(", ")", ")", "{", "$", "key", "=", "$", "buffer", "...
Handles processing the extra key/value pairs for server settings @param \GameQ\Buffer $buffer @param \GameQ\Result $result
[ "Handles", "processing", "the", "extra", "key", "/", "value", "pairs", "for", "server", "settings" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ase.php#L151-L171
Austinb/GameQ
src/GameQ/Protocols/Ase.php
Ase.processPlayersAndTeams
protected function processPlayersAndTeams(Buffer &$buffer, Result &$result) { // Players and team info while ($buffer->getLength()) { // Get the flags $flags = $buffer->readInt8(); // Get data according to the flags if ($flags & 1) { ...
php
protected function processPlayersAndTeams(Buffer &$buffer, Result &$result) { // Players and team info while ($buffer->getLength()) { // Get the flags $flags = $buffer->readInt8(); // Get data according to the flags if ($flags & 1) { ...
[ "protected", "function", "processPlayersAndTeams", "(", "Buffer", "&", "$", "buffer", ",", "Result", "&", "$", "result", ")", "{", "// Players and team info", "while", "(", "$", "buffer", "->", "getLength", "(", ")", ")", "{", "// Get the flags", "$", "flags",...
Handles processing the player and team data into a usable format @param \GameQ\Buffer $buffer @param \GameQ\Result $result
[ "Handles", "processing", "the", "player", "and", "team", "data", "into", "a", "usable", "format" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Ase.php#L179-L207
Austinb/GameQ
src/GameQ/Protocols/Lhmp.php
Lhmp.processResponse
public function processResponse() { // Will hold the packets after sorting $packets = []; // We need to pre-sort these for split packets so we can do extra work where needed foreach ($this->packets_response as $response) { $buffer = new Buffer($response); //...
php
public function processResponse() { // Will hold the packets after sorting $packets = []; // We need to pre-sort these for split packets so we can do extra work where needed foreach ($this->packets_response as $response) { $buffer = new Buffer($response); //...
[ "public", "function", "processResponse", "(", ")", "{", "// Will hold the packets after sorting", "$", "packets", "=", "[", "]", ";", "// We need to pre-sort these for split packets so we can do extra work where needed", "foreach", "(", "$", "this", "->", "packets_response", ...
Process the response @return array @throws \GameQ\Exception\Protocol
[ "Process", "the", "response" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Lhmp.php#L113-L150
Austinb/GameQ
src/GameQ/Protocols/Lhmp.php
Lhmp.processDetails
protected function processDetails(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); $result->add('protocol', $buffer->readString()); $result->add('password', $buffer->readString()); $result->add('numplayers', $buffer->readInt16()); ...
php
protected function processDetails(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); $result->add('protocol', $buffer->readString()); $result->add('password', $buffer->readString()); $result->add('numplayers', $buffer->readInt16()); ...
[ "protected", "function", "processDetails", "(", "Buffer", "$", "buffer", ")", "{", "// Set the result to a new result instance", "$", "result", "=", "new", "Result", "(", ")", ";", "$", "result", "->", "add", "(", "'protocol'", ",", "$", "buffer", "->", "readS...
Handles processing the details data into a usable format @param Buffer $buffer @return array @throws Exception
[ "Handles", "processing", "the", "details", "data", "into", "a", "usable", "format" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Lhmp.php#L164-L182
Austinb/GameQ
src/GameQ/Protocols/Lhmp.php
Lhmp.processPlayers
protected function processPlayers(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Get the number of players $result->add('numplayers', $buffer->readInt16()); // Parse players while ($buffer->getLength()) { // Play...
php
protected function processPlayers(Buffer $buffer) { // Set the result to a new result instance $result = new Result(); // Get the number of players $result->add('numplayers', $buffer->readInt16()); // Parse players while ($buffer->getLength()) { // Play...
[ "protected", "function", "processPlayers", "(", "Buffer", "$", "buffer", ")", "{", "// Set the result to a new result instance", "$", "result", "=", "new", "Result", "(", ")", ";", "// Get the number of players", "$", "result", "->", "add", "(", "'numplayers'", ",",...
Handles processing the player data into a usable format @param Buffer $buffer @return array
[ "Handles", "processing", "the", "player", "data", "into", "a", "usable", "format" ]
train
https://github.com/Austinb/GameQ/blob/85dadc7726f522a31f787a7917b4d6bc74c98529/src/GameQ/Protocols/Lhmp.php#L191-L213
HTMLMin/Laravel-HTMLMin
src/Minifiers/BladeMinifier.php
BladeMinifier.render
public function render($value) { if ($this->shouldMinify($value)) { $replace = [ '/<!--[^\[](.*?)[^\]]-->/s' => '', "/<\?php/" => '<?php ', "/\n([\S])/" => ' $1', "/\r/" => '', ...
php
public function render($value) { if ($this->shouldMinify($value)) { $replace = [ '/<!--[^\[](.*?)[^\]]-->/s' => '', "/<\?php/" => '<?php ', "/\n([\S])/" => ' $1', "/\r/" => '', ...
[ "public", "function", "render", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "shouldMinify", "(", "$", "value", ")", ")", "{", "$", "replace", "=", "[", "'/<!--[^\\[](.*?)[^\\]]-->/s'", "=>", "''", ",", "\"/<\\?php/\"", "=>", "'<?php '", ",...
Get the minified value. All credit to Trevor Fitzgerald for the regex here. See the original here: http://bit.ly/U7mv7a. @param string $value @return string
[ "Get", "the", "minified", "value", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/Minifiers/BladeMinifier.php#L52-L72
HTMLMin/Laravel-HTMLMin
src/Minifiers/BladeMinifier.php
BladeMinifier.shouldMinify
protected function shouldMinify($value) { if ($this->force) { return true; } return !$this->containsBadHtml($value) && !$this->containsBadComments($value); }
php
protected function shouldMinify($value) { if ($this->force) { return true; } return !$this->containsBadHtml($value) && !$this->containsBadComments($value); }
[ "protected", "function", "shouldMinify", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "force", ")", "{", "return", "true", ";", "}", "return", "!", "$", "this", "->", "containsBadHtml", "(", "$", "value", ")", "&&", "!", "$", "this", ...
Determine if the blade should be minified. @param string $value @return bool
[ "Determine", "if", "the", "blade", "should", "be", "minified", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/Minifiers/BladeMinifier.php#L81-L88
HTMLMin/Laravel-HTMLMin
src/Minifiers/BladeMinifier.php
BladeMinifier.containsBadHtml
protected function containsBadHtml($value) { return preg_match('/<(code|pre|textarea)/', $value) || preg_match('/<script[^\??>]*>[^<\/script>]/', $value) || preg_match('/<!--[\s]+skip\.minification[\s]+-->/', $value) || preg_match('/value=("|\')(.*)([ ]{2,})(.*)("|\')/', ...
php
protected function containsBadHtml($value) { return preg_match('/<(code|pre|textarea)/', $value) || preg_match('/<script[^\??>]*>[^<\/script>]/', $value) || preg_match('/<!--[\s]+skip\.minification[\s]+-->/', $value) || preg_match('/value=("|\')(.*)([ ]{2,})(.*)("|\')/', ...
[ "protected", "function", "containsBadHtml", "(", "$", "value", ")", "{", "return", "preg_match", "(", "'/<(code|pre|textarea)/'", ",", "$", "value", ")", "||", "preg_match", "(", "'/<script[^\\??>]*>[^<\\/script>]/'", ",", "$", "value", ")", "||", "preg_match", "(...
Does the code contain bad html? @param string $value @return bool
[ "Does", "the", "code", "contain", "bad", "html?" ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/Minifiers/BladeMinifier.php#L97-L103
HTMLMin/Laravel-HTMLMin
src/Minifiers/BladeMinifier.php
BladeMinifier.containsBadComments
protected function containsBadComments($value) { foreach (token_get_all($value) as $token) { if (!is_array($token) || !isset($token[0]) || $token[0] !== T_COMMENT) { continue; } if (substr($token[1], 0, 2) === '//') { return true; ...
php
protected function containsBadComments($value) { foreach (token_get_all($value) as $token) { if (!is_array($token) || !isset($token[0]) || $token[0] !== T_COMMENT) { continue; } if (substr($token[1], 0, 2) === '//') { return true; ...
[ "protected", "function", "containsBadComments", "(", "$", "value", ")", "{", "foreach", "(", "token_get_all", "(", "$", "value", ")", "as", "$", "token", ")", "{", "if", "(", "!", "is_array", "(", "$", "token", ")", "||", "!", "isset", "(", "$", "tok...
Does the code contain bad comments? @param string $value @return bool
[ "Does", "the", "code", "contain", "bad", "comments?" ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/Minifiers/BladeMinifier.php#L112-L125
HTMLMin/Laravel-HTMLMin
src/Compilers/MinifyCompiler.php
MinifyCompiler.compileMinify
public function compileMinify($value) { if ($this->ignoredPaths) { $path = str_replace('\\', '/', $this->getPath()); foreach ($this->ignoredPaths as $ignoredPath) { if (strpos($path, $ignoredPath) !== false) { return $value; } ...
php
public function compileMinify($value) { if ($this->ignoredPaths) { $path = str_replace('\\', '/', $this->getPath()); foreach ($this->ignoredPaths as $ignoredPath) { if (strpos($path, $ignoredPath) !== false) { return $value; } ...
[ "public", "function", "compileMinify", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "ignoredPaths", ")", "{", "$", "path", "=", "str_replace", "(", "'\\\\'", ",", "'/'", ",", "$", "this", "->", "getPath", "(", ")", ")", ";", "foreach", ...
Minifies the output before saving it. @param string $value @return string
[ "Minifies", "the", "output", "before", "saving", "it", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/Compilers/MinifyCompiler.php#L65-L78
HTMLMin/Laravel-HTMLMin
src/Minifiers/HtmlMinifier.php
HtmlMinifier.render
public function render($value) { $options = [ 'cssMinifier' => function ($css) { return $this->css->render($css); }, 'jsMinifier' => function ($js) { return $this->js->render($js); }, 'jsCleanComments' => true, ...
php
public function render($value) { $options = [ 'cssMinifier' => function ($css) { return $this->css->render($css); }, 'jsMinifier' => function ($js) { return $this->js->render($js); }, 'jsCleanComments' => true, ...
[ "public", "function", "render", "(", "$", "value", ")", "{", "$", "options", "=", "[", "'cssMinifier'", "=>", "function", "(", "$", "css", ")", "{", "return", "$", "this", "->", "css", "->", "render", "(", "$", "css", ")", ";", "}", ",", "'jsMinifi...
Get the minified value. @param string $value @return string
[ "Get", "the", "minified", "value", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/Minifiers/HtmlMinifier.php#L59-L72
HTMLMin/Laravel-HTMLMin
src/HTMLMinServiceProvider.php
HTMLMinServiceProvider.enableBladeOptimisations
protected function enableBladeOptimisations() { $app = $this->app; $app->view->getEngineResolver()->register('blade', function () use ($app) { $compiler = $app['htmlmin.compiler']; return new CompilerEngine($compiler); }); $app->view->addExtension('blade.ph...
php
protected function enableBladeOptimisations() { $app = $this->app; $app->view->getEngineResolver()->register('blade', function () use ($app) { $compiler = $app['htmlmin.compiler']; return new CompilerEngine($compiler); }); $app->view->addExtension('blade.ph...
[ "protected", "function", "enableBladeOptimisations", "(", ")", "{", "$", "app", "=", "$", "this", "->", "app", ";", "$", "app", "->", "view", "->", "getEngineResolver", "(", ")", "->", "register", "(", "'blade'", ",", "function", "(", ")", "use", "(", ...
Enable blade optimisations. @return void
[ "Enable", "blade", "optimisations", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/HTMLMinServiceProvider.php#L70-L81
HTMLMin/Laravel-HTMLMin
src/HTMLMinServiceProvider.php
HTMLMinServiceProvider.register
public function register() { $this->registerJsMinifier(); $this->registerCssMinifier(); $this->registerHtmlMinifier(); $this->registerBladeMinifier(); $this->registerMinifyCompiler(); $this->registerHTMLMin(); }
php
public function register() { $this->registerJsMinifier(); $this->registerCssMinifier(); $this->registerHtmlMinifier(); $this->registerBladeMinifier(); $this->registerMinifyCompiler(); $this->registerHTMLMin(); }
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "registerJsMinifier", "(", ")", ";", "$", "this", "->", "registerCssMinifier", "(", ")", ";", "$", "this", "->", "registerHtmlMinifier", "(", ")", ";", "$", "this", "->", "registerBladeMin...
Register the service provider. @return void
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/HTMLMinServiceProvider.php#L88-L96
HTMLMin/Laravel-HTMLMin
src/HTMLMinServiceProvider.php
HTMLMinServiceProvider.registerHtmlMinifier
protected function registerHtmlMinifier() { $this->app->singleton('htmlmin.html', function (Container $app) { $css = $app['htmlmin.css']; $js = $app['htmlmin.js']; return new HtmlMinifier($css, $js); }); $this->app->alias('htmlmin.html', HtmlMinifier::cl...
php
protected function registerHtmlMinifier() { $this->app->singleton('htmlmin.html', function (Container $app) { $css = $app['htmlmin.css']; $js = $app['htmlmin.js']; return new HtmlMinifier($css, $js); }); $this->app->alias('htmlmin.html', HtmlMinifier::cl...
[ "protected", "function", "registerHtmlMinifier", "(", ")", "{", "$", "this", "->", "app", "->", "singleton", "(", "'htmlmin.html'", ",", "function", "(", "Container", "$", "app", ")", "{", "$", "css", "=", "$", "app", "[", "'htmlmin.css'", "]", ";", "$",...
Register the html minifier class. @return void
[ "Register", "the", "html", "minifier", "class", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/HTMLMinServiceProvider.php#L131-L141
HTMLMin/Laravel-HTMLMin
src/HTMLMinServiceProvider.php
HTMLMinServiceProvider.registerBladeMinifier
protected function registerBladeMinifier() { $this->app->singleton('htmlmin.blade', function (Container $app) { $force = $app->config->get('htmlmin.force', false); return new BladeMinifier($force); }); $this->app->alias('htmlmin.blade', BladeMinifier::class); }
php
protected function registerBladeMinifier() { $this->app->singleton('htmlmin.blade', function (Container $app) { $force = $app->config->get('htmlmin.force', false); return new BladeMinifier($force); }); $this->app->alias('htmlmin.blade', BladeMinifier::class); }
[ "protected", "function", "registerBladeMinifier", "(", ")", "{", "$", "this", "->", "app", "->", "singleton", "(", "'htmlmin.blade'", ",", "function", "(", "Container", "$", "app", ")", "{", "$", "force", "=", "$", "app", "->", "config", "->", "get", "("...
Register the blade minifier class. @return void
[ "Register", "the", "blade", "minifier", "class", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/HTMLMinServiceProvider.php#L148-L157
HTMLMin/Laravel-HTMLMin
src/HTMLMinServiceProvider.php
HTMLMinServiceProvider.registerMinifyCompiler
protected function registerMinifyCompiler() { $this->app->singleton('htmlmin.compiler', function (Container $app) { $blade = $app['htmlmin.blade']; $files = $app['files']; $storagePath = $app->config->get('view.compiled'); $ignoredPaths = $app->config->get('ht...
php
protected function registerMinifyCompiler() { $this->app->singleton('htmlmin.compiler', function (Container $app) { $blade = $app['htmlmin.blade']; $files = $app['files']; $storagePath = $app->config->get('view.compiled'); $ignoredPaths = $app->config->get('ht...
[ "protected", "function", "registerMinifyCompiler", "(", ")", "{", "$", "this", "->", "app", "->", "singleton", "(", "'htmlmin.compiler'", ",", "function", "(", "Container", "$", "app", ")", "{", "$", "blade", "=", "$", "app", "[", "'htmlmin.blade'", "]", "...
Register the minify compiler class. @return void
[ "Register", "the", "minify", "compiler", "class", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/HTMLMinServiceProvider.php#L164-L176
HTMLMin/Laravel-HTMLMin
src/HTMLMinServiceProvider.php
HTMLMinServiceProvider.registerHTMLMin
protected function registerHTMLMin() { $this->app->singleton('htmlmin', function (Container $app) { $blade = $app['htmlmin.blade']; $css = $app['htmlmin.css']; $js = $app['htmlmin.js']; $html = $app['htmlmin.html']; return new HTMLMin($blade, $css...
php
protected function registerHTMLMin() { $this->app->singleton('htmlmin', function (Container $app) { $blade = $app['htmlmin.blade']; $css = $app['htmlmin.css']; $js = $app['htmlmin.js']; $html = $app['htmlmin.html']; return new HTMLMin($blade, $css...
[ "protected", "function", "registerHTMLMin", "(", ")", "{", "$", "this", "->", "app", "->", "singleton", "(", "'htmlmin'", ",", "function", "(", "Container", "$", "app", ")", "{", "$", "blade", "=", "$", "app", "[", "'htmlmin.blade'", "]", ";", "$", "cs...
Register the htmlmin class. @return void
[ "Register", "the", "htmlmin", "class", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/HTMLMinServiceProvider.php#L183-L195
HTMLMin/Laravel-HTMLMin
src/Http/Middleware/MinifyMiddleware.php
MinifyMiddleware.handle
public function handle($request, Closure $next) { $response = $next($request); if ($this->isAResponseObject($response) && $this->isAnHtmlResponse($response)) { $output = $response->getContent(); $minified = $this->html->render($output); $response->setContent($min...
php
public function handle($request, Closure $next) { $response = $next($request); if ($this->isAResponseObject($response) && $this->isAnHtmlResponse($response)) { $output = $response->getContent(); $minified = $this->html->render($output); $response->setContent($min...
[ "public", "function", "handle", "(", "$", "request", ",", "Closure", "$", "next", ")", "{", "$", "response", "=", "$", "next", "(", "$", "request", ")", ";", "if", "(", "$", "this", "->", "isAResponseObject", "(", "$", "response", ")", "&&", "$", "...
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @return mixed
[ "Handle", "an", "incoming", "request", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/Http/Middleware/MinifyMiddleware.php#L53-L64
HTMLMin/Laravel-HTMLMin
src/Http/Middleware/MinifyMiddleware.php
MinifyMiddleware.isAnHtmlResponse
protected function isAnHtmlResponse(Response $response) { $type = $response->headers->get('Content-Type'); return strtolower(strtok($type, ';')) === 'text/html'; }
php
protected function isAnHtmlResponse(Response $response) { $type = $response->headers->get('Content-Type'); return strtolower(strtok($type, ';')) === 'text/html'; }
[ "protected", "function", "isAnHtmlResponse", "(", "Response", "$", "response", ")", "{", "$", "type", "=", "$", "response", "->", "headers", "->", "get", "(", "'Content-Type'", ")", ";", "return", "strtolower", "(", "strtok", "(", "$", "type", ",", "';'", ...
Check if the content type header is html. @param \Illuminate\Http\Response $response @return bool
[ "Check", "if", "the", "content", "type", "header", "is", "html", "." ]
train
https://github.com/HTMLMin/Laravel-HTMLMin/blob/2e2f4f7417b4a03d2be1fed7d34269633a7f8f31/src/Http/Middleware/MinifyMiddleware.php#L85-L90
EdgedesignCZ/phpqa
src/Config.php
Config.mergeConfigs
private function mergeConfigs($key) { $mergedConfig = []; $userConfig = key($this->configs); foreach ($this->configs as $config) { $mergedConfig = array_merge(isset($config[$key]) ? $config[$key] : [], $mergedConfig); } $this->configs[$userConfig][$key] = $mergedC...
php
private function mergeConfigs($key) { $mergedConfig = []; $userConfig = key($this->configs); foreach ($this->configs as $config) { $mergedConfig = array_merge(isset($config[$key]) ? $config[$key] : [], $mergedConfig); } $this->configs[$userConfig][$key] = $mergedC...
[ "private", "function", "mergeConfigs", "(", "$", "key", ")", "{", "$", "mergedConfig", "=", "[", "]", ";", "$", "userConfig", "=", "key", "(", "$", "this", "->", "configs", ")", ";", "foreach", "(", "$", "this", "->", "configs", "as", "$", "config", ...
right now it cannot be used for 'report' because it would path would return invalid file
[ "right", "now", "it", "cannot", "be", "used", "for", "report", "because", "it", "would", "path", "would", "return", "invalid", "file" ]
train
https://github.com/EdgedesignCZ/phpqa/blob/8a5b3f351b757b3eb94d1ea8c615da52e77ee7e1/src/Config.php#L45-L53
top-think/think-worker
src/Session.php
Session.init
public function init(array $config = []) { $config = $config ?: $this->config; $isDoStart = false; if (isset($config['use_trans_sid'])) { ini_set('session.use_trans_sid', $config['use_trans_sid'] ? 1 : 0); } // 启动session if (!empty($config['auto_start'])...
php
public function init(array $config = []) { $config = $config ?: $this->config; $isDoStart = false; if (isset($config['use_trans_sid'])) { ini_set('session.use_trans_sid', $config['use_trans_sid'] ? 1 : 0); } // 启动session if (!empty($config['auto_start'])...
[ "public", "function", "init", "(", "array", "$", "config", "=", "[", "]", ")", "{", "$", "config", "=", "$", "config", "?", ":", "$", "this", "->", "config", ";", "$", "isDoStart", "=", "false", ";", "if", "(", "isset", "(", "$", "config", "[", ...
session初始化 @access public @param array $config @return void @throws \think\Exception
[ "session初始化" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/Session.php#L28-L113
top-think/think-worker
src/Session.php
Session.boot
public function boot() { if (is_null($this->init)) { $this->init(); } if (false === $this->init) { if (PHP_SESSION_ACTIVE != session_status()) { $this->start(); } $this->init = true; } }
php
public function boot() { if (is_null($this->init)) { $this->init(); } if (false === $this->init) { if (PHP_SESSION_ACTIVE != session_status()) { $this->start(); } $this->init = true; } }
[ "public", "function", "boot", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "init", ")", ")", "{", "$", "this", "->", "init", "(", ")", ";", "}", "if", "(", "false", "===", "$", "this", "->", "init", ")", "{", "if", "(", "PHP_S...
session自动启动或者初始化 @access public @return void
[ "session自动启动或者初始化" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/Session.php#L120-L132
top-think/think-worker
src/Http.php
Http.onWorkerStart
public function onWorkerStart($worker) { $this->initMimeTypeMap(); $this->app = new Application($this->appPath); $this->lastMtime = time(); $this->app->workerman = $worker; // 指定日志类驱动 Loader::addClassMap([ 'think\\log\\driver\\File' => __DIR__ . '/...
php
public function onWorkerStart($worker) { $this->initMimeTypeMap(); $this->app = new Application($this->appPath); $this->lastMtime = time(); $this->app->workerman = $worker; // 指定日志类驱动 Loader::addClassMap([ 'think\\log\\driver\\File' => __DIR__ . '/...
[ "public", "function", "onWorkerStart", "(", "$", "worker", ")", "{", "$", "this", "->", "initMimeTypeMap", "(", ")", ";", "$", "this", "->", "app", "=", "new", "Application", "(", "$", "this", "->", "appPath", ")", ";", "$", "this", "->", "lastMtime", ...
onWorkerStart 事件回调 @access public @param \Workerman\Worker $worker @return void @throws \Exception
[ "onWorkerStart", "事件回调" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/Http.php#L98-L150
top-think/think-worker
src/Http.php
Http.onMessage
public function onMessage($connection, $data) { $uri = parse_url($_SERVER['REQUEST_URI']); $path = isset($uri['path']) ? $uri['path'] : '/'; $file = $this->root . $path; if (!is_file($file)) { $this->app->worker($connection, $data); } else { $this->...
php
public function onMessage($connection, $data) { $uri = parse_url($_SERVER['REQUEST_URI']); $path = isset($uri['path']) ? $uri['path'] : '/'; $file = $this->root . $path; if (!is_file($file)) { $this->app->worker($connection, $data); } else { $this->...
[ "public", "function", "onMessage", "(", "$", "connection", ",", "$", "data", ")", "{", "$", "uri", "=", "parse_url", "(", "$", "_SERVER", "[", "'REQUEST_URI'", "]", ")", ";", "$", "path", "=", "isset", "(", "$", "uri", "[", "'path'", "]", ")", "?",...
onMessage 事件回调 @access public @param \Workerman\Connection\TcpConnection $connection @param mixed $data @return void
[ "onMessage", "事件回调" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/Http.php#L159-L171
top-think/think-worker
src/Http.php
Http.getMimeType
public function getMimeType($filename) { $file_info = pathinfo($filename); $extension = isset($file_info['extension']) ? $file_info['extension'] : ''; if (isset(self::$mimeTypeMap[$extension])) { $mime = self::$mimeTypeMap[$extension]; } else { $finfo = finfo...
php
public function getMimeType($filename) { $file_info = pathinfo($filename); $extension = isset($file_info['extension']) ? $file_info['extension'] : ''; if (isset(self::$mimeTypeMap[$extension])) { $mime = self::$mimeTypeMap[$extension]; } else { $finfo = finfo...
[ "public", "function", "getMimeType", "(", "$", "filename", ")", "{", "$", "file_info", "=", "pathinfo", "(", "$", "filename", ")", ";", "$", "extension", "=", "isset", "(", "$", "file_info", "[", "'extension'", "]", ")", "?", "$", "file_info", "[", "'e...
获取文件类型信息 @access public @param $filename @return string
[ "获取文件类型信息" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/Http.php#L221-L233
top-think/think-worker
src/Application.php
Application.worker
public function worker($connection) { try { ob_start(); // 重置应用的开始时间和内存占用 $this->beginTime = microtime(true); $this->beginMem = memory_get_usage(); // 销毁当前请求对象实例 $this->delete('think\Request'); $pathinfo = ltrim(strpos($_...
php
public function worker($connection) { try { ob_start(); // 重置应用的开始时间和内存占用 $this->beginTime = microtime(true); $this->beginMem = memory_get_usage(); // 销毁当前请求对象实例 $this->delete('think\Request'); $pathinfo = ltrim(strpos($_...
[ "public", "function", "worker", "(", "$", "connection", ")", "{", "try", "{", "ob_start", "(", ")", ";", "// 重置应用的开始时间和内存占用", "$", "this", "->", "beginTime", "=", "microtime", "(", "true", ")", ";", "$", "this", "->", "beginMem", "=", "memory_get_usage", ...
处理Worker请求 @access public @param \Workerman\Connection\TcpConnection $connection @param void
[ "处理Worker请求" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/Application.php#L30-L78
top-think/think-worker
src/command/GatewayWorker.php
GatewayWorker.start
public function start($host, $port, $option = []) { $registerAddress = !empty($option['registerAddress']) ? $option['registerAddress'] : '127.0.0.1:1236'; if (!empty($option['register_deploy'])) { // 分布式部署的时候其它服务器可以关闭register服务 // 注意需要设置不同的lanIp $this->register($...
php
public function start($host, $port, $option = []) { $registerAddress = !empty($option['registerAddress']) ? $option['registerAddress'] : '127.0.0.1:1236'; if (!empty($option['register_deploy'])) { // 分布式部署的时候其它服务器可以关闭register服务 // 注意需要设置不同的lanIp $this->register($...
[ "public", "function", "start", "(", "$", "host", ",", "$", "port", ",", "$", "option", "=", "[", "]", ")", "{", "$", "registerAddress", "=", "!", "empty", "(", "$", "option", "[", "'registerAddress'", "]", ")", "?", "$", "option", "[", "'registerAddr...
启动 @access public @param string $host 监听地址 @param integer $port 监听端口 @param array $option 参数 @return void
[ "启动" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/command/GatewayWorker.php#L88-L109
top-think/think-worker
src/command/GatewayWorker.php
GatewayWorker.businessWorker
public function businessWorker($registerAddress, $option = []) { // 初始化 bussinessWorker 进程 $worker = new BusinessWorker(); $this->option($worker, $option); $worker->registerAddress = $registerAddress; }
php
public function businessWorker($registerAddress, $option = []) { // 初始化 bussinessWorker 进程 $worker = new BusinessWorker(); $this->option($worker, $option); $worker->registerAddress = $registerAddress; }
[ "public", "function", "businessWorker", "(", "$", "registerAddress", ",", "$", "option", "=", "[", "]", ")", "{", "// 初始化 bussinessWorker 进程", "$", "worker", "=", "new", "BusinessWorker", "(", ")", ";", "$", "this", "->", "option", "(", "$", "worker", ",",...
启动businessWorker @access public @param string $registerAddress registerAddress @param array $option 参数 @return void
[ "启动businessWorker" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/command/GatewayWorker.php#L130-L138
top-think/think-worker
src/command/GatewayWorker.php
GatewayWorker.gateway
public function gateway($registerAddress, $host, $port, $option = []) { // 初始化 gateway 进程 if (!empty($option['socket'])) { $socket = $option['socket']; unset($option['socket']); } else { $protocol = !empty($option['protocol']) ? $option['protocol'] : 'webs...
php
public function gateway($registerAddress, $host, $port, $option = []) { // 初始化 gateway 进程 if (!empty($option['socket'])) { $socket = $option['socket']; unset($option['socket']); } else { $protocol = !empty($option['protocol']) ? $option['protocol'] : 'webs...
[ "public", "function", "gateway", "(", "$", "registerAddress", ",", "$", "host", ",", "$", "port", ",", "$", "option", "=", "[", "]", ")", "{", "// 初始化 gateway 进程", "if", "(", "!", "empty", "(", "$", "option", "[", "'socket'", "]", ")", ")", "{", "$...
启动gateway @access public @param string $registerAddress registerAddress @param string $host 服务地址 @param integer $port 监听端口 @param array $option 参数 @return void
[ "启动gateway" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/command/GatewayWorker.php#L149-L182
top-think/think-worker
src/command/GatewayWorker.php
GatewayWorker.option
protected function option($worker, array $option = []) { // 设置参数 if (!empty($option)) { foreach ($option as $key => $val) { $worker->$key = $val; } } }
php
protected function option($worker, array $option = []) { // 设置参数 if (!empty($option)) { foreach ($option as $key => $val) { $worker->$key = $val; } } }
[ "protected", "function", "option", "(", "$", "worker", ",", "array", "$", "option", "=", "[", "]", ")", "{", "// 设置参数", "if", "(", "!", "empty", "(", "$", "option", ")", ")", "{", "foreach", "(", "$", "option", "as", "$", "key", "=>", "$", "val",...
设置参数 @access protected @param Worker $worker Worker对象 @param array $option 参数 @return void
[ "设置参数" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/command/GatewayWorker.php#L191-L199
top-think/think-worker
src/log/File.php
File.save
public function save(array $log = [], $append = false) { $destination = $this->getMasterLogFile(); $path = dirname($destination); !is_dir($path) && mkdir($path, 0755, true); $info = []; foreach ($log as $type => $val) { foreach ($val as $msg) { ...
php
public function save(array $log = [], $append = false) { $destination = $this->getMasterLogFile(); $path = dirname($destination); !is_dir($path) && mkdir($path, 0755, true); $info = []; foreach ($log as $type => $val) { foreach ($val as $msg) { ...
[ "public", "function", "save", "(", "array", "$", "log", "=", "[", "]", ",", "$", "append", "=", "false", ")", "{", "$", "destination", "=", "$", "this", "->", "getMasterLogFile", "(", ")", ";", "$", "path", "=", "dirname", "(", "$", "destination", ...
日志写入接口 @access public @param array $log 日志信息 @param bool $append 是否追加请求信息 @return bool
[ "日志写入接口" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/log/File.php#L56-L90
top-think/think-worker
src/log/File.php
File.write
protected function write($message, $destination, $apart = false, $append = false) { // 检测日志文件大小,超过配置大小则备份日志文件重新生成 $this->checkLogSize($destination); // 日志信息封装 $info['timestamp'] = date($this->config['time_format']); foreach ($message as $type => $msg) { $info[$t...
php
protected function write($message, $destination, $apart = false, $append = false) { // 检测日志文件大小,超过配置大小则备份日志文件重新生成 $this->checkLogSize($destination); // 日志信息封装 $info['timestamp'] = date($this->config['time_format']); foreach ($message as $type => $msg) { $info[$t...
[ "protected", "function", "write", "(", "$", "message", ",", "$", "destination", ",", "$", "apart", "=", "false", ",", "$", "append", "=", "false", ")", "{", "// 检测日志文件大小,超过配置大小则备份日志文件重新生成", "$", "this", "->", "checkLogSize", "(", "$", "destination", ")", "...
日志写入 @access protected @param array $message 日志信息 @param string $destination 日志文件 @param bool $apart 是否独立文件写入 @param bool $append 是否追加请求信息 @return bool
[ "日志写入" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/log/File.php#L101-L123
top-think/think-worker
src/log/File.php
File.getMasterLogFile
protected function getMasterLogFile() { if ($this->config['single']) { $name = is_string($this->config['single']) ? $this->config['single'] : 'worker'; $destination = $this->config['path'] . $name . '.log'; } else { if ($this->config['max_files']) { ...
php
protected function getMasterLogFile() { if ($this->config['single']) { $name = is_string($this->config['single']) ? $this->config['single'] : 'worker'; $destination = $this->config['path'] . $name . '.log'; } else { if ($this->config['max_files']) { ...
[ "protected", "function", "getMasterLogFile", "(", ")", "{", "if", "(", "$", "this", "->", "config", "[", "'single'", "]", ")", "{", "$", "name", "=", "is_string", "(", "$", "this", "->", "config", "[", "'single'", "]", ")", "?", "$", "this", "->", ...
获取主日志文件名 @access public @return string
[ "获取主日志文件名" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/log/File.php#L130-L155
top-think/think-worker
src/log/File.php
File.getApartLevelFile
protected function getApartLevelFile($path, $type) { if ($this->config['single']) { $name = is_string($this->config['single']) ? $this->config['single'] : 'worker'; $name .= '_' . $type; } elseif ($this->config['max_files']) { $name = date('Ymd') . '_' . $type . ...
php
protected function getApartLevelFile($path, $type) { if ($this->config['single']) { $name = is_string($this->config['single']) ? $this->config['single'] : 'worker'; $name .= '_' . $type; } elseif ($this->config['max_files']) { $name = date('Ymd') . '_' . $type . ...
[ "protected", "function", "getApartLevelFile", "(", "$", "path", ",", "$", "type", ")", "{", "if", "(", "$", "this", "->", "config", "[", "'single'", "]", ")", "{", "$", "name", "=", "is_string", "(", "$", "this", "->", "config", "[", "'single'", "]",...
获取独立日志文件名 @access public @param string $path 日志目录 @param string $type 日志类型 @return string
[ "获取独立日志文件名" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/log/File.php#L164-L177
top-think/think-worker
src/log/File.php
File.checkLogSize
protected function checkLogSize($destination) { if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { try { rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination)); } catch (\Excep...
php
protected function checkLogSize($destination) { if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { try { rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination)); } catch (\Excep...
[ "protected", "function", "checkLogSize", "(", "$", "destination", ")", "{", "if", "(", "is_file", "(", "$", "destination", ")", "&&", "floor", "(", "$", "this", "->", "config", "[", "'file_size'", "]", ")", "<=", "filesize", "(", "$", "destination", ")",...
检查日志文件大小并自动生成备份文件 @access protected @param string $destination 日志文件 @return void
[ "检查日志文件大小并自动生成备份文件" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/log/File.php#L185-L193
top-think/think-worker
src/log/File.php
File.parseCliLog
protected function parseCliLog($info) { if ($this->config['json']) { $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\r\n"; } else { $now = $info['timestamp']; unset($info['timestamp']); $message = implode("\r\n", $in...
php
protected function parseCliLog($info) { if ($this->config['json']) { $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\r\n"; } else { $now = $info['timestamp']; unset($info['timestamp']); $message = implode("\r\n", $in...
[ "protected", "function", "parseCliLog", "(", "$", "info", ")", "{", "if", "(", "$", "this", "->", "config", "[", "'json'", "]", ")", "{", "$", "message", "=", "json_encode", "(", "$", "info", ",", "JSON_UNESCAPED_UNICODE", "|", "JSON_UNESCAPED_SLASHES", ")...
CLI日志解析 @access protected @param array $info 日志信息 @return string
[ "CLI日志解析" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/log/File.php#L201-L215
top-think/think-worker
src/log/File.php
File.parseLog
protected function parseLog($info) { $requestInfo = [ 'ip' => $this->app['request']->ip(), 'method' => $this->app['request']->method(), 'host' => $this->app['request']->host(), 'uri' => $this->app['request']->url(), ]; if ($this->conf...
php
protected function parseLog($info) { $requestInfo = [ 'ip' => $this->app['request']->ip(), 'method' => $this->app['request']->method(), 'host' => $this->app['request']->host(), 'uri' => $this->app['request']->url(), ]; if ($this->conf...
[ "protected", "function", "parseLog", "(", "$", "info", ")", "{", "$", "requestInfo", "=", "[", "'ip'", "=>", "$", "this", "->", "app", "[", "'request'", "]", "->", "ip", "(", ")", ",", "'method'", "=>", "$", "this", "->", "app", "[", "'request'", "...
解析日志 @access protected @param array $info 日志信息 @return string
[ "解析日志" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/log/File.php#L223-L241
top-think/think-worker
src/Cookie.php
Cookie.setCookie
protected function setCookie($name, $value, $expire, $option = []) { WorkerHttp::setCookie($name, $value, $expire, $option['path'], $option['domain'], $option['secure'], $option['httponly']); }
php
protected function setCookie($name, $value, $expire, $option = []) { WorkerHttp::setCookie($name, $value, $expire, $option['path'], $option['domain'], $option['secure'], $option['httponly']); }
[ "protected", "function", "setCookie", "(", "$", "name", ",", "$", "value", ",", "$", "expire", ",", "$", "option", "=", "[", "]", ")", "{", "WorkerHttp", "::", "setCookie", "(", "$", "name", ",", "$", "value", ",", "$", "expire", ",", "$", "option"...
Cookie 设置保存 @access public @param string $name cookie名称 @param mixed $value cookie值 @param array $option 可选参数 @return void
[ "Cookie", "设置保存" ]
train
https://github.com/top-think/think-worker/blob/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f/src/Cookie.php#L42-L45