_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
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
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) {
php
{ "resource": "" }
q264402
ObjectToArray.convert
test
public function convert($data) { if (is_object($data)) { $data = get_object_vars($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(); } } if ($this->collection) { $this->parents[$relationship] = clone $this; $this->add($relationship)->integer()->collection($collection)->update(false); if (!$relationship) { throw new SimplesRunTimeError("When extending one model you need give a name to relationship"); } }
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
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 import '{$name}' from '{$class}'"); } /** @var DataMapper $class */
php
{ "resource": "" }
q264406
NamespaceClassnameToPath.convert
test
public function convert($string) { $parts = []; foreach (explode('\\', trim($string, '\\')) as $name) {
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->resolveAndFire(array('job' => $this->job, 'data' => $this->data)); /** * Auto delete is implemented. * However, WTF is this AUTO DELETE ??? * None of laravel builtin Job class implements it,
php
{ "resource": "" }
q264408
MysqlJob.delete
test
public function delete() { $this->record['status'] = 'deleted'; DB::table($this->table)->where('ID', $this->id)->update([
php
{ "resource": "" }
q264409
ResetableEntityManager.getClassMetadata
test
public function getClassMetadata($className) { try{ return $this->entityManager->getClassMetadata($className); } catch(ORMException $e) {
php
{ "resource": "" }
q264410
ResetableEntityManager.flush
test
public function flush($entity = null) { try{ return $this->entityManager->flush($entity); } catch(ORMException $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) {
php
{ "resource": "" }
q264412
ResetableEntityManager.clear
test
public function clear($entityName = null) { try{ return $this->entityManager->clear($entityName);
php
{ "resource": "" }
q264413
ResetableEntityManager.remove
test
public function remove($entity) { try{ return $this->entityManager->remove($entity); } catch(ORMException $e) { if (!$this->entityManager->isOpen())
php
{ "resource": "" }
q264414
ResetableEntityManager.refresh
test
public function refresh($entity) { try{ return $this->entityManager->refresh($entity); } catch(ORMException $e) { if
php
{ "resource": "" }
q264415
ResetableEntityManager.getRepository
test
public function getRepository($entityName) { try{ return $this->entityManager->getRepository($entityName); } catch(ORMException $e) {
php
{ "resource": "" }
q264416
ResetableEntityManager.contains
test
public function contains($entity) { try{ return $this->entityManager->contains($entity); } catch(ORMException $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) {
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' => $schema, 'soap_version' => SOAP_1_2, )); $soapServer->setObject($xcdrRequest); try { ob_start(); $soapServer->handle(); } catch (\Exception $e) { return array(
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($value) && array_key_exists($key, $local) && array_key_exists($key, $remote)) { $merged[$key] = $this->performMerge( $value, $local[$key], $remote[$key] ); } else { if (array_key_exists($key, $local) && array_key_exists($key, $remote)) { $merged[$key] = $this->merge( $ancestor[$key], $local[$key], $remote[$key], $key
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 ? explode(PHP_EOL, $z) : array($z)); // Count number of lines in value or elements in new formed array. $count_ancestor = count($ancestor); $count_remote = count($remote); $count_local = count($local); // If number of lines is different in all 3 values. // For example : addition in remote and removal in local node. // // Else get the value of number of lines in updated node. // For example : Addition of 2 lines in local. // Suppose: $count_ancestor = 2 and $count_remote = 2 // then, $count_local would be 4 now. if ($count_ancestor != $count_local && $count_local!= $count_remote && $count_ancestor != $count_remote ) { $merged = $this->linesAddedRemovedAndModified( $ancestor, $local, $remote, $count_ancestor, $count_local, $count_remote ); } else { // Store the updated count value in a variable $count. if ($count_ancestor == $count_local) { $count = $count_remote; } else { $count = $count_local; } // If $count > $count_ancestor, that means lines
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 // and make sure only one of them has been edited. // Otherwise, throw an Exception. foreach ($ancestor as $key => $value) { $counter = $counter + 1; if ($ancestor[$key] == $local[$key]) { $merged[$key] = $remote[$key]; } elseif ($ancestor[$key] == $remote[$key] || $local[$key] == $remote[$key]) { $merged[$key] = $local[$key]; } else { throw new ConflictException("A conflict has occured"); } } // Once done with ancestor lines, we have hunk of // lines added. We will add them as they are. // If the lines are added in both remote and local, //
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); $mincount = min($count_local, $count_ancestor, $count_remote); // First for loop compares all 3 nodes and returns updated node. for ($key = 0; $key < $mincount; $key++) { if ($ancestor[$key] == $local[$key]) { $merged[$key] = $remote[$key]; } elseif ($ancestor[$key] == $remote[$key] || $local[$key] == $remote[$key]) { $merged[$key] = $local[$key]; } else { throw new ConflictException("A conflict has occured"); } }
php
{ "resource": "" }
q264423
XcdrRequest.NotifyXcdrRecord
test
public function NotifyXcdrRecord($msgHeader, $format, $type, $cdr) { $this->msgHeader = $msgHeader; $this->registrationID = $msgHeader->registrationID; $this->transactionID = $msgHeader->transactionID;
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['wp_query'] = $container->factory( function() { return isset( $GLOBALS['wp_query'] ) ? $GLOBALS['wp_query'] : null; } ); $container['wp_rewrite'] = $container->factory( function() { return isset( $GLOBALS['wp_rewrite'] ) ? $GLOBALS['wp_rewrite'] : null; } ); $container['wp_filesystem'] = $container->factory( function() { if ( ! function_exists( 'WP_Filesystem' )
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]; } } if (isset($options[self::CONFIG_KEY_REQUIRED])) { if ($options[self::CONFIG_KEY_REQUIRED]) { \Dotenv::required($app['env.options']['prefix'].'_'.strtoupper($varName)); } } if (isset($options[self::CONFIG_KEY_ALLOWED])) { \Dotenv::required( $app['env.options']['prefix'].'_'.strtoupper($varName), $options[self::CONFIG_KEY_ALLOWED] ); } if (isset($options[self::CONFIG_KEY_CAST])) { switch ($options[self::CONFIG_KEY_CAST]) { case
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_error( 'array_filter_key() expects parameter 1 to be array, '.gettype($input).' given', E_USER_WARNING ); return null; } if (empty($input)) { return $input; } $filteredKeys = array_filter(array_keys($input), $callback); if (empty($filteredKeys)) { return array(); } $input = array_intersect_key(array_flip($filteredKeys), $input); return $input;
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');
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,
php
{ "resource": "" }
q264429
XcdrClient.requestXcdrSetAttribute
test
private function requestXcdrSetAttribute($result, $schema) { $msgHeader = $result['msgHeader']; $soapObjectXML = '<format>DETAIL</format> <msgHeader> <transactionID>' . $msgHeader->transactionID . '</transactionID> <registrationID>' . $msgHeader->registrationID . '</registrationID> </msgHeader>' ; $soapXML = new \SoapVar($soapObjectXML, XSD_ANYXML, null, null, null, $schema); try { $result = $this->soapClient->RequestXcdrSetAttribute($soapXML); } catch (SoapTimeoutException $e) { return array( 'status' => 'error', 'type' => 'soap_fault', 'message' => 'XCDR Soap Client Timeout. ' . $e->getMessage(), 'class' => get_class($this) ); } catch (\Exception $e) { return array( 'status'
php
{ "resource": "" }
q264430
StringToCamelCase.convert
test
public function convert($string, $delimiter = '_') { $func = create_function('$c', 'return strtoupper($c[1]);');
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($relationship, $create->get($parent->getPrimaryKey())); $record->import($create->all()); } $action = coalesce($alias, Action::CREATE); if (!$this->before($action, $record)) { throw new SimplesHookError(get_class($this), $action, 'before'); }
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($this), $action, 'before'); } $filters = []; $values = []; if (!$record->isEmpty()) { $filters = $this->parseFilterFields($record->all()); $values = $this->parseFilterValues($filters); } if ($this->destroyKeys) { $filters[] = $this->getDestroyFilter($this->destroyKeys['at'], $trash); } $fields = $this->getActionFields(Action::READ, false); if ($clean) { $fields = $this->clear($fields); } $order = is_array($this->order) ? $this->order : [$this->order]; $where = off($this->getClauses(), 'where', []); if ($where) { $filters = array_merge($filters, $where); $values = array_merge($values, off($this->getClauses(), 'values', [])); }
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()); } $action = coalesce($alias, Action::UPDATE); $previous = $this->previous($record, $this->hashKey, $trash); if ($previous->isEmpty()) { throw new SimplesResourceError([$this->getHashKey() => $record->get($this->getHashKey())]); } if (!$this->before($action, $record, $previous)) { throw new SimplesHookError(get_class($this), $action, 'before'); }
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($alias, Action::DESTROY); $previous = $this->previous($record, $this->hashKey); if ($previous->isEmpty()) { throw new SimplesResourceError([$this->getHashKey() => $record->get($this->getHashKey())]); } if (!$this->before($action, $record, $previous)) { throw new SimplesHookError(get_class($this), $action, 'before'); } $filter = new Filter($this->get($this->getPrimaryKey()), $record->get($this->getPrimaryKey())); $filters = [$filter]; if ($this->destroyKeys) { $fields = []; $values = []; foreach ($this->destroyKeys as $type => $deletedKey) { $fields[] = $deletedKey; $values[] = $this->getTimestampValue($type); } $removed = $this
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`" );
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)]; $this->reset(); $count = $this ->fields($fields) ->limit(null) ->read($record, null, false)
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 ]
php
{ "resource": "" }
q264438
Log.close
test
public function close():Log{ if(!empty($this->logOutputInterfaces)){ foreach($this->logOutputInterfaces
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);
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
php
{ "resource": "" }
q264441
Plugin.onXmlRpcEliteBeginTurn
test
function onXmlRpcEliteBeginTurn($content) { $this->postTwitterMessage(sprintf("Turn #%d: %s attack", $content->TurnNumber,
php
{ "resource": "" }
q264442
TaskBarIcon.addChild
test
public function addChild(ElementInterface $child) { if ($child instanceof Menu) {
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) {
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'));
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')); } $input = $request->all(); $permission = $this->permissionRepository->update([ 'name' => $input['name'], ], $id); $roles = []; if (!empty($input['roles'])) {
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'));
php
{ "resource": "" }
q264447
AbstractTransport.setAdapter
test
public function setAdapter(\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\AbstractAdapter
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));
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) {
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);
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);
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;
php
{ "resource": "" }
q264453
Validate.asObject
test
public static function asObject($data, $default = null) { $json = is_string($data) ?
php
{ "resource": "" }
q264454
Validate.asJson
test
public static function asJson($data, $default = null) { $json = is_string($data) ? $data : json_encode($data);
php
{ "resource": "" }
q264455
Validate.asString
test
public static function asString($data, $default = null) { $string = filter_var( $data ?? [], FILTER_SANITIZE_STRING,
php
{ "resource": "" }
q264456
Validate.asInteger
test
public static function asInteger($data, $default = null) { $int
php
{ "resource": "" }
q264457
Validate.asFloat
test
public static function asFloat($data, $default = null) { $float = filter_var($data ?? '', FILTER_VALIDATE_FLOAT);
php
{ "resource": "" }
q264458
Validate.asBoolean
test
public static function asBoolean($data, $default = null) { $boolean = filter_var($data
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); $visiblePropertyMap = []; $hiddenPropertyMap = []; foreach ($this->findAllInstanceProperties($originalClass) as $property) { $declaringClassName = $property->getDeclaringClass()->getName(); if ($property->isPrivate() || $property->isProtected()) { $hiddenPropertyMap[$declaringClassName][] = $property->getName(); } else { $visiblePropertyMap[] = $property->getName(); }
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_filter(
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 in the hydrate() and extract() methods. foreach ($hiddenPropertyMap as $className => $propertyNames) { // Hydrate closures $content[] = "\$this->hydrateCallbacks[] = \\Closure::bind(function (\$object, \$values) {"; foreach ($propertyNames as $propertyName) { $content[] = " if (isset(\$values['" . $propertyName . "']) || \$object->" . $propertyName . " !== null && \\array_key_exists('" . $propertyName . "', \$values)) {"; $content[] = " \$object->" . $propertyName . " = \$values['" . $propertyName . "'];"; $content[] = " }"; } $content[] = '}, null, ' . \var_export($className, true) . ');' . "\n"; // Extract closures
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('" . $propertyName . "', \$data)) {"; $content[] = " \$object->" . $propertyName . " = \$data['" . $propertyName . "'];"; $content[] = "}"; } $index = 0; foreach ($hiddenPropertyMap as
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); $writer = new ApplicationConfigWriter(['filename' => $fileName]); $config = self::rebuldConfig($installed);
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, Json::encode($data, JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)
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) {
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) {
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) {
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) {
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); } } switch ($binding) { case 'view.viewparser': $this->registerViewParser(); break; case 'wx': $this->registerWx(); break; case 'launcher': $this->registerLauncher(); break; case 'giml.collection':
php
{ "resource": "" }
q264470
ServiceProvider.registerViewParser
test
protected function registerViewParser() { $this->container->bind('view.viewparser', function() { return new ViewParser(
php
{ "resource": "" }
q264471
ServiceProvider.registerLauncher
test
protected function registerLauncher() { $this->container->bind('launcher', function() { wxInitAllImageHandlers();
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']); return new MySQLDriver($pdo, (string) $data['database']); }
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) {
php
{ "resource": "" }
q264474
Profiler.start
test
public static function start($name = "default") { if(array_key_exists($name, self::$timers)) { self::$timers[$name]->start(); }
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])) {
php
{ "resource": "" }
q264476
Signal.unsubscribe
test
public function unsubscribe($signal, $callback = null) { if(!$this->hasHandlers($signal)) { return; } if($callback !== null) { $index = md5(serialize($callback));
php
{ "resource": "" }
q264477
BaseActionsInfoWidget.getValue
test
protected function getValue($value, $type) { switch ($type) { case self::ATTRIBUTE_TYPE_USER: return
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;
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_push($columns, $column);
php
{ "resource": "" }
q264480
MySQLDriver.properties
test
protected function properties($row, Column $column) { $increment = $row->Extra === 'auto_increment'; $column->setAutoIncrement($increment);
php
{ "resource": "" }
q264481
MySQLDriver.strip
test
protected function strip($table) { $exists = strpos($table, '.') !== false;
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" : null)); if($sid != 0 && $this->predefined_query_name !== null) { $this->execute("clientupdate", array("client_nickname" => (string) $this->predefined_query_name));
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 ? "-virtual" : null)); if($port != 0 && $this->predefined_query_name !== null) { $this->execute("clientupdate", array("client_nickname" => (string) $this->predefined_query_name));
php
{ "resource": "" }
q264484
Host.serverGetPortById
test
public function serverGetPortById($sid) { if(!array_key_exists((string) $sid, $this->serverList())) { throw new
php
{ "resource": "" }
q264485
Host.serverGetByName
test
public function serverGetByName($name) { foreach($this->serverList() as $server) { if($server["virtualserver_name"] ==
php
{ "resource": "" }
q264486
Host.serverGetByUid
test
public function serverGetByUid($uid) { foreach($this->serverList() as $server) { if($server["virtualserver_unique_identifier"] ==
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\Signal::getInstance()->emit("notifyServercreated", $this,
php
{ "resource": "" }
q264488
Host.serverDelete
test
public function serverDelete($sid) { $this->serverListReset(); $this->execute("serverdelete",
php
{ "resource": "" }
q264489
Host.serverStart
test
public function serverStart($sid) { if($sid == $this->serverSelectedId()) { $this->serverDeselect(); } $this->execute("serverstart", array("sid" => $sid)); $this->serverListReset();
php
{ "resource": "" }
q264490
Host.serverStopProcess
test
public function serverStopProcess() { \ManiaLivePlugins\Standard\TeamSpeak\Team
php
{ "resource": "" }
q264491
Host.permissionList
test
public function permissionList() { if($this->permissionList === null) { $this->permissionList =
php
{ "resource": "" }
q264492
Host.permissionFind
test
public function permissionFind($permid) { $permident = (is_numeric($permid)) ? "permid" : "permsid";
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
php
{ "resource": "" }
q264494
Host.permissionGetNameById
test
public function permissionGetNameById($permid) { foreach($this->permissionList() as $name => $perm) { if($perm["permid"] == $permid) return
php
{ "resource": "" }
q264495
Host.permissionGetCategoryById
test
public function permissionGetCategoryById($permid) { if(!is_numeric($permid)) {
php
{ "resource": "" }
q264496
Host.selfPermCheck
test
public function selfPermCheck($permid) { $permident = (is_numeric($permid)) ? "permid" : "permsid";
php
{ "resource": "" }
q264497
Host.logAdd
test
public function logAdd($logmsg, $loglevel = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::LOGLEVEL_INFO) {
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", $username);
php
{ "resource": "" }
q264499
Host.logout
test
public function logout() { $this->request("logout"); $this->whoamiReset(); $this->delStorage("_login_user"); $this->delStorage("_login_pass");
php
{ "resource": "" }