_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
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']); } next($this->fragments['where']); $key = key($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, $data, $queryParams) . $suffix; return $response->withRedirect($url, 301); }
php
{ "resource": "" }
q11802
FactoryRegistry.getFactory
train
public function getFactory($name) { if (!isset($this->factories[$name])) { throw new \RuntimeException(sprintf('No factory registered with name "%s"', $name)); } return $this->factories[$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($_file...
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( ...
php
{ "resource": "" }
q11805
DataGenerator.fakeData
train
public function fakeData(EntityTypeInterface $type, array $options = array()) { $entity = $type->createEntity(); $this->fake($entity, $options); return $entity->toArray(); }
php
{ "resource": "" }
q11806
DataGenerator.createFakeEntity
train
public function createFakeEntity( EntityTypeInterface $type, array $options = array(), EntityInterface $parent = null ) { $options[self::OPTION_MARK_CLEAN] = true; $entity = $type->createEntity([], $parent); $this->fake($entity, $options); return $entity; ...
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::gu...
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->fake...
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)); $this->setValue($entity, $attribute, implode(PHP_EOL . PHP_EOL, $text), $options); }
php
{ "resource": "" }
q11810
DataGenerator.addInteger
train
protected function addInteger(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->randomNumber(5), $options); }
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++) { $values[] = $thi...
php
{ "resource": "" }
q11812
DataGenerator.addFloat
train
protected function addFloat(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->randomFloat(5), $options); }
php
{ "resource": "" }
q11813
DataGenerator.addUrl
train
protected function addUrl(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->url(), $options); }
php
{ "resource": "" }
q11814
DataGenerator.addUuid
train
protected function addUuid(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->uuid(), $options); }
php
{ "resource": "" }
q11815
DataGenerator.addChoice
train
protected function addChoice(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $allowed_values = $attribute->getOption('allowed_values'); $choice = $allowed_values[array_rand($allowed_values)]; $this->setValue($entity, $attribute, $choice, $options); }
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, 5); for ($i = 0; $i < $number_of_values; $i++) { $values[$this->faker->word] = $this->faker->s...
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_va...
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('#ComplexValueInte...
php
{ "resource": "" }
q11819
DataGenerator.addImage
train
protected function addImage( EntityInterface $entity, AttributeInterface $attribute, array $options = array() ) { $image = $this->createComplexValue($attribute, $options); $this->setValue($entity, $attribute, $image, $options); }
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); $numberOfEntr...
php
{ "resource": "" }
q11821
DataGenerator.addBoolean
train
protected function addBoolean(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $this->setValue($entity, $attribute, $this->faker->boolean, $options); }
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(); ...
php
{ "resource": "" }
q11823
DataGenerator.addTimestamp
train
protected function addTimestamp(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $default_value = $attribute->getDefaultValue(); $this->setValue($entity, $attribute, $default_value ?: $this->faker->iso8601, $options); }
php
{ "resource": "" }
q11824
DataGenerator.addGeoPoint
train
protected function addGeoPoint(EntityInterface $entity, AttributeInterface $attribute, array $options = array()) { $geopoint = [ 'lon' => $this->faker->longitude, 'lat' => $this->faker->latitude ]; $this->setValue($entity, $attribute, $geopoint, $options); }
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]) ...
php
{ "resource": "" }
q11827
DataGenerator.shouldGuessByName
train
protected function shouldGuessByName(array $options = array()) { if (array_key_exists(self::OPTION_GUESS_PROVIDER_BY_NAME, $options) && false === $options[self::OPTION_GUESS_PROVIDER_BY_NAME] ) { return false; } return true; }
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 $cr...
php
{ "resource": "" }
q11829
Client.setErrorCallback
train
protected function setErrorCallback(ConnectionInterface $connection, callable $callback) { $connection->setErrorCallback(function ($connection, $exception) use ($callback) { \call_user_func($callback, $this, $exception, $connection); }); }
php
{ "resource": "" }
q11830
Client.wrapCallback
train
protected function wrapCallback(callable $callback) { return function ($response, $connection, $command) use ($callback) { if ($command && !$response instanceof ResponseInterface) { $response = $command->parseResponse($response); } \call_user_func($callba...
php
{ "resource": "" }
q11831
UploadComponent._setStorageTimeUpload
train
protected function _setStorageTimeUpload($time = null) { $time = (int)$time; if ($time > 0) { $this->_storageTimeUpload = $time; } }
php
{ "resource": "" }
q11832
UploadComponent._setUploadDir
train
protected function _setUploadDir($path = null) { $path = (string)$path; if (file_exists($path)) { $this->_pathUploadDir = $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($timeNo...
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->getUploa...
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>'); ...
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); $useMi...
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); $useMi...
php
{ "resource": "" }
q11838
RecordQuery.filterByCheckpoints
train
public function filterByCheckpoints($checkpoints = null, $comparison = null) { if (null === $comparison) { if (is_array($checkpoints)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(RecordTableMap::COL_CHECKPOINTS, $checkpoints, $compar...
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); $useM...
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 ObjectCollectio...
php
{ "resource": "" }
q11841
RecordQuery.usePlayerQuery
train
public function usePlayerQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinPlayer($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'Player', '\eXpansion\Framework\PlayersBundle\Model\PlayerQuery'); }
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); ...
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()."\...
php
{ "resource": "" }
q11844
Listeners.register
train
public function register(ListenerInterface $listener, EventEmitter $target = null) { $EElisteners = array(); if (null !== $target) { $EElisteners = $this->forwardEvents($listener, $target, $listener->forwardedEvents()); } $this->storage->attach($listener, $EElisteners);...
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) { $listener->removeListener($event, $E...
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 ($isPj...
php
{ "resource": "" }
q11847
ThemeComponent._setConfigVar
train
protected function _setConfigVar(Controller &$controller) { $additionalCssFiles = $this->_modelConfigTheme->getListCssFiles(); $additionalJsFiles = $this->_modelConfigTheme->getListJsFiles(); $controller->set(compact('additionalCssFiles', 'additionalJsFiles')); }
php
{ "resource": "" }
q11848
PlayerQuery.filterByLogin
train
public function filterByLogin($login = null, $comparison = null) { if (null === $comparison) { if (is_array($login)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(PlayerTableMap::COL_LOGIN, $login, $comparison); }
php
{ "resource": "" }
q11849
PlayerQuery.filterByNickname
train
public function filterByNickname($nickname = null, $comparison = null) { if (null === $comparison) { if (is_array($nickname)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(PlayerTableMap::COL_NICKNAME, $nickname, $comparison); }
php
{ "resource": "" }
q11850
PlayerQuery.filterByNicknameStripped
train
public function filterByNicknameStripped($nicknameStripped = null, $comparison = null) { if (null === $comparison) { if (is_array($nicknameStripped)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(PlayerTableMap::COL_NICKNAME_STRIPPED, ...
php
{ "resource": "" }
q11851
PlayerQuery.filterByPath
train
public function filterByPath($path = null, $comparison = null) { if (null === $comparison) { if (is_array($path)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(PlayerTableMap::COL_PATH, $path, $comparison); }
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; ...
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); ...
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); ...
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) { ...
php
{ "resource": "" }
q11856
PlayerQuery.useRecordQuery
train
public function useRecordQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinRecord($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'Record', '\eXpansion\Bundle\LocalRecords\Model\RecordQuery'); }
php
{ "resource": "" }
q11857
View.draw
train
public function draw() { $file = Application::current()->getDirectory(); $file .= "views/{$this->templateName}."; $file .= self::$extension; if (!file_exists($file)) { throw new Exception("Template file not found: $file"); } return $this->templateEngine-...
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(...
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)) { # B...
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)) { ...
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); $ev...
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...
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(); ...
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())), 'versio...
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')); $output[] = '<dl ' . $this->buildAttrs($attrs) . '>'; ...
php
{ "resource": "" }
q11866
NotificationUpdater.getTranslations
train
private function getTranslations($string, $params) { $out = []; $messages = $this->translationsHelper->getTranslations($string, $params); foreach ($messages as $message) { $out[$message['Lang']] = $message['Text']; } return $out; }
php
{ "resource": "" }
q11867
ThrowableProxy.toThrowable
train
public function toThrowable() { $class = $this->class; $prev = $this->prev !== null ? $this->prev->toThrowable() : $this->prev; return new $class($this->message, 0, $prev); }
php
{ "resource": "" }
q11868
ParovacFaktur.setStartDay
train
public function setStartDay($daysBack) { if (!is_null($daysBack)) { $this->addStatusMessage('Start Date '.date('Y-m-d', mktime(0, 0, 0, date("m"), date("d") - $daysBack, date("Y")))); } $this->daysBack = $daysBack; }
php
{ "resource": "" }
q11869
ParovacFaktur.getInvoicer
train
public function getInvoicer() { if (!is_object($this->invoicer)) { $this->invoicer = new \FlexiPeeHP\FakturaVydana(null, $this->config); } return $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', 'ko...
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'], empty($bankCode) ? ['buc' => $account] : ['buc' => $account, 'smerKo...
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; ...
php
{ "resource": "" }
q11873
ParovacFaktur.getOriginDocumentType
train
public function getOriginDocumentType($typDokl) { if (empty($this->docTypes)) { $this->docTypes = $this->getDocumentTypes(); } $documentType = \FlexiPeeHP\FlexiBeeRO::uncode($typDokl); return array_key_exists($documentType, $this->docTypes) ? $this->docTypes[$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(...
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'], $file['name'], $file['type'] )...
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( ...
php
{ "resource": "" }
q11877
GridViewWidget.setupDefaultConfigs
train
private function setupDefaultConfigs() { $this->setLayout(); $this->setSummary(); if (!$this->isEmpty()) { $this->setActionBar(); } $this->showOnEmpty = false; }
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']) . Html::tag('div', "{pager}", ['class' => 'pagination-w...
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' => [ 'data-togg...
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 =...
php
{ "resource": "" }
q11881
AbstractVotePlugin.start
train
public function start(Player $player, $params) { $this->currentVote = new Vote($player, $this->getCode(), $params); return $this->currentVote; }
php
{ "resource": "" }
q11882
AbstractVotePlugin.castYes
train
public function castYes($login) { if ($this->currentVote) { $this->currentVote->castYes($login); $player = $this->playerStorage->getPlayerInfo($login); $this->dispatcher->dispatch("votemanager.voteyes", [$player, $this->currentVote]); } }
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 i...
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...
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->addXmlnukeOb...
php
{ "resource": "" }
q11886
SendPage.showMessage
train
public function showMessage() { $blockcenter = new XmlBlockCollection($this->_myWords->Value("MSGOK"), BlockPosition::Center); $this->_document->addXmlnukeObject($blockcenter); $paragraph = new XmlParagraphCollection(); $blockcenter->addXmlnukeObject($paragraph); $paragraph->addXmlnukeObjec...
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 = []; } } /...
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)); $route...
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) { /* @va...
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 ); ...
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) { ...
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' );...
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('ke...
php
{ "resource": "" }
q11894
Customer.loadFromFlexiBee
train
public function loadFromFlexiBee($id = null) { $result = $this->adresar->loadFromFlexiBee($id); $this->takeData($this->adresar->getData()); return $result; }
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)) { ...
php
{ "resource": "" }
q11896
Customer.getUserEmail
train
public function getUserEmail() { return strlen($this->kontakt->getDataValue($this->mailColumn)) ? $this->kontakt->getDataValue($this->mailColumn) : $this->adresar->getDataValue($this->mailColumn); }
php
{ "resource": "" }
q11897
SseTask.getListQueuedTask
train
public function getListQueuedTask() { $result = []; if (!CakeSession::check($this->_sessionKey)) { return $result; } $tasks = CakeSession::read($this->_sessionKey); if (!is_array($tasks)) { return $result; } return $tasks; }
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)) { return false; } $resultTasks = array_values...
php
{ "resource": "" }
q11899
Score.parseChartMask
train
public static function parseChartMask($mask) { $result = []; $arrayParts = explode('|', $mask); foreach ($arrayParts as $partOfMask) { $arrayLib = explode('~', $partOfMask); $result[] = ['size' => (int)$arrayLib[0], 'suffixe' => $arrayLib[1]]; } r...
php
{ "resource": "" }