_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q264400 | MenuItem.getAdditionalStylesByType | test | public function getAdditionalStylesByType($type) {
$return = array();
if($this->additionalStyles) {
foreach ($this->additionalStyles as $additionalStyle) {
if($additionalStyle instanceof $type) {
$return[] = $additionalStyle;
}
}
}
return $return;
} | php | {
"resource": ""
} |
q264401 | MenuItem.getLink | test | public function getLink() {
if ($this->url === null) {
return null;
}
$link = $this->getLinkWithoutParams();
$params = array();
// First, get the list of all parameters to be propagated
if (is_array($this->propagatedUrlParameters)) {
foreach ($this->propagatedUrlParameters as $parameter) {
if (... | php | {
"resource": ""
} |
q264402 | ObjectToArray.convert | test | public function convert($data)
{
if (is_object($data)) {
$data = get_object_vars($data);
}
if (is_array($data)) {
return array_map(__METHOD__, $data);
} else {
return $data;
}
} | php | {
"resource": ""
} |
q264403 | ModelAbstract.configure | test | protected function configure(string $collection, string $primaryKey = 'id', string $relationship = '')
{
if ($relationship) {
$reference = get_parent_class($this);
$call = 'construct';
if (method_exists($reference, $call)) {
$reference::$call();
... | php | {
"resource": ""
} |
q264404 | ModelAbstract.connection | test | private function connection($connection): string
{
$this->connection = !is_null($connection) ? $connection : env('DEFAULT_DATABASE');
if (!$this->connection) {
throw new SimplesRunTimeError(
"There is no `connection` to be used. Check .env file or configure the model prop... | php | {
"resource": ""
} |
q264405 | ModelAbstract.import | test | protected function import(string $name, string $relationship, array $options = []): Field
{
$source = $this->get($relationship);
$reference = $source->getReferences();
$class = off($reference, 'class');
if (!class_exists($class)) {
throw new SimplesRunTimeError("Cant not... | php | {
"resource": ""
} |
q264406 | NamespaceClassnameToPath.convert | test | public function convert($string)
{
$parts = [];
foreach (explode('\\', trim($string, '\\')) as $name) {
$name = strtolower(preg_replace('/([a-z])([A-Z])/', '$1-$2', $name));
$parts[] = $name;
}
return implode('/', $parts);
} | php | {
"resource": ""
} |
q264407 | MysqlJob.fire | test | public function fire()
{
$this->record['attempts'] += 1;
$this->record['status'] = 'running';
DB::table($this->table)->where('ID', $this->id)->update([
'attempts' => $this->record['attempts'],
'status' => $this->record['status'],
]);
$this->resolveAnd... | php | {
"resource": ""
} |
q264408 | MysqlJob.delete | test | public function delete()
{
$this->record['status'] = 'deleted';
DB::table($this->table)->where('ID', $this->id)->update([
'status' => $this->record['status'],
]);
} | php | {
"resource": ""
} |
q264409 | ResetableEntityManager.getClassMetadata | test | public function getClassMetadata($className)
{
try{
return $this->entityManager->getClassMetadata($className);
} catch(ORMException $e) {
if (!$this->entityManager->isOpen()) {
$this->resetEntityManager();
}
throw $e;
}
} | php | {
"resource": ""
} |
q264410 | ResetableEntityManager.flush | test | public function flush($entity = null)
{
try{
return $this->entityManager->flush($entity);
} catch(ORMException $e) {
if (!$this->entityManager->isOpen()) {
$this->resetEntityManager();
}
throw $e;
}
} | php | {
"resource": ""
} |
q264411 | ResetableEntityManager.find | test | public function find($entityName, $id, $lockMode = null, $lockVersion = null)
{
try{
return $this->entityManager->find($entityName, $id, $lockMode, $lockVersion);
} catch(ORMException $e) {
if (!$this->entityManager->isOpen()) {
$this->resetEntityManager();
... | php | {
"resource": ""
} |
q264412 | ResetableEntityManager.clear | test | public function clear($entityName = null)
{
try{
return $this->entityManager->clear($entityName);
} catch(ORMException $e) {
if (!$this->entityManager->isOpen()) {
$this->resetEntityManager();
}
throw $e;
}
} | php | {
"resource": ""
} |
q264413 | ResetableEntityManager.remove | test | public function remove($entity)
{
try{
return $this->entityManager->remove($entity);
} catch(ORMException $e) {
if (!$this->entityManager->isOpen()) {
$this->resetEntityManager();
}
throw $e;
}
} | php | {
"resource": ""
} |
q264414 | ResetableEntityManager.refresh | test | public function refresh($entity)
{
try{
return $this->entityManager->refresh($entity);
} catch(ORMException $e) {
if (!$this->entityManager->isOpen()) {
$this->resetEntityManager();
}
throw $e;
}
} | php | {
"resource": ""
} |
q264415 | ResetableEntityManager.getRepository | test | public function getRepository($entityName)
{
try{
return $this->entityManager->getRepository($entityName);
} catch(ORMException $e) {
if (!$this->entityManager->isOpen()) {
$this->resetEntityManager();
}
throw $e;
}
} | php | {
"resource": ""
} |
q264416 | ResetableEntityManager.contains | test | public function contains($entity)
{
try{
return $this->entityManager->contains($entity);
} catch(ORMException $e) {
if (!$this->entityManager->isOpen()) {
$this->resetEntityManager();
}
throw $e;
}
} | php | {
"resource": ""
} |
q264417 | ResetableEntityManager.create | test | public static function create($conn, Configuration $config, EventManager $eventManager = null)
{
try{
return self::getEntityManager()->create($conn, $config, $eventManager);
} catch(ORMException $e) {
if (!self::getEntityManager()->isOpen()) {
self::resetEntit... | php | {
"resource": ""
} |
q264418 | WsapiServer.processXcdr | test | public function processXcdr(XcdrListenerInterface $listener, array$options = array())
{
$xcdrRequest = new XcdrRequest($listener, $options);
$schema = $xcdrRequest->getSchema();
ini_set("soap.wsdl_cache_enabled", "0");
$soapServer = new \SoapServer(null, array(
'uri' =>... | php | {
"resource": ""
} |
q264419 | ThreeWayMerge.performMerge | test | public function performMerge(array $ancestor, array $local, array $remote)
{
// Returning a new Array for now. Can return the modified ancestor as well.
$merged = [];
foreach ($ancestor as $key => $value) {
// Checks if the value contains an array itself.
if (is_array... | php | {
"resource": ""
} |
q264420 | ThreeWayMerge.merge | test | protected function merge($x, $y, $z, $key)
{
// Convert the value into array.
$ancestor = (strpos($x, PHP_EOL) !== false ? explode(PHP_EOL, $x) : array($x));
$local = (strpos($y, PHP_EOL) !== false ? explode(PHP_EOL, $y) : array($y));
$remote = (strpos($z, PHP_EOL) !== false ? explod... | php | {
"resource": ""
} |
q264421 | ThreeWayMerge.linesAddedOrModified | test | protected function linesAddedOrModified(
array $ancestor,
array $local,
array $remote,
$count,
$count_remote,
$count_ancestor,
$count_local
) {
$merged = [];
$counter = 0;
// For all ancestors lines, it will check local and remote
... | php | {
"resource": ""
} |
q264422 | ThreeWayMerge.linesRemovedOrModified | test | protected function linesRemovedOrModified(
array $ancestor,
array $local,
array $remote,
$count_ancestor,
$count_local,
$count_remote
) {
$merged = [];
$count_array = [$count_ancestor, $count_local, $count_remote];
sort($count_array);
$... | php | {
"resource": ""
} |
q264423 | XcdrRequest.NotifyXcdrRecord | test | public function NotifyXcdrRecord($msgHeader, $format, $type, $cdr)
{
$this->msgHeader = $msgHeader;
$this->registrationID = $msgHeader->registrationID;
$this->transactionID = $msgHeader->transactionID;
$this->cdrFormat = $format;
$this->cdrType = $type;
$this->cdrReco... | php | {
"resource": ""
} |
q264424 | WordPress_Provider.register | test | public function register( PimpleContainer $container ) {
$container['wp'] = $container->factory( function() {
return isset( $GLOBALS['wp'] ) ? $GLOBALS['wp'] : null;
} );
$container['wpdb'] = $container->factory( function() {
return isset( $GLOBALS['wpdb'] ) ? $GLOBALS['wpdb'] : null;
} );
$container[... | php | {
"resource": ""
} |
q264425 | EnvProvider.applyConfigs | test | protected function applyConfigs(Container $app, $config)
{
foreach ($config as $varName => $options) {
if (isset($options[self::CONFIG_KEY_DEFAULT])) {
if (isset($app[$varName]) === false) {
$app[$varName] = $options[self::CONFIG_KEY_DEFAULT];
... | php | {
"resource": ""
} |
q264426 | EnvProvider.addEnvVarsToApp | test | protected function addEnvVarsToApp(Container $app)
{
$hasPrefix = function ($elem) use ($app) {
return strpos($elem, $app['env.options']['prefix'].'_') !== false;
};
$arrayFilterKeys = function ($input, $callback) {
if (!is_array($input)) {
trigger_err... | php | {
"resource": ""
} |
q264427 | MysqlQueue.pop | test | public function pop($queue = null) {
if ($queue === null) { $queue = $this->queue; }
$query = DB::table($this->table)->where('queue_name', $queue)
->where('status', 'pending')
->where('fireon', '<', time())
->orderBy('fireon', 'asc');
if ($query->count() == 0)... | php | {
"resource": ""
} |
q264428 | MysqlQueue.insertJobRecord | test | private function insertJobRecord($payload, $time, $queue)
{
if (!$time instanceof DateTime) {
throw new ErrorException('An explicit DateTime value $time is required. ');
}
$jobId = DB::table($this->table)->insertGetId([
'queue_name' => $queue,
'payload' ... | php | {
"resource": ""
} |
q264429 | XcdrClient.requestXcdrSetAttribute | test | private function requestXcdrSetAttribute($result, $schema)
{
$msgHeader = $result['msgHeader'];
$soapObjectXML = '<format>DETAIL</format>
<msgHeader>
<transactionID>' . $msgHeader->transactionID . '</transactionID>
<registrationID>' . $msg... | php | {
"resource": ""
} |
q264430 | StringToCamelCase.convert | test | public function convert($string, $delimiter = '_')
{
$func = create_function('$c', 'return strtoupper($c[1]);');
return preg_replace_callback('/[\s]+(.)/', $func, str_replace($delimiter, ' ', $string));
} | php | {
"resource": ""
} |
q264431 | DataMapper.create | test | final public function create($record = null, string $alias = null): Record
{
$record = Record::parse($record);
foreach ($this->getParents() as $relationship => $parent) {
/** @var DataMapper $parent */
$create = $parent->create($record);
$record->set($relationshi... | php | {
"resource": ""
} |
q264432 | DataMapper.read | test | final public function read($record = null, string $alias = null, $trash = false, $clean = false): Collection
{
$record = Record::parse(coalesce($record, []));
$action = coalesce($alias, Action::READ);
if (!$this->before($action, $record)) {
throw new SimplesHookError(get_class(... | php | {
"resource": ""
} |
q264433 | DataMapper.update | test | final public function update($record = null, string $alias = null, bool $trash = false): Record
{
$record = Record::parse($record);
foreach ($this->getParents() as $parent) {
/** @var DataMapper $parent */
$record->import($parent->update($record)->all());
}
... | php | {
"resource": ""
} |
q264434 | DataMapper.destroy | test | final public function destroy($record = null, string $alias = null): Record
{
$record = Record::parse($record);
foreach ($this->getParents() as $parent) {
/** @var DataMapper $parent */
$record->import($parent->destroy($record)->all());
}
$action = coalesce(... | php | {
"resource": ""
} |
q264435 | DataMapper.recycle | test | final public function recycle($record = null): Record
{
if (!$this->destroyKeys) {
throw new SimplesValidationError(
['destroyKeys' => 'requires'],
"Recycle needs the `destroyKeys`"
);
}
$record = Record::parse($record);
foreac... | php | {
"resource": ""
} |
q264436 | DataMapper.count | test | final public function count(Record $record): int
{
$alias = 'count';
$collection = $this->getCollection();
$name = $this->getPrimaryKey();
$type = Field::AGGREGATOR_COUNT;
$options = ['alias' => $alias];
$fields = [Field::make($collection, $name, $type, $options)];
... | php | {
"resource": ""
} |
q264437 | Base_Provider.proxy | test | public function proxy( Container $container, $key ) {
if ( isset( $this->proxies[ $key ] ) ) {
return $this->proxies[ $key ];
}
$this->proxies[ $key ] = new Proxy( $container, $key );
return $this->proxies[ $key ];
} | php | {
"resource": ""
} |
q264438 | Log.close | test | public function close():Log{
if(!empty($this->logOutputInterfaces)){
foreach($this->logOutputInterfaces as $instanceName => $instance){
unset($this->logOutputInterfaces[$instanceName]);
}
}
return $this;
} | php | {
"resource": ""
} |
q264439 | PotterCore.loadWidgets | test | protected function loadWidgets()
{
$widgets_folder = apply_filters('potter_widgets_folder', $this->widgetsFolder);
$pattern = $this->themeDIR . $widgets_folder . "/*.php";
foreach (glob($pattern) as $file): // Load File
require_once($file);
$widget = basename($file... | php | {
"resource": ""
} |
q264440 | PotterCore.loadThemeOptions | test | private function loadThemeOptions()
{
$file = cleanURI($this->themeDIR . 'app/ThemeOptions.php');
$file = apply_filters('potter_autoload_themeoptions', $file);
$class = $this->loadFile($file);
if (!$class):
$class = new OptionsEmpty();
add_action('admin_menu... | php | {
"resource": ""
} |
q264441 | Plugin.onXmlRpcEliteBeginTurn | test | function onXmlRpcEliteBeginTurn($content)
{
$this->postTwitterMessage(sprintf("Turn #%d: %s attack", $content->TurnNumber, $this->formatForTwitter($content->AttackingPlayer->Name)));
} | php | {
"resource": ""
} |
q264442 | TaskBarIcon.addChild | test | public function addChild(ElementInterface $child)
{
if ($child instanceof Menu) {
$this->element->setMenu($child);
}
$this->children[] = $child;
} | php | {
"resource": ""
} |
q264443 | PermissionController.store | test | public function store(CreatePermissionRequest $request)
{
$input = $request->all();
$permission = $this->permissionRepository->create([
'name' => $input['name'],
]);
foreach ($input['roles'] as $role) {
$permission->roles()->attach($role);
}
... | php | {
"resource": ""
} |
q264444 | PermissionController.edit | test | public function edit($id)
{
$permission = $this->permissionRepository->findWithoutFail($id);
if (empty($permission)) {
Flash::error(trans('l5starter::messages.404_not_found'));
return redirect(route('admin.permissions.index'));
}
return view('permissions::e... | php | {
"resource": ""
} |
q264445 | PermissionController.update | test | public function update($id, UpdatePermissionRequest $request)
{
$permission = $this->permissionRepository->findWithoutFail($id);
if (empty($permission)) {
Flash::error(trans('l5starter::messages.404_not_found'));
return redirect(route('admin.permissions.index'));
}
... | php | {
"resource": ""
} |
q264446 | PermissionController.destroy | test | public function destroy($id)
{
$permission = $this->permissionRepository->findWithoutFail($id);
if (empty($permission)) {
Flash::error(trans('l5starter::messages.404_not_found'));
return redirect(route('admin.permissions.index'));
}
$this->permissionReposit... | php | {
"resource": ""
} |
q264447 | AbstractTransport.setAdapter | test | public function setAdapter(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\AbstractAdapter $adapter)
{
$this->adapter = $adapter;
} | php | {
"resource": ""
} |
q264448 | AbstractTransport.getAdapterType | test | public function getAdapterType()
{
if($this->adapter instanceof \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\AbstractAdapter)
{
$string = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String::factory(get_class($this->adapter));
return $string->substr($string->findLast("\... | php | {
"resource": ""
} |
q264449 | AbstractTransport.waitForReadyRead | test | protected function waitForReadyRead($time = 0)
{
if(!$this->isConnected() || $this->config["blocking"]) return;
do {
$read = array($this->stream);
$null = null;
if($time)
{
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit(strtolower... | php | {
"resource": ""
} |
q264450 | SearchRepository.getChannels | test | public function getChannels($params = array())
{
$params = 0 < count($params) ? '?'.http_build_query($params) : '';
$response = $this->getClient()->get(self::ENDPOINT.'channels'.$params);
$data = $this->jsonResponse($response);
return $this->setFactory((new ChannelFactory()))->getFa... | php | {
"resource": ""
} |
q264451 | SearchRepository.getGames | test | public function getGames($params = array())
{
$params = 0 < count($params) ? '?'.http_build_query($params) : '';
$response = $this->getClient()->get(self::ENDPOINT.'games'.$params);
$data = $this->jsonResponse($response);
return $this->setFactory((new GameFactory()))->getFactory()->... | php | {
"resource": ""
} |
q264452 | Validate.asArray | test | public static function asArray($data, $default = null)
{
$json = is_string($data) ? $data : json_encode($data);
$array = json_decode($json, true) ?? null;
$array = $array ? filter_var_array($array) : false;
return $array !== false ? $array : $default;
} | php | {
"resource": ""
} |
q264453 | Validate.asObject | test | public static function asObject($data, $default = null)
{
$json = is_string($data) ? $data : json_encode($data);
$object = json_decode($json);
return is_object($object) ? $object : $default;
} | php | {
"resource": ""
} |
q264454 | Validate.asJson | test | public static function asJson($data, $default = null)
{
$json = is_string($data) ? $data : json_encode($data);
return $json !== false ? $json : $default;
} | php | {
"resource": ""
} |
q264455 | Validate.asString | test | public static function asString($data, $default = null)
{
$string = filter_var(
$data ?? [],
FILTER_SANITIZE_STRING,
FILTER_FLAG_NO_ENCODE_QUOTES
);
return $string !== false ? $string : $default;
} | php | {
"resource": ""
} |
q264456 | Validate.asInteger | test | public static function asInteger($data, $default = null)
{
$int = filter_var($data ?? '', FILTER_VALIDATE_INT);
return $int !== false ? $int : $default;
} | php | {
"resource": ""
} |
q264457 | Validate.asFloat | test | public static function asFloat($data, $default = null)
{
$float = filter_var($data ?? '', FILTER_VALIDATE_FLOAT);
return $float !== false ? $float : $default;
} | php | {
"resource": ""
} |
q264458 | Validate.asBoolean | test | public static function asBoolean($data, $default = null)
{
$boolean = filter_var($data ?? [], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
return ! is_null($boolean) ? $boolean : $default;
} | php | {
"resource": ""
} |
q264459 | PHP5HydratorGenerator.generate | test | public function generate(\ReflectionClass $originalClass, string $realClassName, string $originalClassName) : string
{
$position = \strrpos($realClassName, '\\');
$namespace = \substr($realClassName, 0, $position);
$className = \substr($realClassName, $position + 1);
$visiblePropert... | php | {
"resource": ""
} |
q264460 | PHP5HydratorGenerator.findAllInstanceProperties | test | private function findAllInstanceProperties(\ReflectionClass $class = null)
{
if (! $class) {
return [];
}
return \array_values(\array_merge(
$this->findAllInstanceProperties($class->getParentClass() ?: null), // of course PHP is shit.
\array_values(\array... | php | {
"resource": ""
} |
q264461 | PHP5HydratorGenerator.createContructor | test | private function createContructor(array $visiblePropertyMap, array $hiddenPropertyMap) : string
{
$content = [];
// Create a set of closures that will be called to hydrate the object.
// Array of closures in a naturally indexed array, ordered, which will
// then be called in order i... | php | {
"resource": ""
} |
q264462 | PHP5HydratorGenerator.createHydrateMethod | test | private function createHydrateMethod(array $visiblePropertyMap, array $hiddenPropertyMap) : string
{
$content = [];
foreach ($visiblePropertyMap as $propertyName) {
$content[] = "if (isset(\$data['" . $propertyName . "']) || \$object->" . $propertyName . " !== null && \\array_key_exists... | php | {
"resource": ""
} |
q264463 | ExtensionFileWriter.updateConfig | test | public static function updateConfig()
{
/** @var ExtensionsManager $module */
$module = ExtensionsManager::module();
$extensions = $module->getExtensions();
$installed = ComposerInstalledSet::get(true)->getInstalled();
$fileName = Yii::getAlias($module->extensionsStorage);
... | php | {
"resource": ""
} |
q264464 | ExtensionFileWriter.checkLocalStorage | test | public static function checkLocalStorage($dir, $data)
{
$fn = $dir . '/composer.json';
$created = true;
if (true === FileHelper::createDirectory($dir)) {
if (false === file_exists($fn)) {
$created = file_put_contents(
$fn,
J... | php | {
"resource": ""
} |
q264465 | NavigationContainer.findOneByAttribute | test | public function findOneByAttribute(string $attribute, $value): ?Page
{
$iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);
/** @var Page $page */
foreach ($iterator as $page) {
if ($page->getAttribute($attribute) === $value) {
... | php | {
"resource": ""
} |
q264466 | NavigationContainer.findByAttribute | test | public function findByAttribute(string $attribute, $value): array
{
$result = [];
$iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);
/** @var Page $page */
foreach ($iterator as $page) {
if ($page->getAttribute($attribute) == $valu... | php | {
"resource": ""
} |
q264467 | NavigationContainer.findOneByOption | test | public function findOneByOption(string $option, $value): ?Page
{
$iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);
/** @var Page $page */
foreach ($iterator as $page) {
if ($page->getOption($option) == $value) {
return $pag... | php | {
"resource": ""
} |
q264468 | NavigationContainer.findByOption | test | public function findByOption(string $option, $value): array
{
$result = [];
$iterator = new \RecursiveIteratorIterator($this, \RecursiveIteratorIterator::SELF_FIRST);
/** @var Page $page */
foreach ($iterator as $page) {
if ($page->getOption($option) == $value) {
... | php | {
"resource": ""
} |
q264469 | ServiceProvider.register | test | public function register($binding)
{
if ( ! extension_loaded('wxwidgets')) {
if ( ! @dl('wxwidgets.'.PHP_SHLIB_SUFFIX)) {
echo 'wxWidgets extension not installed or dynamically loaded extensions are not enabled'.PHP_EOL;
exit(1);
}
}
s... | php | {
"resource": ""
} |
q264470 | ServiceProvider.registerViewParser | test | protected function registerViewParser()
{
$this->container->bind('view.viewparser', function() {
return new ViewParser(
$this->container['giml.reader'],
$this->container['giml.collection'],
new NamespaceElementFactory('Encore\Wx\Element')
... | php | {
"resource": ""
} |
q264471 | ServiceProvider.registerLauncher | test | protected function registerLauncher()
{
$this->container->bind('launcher', function() {
wxInitAllImageHandlers();
\wxApp::SetInstance($this->container['wx']);
wxEntry();
});
} | php | {
"resource": ""
} |
q264472 | DatabaseDriver.driver | test | protected function driver($name, $data = array())
{
if (in_array($name, $this->mysql) === true) {
$dsn = (string) 'mysql:host=%s;dbname=%s';
$dsn = sprintf($dsn, $data['hostname'], $data['database']);
$pdo = new \PDO($dsn, $data['username'], $data['password']);
... | php | {
"resource": ""
} |
q264473 | AbstractValidator.getInvalidResult | test | protected function getInvalidResult(string $code, array $parameters = null): ResultInterface
{
$templates = $this->getTemplates();
if (array_key_exists($code, $templates) === false) {
throw new TemplateNotFound($code);
}
return new InvalidResult($code, $templates[$code],... | php | {
"resource": ""
} |
q264474 | Profiler.start | test | public static function start($name = "default")
{
if(array_key_exists($name, self::$timers))
{
self::$timers[$name]->start();
}
else
{
self::$timers[$name] = new Profiler\Timer($name);
}
} | php | {
"resource": ""
} |
q264475 | Signal.subscribe | test | public function subscribe($signal, $callback)
{
if(empty($this->sigslots[$signal]))
{
$this->sigslots[$signal] = array();
}
$index = md5(serialize($callback));
if(!array_key_exists($index, $this->sigslots[$signal]))
{
$this->sigslots[$signal][$index] = new Signal\Handl... | php | {
"resource": ""
} |
q264476 | Signal.unsubscribe | test | public function unsubscribe($signal, $callback = null)
{
if(!$this->hasHandlers($signal))
{
return;
}
if($callback !== null)
{
$index = md5(serialize($callback));
if(!array_key_exists($index, $this->sigslots[$signal]))
{
return;
}
unse... | php | {
"resource": ""
} |
q264477 | BaseActionsInfoWidget.getValue | test | protected function getValue($value, $type)
{
switch ($type) {
case self::ATTRIBUTE_TYPE_USER:
return $this->getUsername($value);
case self::ATTRIBUTE_TYPE_DATE:
return date('Y-m-d h:i:s', $value);
default:
return $value;
... | php | {
"resource": ""
} |
q264478 | MySQLDriver.keys | test | protected function keys($row, Column $column)
{
switch ($row->Key) {
case 'PRI':
$column->setPrimary(true);
break;
case 'MUL':
$column->setForeign(true);
break;
case 'UNI':
$co... | php | {
"resource": ""
} |
q264479 | MySQLDriver.query | test | protected function query($table, $query, $columns = array())
{
$result = $this->pdo->prepare($query);
$result->execute();
$result->setFetchMode(\PDO::FETCH_OBJ);
while ($row = $result->fetch()) {
$column = $this->column(new Column, $table, $row);
array_pus... | php | {
"resource": ""
} |
q264480 | MySQLDriver.properties | test | protected function properties($row, Column $column)
{
$increment = $row->Extra === 'auto_increment';
$column->setAutoIncrement($increment);
$column->setNull($row->{'Null'} === 'YES');
return $column;
} | php | {
"resource": ""
} |
q264481 | MySQLDriver.strip | test | protected function strip($table)
{
$exists = strpos($table, '.') !== false;
$updated = substr($table, strpos($table, '.') + 1);
return $exists ? $updated : $table;
} | php | {
"resource": ""
} |
q264482 | Host.serverSelect | test | public function serverSelect($sid, $virtual = null)
{
if($this->whoami !== null && $this->serverSelectedId() == $sid) return;
$virtual = ($virtual !== null) ? $virtual : $this->start_offline_virtual;
$getargs = func_get_args();
$this->execute("use", array("sid" => $sid, $virtual ? "-virtual" ... | php | {
"resource": ""
} |
q264483 | Host.serverSelectByPort | test | public function serverSelectByPort($port, $virtual = null)
{
if($this->whoami !== null && $this->serverSelectedPort() == $port) return;
$virtual = ($virtual !== null) ? $virtual : $this->start_offline_virtual;
$getargs = func_get_args();
$this->execute("use", array("port" => $port, $virtual ?... | php | {
"resource": ""
} |
q264484 | Host.serverGetPortById | test | public function serverGetPortById($sid)
{
if(!array_key_exists((string) $sid, $this->serverList()))
{
throw new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\ServerQuery\Exception("invalid serverID", 0x400);
}
return $this->serverList[intval((string) $sid)]["virtualserver_port"... | php | {
"resource": ""
} |
q264485 | Host.serverGetByName | test | public function serverGetByName($name)
{
foreach($this->serverList() as $server)
{
if($server["virtualserver_name"] == $name) return $server;
}
throw new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\ServerQuery\Exception("invalid serverID", 0x400);
} | php | {
"resource": ""
} |
q264486 | Host.serverGetByUid | test | public function serverGetByUid($uid)
{
foreach($this->serverList() as $server)
{
if($server["virtualserver_unique_identifier"] == $uid) return $server;
}
throw new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\ServerQuery\Exception("invalid serverID", 0x400);
} | php | {
"resource": ""
} |
q264487 | Host.serverCreate | test | public function serverCreate(array $properties = array())
{
$this->serverListReset();
$detail = $this->execute("servercreate", $properties)->toList();
$server = new Server($this, array("virtualserver_id" => intval($detail["sid"])));
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signa... | php | {
"resource": ""
} |
q264488 | Host.serverDelete | test | public function serverDelete($sid)
{
$this->serverListReset();
$this->execute("serverdelete", array("sid" => $sid));
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit("notifyServerdeleted", $this, $sid);
} | php | {
"resource": ""
} |
q264489 | Host.serverStart | test | public function serverStart($sid)
{
if($sid == $this->serverSelectedId())
{
$this->serverDeselect();
}
$this->execute("serverstart", array("sid" => $sid));
$this->serverListReset();
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit("notifyServ... | php | {
"resource": ""
} |
q264490 | Host.serverStopProcess | test | public function serverStopProcess()
{
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit("notifyServershutdown", $this);
$this->execute("serverprocessstop");
} | php | {
"resource": ""
} |
q264491 | Host.permissionList | test | public function permissionList()
{
if($this->permissionList === null)
{
$this->permissionList = $this->request("permissionlist")->toAssocArray("permname");
}
return $this->permissionList;
} | php | {
"resource": ""
} |
q264492 | Host.permissionFind | test | public function permissionFind($permid)
{
$permident = (is_numeric($permid)) ? "permid" : "permsid";
return $this->execute("permfind", array($permident => $permid))->toArray();
} | php | {
"resource": ""
} |
q264493 | Host.permissionGetIdByName | test | public function permissionGetIdByName($name)
{
if(!array_key_exists((string) $name, $this->permissionList()))
{
throw new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\ServerQuery\Exception("invalid permission ID", 0xA02);
}
return $this->permissionList[(string) $name]["permid"... | php | {
"resource": ""
} |
q264494 | Host.permissionGetNameById | test | public function permissionGetNameById($permid)
{
foreach($this->permissionList() as $name => $perm)
{
if($perm["permid"] == $permid) return new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String($name);
}
throw new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\Server... | php | {
"resource": ""
} |
q264495 | Host.permissionGetCategoryById | test | public function permissionGetCategoryById($permid)
{
if(!is_numeric($permid))
{
$permid = $this->permissionGetIdByName($permid);
}
return (int) $permid >> 8;
} | php | {
"resource": ""
} |
q264496 | Host.selfPermCheck | test | public function selfPermCheck($permid)
{
$permident = (is_numeric($permid)) ? "permid" : "permsid";
return $this->execute("permget", array($permident => $permid))->toAssocArray("permsid");
} | php | {
"resource": ""
} |
q264497 | Host.logAdd | test | public function logAdd($logmsg, $loglevel = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::LOGLEVEL_INFO)
{
$sid = $this->serverSelectedId();
$this->serverDeselect();
$this->execute("logadd", array("logmsg" => $logmsg, "loglevel" => $loglevel));
$this->serverSelect($sid);
} | php | {
"resource": ""
} |
q264498 | Host.login | test | public function login($username, $password)
{
$this->execute("login", array("client_login_name" => $username, "client_login_password" => $password));
$this->whoamiReset();
$crypt = new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Crypt($username);
$this->setStorage("_login_user", $u... | php | {
"resource": ""
} |
q264499 | Host.logout | test | public function logout()
{
$this->request("logout");
$this->whoamiReset();
$this->delStorage("_login_user");
$this->delStorage("_login_pass");
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit("notifyLogout", $this);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.