_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q18900
Protection.replaceStatusChecksContexts
train
public function replaceStatusChecksContexts($username, $repository, $branch, array $params = []) { return
php
{ "resource": "" }
q18901
Protection.addStatusChecksContexts
train
public function addStatusChecksContexts($username, $repository, $branch, array $params = []) { return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repositor
php
{ "resource": "" }
q18902
Protection.removeStatusChecksContexts
train
public function removeStatusChecksContexts($username, $repository, $branch, array $params = []) { return
php
{ "resource": "" }
q18903
Protection.showPullRequestReviewEnforcement
train
public function showPullRequestReviewEnforcement($username, $repository, $branch) { return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).
php
{ "resource": "" }
q18904
Protection.updatePullRequestReviewEnforcement
train
public function updatePullRequestReviewEnforcement($username, $repository, $branch, array $params = []) { return
php
{ "resource": "" }
q18905
Protection.removePullRequestReviewEnforcement
train
public function removePullRequestReviewEnforcement($username, $repository, $branch) { return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repositor
php
{ "resource": "" }
q18906
Protection.showAdminEnforcement
train
public function showAdminEnforcement($username, $repository, $branch) { return $this->
php
{ "resource": "" }
q18907
Protection.addAdminEnforcement
train
public function addAdminEnforcement($username, $repository, $branch) { return $this->p
php
{ "resource": "" }
q18908
Protection.removeAdminEnforcement
train
public function removeAdminEnforcement($username, $repository, $branch) { return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository
php
{ "resource": "" }
q18909
Protection.showRestrictions
train
public function showRestrictions($username, $repository, $branch) { return $this->ge
php
{ "resource": "" }
q18910
Protection.removeRestrictions
train
public function removeRestrictions($username, $repository, $branch) { return $this->de
php
{ "resource": "" }
q18911
Protection.showTeamRestrictions
train
public function showTeamRestrictions($username, $repository, $branch) { return $this->ge
php
{ "resource": "" }
q18912
Protection.replaceTeamRestrictions
train
public function replaceTeamRestrictions($username, $repository, $branch, array $params = []) { return
php
{ "resource": "" }
q18913
Protection.addTeamRestrictions
train
public function addTeamRestrictions($username, $repository, $branch, array $params = []) { return
php
{ "resource": "" }
q18914
Protection.removeTeamRestrictions
train
public function removeTeamRestrictions($username, $repository, $branch, array $params = []) { return
php
{ "resource": "" }
q18915
Protection.showUserRestrictions
train
public function showUserRestrictions($username, $repository, $branch) { return $this->ge
php
{ "resource": "" }
q18916
Protection.replaceUserRestrictions
train
public function replaceUserRestrictions($username, $repository, $branch, array $params = []) { return
php
{ "resource": "" }
q18917
Protection.addUserRestrictions
train
public function addUserRestrictions($username, $repository, $branch, array $params = []) { return
php
{ "resource": "" }
q18918
Protection.removeUserRestrictions
train
public function removeUserRestrictions($username, $repository, $branch, array $params = []) { return
php
{ "resource": "" }
q18919
Emails.add
train
public function add($emails) { if (is_string($emails)) { $emails = [$emails]; } elseif (0 === count($emails)) { throw new InvalidArgumentException('The user emails
php
{ "resource": "" }
q18920
Emails.remove
train
public function remove($emails) { if (is_string($emails)) { $emails = [$emails]; } elseif (0 === count($emails)) { throw new InvalidArgumentException('The user emails
php
{ "resource": "" }
q18921
Releases.tag
train
public function tag($username, $repository, $tag) { return $this->get('/repos/'.rawurlencode($userna
php
{ "resource": "" }
q18922
Labels.all
train
public function all($username, $repository, $issue = null) { if ($issue === null) { $path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels'; } else {
php
{ "resource": "" }
q18923
Labels.show
train
public function show($username, $repository, $label) { return $this->get('/repos/'.rawurlencode($us
php
{ "resource": "" }
q18924
Labels.deleteLabel
train
public function deleteLabel($username, $repository, $label) { return
php
{ "resource": "" }
q18925
Labels.update
train
public function update($username, $repository, $label, $newName, $color) { $params = [ 'name' => $newName,
php
{ "resource": "" }
q18926
Labels.add
train
public function add($username, $repository, $issue, $labels) { if (is_string($labels)) { $labels = [$labels]; } elseif (0 === count($labels)) { throw new InvalidArgumentException('The labels parameter should be a single label or an array of labels'); }
php
{ "resource": "" }
q18927
Labels.replace
train
public function replace($username, $repository, $issue, array $params) { return
php
{ "resource": "" }
q18928
Labels.remove
train
public function remove($username, $repository, $issue, $label) { return $this->delete
php
{ "resource": "" }
q18929
Labels.clear
train
public function clear($username, $repository, $issue) { return $this->delete('/repos/'.rawurlencode($use
php
{ "resource": "" }
q18930
Notifications.allInRepository
train
public function allInRepository($username, $repository, array $params = []) {
php
{ "resource": "" }
q18931
Notifications.markAsReadInRepository
train
public function markAsReadInRepository($username, $repository, array $params = []) {
php
{ "resource": "" }
q18932
Authorizations.create
train
public function create(array $params, $OTPCode = null) { $headers = null ===
php
{ "resource": "" }
q18933
Builder.clearHeaders
train
public function clearHeaders() { $this->headers = []; $this->removePlugin(Plugin\HeaderAppendPlugin::class);
php
{ "resource": "" }
q18934
EventDispatcher.add
train
public function add($type, $listener) { if (!array_key_exists($type, $this->_eventListeners)) { $this->_eventListeners [$type] = [];
php
{ "resource": "" }
q18935
EventDispatcher.remove
train
public function remove($type, $listener) { if (array_key_exists($type, $this->_eventListeners)) { $index = array_search($listener, $this->_eventListeners [$type]); if ($index !== null) { unset ($this->_eventListeners [$type] [$index]);
php
{ "resource": "" }
q18936
EventDispatcher.dispatchEvent
train
protected function dispatchEvent($event) { if (!array_key_exists($event->type, $this->_eventListeners)) { return; // no need
php
{ "resource": "" }
q18937
EventDispatcher.dispatch
train
public function dispatch($type, $data = null, $onlyMyWorker = false, $fromDispatch = false) { if (!$onlyMyWorker) { if ($fromDispatch) {//来自集群的请求 get_instance()->sendToAllAsynWorks(SwooleMarco::DISPATCHER_NAME, [$type, $data], EventDispatcher::class . "::workerDispatchEventWith")...
php
{ "resource": "" }
q18938
CMDStore.getWaits
train
public function getWaits($message_type) { return $this->isEmpty($this->command_awaits[$message_type]) ?
php
{ "resource": "" }
q18939
Base.build
train
final public function build(&$length=0) { if ($this->protocol_type == self::FIXED_ONLY) { $payload = $this->payload(); } else if ($this->protocol_type == self::WITH_VARIABLE) { $payload = $this->payload(); } else if ($this->protocol_type == self::WITH_PAYLOAD) { ...
php
{ "resource": "" }
q18940
Base.processReadFixedHeaderWithMsgID
train
final protected function processReadFixedHeaderWithMsgID($message) { $packet_length = 4; $name = Message::$name[$this->message_type]; if (!isset($message[$packet_length - 1])) { # error Debug::Log(Debug::DEBUG, "Message {$name}: error on reading"); return...
php
{ "resource": "" }
q18941
MQTT.setVersion
train
public function setVersion($version) { if ($version == self::VERSION_3 || $version == self::VERSION_3_1_1) { $this->version = $version;
php
{ "resource": "" }
q18942
MQTT.setWill
train
public function setWill($topic, $message, $qos = 0, $retain = 0) { $this->connect_will = new
php
{ "resource": "" }
q18943
MQTT.do_unsubscribe
train
protected function do_unsubscribe() { /** * Packet Identifier Generator * * @var PacketIdentifier $pi */ static $pi = null; if (!$pi) { $pi = $this->PIG(); } $msgid = $pi->next(); # send SUBSCRIBE /** ...
php
{ "resource": "" }
q18944
MQTT.simpleCommand
train
protected function simpleCommand($type, $msgid = 0) { $msgobj = $this->getMessageObject($type); if ($msgid) {
php
{ "resource": "" }
q18945
Base.decode
train
final public function decode(& $packet_data, $remaining_length, & $payload_pos) { $cmd = Utility::ParseCommand(ord($packet_data[0])); $message_type = $cmd['message_type']; if ($this->message->getMessageType() != $message_type) { throw new Exception('Unexpected Control Packet Type...
php
{ "resource": "" }
q18946
Base.setRemainingLength
train
public function setRemainingLength($length) { $this->remaining_length = $length;
php
{ "resource": "" }
q18947
Base.getFullLength
train
public function getFullLength() { $cmd_length = 1; $rl_length = strlen($this->remaining_length_bytes);
php
{ "resource": "" }
q18948
UdpTransport.sendMessageInChunks
train
protected function sendMessageInChunks($rawMessage) { // split to chunks $chunks = str_split($rawMessage, $this->chunkSize); $numChunks = count($chunks); if ($numChunks > self::CHUNK_MAX_COUNT) { throw new \Exception( sprintf( "Message...
php
{ "resource": "" }
q18949
PUBLISH.buildVariableHeader
train
protected function buildVariableHeader() { $header = ''; $topic = $this->message->getTopic(); # Topic $header .= Utility::PackStringWithLength($topic); Debug::Log(Debug::DEBUG, 'Message PUBLISH: topic='.$topic); Debug::Log(Debug::DEBUG, 'Message PUBLISH: QoS='.$this...
php
{ "resource": "" }
q18950
PUBLISH.decodeVariableHeader
train
protected function decodeVariableHeader(& $packet_data, & $pos) { $topic = Utility::UnpackStringWithLength($packet_data, $pos); $this->message->setTopic($topic);
php
{ "resource": "" }
q18951
Utility.ASCII2Visible
train
static public function ASCII2Visible($char, $replace='.') { $c = ord($char); if ($c >= 0x20 && $c <= 0x7F) {
php
{ "resource": "" }
q18952
Utility.PrintHex
train
static public function PrintHex($chars, $return=false, $width=0, $with_ascii=false) { $output = ''; $hex_str = ''; $ascii_str = ''; $width = (int) $width; if (!$width) { for ($i=0; isset($chars[$i]); $i++) { $hex_str .= sprintf('%02x ', ord($...
php
{ "resource": "" }
q18953
Utility.PackStringWithLength
train
static public function PackStringWithLength($str) { $len = strlen($str); # UTF-8 if (!self::ValidateUTF8($str)) {
php
{ "resource": "" }
q18954
Utility.ExtractUShort
train
static public function ExtractUShort($str, &$pos) { $bytes = substr($str, $pos, 2);
php
{ "resource": "" }
q18955
Utility.EncodeLength
train
static public function EncodeLength($length) { self::CheckMessageLength($length); $string = ""; do{ $digit = $length % 0x80; $length = $length >> 7; // if there are more digits to encode, set the top bit of this digit
php
{ "resource": "" }
q18956
Utility.DecodeLength
train
static public function DecodeLength($msg, &$pos) { $multiplier = 1; $value = 0 ; do{ $digit = ord($msg[$pos]);
php
{ "resource": "" }
q18957
Utility.CheckTopicFilter
train
static public function CheckTopicFilter($topic_filter) { if (!isset($topic_filter[0]) || isset($topic_filter[65535])) { throw new Exception('Topic filter must be at 1~65535 bytes long'); } self::ValidateUTF8($topic_filter); if (false !== strpos($topic_filter, chr(0))) { ...
php
{ "resource": "" }
q18958
Utility.ValidateUTF8
train
static public function ValidateUTF8($string) { $pop_10s = 0; $unicode_char = 0; for ($i=0; isset($string[$i]); $i++) { $c = ord($string[$i]); if ($pop_10s) { # Check if following chars in multibytes are not 10xxxxxx if (($c & 0xC0) !=...
php
{ "resource": "" }
q18959
Miner.innerJoin
train
public function innerJoin($table, $criteria = null, $alias = null)
php
{ "resource": "" }
q18960
Miner.join
train
public function join($table, $criteria = null, $type = self::INNER_JOIN, $alias = null) { if (!$this->isJoinUnique($table, $alias)) { return $this; } if (is_string($criteria)) { $criteria = array($criteria);
php
{ "resource": "" }
q18961
Miner.leftJoin
train
public function leftJoin($table, $criteria = null, $alias = null)
php
{ "resource": "" }
q18962
Miner.rightJoin
train
public function rightJoin($table, $criteria = null, $alias = null)
php
{ "resource": "" }
q18963
Miner.orWhere
train
public function orWhere($column, $value, $operator = self::EQUALS, $quote =
php
{ "resource": "" }
q18964
Miner.orCriteria
train
private function orCriteria(array &$criteria, $column, $value, $operator = self::EQUALS, $quote
php
{ "resource": "" }
q18965
Miner.criteriaIn
train
private function criteriaIn(array &$criteria, $column, array $values, $connector = self::LOGICAL_AND, $quote = null)
php
{ "resource": "" }
q18966
Miner.whereNotIn
train
public function whereNotIn($column, array $values, $connector = self::LOGICAL_AND, $quote
php
{ "resource": "" }
q18967
Miner.criteriaNotIn
train
private function criteriaNotIn(array &$criteria, $column, array $values, $connector = self::LOGICAL_AND, $quote
php
{ "resource": "" }
q18968
Miner.whereBetween
train
public function whereBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote
php
{ "resource": "" }
q18969
Miner.criteriaBetween
train
private function criteriaBetween(array &$criteria, $column, $min, $max, $connector = self::LOGICAL_AND, $quote = null)
php
{ "resource": "" }
q18970
Miner.whereNotBetween
train
public function whereNotBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote
php
{ "resource": "" }
q18971
Miner.criteriaNotBetween
train
private function criteriaNotBetween(array &$criteria, $column, $min, $max, $connector = self::LOGICAL_AND, $quote = null)
php
{ "resource": "" }
q18972
Miner.havingNotIn
train
public function havingNotIn($column, array $values, $connector = self::LOGICAL_AND, $quote
php
{ "resource": "" }
q18973
Miner.havingBetween
train
public function havingBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote
php
{ "resource": "" }
q18974
Miner.havingNotBetween
train
public function havingNotBetween($column, $min, $max, $connector = self::LOGICAL_AND, $quote
php
{ "resource": "" }
q18975
Miner.getStatement
train
public function getStatement($usePlaceholders = true) { $statement = ""; if ($this->isSelect()) { $statement = $this->getSelectStatement($usePlaceholders); } elseif ($this->isInsert()) { $statement = $this->getInsertStatement($usePlaceholders); } elseif ($this...
php
{ "resource": "" }
q18976
Miner.getSelectStatement
train
private function getSelectStatement($usePlaceholders = true) { $statement = ""; if (!$this->isSelect()) { return $statement; } $statement .= $this->getSelectString(); if ($this->from) { $statement .= " " . $this->getFromString(); } ...
php
{ "resource": "" }
q18977
Miner.getSelectString
train
public function getSelectString($includeText = true) { $statement = ""; if (!$this->select) { return $statement; } $statement .= $this->getOptionsString(true); foreach ($this->select as $column => $alias) { $statement .= $column; if ($a...
php
{ "resource": "" }
q18978
Miner.getOptionsString
train
public function getOptionsString($includeTrailingSpace = false) { $statement = ""; if (!$this->option) { return $statement; } $statement .= implode(' ', $this->option);
php
{ "resource": "" }
q18979
Miner.getFromString
train
public function getFromString($includeText = true) { $statement = ""; if (!$this->from) { return $statement; } $statement .= $this->getFrom(); if ($this->getFromAlias()) {
php
{ "resource": "" }
q18980
Miner.getJoinCriteriaUsingPreviousTable
train
private function getJoinCriteriaUsingPreviousTable($joinIndex, $table, $column) { $joinCriteria = ""; $previousJoinIndex = $joinIndex - 1; // If the previous table is from a JOIN, use that. Otherwise, use the // FROM table. if (array_key_exists($previousJoinIndex, $this->joi...
php
{ "resource": "" }
q18981
Miner.getWhereString
train
public function getWhereString($usePlaceholders = true, $includeText = true) { $statement = $this->getCriteriaString($this->where, $usePlaceholders, $this->wherePlaceholderValues);
php
{ "resource": "" }
q18982
Miner.autoQuote
train
public function autoQuote($value, $override = null) { return
php
{ "resource": "" }
q18983
Miner.getGroupByString
train
public function getGroupByString($includeText = true) { $statement = ""; foreach ($this->groupBy as $groupBy) { $statement .= $groupBy['column']; if ($groupBy['order']) { $statement .= " " . $groupBy['order']; } $statement .= ", "; ...
php
{ "resource": "" }
q18984
Miner.getHavingString
train
public function getHavingString($usePlaceholders = true, $includeText = true) { $statement = $this->getCriteriaString($this->having, $usePlaceholders, $this->havingPlaceholderValues);
php
{ "resource": "" }
q18985
Miner.getOrderByString
train
public function getOrderByString($includeText = true) { $statement = ""; foreach ($this->orderBy as $orderBy) { $statement .= $orderBy['column'] . " " . $orderBy['order'] . ", "; } $statement = substr($statement, 0, -2);
php
{ "resource": "" }
q18986
Miner.getLimitString
train
public function getLimitString($includeText = true) { $statement = ""; if (!$this->limit) { return $statement; } $statement .= $this->limit['limit']; if ($this->limit['offset'] !== 0) { $statement .= " OFFSET " . $this->limit['offset'];
php
{ "resource": "" }
q18987
Miner.getInsertStatement
train
private function getInsertStatement($usePlaceholders = true) { $statement = ""; if (!$this->isInsert()) { return $statement; } $statement .= $this->getInsertString(); if ($this->isInto) { $statement .= " " . $this->getIntoString($usePlaceholders); ...
php
{ "resource": "" }
q18988
Miner.getInsertString
train
public function getInsertString($includeText = true) { $statement = ""; if (!$this->insert) { return $statement; } if ($this->isInto) { $statement .= $this->getOptionsString(true) . 'INTO '; } else { $statement .= $this->getOptionsString(...
php
{ "resource": "" }
q18989
Miner.getReplaceStatement
train
private function getReplaceStatement($usePlaceholders = true) { $statement = ""; if (!$this->isReplace()) { return $statement; } $statement .= $this->getReplaceString(); if ($this->isInto) { $statement .= " " . $this->getIntoString($usePlaceholders)...
php
{ "resource": "" }
q18990
Miner.getReplaceString
train
public function getReplaceString($includeText = true) { $statement = ""; if (!$this->replace) { return $statement; } if ($this->isInto) { $statement .= $this->getOptionsString(true) . 'INTO '; } else { $statement .= $this->getOptionsStrin...
php
{ "resource": "" }
q18991
Miner.getUpdateStatement
train
private function getUpdateStatement($usePlaceholders = true) { $statement = ""; if (!$this->isUpdate()) { return $statement; } $statement .= $this->getUpdateString(); if ($this->isInto) { $statement .= " " . $this->getIntoString($usePlaceholders); ...
php
{ "resource": "" }
q18992
Miner.getUpdateString
train
public function getUpdateString($includeText = true) { $statement = ""; if (!$this->update) { return $statement; } if ($this->isInto) { $statement .= $this->getOptionsString(true) . 'INTO ';
php
{ "resource": "" }
q18993
Miner.getDeleteStatement
train
private function getDeleteStatement($usePlaceholders = true) { $statement = ""; if (!$this->isDelete()) { return $statement; } $statement .= $this->getDeleteString(); if ($this->from) { $statement .= " " . $this->getFromString(); } ...
php
{ "resource": "" }
q18994
Miner.getDeleteString
train
public function getDeleteString($includeText = true) { $statement = ""; if (!$this->delete && !$this->isDeleteTableFrom()) { return $statement; } $statement .= $this->getOptionsString(true); if (is_array($this->delete)) { $statement .= implode(', ',...
php
{ "resource": "" }
q18995
Miner.mergeSelectInto
train
public function mergeSelectInto(Miner $Miner) { $this->mergeOptionsInto($Miner); foreach ($this->select as $column => $alias) {
php
{ "resource": "" }
q18996
Miner.mergeOptionsInto
train
public function mergeOptionsInto(Miner $Miner) { foreach ($this->option as
php
{ "resource": "" }
q18997
Miner.mergeFromInto
train
public function mergeFromInto(Miner $Miner) { if ($this->from) {
php
{ "resource": "" }
q18998
Miner.from
train
public function from($table, $alias = null) { $this->from['table'] = $table;
php
{ "resource": "" }
q18999
Miner.mergeJoinInto
train
public function mergeJoinInto(Miner $Miner) { foreach ($this->join as $join) {
php
{ "resource": "" }