_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q264500 | Host.whoamiSet | test | public function whoamiSet($ident, $value = null)
{
$this->whoami();
$this->whoami[$ident] = (is_numeric($value)) ? intval($value) : \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String::factory($value);
} | php | {
"resource": ""
} |
q264501 | ValidatorFactory.getValidator | test | protected function getValidator(ServiceLocatorInterface $serviceLocator, string $name, array $options): object
{
return $serviceLocator->getService($name, $options);
} | php | {
"resource": ""
} |
q264502 | PageFetcher.setCurlContent | test | private function setCurlContent($curl, PageFetcherRequestInterface $request): void
{
$rawContent = $request->getRawContent();
if ($rawContent !== '') {
curl_setopt($curl, CURLOPT_POSTFIELDS, $rawContent);
return;
}
$postFields = [];
$hasFiles = false... | php | {
"resource": ""
} |
q264503 | PageFetcher.parseResult | test | private function parseResult(string $result): PageFetcherResponseInterface
{
$resultParts = explode("\r\n\r\n", $result, 2);
$headers = explode("\r\n", $resultParts[0]);
$statusLine = array_shift($headers);
$statusLineParts = explode(' ', $statusLine);
$httpCode = intval($st... | php | {
"resource": ""
} |
q264504 | ExtensionsConfiguration.commonApplicationAttributes | test | public function commonApplicationAttributes()
{
return [
'components' => [
'i18n' => [
'translations' => [
'extensions-manager' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePa... | php | {
"resource": ""
} |
q264505 | Options.getOption | test | protected function getOption($option)
{
return in_array($option, $this->getOptions())
? $this->getOptions()[$option]
: null;
} | php | {
"resource": ""
} |
q264506 | Options.buildOptions | test | protected function buildOptions(array $defaults = null)
{
$options = $this->getOptions();
if ($defaults) $options = array_merge($defaults, $options);
foreach ($options as $option) {
if ( ! array_key_exists($option, $this->options)) continue;
if ( ! isset($optionsBi... | php | {
"resource": ""
} |
q264507 | Securepass.user | test | public function user($type, $params = array()) {
$command_mapping = array(
'auth' => 'UserAuth',
'info' => 'UserInfo',
'add' => 'UserAdd',
'provision' => 'UserProvision',
'list' => 'UserList',
'delete' => 'UserDelete'
);
if (!isset($command_mappin... | php | {
"resource": ""
} |
q264508 | Securepass.ping | test | public function ping()
{
$command = $this->client->getCommand('Ping');
$res = $this->execute($command);
return $res;
} | php | {
"resource": ""
} |
q264509 | BoxSizer.setAttribute | test | public function setAttribute($key, $value)
{
switch ($key) {
case 'orientation':
$this->attributes[$key] =
$value == 'horizontal' ?
wxHORIZONTAL :
wxVERTICAL
;
default:
$this-... | php | {
"resource": ""
} |
q264510 | Money.format | test | public function format(bool $displayCountryForUS = false): string
{
$formatter = new NumberFormatter('en', NumberFormatter::CURRENCY);
if ($displayCountryForUS && $this->currency === 'USD') {
if ($this->amount >= 0) {
return 'US' . $formatter->formatCurrency($this->amoun... | php | {
"resource": ""
} |
q264511 | Money.formatForAccounting | test | public function formatForAccounting(): string
{
$amount = $this->getRoundedAmount();
$negative = 0 > $amount;
if ($negative) {
$amount *= -1;
}
$amount = number_format($amount, Intl::getCurrencyBundle()->getFractionDigits($this->currency));
return $negativ... | php | {
"resource": ""
} |
q264512 | Money.getRoundedAmount | test | public function getRoundedAmount(): float
{
$fractionDigits = Intl::getCurrencyBundle()->getFractionDigits($this->currency);
$roundingIncrement = Intl::getCurrencyBundle()->getRoundingIncrement($this->currency);
$value = round($this->amount, $fractionDigits);
// Swiss rounding
... | php | {
"resource": ""
} |
q264513 | Money.split | test | public function split(array $percentages, bool $round = true): array
{
$totalPercentage = array_sum($percentages);
if ($totalPercentage > 100) {
throw new InvalidArgumentException('Only 100% can be allocated');
}
$amounts = [];
$total = 0;
if (!$round) {
... | php | {
"resource": ""
} |
q264514 | Factory.prepareAndInjectElements | test | protected function prepareAndInjectElements($elements, FieldsetInterface $fieldset, $method)
{
$elements = $this->validateSpecification($elements, $method);
foreach ($elements as $elementSpecification) {
if (null === $elementSpecification) {
continue;
}
... | php | {
"resource": ""
} |
q264515 | MeRepository.getMe | test | public function getMe($accessToken)
{
if (empty($accessToken)) {
throw new \InvalidArgumentException('Empty access token provided', 1);
}
$response = $this->getClient()->get(self::ENDPOINT, array('Authorization' => 'OAuth '.$accessToken));
$data = $this->jsonResponse($res... | php | {
"resource": ""
} |
q264516 | Router.run | test | function run()
{
//Resolve request
$this->resolve();
//If is a CALLBACK...
if (is_object($this->controller)) {
exit(call_user_func_array($this->controller, [$this->request, $this->params]));
}
if ($this->controller === null) {
$thi... | php | {
"resource": ""
} |
q264517 | Router.searchRouter | test | private function searchRouter($routes)
{
foreach ($routes as $route) {
if ($route['controller'] === null
|| !preg_match_all('#^' . $route['request'] . '$#',
$this->request,
$matches,
PREG_SET_ORDER)
) {
... | php | {
"resource": ""
} |
q264518 | Router.requestMethod | test | private function requestMethod()
{
if (php_sapi_name() === 'cli') {
return 'CLI';
}
// Take the method as found in $_SERVER
$method = $_SERVER['REQUEST_METHOD'];
if ($_SERVER['REQUEST_METHOD'] == 'HEAD') {
ob_start();
$method = 'GET';
... | php | {
"resource": ""
} |
q264519 | LogTruck.getLogs | test | public function getLogs()
{
$logsArray = [];
$logs = LoggerORM::findAll();
foreach ($logs as $log) {
$isException = false;
$log = (array) $log;
$logCabin = [];
if ($log['exception'] !== null && is_array($log['exception']) && count($log['e... | php | {
"resource": ""
} |
q264520 | LogTruck.deathByCamels | test | private function deathByCamels($string)
{
$this->index = 0;
return implode('', array_map(function($el) {
$this->index++;
return $this->index === 1 ? $el : ucfirst($el);
}, explode(' ', str_replace('_', ' ', $string))));
} | php | {
"resource": ""
} |
q264521 | Convert.bytes | test | public static function bytes($bytes)
{
$kbytes = sprintf("%.02f", $bytes/1024);
$mbytes = sprintf("%.02f", $kbytes/1024);
$gbytes = sprintf("%.02f", $mbytes/1024);
$tbytes = sprintf("%.02f", $gbytes/1024);
if($tbytes >= 1)
return $tbytes . " TB";
if($gbytes >= 1)
return ... | php | {
"resource": ""
} |
q264522 | Convert.codec | test | public static function codec($codec)
{
if($codec == \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::CODEC_SPEEX_NARROWBAND)
return "Speex Narrowband (8 kHz)";
if($codec == \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::CODEC_SPEEX_WIDEBAND)
return "Speex Wideband (16 ... | php | {
"resource": ""
} |
q264523 | Convert.groupType | test | public static function groupType($type)
{
if($type == \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::GROUP_DBTYPE_TEMPLATE)
return "Template";
if($type == \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::GROUP_DBTYPE_REGULAR)
return "Regular";
if($type == \ManiaLi... | php | {
"resource": ""
} |
q264524 | Convert.permissionType | test | public static function permissionType($type)
{
if($type == \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::PERM_TYPE_SERVERGROUP)
return "Server Group";
if($type == \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::PERM_TYPE_CLIENT)
return "Client";
if($type == \Man... | php | {
"resource": ""
} |
q264525 | Convert.logLevel | test | public static function logLevel($level)
{
if(is_numeric($level))
{
if($level == \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::LOGLEVEL_CRITICAL)
return "CRITICAL";
if($level == \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::LOGLEVEL_ERROR)
return "... | php | {
"resource": ""
} |
q264526 | Convert.logEntry | test | public static function logEntry($entry)
{
$parts = explode("|", $entry, 5);
$array = array();
if(count($parts) != 5)
{
$array["timestamp"] = 0;
$array["level"] = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::LOGLEVEL_ERROR;
$array["channel"] = "ParamPars... | php | {
"resource": ""
} |
q264527 | TimedNoticeAdmin.getList | test | public function getList()
{
$list = parent::getList();
$r = $this->getRequest();
if ($q = $r->requestVar('q')) {
if (isset($q['Status'])) {
$status = $q['Status'];
$now = date('Y-m-d H:i:s');
if ($status == 'Future') {
... | php | {
"resource": ""
} |
q264528 | EntityTrait.getTraits | test | protected static function getTraits()
{
if (isset(static::$traitsList[static::class]) === false) {
$className = static::class;
static::$traitsList[static::class] = [];
do {
foreach (class_uses($className) as $value) {
static::$traitsLis... | php | {
"resource": ""
} |
q264529 | EntityTrait.callTraitMethod | test | protected function callTraitMethod($traitName, $methodName)
{
return method_exists($this, $traitName . $methodName)
? $this->{$traitName . $methodName}()
: null;
} | php | {
"resource": ""
} |
q264530 | EntityTrait.callEvents | test | protected function callEvents($eventName)
{
foreach (static::getTraits() as $name) {
if ($name === 'EntityTrait') {
continue;
}
$this->callTraitMethod($name, $eventName);
}
} | php | {
"resource": ""
} |
q264531 | EntityTrait.attributeLabels | test | public function attributeLabels()
{
if (isset(static::$attributeLabelsList[static::class]) === false) {
static::$attributeLabelsList[static::class] = isset($this->attributeLabels) === true
? $this->attributeLabels
: [];
foreach (static::getTraits() as ... | php | {
"resource": ""
} |
q264532 | EntityTrait.attributeHints | test | public function attributeHints()
{
if (isset(static::$attributeHintsList[static::class]) === false) {
static::$attributeHintsList[static::class] = isset($this->attributeHints) === true
? $this->attributeHints
: [];
foreach (static::getTraits() as $name... | php | {
"resource": ""
} |
q264533 | Reply.toArray | test | public function toArray()
{
$array = array();
$table = $this->toTable(1);
for($i = 0; $i < count($table); $i++)
{
foreach($table[$i] as $pair)
{
if(!$pair->contains(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SEPARATOR_PAIR))
{
$array[$... | php | {
"resource": ""
} |
q264534 | Reply.fetchError | test | protected function fetchError($err)
{
$cells = $err->section(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SEPARATOR_CELL, 1, 3);
foreach($cells->split(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SEPARATOR_CELL) as $pair)
{
list($ident, $value) = $pair->split(\Ma... | php | {
"resource": ""
} |
q264535 | Reply.fetchReply | test | protected function fetchReply($rpl)
{
foreach($rpl as $key => $val)
{
if($val->startsWith(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::GREET))
{
unset($rpl[$key]);
}
elseif($val->startsWith(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::EVENT... | php | {
"resource": ""
} |
q264536 | AuthenticationService.getIdentity | test | public function getIdentity()
{
if ($this->identity instanceof User) {
return $this->identity;
}
$identity = parent::getIdentity();
if (empty($identity)) {
$this->clearIdentity();
return;
}
$identity = $this->tableGateway->selec... | php | {
"resource": ""
} |
q264537 | AuthenticationService.hasIdentity | test | public function hasIdentity()
{
$storageCheck = !$this->getStorage()->isEmpty();
if (!$storageCheck) {
return false;
}
return $this->getIdentity() instanceof User;
} | php | {
"resource": ""
} |
q264538 | SoftDeleteTrait.restore | test | public function restore()
{
/** @var ActiveRecord $this */
if (((boolean) $this->{$this->isDeletedAttribute}) !== false) {
$this->{$this->isDeletedAttribute} = false;
return $this->save(true, [$this->isDeletedAttribute]);
}
return true;
} | php | {
"resource": ""
} |
q264539 | UserRepository.getUser | test | public function getUser($userId)
{
$response = $this->getClient()->get(self::ENDPOINT.$userId);
$data = $this->jsonResponse($response);
return $this->getFactory()->createEntity($data);
} | php | {
"resource": ""
} |
q264540 | UserRepository.getUserFollowedGames | test | public function getUserFollowedGames($userId, $params = array())
{
$params = 0 < count($params) ? '?'.http_build_query($params) : '';
// need old api version to get user's followed games
$client = $this->getClient()->setUrl(Client::URL_PROTOCOL.'://'.Client::URL_HOST.'/'.Client::URL_OLD_VERS... | php | {
"resource": ""
} |
q264541 | TimedNotice.get_notices | test | public static function get_notices($context = null)
{
// fallback to the CMS as the context - this is required to be consistent with the original behaviour.
if ($context == null) {
$context = 'CMS';
}
// prepare and filter the possible result
$now = DBDateti... | php | {
"resource": ""
} |
q264542 | ChannelRepository.getChannel | test | public function getChannel($channelId)
{
$response = $this->getClient()->get(self::ENDPOINT.$channelId);
$data = $this->jsonResponse($response);
return $this->getFactory()->createEntity($data);
} | php | {
"resource": ""
} |
q264543 | String.escape | test | public function escape()
{
foreach(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::getEscapePatterns() as $search => $replace)
{
$this->string = str_replace($search, $replace, $this->string);
}
return $this;
} | php | {
"resource": ""
} |
q264544 | String.unescape | test | public function unescape()
{
$this->string = strtr($this->string, array_flip(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::getEscapePatterns()));
return $this;
} | php | {
"resource": ""
} |
q264545 | TeamRepository.getTeam | test | public function getTeam($teamId)
{
$response = $this->getClient()->get(self::ENDPOINT.$teamId);
$data = $this->jsonResponse($response);
return $this->getFactory()->createEntity($data);
} | php | {
"resource": ""
} |
q264546 | ContainerResult.addResult | test | public function addResult(ResultInterface $result, string $name = null): ContainerResult
{
$this->valid = $this->isValid() && $result->isValid();
if (is_string($name) === true) {
$this->results[$name] = $result;
} else {
$this->results[] = $result;
}
... | php | {
"resource": ""
} |
q264547 | StreamRepository.getStream | test | public function getStream($channelId)
{
$response = $this->getClient()->get(self::ENDPOINT.$channelId);
$data = $this->jsonResponse($response);
$data = null !== $data['stream'] ? $data['stream'] : [];
return $this->getFactory()->createEntity($data);
} | php | {
"resource": ""
} |
q264548 | StreamRepository.getStreams | test | public function getStreams($params = array())
{
$params = 0 < count($params) ? '?'.http_build_query($params) : '';
$response = $this->getClient()->get(self::ENDPOINT.$params);
$data = $this->jsonResponse($response);
return $this->getFactory()->createList($data);
} | php | {
"resource": ""
} |
q264549 | StreamRepository.getFeaturedStreams | test | public function getFeaturedStreams($params = array())
{
$params = 0 < count($params) ? '?'.http_build_query($params) : '';
$response = $this->getClient()->get(self::ENDPOINT.'featured'.$params);
$data = $this->jsonResponse($response);
return $this->getFactory()->createFeatured($data... | php | {
"resource": ""
} |
q264550 | StreamRepository.getFollowedStreams | test | public function getFollowedStreams($accessToken, $params = array())
{
if (empty($accessToken)) {
throw new \InvalidArgumentException('Empty access token provided', 1);
}
$params = 0 < count($params) ? '?'.http_build_query($params) : '';
$response = $this->getClient()->get... | php | {
"resource": ""
} |
q264551 | StreamRepository.getStreamsSummary | test | public function getStreamsSummary($params = array())
{
$params = 0 < count($params) ? '?'.http_build_query($params) : '';
$response = $this->getClient()->get(self::ENDPOINT.'summary'.$params);
$data = $this->jsonResponse($response);
return $this->setFactory((new RankFactory()))->get... | php | {
"resource": ""
} |
q264552 | GameRepository.getTop | test | public function getTop($params = array())
{
$params = 0 < count($params) ? '?'.http_build_query($params) : '';
$response = $this->getClient()->get(self::ENDPOINT.'/top'.$params);
$data = $this->jsonResponse($response);
return $this->getFactory()->createTop($data);
} | php | {
"resource": ""
} |
q264553 | TextBox.getValue | test | public function getValue()
{
if ($this->element) {
$this->value = $this->element->GetValue();
}
return $this->value;
} | php | {
"resource": ""
} |
q264554 | TSDNS.resolve | test | public function resolve($tsdns)
{
$this->getTransport()->sendLine($tsdns);
$repl = $this->getTransport()->readLine();
$this->getTransport()->disconnect();
if($repl->section(":", 0)->toInt() == 404)
{
throw new TSDNS\Exception("unable to resolve TSDNS hostname (" . $tsdns . ")");
... | php | {
"resource": ""
} |
q264555 | ConfigurationUpdater.getConfigurables | test | protected function getConfigurables($ignoreCache = false)
{
if (count($this->_configurables) === 0 || true === $ignoreCache) {
$this->_configurables = ExtensionsHelper::getConfigurables();
}
} | php | {
"resource": ""
} |
q264556 | Client.message | test | public function message($msg)
{
$this->execute("sendtextmessage", array("msg" => $msg, "target" => $this->getId(), "targetmode" => \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::TEXTMSG_CLIENT));
} | php | {
"resource": ""
} |
q264557 | Client.kick | test | public function kick($reasonid = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::KICK_CHANNEL, $reasonmsg = null)
{
return $this->getParent()->clientKick($this->getId(), $reasonid, $reasonmsg);
} | php | {
"resource": ""
} |
q264558 | Client.avatarDownload | test | public function avatarDownload()
{
if($this["client_flag_avatar"] == 0) return;
$download = $this->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->avatarGetName());
$transfer = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::factory("filetransfer://" . $download["host"]... | php | {
"resource": ""
} |
q264559 | Events.bindEvents | test | protected function bindEvents()
{
$callback = new ClosureCallback(function($method) {
$controller = $this->collection->getController();
$args = array_slice(func_get_args(), 1);
return call_user_func_array([$controller, $method], $args);
});
foreach ($thi... | php | {
"resource": ""
} |
q264560 | Events.connectEvent | test | protected function connectEvent($constant, callable $callback)
{
if ( ! method_exists($this->element, 'GetId')) {
return $this->element->Connect($constant, $callback);
}
$id = $this->element->GetId();
$this->collection
->getTopLevelWindow()
->get... | php | {
"resource": ""
} |
q264561 | Uri.getQueryVar | test | public function getQueryVar($key, $default = null)
{
if(!$this->hasQuery()) return $default;
parse_str($this->query, $queryArray);
if(array_key_exists($key, $queryArray))
{
$val = $queryArray[$key];
if(ctype_digit($val))
{
return intval($val);
}
e... | php | {
"resource": ""
} |
q264562 | Uri.getBaseUri | test | public static function getBaseUri()
{
$scriptPath = new String(dirname(self::getHostParam("SCRIPT_NAME")));
return self::getHostUri()->append(($scriptPath == DIRECTORY_SEPARATOR ? "" : $scriptPath) . "/");
} | php | {
"resource": ""
} |
q264563 | ServerQuery.request | test | public function request($cmd)
{
$query = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String::factory($cmd)->section(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SEPARATOR_CELL);
if(strstr($cmd, "\r") || strstr($cmd, "\n"))
{
throw new Exception("illegal characters in... | php | {
"resource": ""
} |
q264564 | ServerQuery.wait | test | public function wait()
{
if($this->getTransport()->getConfig("blocking"))
{
throw new Exception("only available in non-blocking mode");
}
do {
$evt = $this->getTransport()->readLine();
} while($evt instanceof \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String && !$... | php | {
"resource": ""
} |
q264565 | ServerQuery.prepare | test | public function prepare($cmd, array $params = array())
{
$args = array();
$cells = array();
foreach($params as $ident => $value)
{
$ident = is_numeric($ident) ? "" : strtolower($ident) . \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SEPARATOR_PAIR;
if(is_array($val... | php | {
"resource": ""
} |
q264566 | ServerQuery.getHost | test | public function getHost()
{
if($this->host === null)
{
$this->host = new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Node\Host($this);
}
return $this->host;
} | php | {
"resource": ""
} |
q264567 | ExtensionController.actionList | test | public function actionList($sort = true)
{
$sort = (bool) $sort;
if ($sort) {
ksort($this->extensions);
}
foreach ($this->extensions as $name => $extension) {
if ($extension['is_active']) {
$this->stdout('[active] ', Console::FG_GREEN);
... | php | {
"resource": ""
} |
q264568 | ExtensionController.writeConfig | test | private function writeConfig()
{
$fileName = Yii::getAlias($this->module->extensionsStorage);
$writer = new ApplicationConfigWriter([
'filename' => $fileName,
]);
$writer->addValues($this->extensions);
if (true === $writer->commit()) {
$this->stdout('... | php | {
"resource": ""
} |
q264569 | MenuBar.setParent | test | public function setParent(ElementInterface $parent)
{
$this->parent = $parent;
$parent->getRaw()->SetMenuBar($this->element);
} | php | {
"resource": ""
} |
q264570 | Describe.columns | test | public function columns($table)
{
try {
$columns = $this->driver->columns($table);
return $columns;
} catch (\PDOException $error) {
$text = (string) $error->getMessage();
throw new TableNotFoundException($text);
}
} | php | {
"resource": ""
} |
q264571 | GuzzleTranscoder.createTranscoder | test | private function createTranscoder() {
if ($this->transcoder === null) {
$this->transcoder = Transcoder::create();
}
return $this->transcoder;
} | php | {
"resource": ""
} |
q264572 | GuzzleTranscoder.getByCaseInsensitiveKey | test | private static function getByCaseInsensitiveKey(array $words, $key) {
foreach ($words as $headerWord => $value) {
if (strcasecmp($headerWord, $key) === 0) {
return $value;
}
}
return null;
} | php | {
"resource": ""
} |
q264573 | GuzzleTranscoder.setByCaseInsensitiveKey | test | private static function setByCaseInsensitiveKey(array $words, $key, $newValue) {
foreach ($words as $headerWord => $value) {
if (strcasecmp($headerWord, $key) === 0) {
$key = $headerWord;
break;
}
}
$words[$key] = $newValue;
retu... | php | {
"resource": ""
} |
q264574 | TimedNoticeController.notices | test | public function notices($context = null)
{
$notices = [];
// fallback to the CMS as the context - this is required to be consistent with the original behaviour.
if ($context == null || $context instanceof HTTPRequest) {
$context = 'CMS';
}
// We want to deliver... | php | {
"resource": ""
} |
q264575 | ExtensionsController.actionIndex | test | public function actionIndex()
{
$extensions = ExtensionsManager::module()->getExtensions();
return $this->render(
'index',
[
'dataProvider' => new ArrayDataProvider([
'allModels' => $extensions,
'sort' => [
... | php | {
"resource": ""
} |
q264576 | ExtensionsController.doRequest | test | private static function doRequest($url, $headers = [])
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_... | php | {
"resource": ""
} |
q264577 | ExtensionsController.actionRunTask | test | public function actionRunTask()
{
if (false === Yii::$app->request->isAjax) {
throw new NotFoundHttpException('Page not found');
}
$module = ExtensionsManager::module();
$packageName = Yii::$app->request->post('packageName');
$extension = $module->getExtensions($p... | php | {
"resource": ""
} |
q264578 | ExtensionsController.deactivate | test | private static function deactivate($extension, ReportingChain $chain)
{
if ($extension['is_active'] == 1) {
ExtensionDataHelper::prepareMigrationTask(
$extension,
$chain,
ExtensionsManager::MIGRATE_TYPE_DOWN,
ExtensionsManager::EXTE... | php | {
"resource": ""
} |
q264579 | ExtensionsController.activate | test | private static function activate($extension, ReportingChain $chain)
{
if ($extension['is_active'] == 0) {
ExtensionDataHelper::prepareMigrationTask(
$extension,
$chain,
ExtensionsManager::MIGRATE_TYPE_UP,
ExtensionsManager::EXTENSIO... | php | {
"resource": ""
} |
q264580 | ExtensionsController.uninstall | test | private static function uninstall($extension, ReportingChain $chain)
{
$module = ExtensionsManager::module();
if (true === $module->extensionIsCore($extension['composer_name'])) {
$dummyTask = ExtensionDataHelper::buildTask(
[
realpath(Yii::getAlias('@... | php | {
"resource": ""
} |
q264581 | ExtensionsController.runTask | test | private static function runTask($command, $groupName)
{
$task = ExtensionDataHelper::buildTask($command, $groupName);
if ($task->registerTask()) {
DeferredHelper::runImmediateTask($task->model()->id);
Yii::$app->response->format = Response::FORMAT_JSON;
return [
... | php | {
"resource": ""
} |
q264582 | Channel.clientGetByName | test | public function clientGetByName($name)
{
foreach($this->clientList() as $client)
{
if($client["client_nickname"] == $name) return $client;
}
throw new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\ServerQuery\Exception("invalid clientID", 0x200);
} | php | {
"resource": ""
} |
q264583 | Channel.iconDownload | test | public function iconDownload()
{
if($this->iconIsLocal("channel_icon_id") || $this["channel_icon_id"] == 0) return;
$download = $this->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->iconGetName("channel_icon_id"));
$transfer = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSp... | php | {
"resource": ""
} |
q264584 | Channel.message | test | public function message($msg, $cpw = null)
{
if($this->getId() != $this->getParent()->whoamiGet("client_channel_id"))
{
$this->getParent()->clientMove($this->getParent()->whoamiGet("client_id"), $this->getId(), $cpw);
}
$this->execute("sendtextmessage", array("msg" => $msg, "target" => $... | php | {
"resource": ""
} |
q264585 | Channel.delete | test | public function delete($force = FALSE)
{
$this->getParent()->channelDelete($this->getId(), $force);
unset($this);
} | php | {
"resource": ""
} |
q264586 | JWT.encode | test | public static function encode($payload, $key, $alg = 'HS256', $keyId = null, $head = null)
{
$header = array('typ' => 'JWT', 'alg' => $alg);
if ($keyId !== null) {
$header['kid'] = $keyId;
}
if ( isset($head) && is_array($head) ) {
$header = array_merge($head,... | php | {
"resource": ""
} |
q264587 | JWT.sign | test | public static function sign($msg, $key, $alg = 'HS256')
{
if (empty(self::$supported_algs[$alg])) {
throw new DomainException('Algorithm not supported');
}
list($function, $algorithm) = self::$supported_algs[$alg];
switch($function) {
case 'hash_hmac':
... | php | {
"resource": ""
} |
q264588 | JWT.jsonDecode | test | public static function jsonDecode($input)
{
if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
/** In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you
* to specify that large ints (like Steam Transaction IDs... | php | {
"resource": ""
} |
q264589 | ApplicationConfigWriter.commit | test | public function commit()
{
$data = <<<PHP
<?php
/*
* ! WARNING !
*
* This file is auto-generated.
* Please don't modify it by-hand or all your changes can be lost.
*/
{$this->append}
return
PHP;
$data .= VarDumper::export($this->configuration);
$data .= ";\n\n";
$result = file_... | php | {
"resource": ""
} |
q264590 | Bootstrap.bootstrap | test | public function bootstrap($app)
{
$app->i18n->translations['extensions-manager'] = [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => __DIR__ . DIRECTORY_SEPARATOR . 'messages',
];
DeferredQueueEvent::on(
DeferredController::className(),
D... | php | {
"resource": ""
} |
q264591 | Channelgroup.copy | test | public function copy($name = null, $tcgid = 0, $type = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::GROUP_DBTYPE_REGULAR)
{
return $this->getParent()->channelGroupCopy($this->getId(), $name, $tcgid, $type);
} | php | {
"resource": ""
} |
q264592 | Channelgroup.message | test | public function message($msg)
{
foreach($this as $client)
{
try
{
$this->execute("sendtextmessage", array("msg" => $msg, "target" => $client, "targetmode" => \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::TEXTMSG_CLIENT));
}
catch(\ManiaLivePlugins\Standard... | php | {
"resource": ""
} |
q264593 | ApiController.formClassName | test | protected function formClassName(): string
{
if ($this->formClassName)
{
return $this->formClassName;
}
$entityClassName = $this->entityClassName();
$this->formClassName = substr(str_replace('/Form/', '/Entity/', $entityClassName), 0, -4);
return $this->... | php | {
"resource": ""
} |
q264594 | ApiController.getAction | test | public function getAction(int $id)
{
try {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->entityClassName())->find($id);
if ($entity) {
return $entity;
}
return FOSView::create('Not Found', Response::H... | php | {
"resource": ""
} |
q264595 | ApiController.cgetAction | test | public function cgetAction(ParamFetcherInterface $paramFetcher)
{
try {
$offset = $paramFetcher->get('offset');
$limit = $paramFetcher->get('limit');
$order_by = $paramFetcher->get('order_by');
$filters = !is_null($paramFetcher->get('filters')) ? $paramFetcher... | php | {
"resource": ""
} |
q264596 | ApiController.postAction | test | public function postAction(Request $request)
{
/**
* @var $em ApiEntityManager
*/
$em = $this->getDoctrine()->getManager();
$data = json_decode($request->getContent(), true);
$entity = $em->createEntity($this->entityClassName());
$form = $this->createForm(... | php | {
"resource": ""
} |
q264597 | ApiController.putAction | test | public function putAction(Request $request, int $id)
{
try {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->entityClassName())->find($id);
$data = json_decode($request->getContent(), true);
$request->setMethod('PATCH'); //Trea... | php | {
"resource": ""
} |
q264598 | ApiController.deleteAction | test | public function deleteAction(Request $request, int $id)
{
try {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->entityClassName())->find($id);
$em->remove($entity);
$em->flush();
return null;
} catch (\Except... | php | {
"resource": ""
} |
q264599 | JsonDecodeFile.readFile | test | protected static function readFile($path)
{
// Workaround for https://github.com/kherge-php/file-manager/pull/2
$error = null;
set_error_handler(function ($severity, $message, $filename, $lineno) use (&$error) {
$error = new \ErrorException($message, 0, $severity, $filename, $lin... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.