_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q247200
Server.clientGetByUid
validation
public function clientGetByUid($uid) { foreach ($this->clientList() as $client) { if ($client["client_unique_identifier"] == $uid) { return $client; } } throw new Ts3Exception("invalid clientID", 0x200); }
php
{ "resource": "" }
q247201
Server.clientGetByDbid
validation
public function clientGetByDbid($dbid) { foreach ($this->clientList() as $client) { if ($client["client_database_id"] == $dbid) { return $client; } } throw new Ts3Exception("invalid clientID", 0x200); }
php
{ "resource": "" }
q247202
Server.serverGroupGetByName
validation
public function serverGroupGetByName($name, $type = TeamSpeak3::GROUP_DBTYPE_REGULAR) { foreach ($this->serverGroupList() as $group) { if ($group["name"] == $name && $group["type"] == $type) { return $group; } } throw new Ts3Exception("invalid groupID", 0xA00); }
php
{ "resource": "" }
q247203
Server.serverGroupPermList
validation
public function serverGroupPermList($sgid, $permsid = false) { return $this->execute( "servergrouppermlist", array("sgid" => $sgid, $permsid ? "-permsid" : null) )->toAssocArray($permsid ? "permsid" : "permid"); }
php
{ "resource": "" }
q247204
Server.serverGroupGetProfiles
validation
public function serverGroupGetProfiles() { $profiles = array(); foreach ($this->serverGroupList() as $sgid => $sgroup) { if ($sgroup["type"] != TeamSpeak3::GROUP_DBTYPE_REGULAR) { continue; } $profiles[$sgid] = array( "b_permission_modify_power_ignore" => 0, "i_group_needed_member_add_power" => 0, "i_group_member_add_power" => 0, "i_group_needed_member_remove_power" => 0, "i_group_member_remove_power" => 0, "i_needed_modify_power_count" => 0, "i_needed_modify_power_total" => 0, "i_permission_modify_power" => 0, "i_group_needed_modify_power" => 0, "i_group_modify_power" => 0, "i_client_needed_modify_power" => 0, "i_client_modify_power" => 0, "b_virtualserver_servergroup_create" => 0, "b_virtualserver_servergroup_delete" => 0, "b_client_ignore_bans" => 0, "b_client_ignore_antiflood" => 0, "b_group_is_permanent" => 0, "i_client_needed_ban_power" => 0, "i_client_needed_kick_power" => 0, "i_client_needed_move_power" => 0, "i_client_talk_power" => 0, "__sgid" => $sgid, "__name" => $sgroup->toString(), "__node" => $sgroup, ); try { $perms = $this->serverGroupPermList($sgid, true); $grant = isset($perms["i_permission_modify_power"]) ? $perms["i_permission_modify_power"]["permvalue"] : null; } catch (Ts3Exception $e) { /* ERROR_database_empty_result */ if ($e->getCode() != 0x501) { throw $e; } $perms = array(); $grant = null; } foreach ($perms as $permsid => $perm) { if (in_array($permsid, array_keys($profiles[$sgid]))) { $profiles[$sgid][$permsid] = $perm["permvalue"]; } elseif (StringHelper::factory($permsid)->startsWith("i_needed_modify_power_")) { if (!$grant || $perm["permvalue"] > $grant) { continue; } $profiles[$sgid]["i_needed_modify_power_total"] = $profiles[$sgid]["i_needed_modify_power_total"] + $perm["permvalue"]; $profiles[$sgid]["i_needed_modify_power_count"]++; } } } array_multisort($profiles, SORT_DESC); return $profiles; }
php
{ "resource": "" }
q247205
Server.channelGroupGetById
validation
public function channelGroupGetById($cgid) { if (!array_key_exists((string)$cgid, $this->channelGroupList())) { throw new Ts3Exception("invalid groupID", 0xA00); } return $this->cgroupList[intval((string)$cgid)]; }
php
{ "resource": "" }
q247206
Server.channelGroupPermList
validation
public function channelGroupPermList($cgid, $permsid = false) { return $this->execute( "channelgrouppermlist", array("cgid" => $cgid, $permsid ? "-permsid" : null) )->toAssocArray($permsid ? "permsid" : "permid"); }
php
{ "resource": "" }
q247207
Server.permReset
validation
public function permReset() { $token = $this->request("permreset")->toList(); Signal::getInstance()->emit("notifyTokencreated", $this, $token["token"]); return $token["token"]; }
php
{ "resource": "" }
q247208
Server.tempPasswordList
validation
public function tempPasswordList($resolve = false) { $passwords = $this->request("servertemppasswordlist")->toAssocArray("pw_clear"); if ($resolve) { foreach ($passwords as $password => $array) { try { $channel = $this->channelGetById($array["tcid"]); $passwords[$password]["tcname"] = $channel->toString(); $passwords[$password]["tcpath"] = $channel->getPathway(); } catch (Ts3Exception $e) { /* ERROR_channel_invalid_id */ if ($e->getCode() != 0xA00) { throw $e; } } } } return $passwords; }
php
{ "resource": "" }
q247209
Server.sortGroupList
validation
protected static function sortGroupList(AbstractNode $a, AbstractNode $b) { if (get_class($a) != get_class($b)) { return 0; /* workaround for PHP bug #50688 */ throw new Ts3Exception("invalid parameter", 0x602); } if (!$a instanceof Servergroup && !$a instanceof Channelgroup) { return 0; /* workaround for PHP bug #50688 */ throw new Ts3Exception("convert error", 0x604); } if ($a->getProperty("sortid", 0) != $b->getProperty("sortid", 0) && $a->getProperty( "sortid", 0 ) != 0 && $b->getProperty("sortid", 0) != 0 ) { return ($a->getProperty("sortid", 0) < $b->getProperty("sortid", 0)) ? -1 : 1; } return ($a->getId() < $b->getId()) ? -1 : 1; }
php
{ "resource": "" }
q247210
Server.sortFileList
validation
protected static function sortFileList(array $a, array $b) { if (!array_key_exists("src", $a) || !array_key_exists("src", $b) || !array_key_exists( "type", $a ) || !array_key_exists("type", $b) ) { return 0; throw new Ts3Exception("invalid parameter", 0x602); } if ($a["type"] != $b["type"]) { return ($a["type"] < $b["type"]) ? -1 : 1; } return strcmp(strtolower($a["src"]), strtolower($b["src"])); }
php
{ "resource": "" }
q247211
QBankApi.accounts
validation
public function accounts() { if (!$this->accounts instanceof AccountsController) { $this->accounts = new AccountsController($this->getClient(), $this->cachePolicy, $this->cache); $this->accounts->setLogger($this->logger); } return $this->accounts; }
php
{ "resource": "" }
q247212
QBankApi.categories
validation
public function categories() { if (!$this->categories instanceof CategoriesController) { $this->categories = new CategoriesController($this->getClient(), $this->cachePolicy, $this->cache); $this->categories->setLogger($this->logger); } return $this->categories; }
php
{ "resource": "" }
q247213
QBankApi.deployment
validation
public function deployment() { if (!$this->deployment instanceof DeploymentController) { $this->deployment = new DeploymentController($this->getClient(), $this->cachePolicy, $this->cache); $this->deployment->setLogger($this->logger); } return $this->deployment; }
php
{ "resource": "" }
q247214
QBankApi.events
validation
public function events() { if (!$this->events instanceof EventsController) { $this->events = new EventsController($this->getClient(), $this->cachePolicy, $this->cache); $this->events->setLogger($this->logger); } return $this->events; }
php
{ "resource": "" }
q247215
QBankApi.filters
validation
public function filters() { if (!$this->filters instanceof FiltersController) { $this->filters = new FiltersController($this->getClient(), $this->cachePolicy, $this->cache); $this->filters->setLogger($this->logger); } return $this->filters; }
php
{ "resource": "" }
q247216
QBankApi.folders
validation
public function folders() { if (!$this->folders instanceof FoldersController) { $this->folders = new FoldersController($this->getClient(), $this->cachePolicy, $this->cache); $this->folders->setLogger($this->logger); } return $this->folders; }
php
{ "resource": "" }
q247217
QBankApi.media
validation
public function media() { if (!$this->media instanceof MediaController) { $this->media = new MediaController($this->getClient(), $this->cachePolicy, $this->cache); $this->media->setLogger($this->logger); } return $this->media; }
php
{ "resource": "" }
q247218
QBankApi.moodboards
validation
public function moodboards() { if (!$this->moodboards instanceof MoodboardsController) { $this->moodboards = new MoodboardsController($this->getClient(), $this->cachePolicy, $this->cache); $this->moodboards->setLogger($this->logger); } return $this->moodboards; }
php
{ "resource": "" }
q247219
QBankApi.objecttypes
validation
public function objecttypes() { if (!$this->objecttypes instanceof ObjecttypesController) { $this->objecttypes = new ObjecttypesController($this->getClient(), $this->cachePolicy, $this->cache); $this->objecttypes->setLogger($this->logger); } return $this->objecttypes; }
php
{ "resource": "" }
q247220
QBankApi.propertysets
validation
public function propertysets() { if (!$this->propertysets instanceof PropertysetsController) { $this->propertysets = new PropertysetsController($this->getClient(), $this->cachePolicy, $this->cache); $this->propertysets->setLogger($this->logger); } return $this->propertysets; }
php
{ "resource": "" }
q247221
QBankApi.socialmedia
validation
public function socialmedia() { if (!$this->socialmedia instanceof SocialmediaController) { $this->socialmedia = new SocialmediaController($this->getClient(), $this->cachePolicy, $this->cache); $this->socialmedia->setLogger($this->logger); } return $this->socialmedia; }
php
{ "resource": "" }
q247222
QBankApi.buildBasepath
validation
protected function buildBasepath($url) { if (!preg_match('#(\w+:)?//#', $url)) { $url = '//' . $url; } $urlParts = parse_url($url); if (false === $urlParts) { throw new \InvalidArgumentException('Could not parse QBank URL.'); } // Default to HTTP if (empty($urlParts['scheme'])) { $urlParts['scheme'] = 'http'; } // Add the api path automatically if omitted for qbank.se hosted QBank instances if ((empty($urlParts['path']) || '/' == $urlParts['path']) && 'qbank.se' == substr($urlParts['host'], -strlen('qbank.se'))) { $urlParts['path'] = '/api/'; } // Pad the end of the path with a slash if ('/' != substr($urlParts['path'], -1)) { $urlParts['path'] .= '/'; } return $urlParts['scheme'] . '://' . $urlParts['host'] . (!empty($urlParts['port']) ? ':' . $urlParts['port'] : '') . $urlParts['path']; }
php
{ "resource": "" }
q247223
QBankApi.getClient
validation
protected function getClient() { if (!($this->client instanceof Client)) { $handlerStack = HandlerStack::create(); $handlerStack = $this->withOAuth2MiddleWare($handlerStack); $this->client = new Client([ 'handler' => $handlerStack, 'auth' => 'oauth2', 'base_uri' => $this->basepath, 'headers' => [ 'Accept' => 'application/json', 'Content-type' => 'application/json', 'User-Agent' => 'qbank3api-phpwrapper/2 (qbankapi: 1; swagger: 1.1)', ], 'verify' => $this->verifyCertificates, ]); $this->logger->debug('Guzzle client instantiated.', ['basepath' => $this->basepath]); } return $this->client; }
php
{ "resource": "" }
q247224
QBankApi.withOAuth2MiddleWare
validation
protected function withOAuth2MiddleWare(HandlerStack $stack) { if (!($this->oauth2Middleware instanceof OAuthMiddleware)) { $oauthClient = new Client([ 'base_uri' => $this->basepath, 'verify' => $this->verifyCertificates, 'headers' => [ 'User-Agent' => 'qbank3api-phpwrapper/2 (qbankapi: 1; swagger: 1.1)', ], ]); $config = [ PasswordCredentials::CONFIG_USERNAME => $this->credentials->getUsername(), PasswordCredentials::CONFIG_PASSWORD => $this->credentials->getPassword(), PasswordCredentials::CONFIG_CLIENT_ID => $this->credentials->getClientId(), PasswordCredentials::CONFIG_TOKEN_URL => 'oauth2/token', ]; $this->oauth2Middleware = new OAuthMiddleware( $oauthClient, new PasswordCredentials($oauthClient, $config), new RefreshToken($oauthClient, $config) ); $tokens = $this->getTokens(); if (!empty($tokens['accessTokens'])) { $this->oauth2Middleware->setAccessToken($tokens['accessTokens']); } if (!empty($tokens['refreshTokens'])) { $this->oauth2Middleware->setRefreshToken($tokens['refreshTokens']); } } $stack->push($this->oauth2Middleware->onBefore()); $stack->push($this->oauth2Middleware->onFailure(3)); return $stack; }
php
{ "resource": "" }
q247225
QBankApi.updateCredentials
validation
public function updateCredentials($user, $password) { $oldUser = $this->credentials->getUsername(); $this->credentials = new Credentials($this->credentials->getClientId(), $user, $password); unset($password); if ($this->client instanceof Client) { $this->client = $this->oauth2Middleware = null; $this->client = $this->getClient(); } if ($this->cache instanceof CacheProvider) { $this->cache->setNamespace(md5($this->basepath . $this->credentials->getUsername() . $this->credentials->getPassword())); } $this->logger->notice('Updated user!', ['old' => $oldUser, 'new' => $user]); }
php
{ "resource": "" }
q247226
QBankApi.setTokens
validation
public function setTokens(AccessToken $accessToken, AccessToken $refreshToken = null) { if ($accessToken instanceof AccessToken && false === $accessToken->isExpired()) { if ($this->cache instanceof Cache) { $this->cache->save( 'oauth2accesstoken', serialize($accessToken), $accessToken->getExpires()->getTimestamp() - (new \DateTime())->getTimestamp() ); } $this->oauth2Middleware->setAccessToken($accessToken); } if ($refreshToken instanceof AccessToken && false === $accessToken->isExpired()) { if ($this->cache instanceof Cache) { $this->cache->save( 'oauth2refreshtoken', serialize($refreshToken), $refreshToken->getExpires() instanceof \DateTime ? $refreshToken->getExpires()->getTimestamp() - (new \DateTime())->getTimestamp() : 3600 * 24 * 13 ); } $this->oauth2Middleware->setRefreshToken($refreshToken); } }
php
{ "resource": "" }
q247227
QBankApi.getTokens
validation
public function getTokens() { $tokens = ['accessToken' => null, 'refreshToken' => null]; if ($this->oauth2Middleware instanceof OAuthMiddleware) { $tokens['accessToken'] = $this->oauth2Middleware->getAccessToken(); $tokens['refreshToken'] = $this->oauth2Middleware->getRefreshToken(); } if ($this->cache instanceof Cache && empty($tokens['accessToken']) && $this->cache->contains('oauth2accesstoken')) { $tokens['accessToken'] = unserialize($this->cache->fetch('oauth2accesstoken')); } if ($this->cache instanceof Cache && empty($tokens['accessToken']) && $this->cache->contains('oauth2refreshtoken')) { $tokens['refreshToken'] = unserialize($this->cache->fetch('oauth2refreshtoken')); } if (empty($tokens['accessToken'])) { $response = $this->getClient()->get('/'); // Trigger call to get a token. Don't care about the result. $tokens['accessToken'] = $this->oauth2Middleware->getAccessToken(); $tokens['refreshToken'] = $this->oauth2Middleware->getRefreshToken(); } return $tokens; }
php
{ "resource": "" }
q247228
Search.setCreatedRange
validation
public function setCreatedRange($createdRange) { if ($createdRange instanceof DateTimeRange) { $this->createdRange = $createdRange; } elseif (is_array($createdRange)) { $this->createdRange = new DateTimeRange($createdRange); } else { $this->createdRange = null; trigger_error('Argument must be an object of class DateTimeRange. Data loss!', E_USER_WARNING); } return $this; }
php
{ "resource": "" }
q247229
Search.setUpdatedRange
validation
public function setUpdatedRange($updatedRange) { if ($updatedRange instanceof DateTimeRange) { $this->updatedRange = $updatedRange; } elseif (is_array($updatedRange)) { $this->updatedRange = new DateTimeRange($updatedRange); } else { $this->updatedRange = null; trigger_error('Argument must be an object of class DateTimeRange. Data loss!', E_USER_WARNING); } return $this; }
php
{ "resource": "" }
q247230
Search.setProperties
validation
public function setProperties(array $properties) { $this->properties = []; foreach ($properties as $item) { $this->addPropertyCriteria($item); } return $this; }
php
{ "resource": "" }
q247231
Search.addPropertyCriteria
validation
public function addPropertyCriteria($item) { if (!($item instanceof PropertyCriteria)) { if (is_array($item)) { try { $item = new PropertyCriteria($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate PropertyCriteria. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "PropertyCriteria"!', E_USER_WARNING); } } $this->properties[] = $item; return $this; }
php
{ "resource": "" }
q247232
Search.setDeploymentDateRange
validation
public function setDeploymentDateRange($deploymentDateRange) { if ($deploymentDateRange instanceof DateTimeRange) { $this->deploymentDateRange = $deploymentDateRange; } elseif (is_array($deploymentDateRange)) { $this->deploymentDateRange = new DateTimeRange($deploymentDateRange); } else { $this->deploymentDateRange = null; trigger_error('Argument must be an object of class DateTimeRange. Data loss!', E_USER_WARNING); } return $this; }
php
{ "resource": "" }
q247233
Search.setSortFields
validation
public function setSortFields(array $sortFields) { $this->sortFields = []; foreach ($sortFields as $item) { $this->addSearchSort($item); } return $this; }
php
{ "resource": "" }
q247234
Search.addSearchSort
validation
public function addSearchSort($item) { if (!($item instanceof SearchSort)) { if (is_array($item)) { try { $item = new SearchSort($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate SearchSort. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "SearchSort"!', E_USER_WARNING); } } $this->sortFields[] = $item; return $this; }
php
{ "resource": "" }
q247235
FolderResponse.setSubFolders
validation
public function setSubFolders(array $subFolders) { $this->subFolders = []; foreach ($subFolders as $item) { $this->addFolderResponse($item); } return $this; }
php
{ "resource": "" }
q247236
FolderResponse.addFolderResponse
validation
public function addFolderResponse($item) { if (!($item instanceof self)) { if (is_array($item)) { try { $item = new self($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate FolderResponse. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "FolderResponse"!', E_USER_WARNING); } } $this->subFolders[] = $item; return $this; }
php
{ "resource": "" }
q247237
FolderResponse.setSavedSearch
validation
public function setSavedSearch($savedSearch) { if ($savedSearch instanceof SavedSearch) { $this->savedSearch = $savedSearch; } elseif (is_array($savedSearch)) { $this->savedSearch = new SavedSearch($savedSearch); } else { $this->savedSearch = null; trigger_error('Argument must be an object of class SavedSearch. Data loss!', E_USER_WARNING); } return $this; }
php
{ "resource": "" }
q247238
DateTimeRange.setMin
validation
public function setMin($min) { if ($min instanceof DateTime) { $this->min = $min; } else { try { $this->min = new DateTime($min); } catch (\Exception $e) { $this->min = null; } } return $this; }
php
{ "resource": "" }
q247239
DateTimeRange.setMax
validation
public function setMax($max) { if ($max instanceof DateTime) { $this->max = $max; } else { try { $this->max = new DateTime($max); } catch (\Exception $e) { $this->max = null; } } return $this; }
php
{ "resource": "" }
q247240
DeploymentSite.setProtocol
validation
public function setProtocol($protocol) { if ($protocol instanceof Protocol) { $this->protocol = $protocol; } elseif (is_array($protocol)) { $this->protocol = new Protocol($protocol); } else { $this->protocol = null; trigger_error('Argument must be an object of class Protocol. Data loss!', E_USER_WARNING); } return $this; }
php
{ "resource": "" }
q247241
DeploymentSite.setImagetemplates
validation
public function setImagetemplates(array $imagetemplates) { $this->imagetemplates = []; foreach ($imagetemplates as $item) { $this->addImageTemplate($item); } return $this; }
php
{ "resource": "" }
q247242
DeploymentSite.addImageTemplate
validation
public function addImageTemplate($item) { if (!($item instanceof ImageTemplate)) { if (is_array($item)) { try { $item = new ImageTemplate($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate ImageTemplate. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "ImageTemplate"!', E_USER_WARNING); } } $this->imagetemplates[] = $item; return $this; }
php
{ "resource": "" }
q247243
DeploymentSite.setVideotemplates
validation
public function setVideotemplates(array $videotemplates) { $this->videotemplates = []; foreach ($videotemplates as $item) { $this->addVideoTemplate($item); } return $this; }
php
{ "resource": "" }
q247244
DeploymentSite.addVideoTemplate
validation
public function addVideoTemplate($item) { if (!($item instanceof VideoTemplate)) { if (is_array($item)) { try { $item = new VideoTemplate($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate VideoTemplate. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "VideoTemplate"!', E_USER_WARNING); } } $this->videotemplates[] = $item; return $this; }
php
{ "resource": "" }
q247245
DeploymentSite.setCategories
validation
public function setCategories(array $categories) { $this->categories = []; foreach ($categories as $item) { $this->addCategoryResponse($item); } return $this; }
php
{ "resource": "" }
q247246
DeploymentSite.addCategoryResponse
validation
public function addCategoryResponse($item) { if (!($item instanceof CategoryResponse)) { if (is_array($item)) { try { $item = new CategoryResponse($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate CategoryResponse. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "CategoryResponse"!', E_USER_WARNING); } } $this->categories[] = $item; return $this; }
php
{ "resource": "" }
q247247
Char.toUnicode
validation
public function toUnicode() { $h = ord($this->char{0}); if ($h <= 0x7F) { return $h; } else { if ($h < 0xC2) { return false; } else { if ($h <= 0xDF) { return ($h & 0x1F) << 6 | (ord($this->char{1}) & 0x3F); } else { if ($h <= 0xEF) { return ($h & 0x0F) << 12 | (ord($this->char{1}) & 0x3F) << 6 | (ord($this->char{2}) & 0x3F); } else { if ($h <= 0xF4) { return ($h & 0x0F) << 18 | (ord($this->char{1}) & 0x3F) << 12 | (ord( $this->char{2} ) & 0x3F) << 6 | (ord( $this->char{3} ) & 0x3F); } else { return false; } } } } } }
php
{ "resource": "" }
q247248
Char.fromHex
validation
public static function fromHex($hex) { if (strlen($hex) != 2) { throw new Ts3Exception("given parameter '" . $hex . "' is not a valid hexadecimal number"); } return new self(chr(hexdec($hex))); }
php
{ "resource": "" }
q247249
FileTransfer.init
validation
protected function init($ftkey) { if (strlen($ftkey) != 32) { throw new Ts3Exception("invalid file transfer key format"); } $this->getProfiler()->start(); $this->getTransport()->send($ftkey); Signal::getInstance()->emit("filetransferHandshake", $this); }
php
{ "resource": "" }
q247250
MediaUsageResponse.setDeleted
validation
public function setDeleted($deleted) { if ($deleted instanceof DateTime) { $this->deleted = $deleted; } else { try { $this->deleted = new DateTime($deleted); } catch (\Exception $e) { $this->deleted = null; } } return $this; }
php
{ "resource": "" }
q247251
SearchSort.setDateRange
validation
public function setDateRange($dateRange) { if ($dateRange instanceof DateTimeRange) { $this->dateRange = $dateRange; } elseif (is_array($dateRange)) { $this->dateRange = new DateTimeRange($dateRange); } else { $this->dateRange = null; trigger_error('Argument must be an object of class DateTimeRange. Data loss!', E_USER_WARNING); } return $this; }
php
{ "resource": "" }
q247252
CommentResponse.setReplies
validation
public function setReplies(array $replies) { $this->replies = []; foreach ($replies as $item) { $this->addCommentResponse($item); } return $this; }
php
{ "resource": "" }
q247253
CommentResponse.addCommentResponse
validation
public function addCommentResponse($item) { if (!($item instanceof self)) { if (is_array($item)) { try { $item = new self($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate CommentResponse. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "CommentResponse"!', E_USER_WARNING); } } $this->replies[] = $item; return $this; }
php
{ "resource": "" }
q247254
DeploymentController.listProtocols
validation
public function listProtocols(CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/deployment/protocols', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new Protocol($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247255
DeploymentController.retrieveProtocol
validation
public function retrieveProtocol($id, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/deployment/protocols/' . $id . '', $parameters, $cachePolicy); $result = new Protocol($result); return $result; }
php
{ "resource": "" }
q247256
DeploymentController.retrieveSite
validation
public function retrieveSite($id, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/deployment/sites/' . $id . '', $parameters, $cachePolicy); $result = new DeploymentSiteResponse($result); return $result; }
php
{ "resource": "" }
q247257
DeploymentController.createSite
validation
public function createSite(DeploymentSite $deploymentSite) { $parameters = [ 'query' => [], 'body' => json_encode(['deploymentSite' => $deploymentSite], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/deployment', $parameters); $result = new DeploymentSiteResponse($result); return $result; }
php
{ "resource": "" }
q247258
DeploymentController.updateSite
validation
public function updateSite($id, DeploymentSite $deploymentSite) { $parameters = [ 'query' => [], 'body' => json_encode(['deploymentSite' => $deploymentSite], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/deployment/' . $id . '', $parameters); $result = new DeploymentSiteResponse($result); return $result; }
php
{ "resource": "" }
q247259
DeploymentController.addMediaToDeploymentSite
validation
public function addMediaToDeploymentSite($id, array $mediaIds) { $parameters = [ 'query' => [], 'body' => json_encode(['mediaIds' => $mediaIds], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/deployment/' . $id . '/media', $parameters); return $result; }
php
{ "resource": "" }
q247260
DeploymentController.removeSite
validation
public function removeSite($id) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->delete('v1/deployment/' . $id . '', $parameters); $result = new DeploymentSiteResponse($result); return $result; }
php
{ "resource": "" }
q247261
DeploymentController.removeMediaFromDeploymentSite
validation
public function removeMediaFromDeploymentSite($id, $mediaIds) { $parameters = [ 'query' => ['mediaIds' => $mediaIds], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->delete('v1/deployment/' . $id . '/media', $parameters); return $result; }
php
{ "resource": "" }
q247262
MailChimp.setApiKey
validation
public function setApiKey($apiKey) { $this->apiKey = $apiKey; list(, $datacentre) = explode('-', $this->apiKey); $this->apiUrl = str_replace('<dc>', $datacentre, $this->apiUrl); }
php
{ "resource": "" }
q247263
MailChimp.request
validation
public function request($endPoint, $httpVerb = 'GET', $data = array()) { // Validate API if (!$this->apiKey) { throw new \Exception('MailChimp API Key must be set before making request!'); } $endPoint = ltrim($endPoint, '/'); $httpVerb = strtoupper($httpVerb); $requestUrl = $this->apiUrl.$endPoint; return $this->curlRequest($requestUrl, $httpVerb, $data); }
php
{ "resource": "" }
q247264
MailChimp.curlRequest
validation
private function curlRequest($url, $httpVerb, array $data = array(), $curlTimeout = 15) { if (function_exists('curl_init') && function_exists('curl_setopt')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_USERAGENT, 'VPS/MC-API:3.0'); curl_setopt($ch, CURLOPT_TIMEOUT, $curlTimeout); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_USERPWD, "user:".$this->apiKey); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $httpVerb); //Submit data if (!empty($data)) { $jsonData = json_encode($data); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); return $result ? json_decode($result, true) : false; } throw new \Exception('curl extension is missing!'); }
php
{ "resource": "" }
q247265
MediaResponse.setMetadata
validation
public function setMetadata(array $metadata) { $this->metadata = []; foreach ($metadata as $item) { $this->addMetaData($item); } return $this; }
php
{ "resource": "" }
q247266
MediaResponse.addMetaData
validation
public function addMetaData($item) { if (!($item instanceof MetaData)) { if (is_array($item)) { try { $item = new MetaData($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate MetaData. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "MetaData"!', E_USER_WARNING); } } $this->metadata[] = $item; return $this; }
php
{ "resource": "" }
q247267
MediaResponse.setMimetype
validation
public function setMimetype($mimetype) { if ($mimetype instanceof MimeType) { $this->mimetype = $mimetype; } elseif (is_array($mimetype)) { $this->mimetype = new MimeType($mimetype); } else { $this->mimetype = null; trigger_error('Argument must be an object of class MimeType. Data loss!', E_USER_WARNING); } return $this; }
php
{ "resource": "" }
q247268
MediaResponse.setUploaded
validation
public function setUploaded($uploaded) { if ($uploaded instanceof DateTime) { $this->uploaded = $uploaded; } else { try { $this->uploaded = new DateTime($uploaded); } catch (\Exception $e) { $this->uploaded = null; } } return $this; }
php
{ "resource": "" }
q247269
MediaResponse.setDeployedFiles
validation
public function setDeployedFiles(array $deployedFiles) { $this->deployedFiles = []; foreach ($deployedFiles as $item) { $this->addDeploymentFile($item); } return $this; }
php
{ "resource": "" }
q247270
MediaResponse.addDeploymentFile
validation
public function addDeploymentFile($item) { if (!($item instanceof DeploymentFile)) { if (is_array($item)) { try { $item = new DeploymentFile($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate DeploymentFile. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "DeploymentFile"!', E_USER_WARNING); } } $this->deployedFiles[] = $item; return $this; }
php
{ "resource": "" }
q247271
MediaResponse.setChildMedias
validation
public function setChildMedias(array $childMedias) { $this->childMedias = []; foreach ($childMedias as $item) { $this->addself($item); } return $this; }
php
{ "resource": "" }
q247272
MediaResponse.addself
validation
public function addself($item) { if (!($item instanceof self)) { if (is_array($item)) { try { $item = new self($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate self. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "self"!', E_USER_WARNING); } } $this->childMedias[] = $item; return $this; }
php
{ "resource": "" }
q247273
MediaResponse.getDeployedFile
validation
public function getDeployedFile($templateId, $templateType = self::TEMPLATE_IMAGE, $siteId = null) { foreach ($this->deployedFiles as $deployedFile) { /** @var DeploymentFile $deployedFile */ if (null === $siteId || $siteId == $deployedFile->getDeployMentSiteId()) { if (self::TEMPLATE_VIDEO == $templateType) { if ($templateId == $deployedFile->getVideoTemplateId() && null === $deployedFile->getImageTemplateId()) { return $deployedFile; } } elseif (self::TEMPLATE_IMAGE == $templateType && $templateId == $deployedFile->getImageTemplateId() || (null === $templateId && null === $deployedFile->getImageTemplateId() && null === $deployedFile->getVideoTemplateId())) { return $deployedFile; } } } throw new NotFoundException('No DeploymentFile with the id "' . $templateId . '" exists.'); }
php
{ "resource": "" }
q247274
MediaResponse.getMetadata
validation
public function getMetadata($section = null, $key = null) { if (null === $section) { return $this->metadata; } foreach ($this->metadata as $md) { /** @var MetaData $md */ if ($section != $md->getSection()) { continue; } if (null === $key) { return $md; } foreach ($md->getData() as $k => $data) { if ($key == $k) { return $data; } } throw new NotFoundException('No metadata with section "' . $section . '" and key "' . $key . '" exists.'); } throw new NotFoundException('No metadata with section "' . $section . '" exists.'); }
php
{ "resource": "" }
q247275
ImageTemplate.setMimeType
validation
public function setMimeType($mimeType) { if ($mimeType instanceof MimeType) { $this->mimeType = $mimeType; } elseif (is_array($mimeType)) { $this->mimeType = new MimeType($mimeType); } else { $this->mimeType = null; trigger_error('Argument must be an object of class MimeType. Data loss!', E_USER_WARNING); } return $this; }
php
{ "resource": "" }
q247276
ImageTemplate.setCommands
validation
public function setCommands(array $commands) { $this->commands = []; foreach ($commands as $item) { $this->addCommand($item); } return $this; }
php
{ "resource": "" }
q247277
ImageTemplate.addCommand
validation
public function addCommand($item) { if (!($item instanceof Command)) { if (is_array($item)) { try { $item = new Command($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate Command. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "Command"!', E_USER_WARNING); } } $this->commands[] = $item; return $this; }
php
{ "resource": "" }
q247278
Multiselect.init
validation
public function init(){ parent::init(); //$this->options = array_merge($this->options,['readonly'=>'true']); if($this->data){ $order = 0; if(is_array($this->model->{$this->attribute})){ //echo '<pre>'; //print_r($this->model->{$this->attribute});die; foreach($this->model->{$this->attribute} as $value){ $order++; if(is_object($value)){ $this->options['options'][$value->Id] = ['data-order' => $order]; }else{ $this->options['options'][$value] = ['data-order' => $order]; } } } } }
php
{ "resource": "" }
q247279
AbstractAdapter.initTransport
validation
protected function initTransport($options, $transport = "TCP") { if (!is_array($options)) { throw new Ts3Exception("transport parameters must provided in an array"); } if($transport == "TCP") $this->transport = new TCP($options); else $this->transport = new UDP($options); }
php
{ "resource": "" }
q247280
EventsController.custom
validation
public function custom($sessionId, $mediaId, $event) { $parameters = [ 'query' => [], 'body' => json_encode(['sessionId' => $sessionId, 'mediaId' => $mediaId, 'event' => $event], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/events/custom', $parameters, true); return $result; }
php
{ "resource": "" }
q247281
EventsController.download
validation
public function download($sessionId, array $downloads) { $parameters = [ 'query' => [], 'body' => json_encode(['sessionId' => $sessionId, 'downloads' => $downloads], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/events/download', $parameters, true); return $result; }
php
{ "resource": "" }
q247282
EventsController.search
validation
public function search($sessionId, Search $search, $hits) { $parameters = [ 'query' => [], 'body' => json_encode(['sessionId' => $sessionId, 'search' => $search, 'hits' => $hits], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/events/search', $parameters, true); return $result; }
php
{ "resource": "" }
q247283
EventsController.session
validation
public function session($sourceId, $sessionHash, $remoteIp, $userAgent, $userId = null) { $parameters = [ 'query' => [], 'body' => json_encode(['sourceId' => $sourceId, 'sessionHash' => $sessionHash, 'remoteIp' => $remoteIp, 'userAgent' => $userAgent, 'userId' => $userId], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/events/session', $parameters); return $result; }
php
{ "resource": "" }
q247284
EventsController.addUsage
validation
public function addUsage($sessionId, MediaUsage $mediaUsage) { $parameters = [ 'query' => [], 'body' => json_encode(['sessionId' => $sessionId, 'mediaUsage' => $mediaUsage], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/events/usage', $parameters); $result = new MediaUsageResponse($result); return $result; }
php
{ "resource": "" }
q247285
EventsController.view
validation
public function view($sessionId, $mediaId) { $parameters = [ 'query' => [], 'body' => json_encode(['sessionId' => $sessionId, 'mediaId' => $mediaId], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/events/view', $parameters, true); return $result; }
php
{ "resource": "" }
q247286
Dropdown.renderItems
validation
protected function renderItems($items) { $lines = []; foreach ($items as $i => $item) { if (isset($item['visible']) && !$item['visible']) { unset($items[$i]); continue; } if (is_string($item)) { $lines[] = $item; continue; } $options = ArrayHelper::getValue($item, 'options', []); if(isset($item['divider'])){ Html::addCssClass($options, 'divider'); $lines[] = Html::tag('li','', $options); continue; } if (!isset($item['label'])) { throw new InvalidConfigException("The 'label' option is required."); } $label = $this->encodeLabels ? Html::encode($item['label']) : $item['label']; $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []); $linkOptions['tabindex'] = '-1'; $badgeOptions = ArrayHelper::getValue($item, 'badgeOptions', []); $label = Html::tag('i', '', $linkOptions).Html::tag('span', $label); $label .= $this->renderBadge($badgeOptions); $content = Html::a($label, ArrayHelper::getValue($item, 'url', '#')); if (!empty($item['items'])) { $content .= $this->renderItems($item['items']); Html::addCssClass($options, 'dropdown-submenu'); } $lines[] = Html::tag('li', $content, $options); } return Html::tag('ul', implode("\n", $lines), $this->options); }
php
{ "resource": "" }
q247287
Widget.registerPlugin
validation
protected function registerPlugin($name) { $view = $this->getView(); AdminUiAsset::register($view); $id = $this->options['id']; if ($this->clientOptions !== false) { $options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions); $js = "jQuery('#$id').$name($options);"; $view->registerJs($js); } if (!empty($this->clientEvents)) { $js = []; foreach ($this->clientEvents as $event => $handler) { $js[] = "jQuery('#$id').on('$event', $handler);"; } $view->registerJs(implode("\n", $js)); } }
php
{ "resource": "" }
q247288
ObjecttypesController.listObjectTypes
validation
public function listObjectTypes(CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/objecttypes', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new ObjectType($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247289
ObjecttypesController.retrieveObjectType
validation
public function retrieveObjectType($id, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/objecttypes/' . $id . '', $parameters, $cachePolicy); $result = new ObjectType($result); return $result; }
php
{ "resource": "" }
q247290
PropertySet.setProperties
validation
public function setProperties(array $properties) { $this->properties = []; foreach ($properties as $item) { $this->addPropertyResponse($item); } return $this; }
php
{ "resource": "" }
q247291
PropertySet.addPropertyResponse
validation
public function addPropertyResponse($item) { if (!($item instanceof PropertyResponse)) { if (is_array($item)) { try { $item = new PropertyResponse($item); } catch (\Exception $e) { trigger_error('Could not auto-instantiate PropertyResponse. ' . $e->getMessage(), E_USER_WARNING); } } else { trigger_error('Array parameter item is not of expected type "PropertyResponse"!', E_USER_WARNING); } } $this->properties[] = $item; return $this; }
php
{ "resource": "" }
q247292
FoldersController.listFolders
validation
public function listFolders($root = 0, $depth = 0, $includeProperties = true, $includeObjectCounts = false, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => ['root' => $root, 'depth' => $depth, 'includeProperties' => $includeProperties, 'includeObjectCounts' => $includeObjectCounts], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/folders', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new FolderResponse($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247293
FoldersController.retrieveFolder
validation
public function retrieveFolder($id, $depth = 0, $includeProperties = true, $includeObjectCounts = false, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => ['depth' => $depth, 'includeProperties' => $includeProperties, 'includeObjectCounts' => $includeObjectCounts], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/folders/' . $id . '', $parameters, $cachePolicy); $result = new FolderResponse($result); return $result; }
php
{ "resource": "" }
q247294
FoldersController.retrieveParents
validation
public function retrieveParents($id, CachePolicy $cachePolicy = null) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->get('v1/folders/' . $id . '/parents', $parameters, $cachePolicy); foreach ($result as &$entry) { $entry = new FolderParent($entry); } unset($entry); reset($result); return $result; }
php
{ "resource": "" }
q247295
FoldersController.createFolder
validation
public function createFolder(Folder $folder, $parentId = 0, $inheritAccess = null) { $parameters = [ 'query' => ['parentId' => $parentId], 'body' => json_encode(['folder' => $folder, 'inheritAccess' => $inheritAccess], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/folders', $parameters); $result = new FolderResponse($result); return $result; }
php
{ "resource": "" }
q247296
FoldersController.addMediaToFolder
validation
public function addMediaToFolder($folderId, array $mediaIds) { $parameters = [ 'query' => [], 'body' => json_encode(['mediaIds' => $mediaIds], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/folders/' . $folderId . '/media', $parameters); return $result; }
php
{ "resource": "" }
q247297
FoldersController.updateFolder
validation
public function updateFolder($id, Folder $folder) { $parameters = [ 'query' => [], 'body' => json_encode(['folder' => $folder], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->post('v1/folders/' . $id . '', $parameters); $result = new FolderResponse($result); return $result; }
php
{ "resource": "" }
q247298
FoldersController.removeMediaFromFolder
validation
public function removeMediaFromFolder($folderId, $mediaId) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->delete('v1/folders/' . $folderId . '/media/' . $mediaId . '', $parameters); return $result; }
php
{ "resource": "" }
q247299
FoldersController.removeFolder
validation
public function removeFolder($id) { $parameters = [ 'query' => [], 'body' => json_encode([], JSON_UNESCAPED_UNICODE), 'headers' => [], ]; $result = $this->delete('v1/folders/' . $id . '', $parameters); $result = new FolderResponse($result); return $result; }
php
{ "resource": "" }