_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q11800 | Where.getNextOperator | train | private function getNextOperator(string $column): ?string
{
reset($this->fragments['where']);
while (key($this->fragments['where']) !== $column) {
next($this->fragments['where']);
}
| php | {
"resource": ""
} |
q11801 | RedirectToRouteTrait.redirectToRoute | train | public function redirectToRoute(Response $response, $route, array $data = [], array $queryParams = [], $suffix = '')
{
$url = $this->router->pathFor($route, | php | {
"resource": ""
} |
q11802 | FactoryRegistry.getFactory | train | public function getFactory($name)
{
if (!isset($this->factories[$name])) {
throw new \RuntimeException(sprintf('No factory registered with name | php | {
"resource": ""
} |
q11803 | Smarty_Internal_Write_File.writeFile | train | public static function writeFile($_filepath, $_contents, Smarty $smarty)
{
$_error_reporting = error_reporting();
error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);
if ($smarty->_file_perms !== null) {
$old_umask = umask(0);
}
$_dirpath = dirname($_filepath);
// if subdirs, create dir structure
if ($_dirpath !== '.' && !file_exists($_dirpath)) {
mkdir($_dirpath, $smarty->_dir_perms === null ? 0777 : $smarty->_dir_perms, true);
}
// write to tmp file, then move to overt file lock race condition
$_tmp_file = $_dirpath . DS . str_replace(array('.', ','), '_', uniqid('wrt', true));
if (!file_put_contents($_tmp_file, $_contents)) {
error_reporting($_error_reporting);
throw new SmartyException("unable to write file {$_tmp_file}");
}
/*
* Windows' rename() fails if the destination exists,
* Linux' rename() properly handles the overwrite.
* Simply unlink()ing a file might cause other processes
* currently reading that file to fail, but linux' rename()
* seems to be smart enough to handle that for us.
*/
if (Smarty::$_IS_WINDOWS) {
// remove original | php | {
"resource": ""
} |
q11804 | DataGenerator.fake | train | public function fake(EntityInterface $entity, array $options = array())
{
if (!empty($options[self::OPTION_LOCALE])) {
$loc = $options[self::OPTION_LOCALE];
if (!is_string($loc) || !preg_match('#[a-z]{2,6}_[A-Z]{2,6}#', $loc)) {
throw new BadValueException(
'Given option "' . self::OPTION_LOCALE
. '" is not a valid string. Use "languageCode_countryCode", e.g. "de_DE" or "en_UK".'
);
}
$this->locale = $loc;
$this->faker = Factory::create($this->locale);
}
$attributes_to_exclude = array();
if (!empty($options[self::OPTION_EXCLUDED_FIELDS])) {
$excluded = $options[self::OPTION_EXCLUDED_FIELDS];
if (!is_array($excluded)) {
throw new BadValueException(
'Given option "' . self::OPTION_EXCLUDED_FIELDS
. '" is not an array. It should be an array of attribute_names.'
);
}
$attributes_to_exclude = $excluded;
| php | {
"resource": ""
} |
q11805 | DataGenerator.fakeData | train | public function fakeData(EntityTypeInterface $type, array $options = array())
{
$entity = $type->createEntity();
| php | {
"resource": ""
} |
q11806 | DataGenerator.createFakeEntity | train | public function createFakeEntity(
EntityTypeInterface $type,
array $options = array(),
EntityInterface $parent = null
) {
$options[self::OPTION_MARK_CLEAN] = | php | {
"resource": ""
} |
q11807 | DataGenerator.addText | train | protected function addText(EntityInterface $entity, AttributeInterface $attribute, array $options = array())
{
$min_length = $attribute->getOption('min_length');
$max_length = $attribute->getOption('max_length');
if ($this->shouldGuessByName($options)) {
$value = TextGuesser::guess($attribute->getName(), $this->faker);
}
if (!isset($value)) {
$value = $this->faker->words($this->faker->numberBetween(2, 10), true);
}
if ($min_length && ($len = mb_strlen($value)) < $min_length) {
$repeat = ceil(($min_length - $len) / $len);
| php | {
"resource": ""
} |
q11808 | DataGenerator.addTextList | train | protected function addTextList(
EntityInterface $entity,
AttributeInterface $attribute,
array $options = array()
) {
$values = array();
$number_of_values = $this->faker->numberBetween(1, 5);
for ($i = 0; $i < $number_of_values; $i++) {
$text = $this->faker->words($this->faker->numberBetween(1, 3), true);
if ($this->shouldGuessByName($options)) {
$closure = | php | {
"resource": ""
} |
q11809 | DataGenerator.addTextarea | train | protected function addTextarea(EntityInterface $entity, AttributeInterface $attribute, array $options = array())
{
$text = $this->faker->paragraphs($this->faker->numberBetween(1, 5));
| php | {
"resource": ""
} |
q11810 | DataGenerator.addInteger | train | protected function addInteger(EntityInterface $entity, AttributeInterface $attribute, array | php | {
"resource": ""
} |
q11811 | DataGenerator.addIntegerList | train | protected function addIntegerList(
EntityInterface $entity,
AttributeInterface $attribute,
array $options = array()
) {
$values = array();
$number_of_values = $this->faker->numberBetween(1, 5);
for ($i = 0; $i < $number_of_values; $i++) {
| php | {
"resource": ""
} |
q11812 | DataGenerator.addFloat | train | protected function addFloat(EntityInterface $entity, AttributeInterface $attribute, array | php | {
"resource": ""
} |
q11813 | DataGenerator.addUrl | train | protected function addUrl(EntityInterface $entity, AttributeInterface $attribute, array | php | {
"resource": ""
} |
q11814 | DataGenerator.addUuid | train | protected function addUuid(EntityInterface $entity, AttributeInterface $attribute, array | php | {
"resource": ""
} |
q11815 | DataGenerator.addChoice | train | protected function addChoice(EntityInterface $entity, AttributeInterface $attribute, array $options = array())
{
$allowed_values = $attribute->getOption('allowed_values');
| php | {
"resource": ""
} |
q11816 | DataGenerator.addKeyValue | train | protected function addKeyValue(EntityInterface $entity, AttributeInterface $attribute, array $options = array())
{
$values = array();
$number_of_values = $this->faker->numberBetween(1, | php | {
"resource": ""
} |
q11817 | DataGenerator.addKeyValueList | train | protected function addKeyValueList(
EntityInterface $entity,
AttributeInterface $attribute,
array $options = array()
) {
$collection = array();
$numberOfEntries = $this->faker->numberBetween(1, 5);
for ($i = 0; $i < $numberOfEntries; $i++) {
$number_of_values = $this->faker->numberBetween(1, 5);
| php | {
"resource": ""
} |
q11818 | DataGenerator.createComplexValue | train | protected function createComplexValue(AttributeInterface $attribute, array $options = array())
{
$values = array();
$value_holder = $attribute->createValueHolder();
$value_type = $value_holder->getValueType();
if (class_exists($value_type)
&& preg_grep('#ComplexValueInterface$#', class_implements($value_type))
) {
foreach ($value_type::getPropertyMap() as $property_name => $property_type) {
switch ($property_type) {
case ComplexValue::VALUE_TYPE_TEXT:
if ($this->shouldGuessByName($options)) {
$values[$property_name] = TextGuesser::guess($property_name, $this->faker);
}
if (empty($values[$property_name])) {
$values[$property_name] = $this->faker->words(3, true);
}
break;
case ComplexValue::VALUE_TYPE_URL:
$values[$property_name] = $this->faker->url;
break;
case ComplexValue::VALUE_TYPE_BOOLEAN:
$values[$property_name] = $this->faker->boolean();
break;
case ComplexValue::VALUE_TYPE_INTEGER:
$values[$property_name] = $this->faker->numberBetween(0, 10);
break;
case ComplexValue::VALUE_TYPE_FLOAT:
$values[$property_name] = $this->faker->randomFloat(5);
| php | {
"resource": ""
} |
q11819 | DataGenerator.addImage | train | protected function addImage(
EntityInterface $entity,
AttributeInterface $attribute,
array $options = array()
) {
$image | php | {
"resource": ""
} |
q11820 | DataGenerator.addImageList | train | protected function addImageList(
EntityInterface $entity,
AttributeInterface $attribute,
array $options = array()
) {
$collection = array();
$min_count = $attribute->getOption('min_count', 0);
$max_count = $attribute->getOption('max_count', 3);
$numberOfEntries = $this->faker->numberBetween($min_count, $max_count);
$image_attribute = new ImageAttribute('someimage', $entity->getType());
// | php | {
"resource": ""
} |
q11821 | DataGenerator.addBoolean | train | protected function addBoolean(EntityInterface $entity, AttributeInterface $attribute, array | php | {
"resource": ""
} |
q11822 | DataGenerator.addEmbeddedEntityList | train | protected function addEmbeddedEntityList(
EntityInterface $entity,
EmbeddedEntityListAttribute $attribute,
array $options = array()
) {
$options_clone = $options;
$entity_collection = new EntityList();
$embedded_type_map = $attribute->getEmbeddedEntityTypeMap();
$min_count = $attribute->getOption('min_count', 0);
$max_count = $attribute->getOption('max_count', 3);
$inline_mode = $attribute->getOption('inline_mode', false);
if (true === $inline_mode) {
$number_of_new_embed_entries = 1;
} else {
$number_of_new_embed_entries = $this->faker->numberBetween($min_count, $max_count);
}
| php | {
"resource": ""
} |
q11823 | DataGenerator.addTimestamp | train | protected function addTimestamp(EntityInterface $entity, AttributeInterface $attribute, array $options = array())
{
$default_value = $attribute->getDefaultValue();
| php | {
"resource": ""
} |
q11824 | DataGenerator.addGeoPoint | train | protected function addGeoPoint(EntityInterface $entity, AttributeInterface $attribute, array $options = array())
{
$geopoint | php | {
"resource": ""
} |
q11825 | DataGenerator.addToken | train | protected function addToken(EntityInterface $entity, AttributeInterface $attribute, array $options = array())
{
$min_length = $attribute->getOption('min_length', 1);
$max_length = $attribute->getOption('max_length', 40);
$size = $this->faker->numberBetween($min_length, $max_length);
| php | {
"resource": ""
} |
q11826 | DataGenerator.setValue | train | protected function setValue(
EntityInterface $entity,
AttributeInterface $attribute,
$default_value,
array $options = array()
) {
$attribute_name = $attribute->getName();
$attribute_options = array();
if (!empty($options[self::OPTION_FIELD_VALUES])
&& is_array($options[self::OPTION_FIELD_VALUES])
) {
$attribute_options = $options[self::OPTION_FIELD_VALUES];
}
if (empty($attribute_options[$attribute_name])) {
$entity->setValue($attribute_name, $default_value);
} else {
| php | {
"resource": ""
} |
q11827 | DataGenerator.shouldGuessByName | train | protected function shouldGuessByName(array $options = array())
{
if (array_key_exists(self::OPTION_GUESS_PROVIDER_BY_NAME, $options) | php | {
"resource": ""
} |
q11828 | GamecurrencyTableMap.doDelete | train | public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(GamecurrencyTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = $values;
} elseif ($values instanceof \eXpansion\Framework\GameCurrencyBundle\Model\Gamecurrency) { // it's a model object
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(GamecurrencyTableMap::DATABASE_NAME);
$criteria->add(GamecurrencyTableMap::COL_ID, (array) $values, Criteria::IN);
| php | {
"resource": ""
} |
q11829 | Client.setErrorCallback | train | protected function setErrorCallback(ConnectionInterface $connection, callable $callback)
{
$connection->setErrorCallback(function ($connection, $exception) use ($callback) {
| php | {
"resource": ""
} |
q11830 | Client.wrapCallback | train | protected function wrapCallback(callable $callback)
{
return function ($response, $connection, $command) use ($callback) {
if ($command && !$response instanceof ResponseInterface) {
| php | {
"resource": ""
} |
q11831 | UploadComponent._setStorageTimeUpload | train | protected function _setStorageTimeUpload($time = null) {
$time = (int)$time;
if ($time | php | {
"resource": ""
} |
q11832 | UploadComponent._setUploadDir | train | protected function _setUploadDir($path = null) {
$path = (string)$path;
| php | {
"resource": ""
} |
q11833 | UploadComponent._clearDir | train | protected function _clearDir($timeNow = null) {
$clearPath = $this->getUploadDir();
$storageTime = $this->_getStorageTimeUpload();
$result = true;
$oFolder = new Folder($clearPath, true);
$uploadedFiles = $oFolder->find('.*', false);
if (empty($uploadedFiles)) {
return $result;
}
if (!empty($timeNow)) {
$timeNow = (int)$timeNow;
} else {
$timeNow = time();
}
$uploadedFilesPath = $oFolder->pwd();
foreach ($uploadedFiles as $uploadedFile) {
| php | {
"resource": ""
} |
q11834 | UploadComponent.upload | train | public function upload($maxFileSize = null, $acceptFileTypes = null) {
Configure::write('debug', 0);
if (!$this->_controller->request->is('ajax') || !$this->_controller->RequestHandler->prefers('json')) {
throw new BadRequestException(__d('view_extension', 'Invalid request'));
}
$uploadDir = $this->getUploadDir();
if (empty($acceptFileTypes)) {
$acceptFileTypes = '/.+$/i';
}
$opt = [
'script_url' => '',
'upload_url' => '',
'param_name' => 'files',
'upload_dir' => $uploadDir,
'max_file_size' => $maxFileSize,
'image_versions' => [
'' => ['auto_orient' => false]
], | php | {
"resource": ""
} |
q11835 | ImageDownloadCommand.saveImageContents | train | private function saveImageContents(Image $client, SourceImage $image, $saveTo, OutputInterface $output, $stackName = null, $format = 'jpg')
{
if (!$stackName) {
$output->writeln('Getting source image contents for <info>'.$image->hash.'</info> from <comment>'.$image->organization.'</comment>');
} else {
$output->writeln('Rendering image <info>'.$image->hash.'</info> from <comment>'.$image->organization.'</comment> on stack <info>'.$stackName.'</info>');
}
$contents = $this->rokkaHelper->getSourceImageContents($client, $image->hash, $image->organization, $stackName, $format);
| php | {
"resource": ""
} |
q11836 | RecordQuery.filterByNbfinish | train | public function filterByNbfinish($nbfinish = null, $comparison = null)
{
if (is_array($nbfinish)) {
$useMinMax = false;
if (isset($nbfinish['min'])) {
$this->addUsingAlias(RecordTableMap::COL_NBFINISH, $nbfinish['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($nbfinish['max'])) {
$this->addUsingAlias(RecordTableMap::COL_NBFINISH, $nbfinish['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
| php | {
"resource": ""
} |
q11837 | RecordQuery.filterByAvgscore | train | public function filterByAvgscore($avgscore = null, $comparison = null)
{
if (is_array($avgscore)) {
$useMinMax = false;
if (isset($avgscore['min'])) {
$this->addUsingAlias(RecordTableMap::COL_AVGSCORE, $avgscore['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($avgscore['max'])) {
$this->addUsingAlias(RecordTableMap::COL_AVGSCORE, $avgscore['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
| php | {
"resource": ""
} |
q11838 | RecordQuery.filterByCheckpoints | train | public function filterByCheckpoints($checkpoints = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($checkpoints)) {
$comparison = Criteria::IN;
}
| php | {
"resource": ""
} |
q11839 | RecordQuery.filterByPlayerId | train | public function filterByPlayerId($playerId = null, $comparison = null)
{
if (is_array($playerId)) {
$useMinMax = false;
if (isset($playerId['min'])) {
$this->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $playerId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($playerId['max'])) {
$this->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $playerId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
| php | {
"resource": ""
} |
q11840 | RecordQuery.filterByPlayer | train | public function filterByPlayer($player, $comparison = null)
{
if ($player instanceof \eXpansion\Framework\PlayersBundle\Model\Player) {
return $this
->addUsingAlias(RecordTableMap::COL_PLAYER_ID, $player->getId(), $comparison);
} elseif ($player instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
| php | {
"resource": ""
} |
q11841 | RecordQuery.usePlayerQuery | train | public function usePlayerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinPlayer($relationAlias, $joinType)
| php | {
"resource": ""
} |
q11842 | ScriptVariableUpdateFactory.updateValue | train | public function updateValue($group, $variableCode, $newValue)
{
$variable = clone $this->getVariable($variableCode);
$variable->setValue($newValue);
if (!isset($this->queuedForUpdate[$group->getName()])) {
$this->queuedForUpdate[$group->getName()]['time'] = microtime(true);
}
$checkVariable = clone $this->checkVariable;
$uniqueId = uniqid('exp_', true);
| php | {
"resource": ""
} |
q11843 | ScriptVariableUpdateFactory.getScriptInitialization | train | public function getScriptInitialization($defaultValues = false)
{
$scriptContent = '';
foreach ($this->variables as $variable) {
$scriptContent .= $variable->getScriptDeclaration()."\n";
if ($defaultValues) {
$scriptContent .= $variable->getScriptValueSet()."\n";
}
}
$scriptContent .= $this->checkVariable->getScriptDeclaration()."\n";
$scriptContent .= $this->checkOldVariable->getScriptDeclaration()."\n";
$scriptContent .= $this->checkWindow->getScriptDeclaration()."\n";
$scriptContent .= "declare check_original = ".$this->checkWindow->getInitialValue().";\n"; | php | {
"resource": ""
} |
q11844 | Listeners.register | train | public function register(ListenerInterface $listener, EventEmitter $target = null)
{
$EElisteners = array();
if (null !== $target) {
$EElisteners = $this->forwardEvents($listener, $target, | php | {
"resource": ""
} |
q11845 | Listeners.unregister | train | public function unregister(ListenerInterface $listener)
{
if (!isset($this->storage[$listener])) {
throw new InvalidArgumentException('Listener is not registered.');
}
foreach ($this->storage[$listener] as $event => $EElistener) {
| php | {
"resource": ""
} |
q11846 | ThemeComponent._setLayout | train | protected function _setLayout(Controller &$controller) {
if ($controller->name == 'CakeError') {
$controller->layout = 'CakeTheme.error';
return;
}
$isAjax = $controller->request->is('ajax');
$isPjax = $controller->request->is('pjax');
$isHtml = $this->_controller->ViewExtension->isHtml();
if ($isPjax) {
$controller->layout = 'CakeTheme.pjax';
} | php | {
"resource": ""
} |
q11847 | ThemeComponent._setConfigVar | train | protected function _setConfigVar(Controller &$controller) {
$additionalCssFiles = $this->_modelConfigTheme->getListCssFiles();
$additionalJsFiles = | php | {
"resource": ""
} |
q11848 | PlayerQuery.filterByLogin | train | public function filterByLogin($login = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($login)) {
$comparison = Criteria::IN;
}
| php | {
"resource": ""
} |
q11849 | PlayerQuery.filterByNickname | train | public function filterByNickname($nickname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($nickname)) {
$comparison = Criteria::IN;
}
| php | {
"resource": ""
} |
q11850 | PlayerQuery.filterByNicknameStripped | train | public function filterByNicknameStripped($nicknameStripped = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($nicknameStripped)) {
$comparison = Criteria::IN;
}
| php | {
"resource": ""
} |
q11851 | PlayerQuery.filterByPath | train | public function filterByPath($path = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($path)) {
$comparison = Criteria::IN;
}
| php | {
"resource": ""
} |
q11852 | PlayerQuery.filterByWins | train | public function filterByWins($wins = null, $comparison = null)
{
if (is_array($wins)) {
$useMinMax = false;
if (isset($wins['min'])) {
$this->addUsingAlias(PlayerTableMap::COL_WINS, $wins['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($wins['max'])) {
$this->addUsingAlias(PlayerTableMap::COL_WINS, $wins['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
| php | {
"resource": ""
} |
q11853 | PlayerQuery.filterByOnlineTime | train | public function filterByOnlineTime($onlineTime = null, $comparison = null)
{
if (is_array($onlineTime)) {
$useMinMax = false;
if (isset($onlineTime['min'])) {
$this->addUsingAlias(PlayerTableMap::COL_ONLINE_TIME, $onlineTime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($onlineTime['max'])) {
$this->addUsingAlias(PlayerTableMap::COL_ONLINE_TIME, $onlineTime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
| php | {
"resource": ""
} |
q11854 | PlayerQuery.filterByLastOnline | train | public function filterByLastOnline($lastOnline = null, $comparison = null)
{
if (is_array($lastOnline)) {
$useMinMax = false;
if (isset($lastOnline['min'])) {
$this->addUsingAlias(PlayerTableMap::COL_LAST_ONLINE, $lastOnline['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($lastOnline['max'])) {
$this->addUsingAlias(PlayerTableMap::COL_LAST_ONLINE, $lastOnline['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
| php | {
"resource": ""
} |
q11855 | PlayerQuery.filterByRecord | train | public function filterByRecord($record, $comparison = null)
{
if ($record instanceof \eXpansion\Bundle\LocalRecords\Model\Record) {
return $this
->addUsingAlias(PlayerTableMap::COL_ID, $record->getPlayerId(), $comparison);
} elseif ($record instanceof ObjectCollection) {
return $this
->useRecordQuery()
->filterByPrimaryKeys($record->getPrimaryKeys())
| php | {
"resource": ""
} |
q11856 | PlayerQuery.useRecordQuery | train | public function useRecordQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinRecord($relationAlias, $joinType)
| php | {
"resource": ""
} |
q11857 | View.draw | train | public function draw()
{
$file = Application::current()->getDirectory();
$file .= "views/{$this->templateName}.";
$file .= self::$extension;
if (!file_exists($file)) {
| php | {
"resource": ""
} |
q11858 | WebaccessUrl._bad | train | public function _bad($errstr, $isbad = true)
{
global $_web_access_retry_timeout;
$this->console->writeln($this->_webaccess_str.'$f00'.$errstr);
if ($this->_socket) {
@fclose($this->_socket);
}
$this->_socket = null;
if ($isbad) {
if (isset($this->_spool[0]['State'])) {
$this->_spool[0]['State'] = 'BAD';
}
$this->_state = 'BAD';
$this->_bad_time = time();
if ($this->_bad_timeout < $_web_access_retry_timeout) {
| php | {
"resource": ""
} |
q11859 | PdoConnection.rawQuery | train | public function rawQuery(string $sql, array $params=[]): array
{
$rows = [];
# Sanity check
if (empty($sql)) {
return $rows;
}
# Obtain transaction, unelss already in a transaction
$autoCommit = $this->beginTransaction();
# Prepare
if ($sth = $this->prepare($sql)) {
| php | {
"resource": ""
} |
q11860 | PdoConnection.rawExec | train | public function rawExec(string $sql, array $params=[]): bool
{
$result = false;
# Sanity check
if (empty($sql)) {
return $result;
}
# Obtain transaction, unelss already in a transaction
$autoCommit = $this->beginTransaction();
# Prepare
if ($sth = $this->prepare($sql)) {
# Binds
foreach ($params as $bind=>$value) {
$sth->bindValue( ':'.\ltrim($bind,':'), $value);
| php | {
"resource": ""
} |
q11861 | EventHandlerLocator.get | train | public function get($eventType)
{
$handlers = array_merge_recursive(
array_key_exists($eventType, $this->handlers) ? $this->handlers[$eventType] : [],
array_key_exists('*', $this->handlers) ? $this->handlers['*'] : []
);
krsort($handlers, SORT_NUMERIC);
| php | {
"resource": ""
} |
q11862 | Analytics.handshake | train | protected function handshake()
{
$key = &$this->key;
$lastPing = &$this->lastPing;
$that = $this;
$logger = $this->logger;
$query = http_build_query(
['login' => $this->gameData->getSystemInfo()->serverLogin]
);
$url = $this->handshakeUrl . '?' . $query;
$lastPing = time();
$this->logger->debug("[eXpansion analytics]Starting handshake");
$this->http->put(
$url,
[],
function (HttpResult $result) use (&$key, &$lastPing, $logger, | php | {
"resource": ""
} |
q11863 | Analytics.ping | train | public function ping()
{
if (!$this->key || $this->operationInProgress || (time() - $this->lastPing) < $this->pingInterval) {
// Attempt a new handshake.
if (is_null($this->key) && (time() - $this->lastPing) > $this->retryInterval) {
$this->lastPing = time();
$this->handshake();
}
return;
}
$data = $this->getBasePingData();
$query = http_build_query(
$data
);
$url = $this->pingUrl . '?' . $query;
$this->operationInProgress = true;
| php | {
"resource": ""
} |
q11864 | Analytics.getBasePingData | train | protected function getBasePingData()
{
return [
'key' => $this->key,
'nbPlayers' => count($this->playerStorage->getOnline()),
'country' => $this->countries->getIsoAlpha2FromName($this->countries->parseCountryFromPath($this->gameData->getServerPath())),
'version' => Application::EXPANSION_VERSION,
'php_version' => $this->gameData->getServerCleanPhpVersion(),
'php_version_short' => $this->gameData->getServerMajorPhpVersion(),
'mysql_version' => 'unknown',
'memory' => memory_get_usage(),
'memory_peak' => memory_get_peak_usage(),
| php | {
"resource": ""
} |
q11865 | Datalist.render | train | public function render(array $data, array $attrs = array())
{
$output = array();
$attrs = array_merge(array('class' => 'uk-description-list-horizontal'), $attrs);
$attrs = $this->_mergeAttr($attrs, $this->_jbSrt('data-list'));
| php | {
"resource": ""
} |
q11866 | NotificationUpdater.getTranslations | train | private function getTranslations($string, $params)
{
$out = [];
$messages = $this->translationsHelper->getTranslations($string, $params);
foreach ($messages as $message) {
| php | {
"resource": ""
} |
q11867 | ThrowableProxy.toThrowable | train | public function toThrowable()
{
$class = $this->class;
$prev = $this->prev !== null ? | php | {
"resource": ""
} |
q11868 | ParovacFaktur.setStartDay | train | public function setStartDay($daysBack)
{
if (!is_null($daysBack)) {
$this->addStatusMessage('Start Date '.date('Y-m-d',
| php | {
"resource": ""
} |
q11869 | ParovacFaktur.getInvoicer | train | public function getInvoicer()
{
if (!is_object($this->invoicer)) {
$this->invoicer = | php | {
"resource": ""
} |
q11870 | ParovacFaktur.getPaymentsToProcess | train | public function getPaymentsToProcess($daysBack = 1, $direction = 'in')
{
$result = [];
$this->banker->defaultUrlParams['order'] = 'datVyst@A';
$payments = $this->banker->getColumnsFromFlexibee([
'id',
'kod',
'varSym',
'specSym',
'sumCelkem',
'buc',
'smerKod',
'mena',
'datVyst'],
["sparovano eq false AND typPohybuK eq '".(($direction == 'out') ? 'typPohybu.vydej'
: 'typPohybu.prijem' )."' AND storno eq false ".
| php | {
"resource": ""
} |
q11871 | ParovacFaktur.getCompanyForBUC | train | public function getCompanyForBUC($account, $bankCode = null)
{
$bucer = new \FlexiPeeHP\FlexiBeeRW(null,
['evidence' => 'adresar-bankovni-ucet']);
$companyRaw = $bucer->getColumnsFromFlexibee(['firma'],
| php | {
"resource": ""
} |
q11872 | ParovacFaktur.reorderInvoicesByAge | train | public static function reorderInvoicesByAge($invoices)
{
$invoicesByAge = [];
$invoicesByAgeRaw = [];
foreach ($invoices as $invoiceData) {
$invoicesByAgeRaw[\FlexiPeeHP\FlexiBeeRW::flexiDateToDateTime($invoiceData['datVyst'])->getTimestamp()]
= $invoiceData;
}
ksort($invoicesByAgeRaw); | php | {
"resource": ""
} |
q11873 | ParovacFaktur.getOriginDocumentType | train | public function getOriginDocumentType($typDokl)
{
if (empty($this->docTypes)) {
$this->docTypes = $this->getDocumentTypes();
}
$documentType | php | {
"resource": ""
} |
q11874 | MultipartFormDataParser.getFiles | train | public function getFiles() : array
{
$files = [];
if (!empty($_FILES)) {
foreach ($_FILES as $inputName => $phpFile) {
if (!is_array($phpFile['name'])) {
// When this was a single file
$files[$inputName] = $this->handleUniqueFile($phpFile);
} else {
//When the input has a | php | {
"resource": ""
} |
q11875 | MultipartFormDataParser.handleUniqueFile | train | protected function handleUniqueFile($file)
{
$uploadedFile = null;
//The current file was uploaded successfully?
if (!$file['error']) {
$uploadedFile = new UploadedFile(
$file['tmp_name'],
| php | {
"resource": ""
} |
q11876 | MultipartFormDataParser.handleMultipleFile | train | protected function handleMultipleFile($file) : array
{
$fileBag = [];
foreach ($file['name'] as $idx => $name) {
$uploadedFile = null;
//The current file was uploaded successfully?
if (!$file[$idx]['error']) {
$uploadedFile = new UploadedFile(
$file[$idx]['tmp_name'],
| php | {
"resource": ""
} |
q11877 | GridViewWidget.setupDefaultConfigs | train | private function setupDefaultConfigs()
{
$this->setLayout();
$this->setSummary();
if (!$this->isEmpty()) {
| php | {
"resource": ""
} |
q11878 | GridViewWidget.setLayout | train | private function setLayout()
{
$this->layout = Html::tag('div', "{items}", ['class' => 'table-responsive']) .
Html::tag(
'div',
Html::tag('div', "{summary}", ['class' => 'pagination-summary']) .
| php | {
"resource": ""
} |
q11879 | GridViewWidget.setActionBar | train | public function setActionBar()
{
if (is_null($this->actionButtonLabel) && is_null($this->actionButtonModalId)) {
return;
}
$this->getView()->params['content-header-button'] = [
'label' => $this->actionButtonLabel,
'options' => [
| php | {
"resource": ""
} |
q11880 | SummaryForm.getPaymentErrorMessage | train | public function getPaymentErrorMessage()
{
/** @var Payment $lastPayment */
// Get the last payment
if (!$lastPayment = $this->reservation->Payments()->first()) {
return false;
}
// Find the gateway error
$lastErrorMessage = null;
$errorMessages = $lastPayment->Messages()->exclude('Message', '')->sort('Created', 'DESC');
| php | {
"resource": ""
} |
q11881 | AbstractVotePlugin.start | train | public function start(Player $player, $params)
{
$this->currentVote = new Vote($player, $this->getCode(), | php | {
"resource": ""
} |
q11882 | AbstractVotePlugin.castYes | train | public function castYes($login)
{
if ($this->currentVote) {
$this->currentVote->castYes($login);
$player = $this->playerStorage->getPlayerInfo($login);
| php | {
"resource": ""
} |
q11883 | AbstractVotePlugin.update | train | public function update($time = null)
{
if (!$this->currentVote || $this->currentVote->getStatus() == Vote::STATUS_CANCEL) {
return;
}
if (is_null($time)) {
$time = time();
}
$playerCount = count($this->playerStorage->getOnline());
// Check if vote passes when we suppose that all palyers that didn't vote would vote NO.
if ($playerCount > 0 && ($this->currentVote->getYes() / $playerCount) > $this->ratio) {
$this->votePassed();
return;
}
// If the vote is still not decided wait for the end to decide.
| php | {
"resource": ""
} |
q11884 | SendPage.showForm | train | public function showForm()
{
$blockcenter = new XmlBlockCollection($this->_myWords->Value("MSGFILL"), BlockPosition::Center );
$this->_document->addXmlnukeObject($blockcenter);
$paragraph = new XmlParagraphCollection();
$blockcenter->addXmlnukeObject($paragraph);
$form = new XmlFormCollection($this->_context, "module:sendpage", $this->_myWords->Value("CAPTION"));
$paragraph->addXmlnukeObject($form);
$caption = new XmlInputCaption($this->_myWords->ValueArgs("INFO", array(urldecode($this->_link))));
$form->addXmlnukeObject($caption);
$hidden = new XmlInputHidden("action", "submit");
$form->addXmlnukeObject($hidden);
$hidden = new XmlInputHidden("link", $this->_link);
$form->addXmlnukeObject($hidden);
$textbox = new XmlInputTextBox($this->_myWords->Value("FLDNAME"), "fromname", "", 40);
$textbox->setRequired(true);
$form->addXmlnukeObject($textbox);
$textbox = new XmlInputTextBox($this->_myWords->Value("FLDEMAIL"), "frommail", "", 40);
$textbox->setDataType(INPUTTYPE::EMAIL );
$textbox->setRequired(true);
$form->addXmlnukeObject($textbox);
| php | {
"resource": ""
} |
q11885 | SendPage.goBack | train | public function goBack($showMessage)
{
$blockcenter = new XmlBlockCollection($this->_myWords->Value("MSGERROR"), BlockPosition::Center );
$this->_document->addXmlnukeObject($blockcenter);
$paragraph = new XmlParagraphCollection();
$blockcenter->addXmlnukeObject($paragraph);
$paragraph->addXmlnukeObject(new XmlnukeText($showMessage,true));
| php | {
"resource": ""
} |
q11886 | SendPage.showMessage | train | public function showMessage()
{
$blockcenter = new XmlBlockCollection($this->_myWords->Value("MSGOK"), BlockPosition::Center);
$this->_document->addXmlnukeObject($blockcenter);
$paragraph = | php | {
"resource": ""
} |
q11887 | Request.fillCurrentHeaders | train | private static function fillCurrentHeaders(self $request)
{
$headers = [];
//Native method exists?
if (function_exists('getallheaders')) {
//try to use it
if (($headers = getallheaders()) === false) {
$headers = [];
}
}
//No header captured yet? Try to get it myself
if (empty($headers)) {
/*
* Based on a user note provided by joyview
* at http://php.net/manual/en/function.getallheaders.php
| php | {
"resource": ""
} |
q11888 | Request.fillCurrentRouteString | train | private static function fillCurrentRouteString(self $request)
{
//Read data from $_SERVER array
$requestUri = urldecode($_SERVER['REQUEST_URI']);
$scriptName = $_SERVER['SCRIPT_NAME'];
//Extract route string from the URI
$length = strlen(dirname($scriptName));
$routeAux = substr(explode('?', $requestUri)[0], $length);
| php | {
"resource": ""
} |
q11889 | Request.selectDataParser | train | private function selectDataParser()
{
/* @var ContentTypeParser $selected */
$selected = null;
//Has content?
if (!empty($this->getContentType())) {
//Search trough the registered parsers
foreach (self::$registeredParsers as $parser) {
/* @var ContentTypeParser $parser */
if ($parser->canHandle($this->getContentType())) {
$selected = $parser;
| php | {
"resource": ""
} |
q11890 | ResourceFactory.create | train | public function create($resource)
{
$className = $this->getResourceClassName($resource->type);
if (!class_exists($className)) {
throw new Exception(
'Unknown resource type "' . $resource->type . '".',
Exception::UNKNOWN_RESOURCE_TYPE
);
}
/** @var AbstractResource $object */
$object = $this->objectManager->get($className);
foreach ($resource as $property => $value) {
| php | {
"resource": ""
} |
q11891 | Period.getPeriod | train | public function getPeriod($period, $mode = self::DAYS_ONLY)
{
$result = $this->parsePeriod($period);
if ($result['max'] && $mode == self::DAYS_AND_TIME) {
$result['max']->modify("+1 day -1 second");
}
foreach ($result as $key => $value) {
if (!$value) {
unset($result[$key]);
} elseif ($mode == self::DAYS_ONLY) {
$result[$key] = new | php | {
"resource": ""
} |
q11892 | Unoconv.transcode | train | public function transcode($input, $format, $outputFile, $pageRange = null)
{
if (!file_exists($input)) {
throw new InvalidFileArgumentException(sprintf('File %s does not exists', $input));
}
$arguments = array(
'--format=' . $format,
'--stdout'
);
if (preg_match('/\d+-\d+/', $pageRange)) {
$arguments[] = '-e';
$arguments[] = 'PageRange=' . $pageRange;
}
$arguments[] = $input;
try {
$output = $this->command($arguments);
} catch | php | {
"resource": ""
} |
q11893 | DependentBenGorUserBundle.checkDependencies | train | public function checkDependencies(array $requiredBundles, ContainerBuilder $container)
{
if (false === ($this instanceof Bundle)) {
throw new RuntimeException('It is a bundle trait, you shouldn\'t have to use in other instances');
}
$enabledBundles = $container->getParameter('kernel.bundles');
foreach ($requiredBundles as $requiredBundle) {
if (!isset($enabledBundles[$requiredBundle])) {
throw new RuntimeException(
sprintf(
| php | {
"resource": ""
} |
q11894 | Customer.loadFromFlexiBee | train | public function loadFromFlexiBee($id = null)
{
$result = $this->adresar->loadFromFlexiBee($id); | php | {
"resource": ""
} |
q11895 | Customer.getCustomerScore | train | public function getCustomerScore($addressID)
{
$score = 0;
$debts = $this->getCustomerDebts($addressID);
$stitkyRaw = $this->adresar->getColumnsFromFlexiBee(['stitky'],
['id' => $addressID]);
$stitky = $stitkyRaw[0]['stitky'];
if (!empty($debts)) {
foreach ($debts as $did => $debt) {
$ddiff = \FlexiPeeHP\FakturaVydana::overdueDays($debt['datSplat']);
if (($ddiff <= 7) && ($ddiff >= 1)) {
$score = self::maxScore($score, 1);
} else {
if (($ddiff > 7 ) && ($ddiff <= 14)) {
$score = self::maxScore($score, 2);
} else {
| php | {
"resource": ""
} |
q11896 | Customer.getUserEmail | train | public function getUserEmail()
{
return strlen($this->kontakt->getDataValue($this->mailColumn)) ? $this->kontakt->getDataValue($this->mailColumn)
| php | {
"resource": ""
} |
q11897 | SseTask.getListQueuedTask | train | public function getListQueuedTask() {
$result = [];
if (!CakeSession::check($this->_sessionKey)) {
return $result;
} | php | {
"resource": ""
} |
q11898 | SseTask.deleteQueuedTask | train | public function deleteQueuedTask($tasks = []) {
if (empty($tasks) || !is_array($tasks)) {
return false;
}
if (!CakeSession::check($this->_sessionKey)) {
return false;
}
$existsTasks = CakeSession::read($this->_sessionKey);
if (empty($existsTasks)) {
| php | {
"resource": ""
} |
q11899 | Score.parseChartMask | train | public static function parseChartMask($mask)
{
$result = [];
$arrayParts = explode('|', $mask);
foreach ($arrayParts as $partOfMask) | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.