_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q11400
EloquentJournalVoucher.subsequentByPeriodByNumberAndByOrganization
train
public function subsequentByPeriodByNumberAndByOrganization($periodId, $number, $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->JournalVoucher->setConnection($databaseConnectionName)...
php
{ "resource": "" }
q11401
EloquentJournalVoucher.subsequentByPeriodByVoucherTypeByNumberAndByOrganization
train
public function subsequentByPeriodByVoucherTypeByNumberAndByOrganization($periodId, $voucherTypeId, $number, $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->JournalVoucher->setConnec...
php
{ "resource": "" }
q11402
EloquentJournalVoucher.subtractOneNumber
train
public function subtractOneNumber($journalVoucherIds, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } $this->JournalVoucher->setConnection($databaseConnectionName) ->whereIn('id', $journalVoucherIds) -...
php
{ "resource": "" }
q11403
MapratingQuery.filterByMapuid
train
public function filterByMapuid($mapuid = null, $comparison = null) { if (null === $comparison) { if (is_array($mapuid)) { $comparison = Criteria::IN; } } return $this->addUsingAlias(MapratingTableMap::COL_MAPUID, $mapuid, $comparison); }
php
{ "resource": "" }
q11404
MapratingQuery.filterByScore
train
public function filterByScore($score = null, $comparison = null) { if (is_array($score)) { $useMinMax = false; if (isset($score['min'])) { $this->addUsingAlias(MapratingTableMap::COL_SCORE, $score['min'], Criteria::GREATER_EQUAL); $useMinMax = true; ...
php
{ "resource": "" }
q11405
ConfigPass.createConfigs
train
protected function createConfigs($groups, $permissions, ContainerBuilder $container) { $configManager = $container->findDefinition(ConfigManagerInterface::class); foreach ($groups as $groupCode => $group) { $pathPrefix = $container->getParameter('expansion.admin_groups.config.pa...
php
{ "resource": "" }
q11406
Profiler.getLastQuery
train
public function getLastQuery(string $key = null) { return $key ? $this->profiles['query'][$this->queryCount][$key] ?? null : $this->profiles['query'][$this->queryCount] ?? null; }
php
{ "resource": "" }
q11407
Profiler.getTotalTime
train
public function getTotalTime(bool $indexed = false) { if ($this->profiles == null) { return null; } $totalTime = 0.00; $totalTimeIndexed = ''; if (isset($this->profiles['connection'])) { $totalTime += $this->profiles['connection']['time']; ...
php
{ "resource": "" }
q11408
RoutesLoaderBuilder.build
train
public function build() { if ($this->container->hasDefinition($this->definitionName())) { $this->container->getDefinition( $this->definitionName() )->replaceArgument(0, array_unique($this->configuration, SORT_REGULAR)); } if ($this->container->hasDefin...
php
{ "resource": "" }
q11409
RoutesLoaderBuilder.sanitize
train
protected function sanitize(array $configuration) { foreach ($configuration as $key => $config) { if (null === $config['name']) { $configuration[$key]['name'] = $this->defaultRouteName($key); } if (null === $config['path']) { $configuration...
php
{ "resource": "" }
q11410
ParametrizedString.getParameters
train
public function getParameters() : array { if (is_null($this->parameters)) { $matches = []; $regExp = self::PARAMS_SEARCH_REGEXP; preg_match_all($regExp, $this->str, $matches); $this->parameters = $matches[2]; } return $this->parameters; }
php
{ "resource": "" }
q11411
View.render
train
public function render( $view, $view_suffix = '' ) { $this->view = $view; $this->view_suffix = $view_suffix; if ( is_singular() ) { $this->_render_loop(); } else { $this->_render_direct(); } }
php
{ "resource": "" }
q11412
View.view
train
public function view() { $view = $this->_get_args_for_template_part(); $view = apply_filters( 'inc2734_wp_view_controller_view', $view ); Helper\get_template_part( $view['slug'], $view['name'] ); }
php
{ "resource": "" }
q11413
View._get_args_for_template_part
train
protected function _get_args_for_template_part() { $view = [ 'slug' => '', 'name' => '', ]; $template_name = Helper\locate_template( (array) Helper\config( 'view' ), $this->view, $this->view_suffix ); if ( empty( $template_name ) ) { return $view; } if ( ! $this->view_suffix ) { $view = [ ...
php
{ "resource": "" }
q11414
View.get_static_view_template_name
train
public function get_static_view_template_name() { // @codingStandardsIgnoreStart // @todo サニタイズしているのに Detected usage of a non-validated input variable: $_SERVER がでる。バグ? $request_uri = sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ); // @codingStandardsIgnoreEnd $request_uri = $this->_get_relative...
php
{ "resource": "" }
q11415
View._remove_http_query
train
protected function _remove_http_query( $uri ) { $uri = str_replace( http_build_query( $_GET, null, '&' ), '', $uri ); $uri = rtrim( $uri, '?' ); return $uri; }
php
{ "resource": "" }
q11416
Gravatar.getGravatarSize
train
protected function getGravatarSize() { $size = $this->getSize(); return $this->config['sizes'][$size] ?? (\is_int($size) ? $size : 'small'); }
php
{ "resource": "" }
q11417
CsvBuilderBase.setCallback
train
public function setCallback($callback = null) { if (!is_null($callback) && !is_callable($callback)) { throw new Exception("callback must be of type callable or null"); } $this->callback = $callback; return $this; }
php
{ "resource": "" }
q11418
CsvBuilderBase.setHeader
train
public function setHeader(array $header) { if (is_numeric(key($header))) { $header = array_fill_keys($header, ''); } $this->header = $header; return $this; }
php
{ "resource": "" }
q11419
BaseService.CreatePage
train
public final function CreatePage() { $method = strtoupper($this->_context->get("REQUEST_METHOD")); $customAction = strtolower($method) . ucfirst($this->_action); if (method_exists($this, $customAction)) $this->$customAction($this->getRawRequest(), $this->_context->get("id")); else throw new Ba...
php
{ "resource": "" }
q11420
FileUtil.DeleteFilesFromPath
train
public static function DeleteFilesFromPath($file) { $files = self::RetrieveFilesFromFolder($file->PathSuggested(),null); foreach ($files as $f) { if (strpos($f,$file->Extension())!== false) { self::DeleteFileString($f); } } }
php
{ "resource": "" }
q11421
FileUtil.AdjustSlashes
train
public static function AdjustSlashes($path) { if (self::isWindowsOS()) { $search = "/"; $replace = "\\"; } else { $search = "\\"; $replace = "/"; } return str_replace($search, $replace, $path); }
php
{ "resource": "" }
q11422
FileUtil.getUriFromFile
train
public static function getUriFromFile($absolutepath) { if (self::isWindowsOS()) { $result = "file:///".$absolutepath; $search = "\\"; $replace = "/"; $result =str_replace($search, $replace, $result); } else { $result = "file://".$absolutepath; } return $result; }
php
{ "resource": "" }
q11423
FileUtil.isReadable
train
public static function isReadable($filename) { if (!is_readable($filename)) return false; if ((self::isWindowsOS() || self::isMacOS()) && (count(glob($filename . '*')) == 0)) throw new \Xmlnuke\Core\Exception\CaseMismatchException( 'Your operating system is not case sensitive and it can find the file "'...
php
{ "resource": "" }
q11424
FileUtil.ForceDirectories
train
public static function ForceDirectories($pathname, $mode = 0777) { // Crawl up the directory tree $next_pathname = substr($pathname,0, strrpos($pathname, self::Slash())); if ($next_pathname != "") { self::ForceDirectories($next_pathname, $mode); } if (!file_exists($pathname)) { FileUtil::CreateDire...
php
{ "resource": "" }
q11425
FileUtil.ForceRemoveDirectories
train
public static function ForceRemoveDirectories($dir) { if($objs = glob($dir."/*")){ foreach($objs as $obj) { is_dir($obj)? self::ForceRemoveDirectories($obj) : self::DeleteFileString($obj); } } self::DeleteDirectory($dir); }
php
{ "resource": "" }
q11426
FileUtil.OpenRemoteDocument
train
public static function OpenRemoteDocument($url) { // Expression Regular: // [1]: http or ftp // [2]: Server name // [4]: Full Path $pat = '/(http|ftp|https):\\/\\/((\\w|\\.)+)/i'; $urlParts = preg_split($pat, $url, -1,PREG_SPLIT_DELIM_CAPTURE); $handle = fsockopen($urlParts[2], 80, $errno, $errstr, 30);...
php
{ "resource": "" }
q11427
FileUtil.ReadRemoteDocument
train
public static function ReadRemoteDocument($handle) { // THIS FUNCTION IS A CRAP!!!! // I NEED REFACTORY THIS! $retdocument = ""; $xml = true; $canread = true; // READ HEADER while (!feof($handle)) { $buffer = fgets($handle, 4096); if (strpos(strtolower($buffer), "content-type:")!==false) { ...
php
{ "resource": "" }
q11428
Stringifier.stringify
train
public function stringify($value): string { if ($value instanceof \DateTimeInterface) { return $value->format('Y-m-d'); } if (is_array($value)) { return self::ARRAY_VALUE; } if (is_object($value) && !method_exists($value, '__tostring')) { ...
php
{ "resource": "" }
q11429
Profiler.add
train
public function add(string $profile, $inheritContext = false) { if ($this->has($profile)) { throw new Exception("Profile {$profile} already exist."); } if (!strlen($profile)) { throw new Exception("Profile must be set."); } $child = clone $this; ...
php
{ "resource": "" }
q11430
Profiler.clear
train
public function clear($clearContext = false) { // Clear all stopwatch related values $this->start = null; $this->stop = null; $this->laps = []; if ($clearContext) { $this->context = null; } return $this; }
php
{ "resource": "" }
q11431
Profiler.clearAll
train
public function clearAll($clearContext = false) { foreach ($this->getProfiles() as $child) { $child->clearAll($clearContext); } $this->clear($clearContext); return $this; }
php
{ "resource": "" }
q11432
Profiler.get
train
public function get(string $profile) { if (!$this->has($profile)) { throw new Exception("Profile {$profile} does not exist."); } return $this->children[$profile]; }
php
{ "resource": "" }
q11433
Profiler.note
train
public function note($message = 'Note', $context = [], $level = null) { // Check if method was called only with $context if (is_array($message)) { $level = $context ?: null; $context = $message; $message = 'Note'; } // Skip log entry if message ...
php
{ "resource": "" }
q11434
Profiler.remove
train
public function remove(string $profile) { $child = $this->get($profile); $child->clearAll(); $child->removeAll(); unset($this->children[$profile]); return $this; }
php
{ "resource": "" }
q11435
Profiler.removeAll
train
public function removeAll() { foreach ($this->getProfiles() as $profile => $child) { $this->remove($profile); } return $this; }
php
{ "resource": "" }
q11436
Profiler.restart
train
public function restart($message = 'Restart', $context = []) { // Check if method was called only with $context if (is_array($message)) { $context = $message; $message = 'Restart'; } // Clear data and start (again) $this->clear(); $this->start...
php
{ "resource": "" }
q11437
Profiler.set
train
public function set(string $profile, $inheritContext = false) { return $this->has($profile) ? $this->get($profile) : $this->add($profile, $inheritContext); }
php
{ "resource": "" }
q11438
Profiler.start
train
public function start($message = 'Start', $context = []) { // Check if method was called only with $context if (is_array($message)) { $context = $message; $message = 'Start'; } // A profile can only be started if never started or cleared before if ($t...
php
{ "resource": "" }
q11439
Profiler.startAll
train
public function startAll($message = 'Start', $context = []) { // Start this profile if not started if (!$this->isStarted()) { $this->start($message, $context); } // Start all child profiles afterwards foreach ($this->getProfiles() as $child) { $child-...
php
{ "resource": "" }
q11440
Profiler.stop
train
public function stop($message = 'Stop', $context = [], $lap = true) { // Check if method was called only with $context if (is_array($message)) { $lap = $context; $context = $message; $message = 'Stop'; } elseif (is_bool($message)) { $lap ...
php
{ "resource": "" }
q11441
Profiler.stopAll
train
public function stopAll($message = 'Stop', $context = [], $lap = true) { // Stop all running child profiles first foreach ($this->getProfiles(true) as $child) { $child->stopAll($message, $context, $lap); } // Stop this profile if still running if ($this->isRunnin...
php
{ "resource": "" }
q11442
SymfonyEventAdapter.dispatch
train
public function dispatch($eventName, $params) { $event = new DedicatedEvent(); $event->setParameters($params); $this->symfonyEventDispatcher->dispatch("maniaplanet.game.".$eventName, $event); }
php
{ "resource": "" }
q11443
FlashController.flashcfg
train
public function flashcfg() { Configure::write('debug', 0); if (!$this->request->is('ajax') || !$this->request->is('post') || !$this->RequestHandler->prefers('json')) { throw new BadRequestException(); } $data = $this->ConfigTheme->getConfigAjaxFlash(); $this->set(compact('data')); $this->set('_serial...
php
{ "resource": "" }
q11444
FlashController.flashmsg
train
public function flashmsg() { Configure::write('debug', 0); if (!$this->request->is('ajax') || !$this->request->is('post') || !$this->RequestHandler->prefers('json')) { throw new BadRequestException(); } $data = []; $dataDefault = [ 'result' => false, 'key' => null, 'messages' => [], ]; $ke...
php
{ "resource": "" }
q11445
Radarr.postCommand
train
public function postCommand($name, array $params = null) { $uri = 'command'; $uriData = [ 'name' => $name ]; if ($params != null) { foreach ($params as $key=>$value) { $uriData[$key]= $value; } } try { ...
php
{ "resource": "" }
q11446
Radarr.postMovie
train
public function postMovie(array $data) { $uri = 'movie'; try { $response = $this->_request( [ 'uri' => $uri, 'type' => 'post', 'data' => $data ] ); } catch ( \Exception $e ) { return $e->getMessage(); } return $resp...
php
{ "resource": "" }
q11447
Radarr.updateMovie
train
public function updateMovie(array $data) { $uri = 'movie'; try { $response = $this->_request( [ 'uri' => $uri, 'type' => 'put', 'data' => $data ] ); } catch ( \Exc...
php
{ "resource": "" }
q11448
Radarr.deleteMovie
train
public function deleteMovie($id,$deleteFiles=false) { $uri = 'movie'; try { $response = $this->_request( [ 'uri' => $uri . '/' . $id, 'type' => 'delete', 'deleteFiles' => $deleteFiles ]...
php
{ "resource": "" }
q11449
Ranking.order
train
public static function order(array $array, array $columns) { $arrayMultisortParameters = []; foreach ($columns as $column => $order) { $arrayMultisortParameters[] = array_column($array, $column); $arrayMultisortParameters[] = $order; } $arrayMultisortParameter...
php
{ "resource": "" }
q11450
Ranking.addRank
train
public static function addRank($array, $key = 'rank', $columns = ['pointChart'], $boolEqual = false) { $rank = 1; $compteur = 0; $nbEqual = 1; $nb = count($array); for ($i = 0; $i <= $nb - 1; $i++) { if ($i >= 1) { $row1 = $array[$i ...
php
{ "resource": "" }
q11451
Ranking.chartPointProvider
train
public static function chartPointProvider($iNbPartcipant) { $liste = []; $pointRecord = 100 * $iNbPartcipant; $nb = 80;// % différence entre deux positions $compteur = 0;// compteur de position // 1er $liste[1] = $pointRecord; for ($i = 2; ...
php
{ "resource": "" }
q11452
DebuggerTrait.reInitOptions
train
public function reInitOptions($options) { /* @var Renderer $this */ $this->setOptions([ 'memory_limit' => null, 'execution_max_time' => null, 'enable_profiler' => false, 'profiler' => [ 'display' => false, ...
php
{ "resource": "" }
q11453
DebuggerTrait.handleError
train
public function handleError($error, $code, $path, $source, $parameters, $options) { /* @var \Throwable $error */ $exception = $options['debug'] ? $this->getDebuggedException($error, $code, $source, $path, $parameters, $options) : $error; $handler = $options['error_ha...
php
{ "resource": "" }
q11454
Bubble.getRenderData
train
public function getRenderData( $useLabel = false ) { $radius = ( $this->jsWriter instanceof \Altamira\JsWriter\Flot ) ? $this['radius'] * 10 : $this['radius']; $data = array( $this['x'], $this['y'], $radius ); if ( $useLabel ) { $data[] = $this['label']; ...
php
{ "resource": "" }
q11455
Translations.getTranslation
train
public function getTranslation($id, $parameters = [], $locale = null) { $parameters = array_merge($this->replacementPatterns, $parameters); return $this->translator->trans($id, $parameters, null, $locale); }
php
{ "resource": "" }
q11456
Translations.getTranslations
train
public function getTranslations($id, $parameters = []) { $messages = []; foreach ($this->supportedLocales as $locale) { $message = $this->getTranslation($id, $parameters, $locale); $messages[] = [ "Lang" => lcfirst($locale), "Text" => $message...
php
{ "resource": "" }
q11457
WebHookHandler.setUp
train
public function setUp($options = []) { parent::setUp($options); if (isset($options['changeid'])) { $this->changeid = $options['changeid']; } if (isset($options['operation'])) { $this->setOperation($options['operation']); if ($options['operation'] =...
php
{ "resource": "" }
q11458
BrowserConsoleHandler.getResponseFormat
train
protected static function getResponseFormat() { // Check content type foreach (headers_list() as $header) { if (stripos($header, 'content-type:') === 0) { // This handler only works with HTML and javascript outputs // text/javascript is obsolete in favour ...
php
{ "resource": "" }
q11459
CompatibleFetcher.getCompatibleData
train
public function getCompatibleData($haystack, $title, $mode, $script) { // List of choices order by importance. $choices = $this->getChoicesByPriority($title, $mode, $script); foreach ($choices as $choice) { $data = AssociativeArray::getFromKey($haystack, $choice); i...
php
{ "resource": "" }
q11460
CompatibleFetcher.getChoicesByPriority
train
public function getChoicesByPriority($titleId, $mode, $script) { $game = $this->getTitleGame($titleId); return [ [$titleId, $mode, $script], [$titleId, $mode, self::COMPATIBLE_ALL], [$titleId, self::COMPATIBLE_ALL, self::COMPATIBLE_ALL], // If perfect...
php
{ "resource": "" }
q11461
CompatibleFetcher.getTitleGame
train
public function getTitleGame($titleId) { $game = $this->titles->get($titleId, self::GAME_UNKNOWN); return $game; }
php
{ "resource": "" }
q11462
PlayerListConfig.get
train
public function get() { $players = []; foreach (parent::get() as $login) { $player = $this->playerDb->get($login); if (is_null($player)) { $player = new Player(); $player->setLogin($login); } $players[] = $player; ...
php
{ "resource": "" }
q11463
XmlnukeTabView.addTabItem
train
public function addTabItem($title, $docobj, $tabdefault = false) { if (is_null($docobj) || !($docobj instanceof IXmlnukeDocumentObject)) { throw new InvalidArgumentException("Object is null or not is IXmlnukeDocumentObject. Found object type: " . get_class($docobj), 853); } $this->_tabs[] = array($title, "...
php
{ "resource": "" }
q11464
TicketsField.validate
train
public function validate($validator) { // Throw an error when there are no tickets selected if (empty($this->value)) { $validator->validationError($this->name, _t( 'TicketsField.VALIDATION_EMPTY', 'Select at least one ticket' ), 'validation'); ...
php
{ "resource": "" }
q11465
EloquentAccountChartType.accountsChartsTypesByCountry
train
public function accountsChartsTypesByCountry($id) { return $this->AccountChartType->where(function($query) use ($id) { $query->orWhere('country_id', '=', $id); $query->orWhereNull('country_id'); })->get(); }
php
{ "resource": "" }
q11466
WindowFrameFactory.callbackItemClick
train
public function callbackItemClick(ManialinkInterface $manialink, $login, $params, $args) { $this->menuContentFactory->create($login); /** @var ItemInterface $item */ $item = $args['item']; $item->execute($this->menuContentFactory, $manialink, $login, $params, $args); }
php
{ "resource": "" }
q11467
Pagination.clear
train
public function clear() { if (is_array($this->temp_properties)) { foreach ($this->temp_properties as $key => $value) { if (property_exists($this, $key)) { $this->$key = $value; } } unset($key, $value); $this...
php
{ "resource": "" }
q11468
Pagination.createLinks
train
public function createLinks($result_string = 'Displaying page :current_page_number_displaying of :total_pages<br>:pagination') { $pagination_data = $this->getPaginationData(); if (!is_array($pagination_data)) { return null; } if ($result_string == null) { $r...
php
{ "resource": "" }
q11469
Pagination.generateUrl
train
private function generateUrl($page_value, $direction = '', $return_value_only = false) { switch ($direction) { case 'first': if ($this->page_number_type == 'start_num') { $page_value = 0; } elseif ($this->page_number_type == 'page_num') { ...
php
{ "resource": "" }
q11470
Pagination.isCurrentlyFirstPage
train
private function isCurrentlyFirstPage() { if ($this->page_number_type === 'start_num') { if ($this->page_number_value === 0) { return true; } return false; } elseif ($this->page_number_type === 'page_num') { if ($this->page_number_value...
php
{ "resource": "" }
q11471
Pagination.isCurrentlyLastPage
train
private function isCurrentlyLastPage() { if ($this->page_number_type === 'start_num') { if ($this->page_number_value >= ($this->total_pages*$this->items_per_page)-$this->items_per_page) { return true; } return false; } elseif ($this->page_number_ty...
php
{ "resource": "" }
q11472
Pagination.validateCorrectProperties
train
private function validateCorrectProperties() { if (!is_bool($this->current_page_link)) { $this->current_page_link = false; } if (!is_bool($this->first_page_always_show)) { $this->first_page_always_show = false; } if (is_numeric($this->items_per_page)...
php
{ "resource": "" }
q11473
Pagination.validateRequiredProperties
train
private function validateRequiredProperties() { if ($this->base_url == null) { throw new \Exception('The base_url property was not set.'); } if (is_numeric($this->total_records)) { $this->total_records = intval($this->total_records); } else { thro...
php
{ "resource": "" }
q11474
MessageBag.setSessionStore
train
public function setSessionStore(Session $session) { $this->session = $session; $this->instance = null; return $this; }
php
{ "resource": "" }
q11475
MessageBag.retrieve
train
public function retrieve() { $messages = null; if (\is_null($this->instance)) { $this->instance = new static(); $this->instance->setSessionStore($this->session); if ($this->session->has('message')) { $messages = \unserialize($this->session->pull(...
php
{ "resource": "" }
q11476
MessageBag.save
train
public function save(): void { $this->session->flash('message', $this->serialize()); $this->instance = null; }
php
{ "resource": "" }
q11477
Entity.addMethod
train
public function addMethod(string $methodName, callable $methodClosure): void { $this->methods[strtolower($methodName)] = $methodClosure->bindTo($this); }
php
{ "resource": "" }
q11478
FiltersExtension.passFilterManagerToListener
train
private function passFilterManagerToListener() { $enableFiltersSubscriberDefinition = $this->definitionFinder->getDefinitionByType( EnableFiltersSubscriber::class ); $filterManagerServiceName = $this->definitionFinder->getServiceNameByType(FilterManagerInterface::class); $enableFiltersSubscriberDefinition-...
php
{ "resource": "" }
q11479
SecurityServicesPass.formLoginAuthenticator
train
private function formLoginAuthenticator(ContainerBuilder $container, $routes, $user) { $container->setDefinition( 'bengor.user_bundle.security.authenticator.form_login_' . $user . '_authenticator', new Definition( FormLoginAuthenticator::class, [ $...
php
{ "resource": "" }
q11480
SecurityServicesPass.userSymfonyDataTransformer
train
private function userSymfonyDataTransformer(ContainerBuilder $container, $user) { $container->setDefinition( 'bengor.user_bundle.security.' . $user . '_symfony_data_transformer', new Definition( UserSymfonyDataTransformer::class ) )->setPublic(fals...
php
{ "resource": "" }
q11481
SecurityServicesPass.userProvider
train
private function userProvider(ContainerBuilder $container, $user) { $container->setDefinition( 'bengor.user_bundle.security.' . $user . '_provider', new Definition( UserProvider::class, [ $container->getDefinition( 'bengor.u...
php
{ "resource": "" }
q11482
DateTimeCreator.getNowDateTime
train
public static function getNowDateTime() { if (PHP_VERSION_ID < 70100) { $now = \DateTime::createFromFormat('U.u', \sprintf('%.6F', microtime(true))); } else { $now = new \DateTime(null); } return $now; }
php
{ "resource": "" }
q11483
PlayerStorage.getPlayerInfo
train
public function getPlayerInfo($login, $forceNew = false) { if (!isset($this->online[$login]) || $forceNew) { // to make sure even if an exception happens, player has login and basic nickname $playerInformation = new PlayerInfo(); $playerInformation->login = $login; ...
php
{ "resource": "" }
q11484
PlayerStorage.onPlayerConnect
train
public function onPlayerConnect(Player $playerData) { $login = $playerData->getLogin(); $this->online[$login] = $playerData; if ($playerData->isSpectator()) { $this->spectators[$login] = $playerData; } else { $this->players[$login] = $playerData; } ...
php
{ "resource": "" }
q11485
PlayerStorage.onPlayerInfoChanged
train
public function onPlayerInfoChanged(Player $oldPlayer, Player $player) { unset($this->players[$player->getLogin()]); unset($this->spectators[$player->getLogin()]); $this->onPlayerConnect($player); }
php
{ "resource": "" }
q11486
Installer.installFile
train
public function installFile($sSourcePath, $sInstallPath) { // If the temp file doesn't exist, we cannot install it if(! file_exists($sSourcePath)) throw new NoSuchFileException($sSourcePath, 1); try { // Create the install directory if needed $sInstallDir = dirname($sInstallPath); $this->installDi...
php
{ "resource": "" }
q11487
Installer.findTempSafeInstallPath
train
public function findTempSafeInstallPath($sInstallPath) { try { $sTemp = $this->appendTempExtension($sInstallPath); while(file_exists($sTemp)) { $sTemp = $this->appendTempExtension($sTemp); } } catch(Exception $e) { throw new Exception("No available temp file found for: $sInstallPath", 0, ...
php
{ "resource": "" }
q11488
StackCreateCommand.displayResume
train
protected function displayResume(OutputInterface $output) { $output->write("Creation of a new stack [<info>{$this->collectedData['name']}</info>]", true); foreach ($this->collectedData['operations'] as $name => $operation) { $output->write(" * Operation [<info>$name</info>] with ".json_e...
php
{ "resource": "" }
q11489
JukeboxService.addMapFirst
train
public function addMapFirst(Map $map, $login = null, $force = false) { return $this->addMap($map, $login, $force, true); }
php
{ "resource": "" }
q11490
JukeboxService.addMapLast
train
public function addMapLast(Map $map, $login = null, $force = false) { return $this->addMap($map, $login, $force, false); }
php
{ "resource": "" }
q11491
JukeboxService.addMap
train
public function addMap(Map $map, $login = null, $force = false, $addFirst = false) { if (!$login) { return false; } $player = $this->playerStorage->getPlayerInfo($login); $jbMap = new JukeboxMap($map, $player); if ($force) { $this->add($jbMap, $addF...
php
{ "resource": "" }
q11492
JukeboxService.checkLogin
train
private function checkLogin($login) { foreach ($this->mapQueue as $jukeboxMap) { if ($jukeboxMap->getPlayer()->getLogin() == $login) { return true; } } return false; }
php
{ "resource": "" }
q11493
WindowsPipes.removeFiles
train
private function removeFiles() { foreach ($this->files as $filename) { if (file_exists($filename)) { @unlink($filename); } } $this->files = array(); }
php
{ "resource": "" }
q11494
FilterHelper._getSchemaCache
train
protected function _getSchemaCache($model = null) { if (empty($model) || !isset($this->_schemaCache[$model])) { return null; } return $this->_schemaCache[$model]; }
php
{ "resource": "" }
q11495
FilterHelper._setSchemaCache
train
protected function _setSchemaCache($model = null, $schema = null) { if (empty($model)) { return; } $this->_schemaCache[$model] = $schema; }
php
{ "resource": "" }
q11496
FilterHelper._getSchema
train
protected function _getSchema($model = null) { $result = null; if (empty($model)) { return $result; } $modelObj = ClassRegistry::init($model, true); if ($modelObj === false) { return $result; } $result = $modelObj->schema(); if (empty($modelObj->virtualFields)) { return $result; } foreac...
php
{ "resource": "" }
q11497
FilterHelper.openFilterForm
train
public function openFilterForm($usePost = false) { $this->_setFlagUsePost($usePost); $type = 'get'; $dataToggle = 'pjax-form'; if ($this->_getFlagUsePost()) { $type = 'post'; $dataToggle = 'ajax-form'; } else { $filterData = $this->getFilterData(); if (!empty($filterData)) { $this->setFilterIn...
php
{ "resource": "" }
q11498
FilterHelper.closeFilterForm
train
public function closeFilterForm() { $type = 'get'; if ($this->_getFlagUsePost()) { $type = 'post'; } $this->ExtBs3Form->requestType = $type; $result = $this->ExtBs3Form->end(); return $result; }
php
{ "resource": "" }
q11499
FilterHelper._createPaginationTableRow
train
protected function _createPaginationTableRow($paginationFields = null) { $result = ''; if (empty($paginationFields) || !is_array($paginationFields)) { return $result; } $tableHeader = []; $includeOptions = [ 'class' => null, 'escape' => null, ]; foreach ($paginationFields as $paginationField => ...
php
{ "resource": "" }