_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q10400 | WaitingListRegistrationForm.doRegister | train | public function doRegister($data, WaitingListRegistrationForm $form)
{
$form->saveInto($registration = WaitingListRegistration::create());
$registration->EventID = $this->getController()->ID;
$this->getController()->WaitingList()->add($registration);
$this->getController()->redirect(... | php | {
"resource": ""
} |
q10401 | Database.getInfo | train | public function getInfo(string $key = null)
{
if ($this->info == null) {
$resource = $this->linker->getLink()->getAgent()->getResource();
$resourceType = $resource->getType();
$serverVersion = $clientVersion = null;
if ($resourceType == Resource::TYPE_MYSQL_... | php | {
"resource": ""
} |
q10402 | LayoutRow.updateSize | train | protected function updateSize()
{
$sizeY = abs($this->startY);
$sizeX = 0;
foreach ($this->elements as $idx => $element) {
$sizeY += $element->getHeight() + $this->margin;
if (abs($element->getX()) + $element->getWidth() > $sizeX) {
$sizeX = abs($elem... | php | {
"resource": ""
} |
q10403 | LayoutRow.setPosition | train | public function setPosition($x, $y)
{
$this->posX = $x;
$this->posy = $y;
return $this;
} | php | {
"resource": ""
} |
q10404 | AccountManager.getAccounts | train | public function getAccounts()
{
//Is Group: Further accounts can be made under Groups, but entries can be made against non-Groups
$accounts = array();
$this->Account->byOrganization($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($Account) use (&$accounts)
{
array_p... | php | {
"resource": ""
} |
q10405 | AccountManager.getGroupsAccounts | train | public function getGroupsAccounts()
{
//Is Group: Further accounts can be made under Groups, but entries can be made against non-Groups
$accounts = array();
$this->Account->byOrganization($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($Account) use (&$accounts)
{
i... | php | {
"resource": ""
} |
q10406 | AccountManager.getAccountsTypes | train | public function getAccountsTypes()
{
//Is Group: Further accounts can be made under Groups, but entries can be made against non-Groups
$accountTypes = array();
$this->AccountType->byOrganization($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($AccountType) use (&$accountTypes... | php | {
"resource": ""
} |
q10407 | Node.accept | train | public function accept(VisitorInterface $visitor): void
{
$visitor->visitBefore($this);
foreach ($this->getChildren() as $node) {
$node->accept($visitor);
}
$visitor->visitAfter($this);
} | php | {
"resource": ""
} |
q10408 | Node.getChild | train | public function getChild(string $name): Node
{
foreach ($this->children as $node) {
if (strcasecmp($node->getName(), $name) == 0) {
return $node;
}
}
return new NullNode;
} | php | {
"resource": ""
} |
q10409 | Node.hasChild | train | public function hasChild(string $name): bool
{
foreach ($this->children as $node) {
if (strcasecmp($node->getName(), $name) == 0) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q10410 | Node.getChildren | train | public function getChildren(string $name = ''): array
{
$nodes = [];
foreach ($this->children as $node) {
if (!$name || strcasecmp($node->getName(), $name) == 0) {
$nodes[] = $node;
}
}
return $nodes;
} | php | {
"resource": ""
} |
q10411 | SettingManager.getCountryAccountsChartsTypes | train | public function getCountryAccountsChartsTypes()
{
$accountsChartsTypes = array();
$this->AccountChartType->accountsChartsTypesByCountry($this->AuthenticationManager->getCurrentUserOrganizationCountry())->each(function($AccountChartType) use(&$accountsChartsTypes)
{
$name = $this->Lang->has($AccountC... | php | {
"resource": ""
} |
q10412 | SettingManager.getSystemCurrencies | train | public function getSystemCurrencies()
{
$currencies = array();
$this->Currency->all()->each(function($Currency) use (&$currencies)
{
array_push($currencies, array('label'=> $Currency->name . ' (' . $Currency->symbol . ')', 'value'=>$Currency->id));
});
return $currencies;
} | php | {
"resource": ""
} |
q10413 | SettingManager.getSettingJournals | train | public function getSettingJournals()
{
return $this->JournalManager->getJournalsByApp(array('appId' => 'acct-initial-acounting-setup', 'page' => 1, 'journalizedId' => $this->Setting->byOrganization($this->AuthenticationManager->getCurrentUserOrganization('id'))->first()->id, 'filter' => null, 'userId' => null, 'o... | php | {
"resource": ""
} |
q10414 | Model.initModelProperties | train | private static function initModelProperties()
{
$currentModel = static::class;
if (isset(self::$modelProperties[$currentModel])) {
return;
}
$properties = [
'connection' => ConnectionFactory::build(static::$connection),
'dateFields' => static::... | php | {
"resource": ""
} |
q10415 | Model.exists | train | public function exists() : bool
{
$query = static::createQuery();
$pks = static::getPrimaryKeys();
$pkValues = $this->getPrimaryKeyValues();
if (count($pks) != count($pkValues)) {
return false;
}
$filterFunction = function (WhereClause $whereClause) use ... | php | {
"resource": ""
} |
q10416 | Model.insert | train | public function insert() : Result
{
$result = self::getConnection()->insert($this);
/*
* In a successful insert operation, assign the new id to
* current model.
*/
if ($result->count()) {
$pks = static::getPrimaryKeys();
if (count($pks) ==... | php | {
"resource": ""
} |
q10417 | MelisModuleManager.sanitize | train | public static function sanitize($input, $skip = [], $textOnly = false, $removeFunctions = true)
{
if (!is_array($input)) {
if (true === $removeFunctions) {
$input = preg_replace('/[a-zA-Z][a-zA-Z0-9_]+(\()+([a-zA-Z0-9_\-$,\s\"]?)+(\))(\;?)/', '', $input);
}
... | php | {
"resource": ""
} |
q10418 | XmlDualList.setDataSource | train | public function setDataSource($listLeft, $listRight = null)
{
$this->_listLeftDataSource = $listLeft;
$this->_listRightDataSource = $listRight;
} | php | {
"resource": ""
} |
q10419 | XmlDualList.createDefaultButtons | train | public function createDefaultButtons()
{
$this->setButtonOneLeft(new DualListButton("<--", DualListButtonType::Button));
$this->setButtonAllLeft(new DualListButton("<<<", DualListButtonType::Button));
$this->setButtonOneRight(new DualListButton("-->", DualListButtonType::Button));
$this->se... | php | {
"resource": ""
} |
q10420 | XmlDualList.Parse | train | public static function Parse($context, $duallistaname)
{
$val = $context->get($duallistaname);
if ($val != "")
{
return explode(",", $val);
}
else
{
return array();
}
} | php | {
"resource": ""
} |
q10421 | XmlDualList.buildListItens | train | private function buildListItens($list, $arr)
{
foreach ($arr as $key=>$value)
{
$item = XmlUtil::CreateChild($list, "item", "");
XmlUtil::AddAttribute($item, "id", $key);
XmlUtil::AddAttribute($item, "text", $value);
}
} | php | {
"resource": ""
} |
q10422 | XmlDualList.makeButton | train | private function makeButton($button, $name, $duallist, $from, $to, $all)
{
$newbutton = XmlUtil::CreateChild($duallist, "button", "");
XmlUtil::AddAttribute($newbutton, "name", $name);
if ($button->type == DualListButtonType::Image ) {
XmlUtil::AddAttribute($newbutton, "type", "image");
XmlUtil::AddAttribu... | php | {
"resource": ""
} |
q10423 | Collection.delete | train | function delete($key) {
$this->data[$key] = null;
unset($this->data[$key]);
return $this;
} | php | {
"resource": ""
} |
q10424 | Collection.chunk | train | function chunk(int $numitems, bool $preserve_keys = false) {
return (new self(\array_chunk($this->data, $numitems, $preserve_keys)));
} | php | {
"resource": ""
} |
q10425 | Collection.diff | train | function diff($arr) {
if($arr instanceof self) {
$arr = $arr->all();
}
return (new self(\array_diff($this->data, $arr)));
} | php | {
"resource": ""
} |
q10426 | Collection.diffKeys | train | function diffKeys($arr) {
if($arr instanceof self) {
$arr = $arr->all();
}
return (new self(\array_diff_key($this->data, $arr)));
} | php | {
"resource": ""
} |
q10427 | Collection.each | train | function each(callable $closure) {
foreach($this->data as $key => $val) {
$feed = $closure($val, $key);
if($feed === false) {
break;
}
}
return $this;
} | php | {
"resource": ""
} |
q10428 | Collection.filter | train | function filter(callable $closure) {
$new = array();
foreach($this->data as $key => $val) {
$feed = (bool) $closure($val, $key);
if($feed) {
$new[$key] = $val;
}
}
return (new self($new));
} | php | {
"resource": ""
} |
q10429 | Collection.first | train | function first(callable $closure = null) {
if($closure === null) {
if(empty($this->data)) {
return null;
}
$keys = \array_keys($this->data);
return ($this->data[$keys[0]] ?? null);
}
foreach($this->data as $key... | php | {
"resource": ""
} |
q10430 | Collection.flatten | train | function flatten(int $depth = 0) {
$data = $this->flattenDo($this->data, $depth);
return (new self($data));
} | php | {
"resource": ""
} |
q10431 | Collection.groupBy | train | function groupBy($column) {
if($column === null || $column === '') {
return $this;
}
$new = array();
foreach($this->data as $key => $val) {
if(\is_callable($column)) {
$key = $column($val, $key);
} elseif(\is_array($val)) {
... | php | {
"resource": ""
} |
q10432 | Collection.implode | train | function implode($col, string $glue = ', ') {
$data = '';
foreach($this->data as $key => $val) {
if(\is_array($val)) {
if(!isset($val[$col])) {
throw new \BadMethodCallException('Specified key "'.$col.'" does not exist on array');
... | php | {
"resource": ""
} |
q10433 | Collection.indexOf | train | function indexOf($value) {
$i = 0;
foreach($this->data as $val) {
if($val === $value) {
return $i;
}
$i++;
}
return null;
} | php | {
"resource": ""
} |
q10434 | Collection.intersect | train | function intersect($arr) {
if($arr instanceof self) {
$arr = $arr->all();
}
return (new self(\array_intersect($this->data, $arr)));
} | php | {
"resource": ""
} |
q10435 | Collection.last | train | function last(callable $closure = null) {
if($closure === null) {
if(empty($this->data)) {
return null;
}
$keys = \array_keys($this->data);
return $this->data[$keys[(\count($keys) - 1)]];
}
$data = null;
... | php | {
"resource": ""
} |
q10436 | Collection.map | train | function map(callable $closure) {
$keys = \array_keys($this->data);
$items = \array_map($closure, $this->data, $keys);
return (new self(\array_combine($keys, $items)));
} | php | {
"resource": ""
} |
q10437 | Collection.max | train | function max($key = null) {
if($key !== null) {
$data = \array_column($this->data, $key);
} else {
$data = $this->data;
}
return \max($data);
} | php | {
"resource": ""
} |
q10438 | Collection.min | train | function min($key = null) {
if($key !== null) {
$data = \array_column($this->data, $key);
} else {
$data = $this->data;
}
return \min($data);
} | php | {
"resource": ""
} |
q10439 | Collection.merge | train | function merge(\CharlotteDunois\Collect\Collection $collection) {
return (new self(\array_merge($this->data, $collection->all())));
} | php | {
"resource": ""
} |
q10440 | Collection.nth | train | function nth(int $nth, int $offset = 0) {
if($nth <= 0) {
throw new \InvalidArgumentException('nth must be a non-zero positive integer');
}
$new = array();
$size = \count($this->data);
for($i = $offset; $i < $size; $i += $nth) {
$new[] = ... | php | {
"resource": ""
} |
q10441 | Collection.only | train | function only(array $keys) {
$new = array();
foreach($this->data as $key => $val) {
if(\in_array($key, $keys, true)) {
$new[$key] = $val;
}
}
return (new self($new));
} | php | {
"resource": ""
} |
q10442 | Collection.partition | train | function partition(callable $closure) {
$collection1 = new self();
$collection2 = new self();
foreach($this->data as $key => $val) {
if($closure($val, $key)) {
$collection1->set($key, $val);
} else {
$collection2->set($key, $val);
... | php | {
"resource": ""
} |
q10443 | Collection.pluck | train | function pluck($key, $index = null) {
$data = array();
$i = 0;
foreach($this->data as $v) {
$k = ($index ?
(\is_array($v) ?
(\array_key_exists($index, $v) ? $v[$index] : $i)
: (\is_object($v) ?
... | php | {
"resource": ""
} |
q10444 | Collection.random | train | function random(int $num = 1) {
$rand = \array_rand($this->data, $num);
if(!\is_array($rand)) {
$rand = array($rand);
}
$col = new self();
foreach($rand as $key) {
$col->set($key, $this->data[$key]);
}
return $col;
} | php | {
"resource": ""
} |
q10445 | Collection.reduce | train | function reduce(callable $closure, $carry = null) {
foreach($this->data as $val) {
$carry = $closure($carry, $val);
}
return $carry;
} | php | {
"resource": ""
} |
q10446 | Collection.search | train | function search($needle, bool $strict = true) {
return \array_search($needle, $this->data, $strict);
} | php | {
"resource": ""
} |
q10447 | Collection.slice | train | function slice(int $offset, int $limit = null, bool $preserve_keys = false) {
$data = $this->data;
return (new self(\array_slice($data, $offset, $limit, $preserve_keys)));
} | php | {
"resource": ""
} |
q10448 | Collection.some | train | function some(callable $closure) {
foreach($this->data as $key => $val) {
if($closure($val, $key)) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q10449 | Collection.sort | train | function sort(bool $descending = false, int $options = \SORT_REGULAR) {
$data = $this->data;
if($descending) {
\arsort($data, $options);
} else {
\asort($data, $options);
}
return (new self($data));
} | php | {
"resource": ""
} |
q10450 | Collection.sortKey | train | function sortKey(bool $descending = false, int $options = \SORT_REGULAR) {
$data = $this->data;
if($descending) {
\krsort($data, $options);
} else {
\ksort($data, $options);
}
return (new self($data));
} | php | {
"resource": ""
} |
q10451 | Collection.sortCustom | train | function sortCustom(callable $closure) {
$data = $this->data;
\uasort($data, $closure);
return (new self($data));
} | php | {
"resource": ""
} |
q10452 | Collection.sortCustomKey | train | function sortCustomKey(callable $closure) {
$data = $this->data;
\uksort($data, $closure);
return (new self($data));
} | php | {
"resource": ""
} |
q10453 | Collection.unique | train | function unique($key, $options = \SORT_REGULAR) {
if($key === null) {
return (new self(\array_unique($this->data, $options)));
}
$exists = array();
return $this->filter(function ($item) use ($key, &$exists) {
if(\is_array($item)) {
if(!iss... | php | {
"resource": ""
} |
q10454 | File.resolveClass | train | public function resolveClass(FoundClass $found)
{
Logger::trace("Resolving class %s", $found->name);
if ($found->name[0] === '\\') {
return new Classname($found->name);
}
$classParts = explode('\\', $found->name);
if (count($classParts) >= 2) {
$b = a... | php | {
"resource": ""
} |
q10455 | File.shortenClasses | train | public function shortenClasses($classesToFix, Configuration $config)
{
$cumulativeOffset = 0;
/** @var FoundClass $c */
foreach ($classesToFix as $c) {
$replacement = [];
if (in_array($c->name, $this->ignoredClassNames)) {
if ($c->name == $this->orig... | php | {
"resource": ""
} |
q10456 | File.getSrc | train | public function getSrc()
{
$content = "";
foreach ($this->tokens as $token) {
$content .= is_string($token) ? $token : $token[1];;
}
return $content;
} | php | {
"resource": ""
} |
q10457 | File.save | train | public function save($directory)
{
$parts = explode('_', $this->getClass());
array_unshift($parts, $directory);
$path = join(DIRECTORY_SEPARATOR, $parts) . '.php';
self::saveToFile($path, $this->getSrc());
} | php | {
"resource": ""
} |
q10458 | File.saveToFile | train | private static function saveToFile($path, $contents)
{
$directory = pathinfo($path, PATHINFO_DIRNAME);
if (!file_exists($directory)) {
mkdir($directory, 0777, true);
}
file_put_contents($path, $contents);
} | php | {
"resource": ""
} |
q10459 | HookReciever.saveLastProcessedVersion | train | public function saveLastProcessedVersion($version)
{
$this->lastProcessedVersion = $version;
$this->myCreateColumn = null;
$this->deleteFromSQL(['serverurl' => constant('FLEXIBEE_URL')]);
if (is_null($this->insertToSQL(['serverurl' => constant('FLEXIBEE_URL'),
... | php | {
"resource": ""
} |
q10460 | SyncPlugin.putFile | train | private function putFile(MountManager $mountManager, string $from, string $to, array $config): bool
{
$this->logger->debug("Copying file $from to $to");
list($prefixFrom, $from) = $mountManager->getPrefixAndPath($from);
$buffer = $mountManager->getFilesystem($prefixFrom)->readStream($from);
... | php | {
"resource": ""
} |
q10461 | IdGenerator.generateSessionId | train | public static function generateSessionId($length = 40)
{
if ($length < 1) {
throw new \InvalidArgumentException('Length should be >= 1');
}
$chars = '0123456789abcdefghijklmnopqrstuvwxyz';
$numChars = 36;
$bytes = random_bytes($length);
$pos = 0;
... | php | {
"resource": ""
} |
q10462 | PlayerFactory.createPlayer | train | public function createPlayer(PlayerInfo $playerInfo, PlayerDetailedInfo $playerDetailedInfo)
{
$class = $this->class;
$player = new $class();
$player->merge($playerInfo);
$player->merge($playerDetailedInfo);
return $player;
} | php | {
"resource": ""
} |
q10463 | TwoDimensionalPoint.getRenderData | train | public function getRenderData( $useLabel = false )
{
if ( ( $this->jsWriter->getType( $this->series->getTitle() ) instanceof \Altamira\Type\Flot\Donut ) ) {
$value = array( 1, $this['y'] );
} else {
$value = array($this['x'], $this['y']);
if ( $useLabel ) {
... | php | {
"resource": ""
} |
q10464 | DlstatsHelper.checkIP | train | public function checkIP($UserIP = false)
{
// Check if IP present
if ($UserIP === false)
{
$tempIP = $this->dlstatsGetUserIP();
if ($tempIP !== false)
{
$this->IP = $tempIP;
}
else
{
return false; // No IP, no search.
... | php | {
"resource": ""
} |
q10465 | DlstatsHelper.checkIPVersion | train | protected function checkIPVersion($UserIP = false)
{
// Test for IPv4
if (ip2long($UserIP) !== false)
{
$this->IP_Version = "IPv4";
return $this->IP_Version;
}
// Test for IPv6
if (substr_count($UserIP, ":") < 2)
{
$this->IP_Version = false;
return false;
}
// ::1 or 2001::0db8
if (... | php | {
"resource": ""
} |
q10466 | DlstatsHelper.checkIPv6 | train | protected function checkIPv6($UserIP = false)
{
// Check if IP present
if ($UserIP === false)
{
return false; // No IP, no search.
}
// search for user bot IP-filter definitions in localconfig.php
if (isset($GLOBALS['DLSTATS']['BOT_IPV6']))
{
foreach ($GLOBALS['DLSTATS']['BOT_IPV6'] as $lineleft)
... | php | {
"resource": ""
} |
q10467 | DlstatsHelper.checkIPv4 | train | protected function checkIPv4($UserIP = false)
{
// Check if IP present
if ($UserIP === false)
{
return false; // No IP, no search.
}
// search for user bot IP-filter definitions in localconfig.php
if (isset($GLOBALS['DLSTATS']['BOT_IPV4']))
{
foreach ($GLOBALS['DLSTATS']['BOT_IPV4'] as $lineleft)
... | php | {
"resource": ""
} |
q10468 | DlstatsHelper.dlstatsAnonymizeDomain | train | protected function dlstatsAnonymizeDomain()
{
if ($this->IP_Version === false || $this->IP === '0.0.0.0')
{
return '';
}
if (isset($GLOBALS['TL_CONFIG']['privacyAnonymizeIp']) &&
(bool) $GLOBALS['TL_CONFIG']['privacyAnonymizeIp'] === false)
{
// Anonymize is disabled
$domain = gethostbya... | php | {
"resource": ""
} |
q10469 | TextListConfig.add | train | public function add($element) {
$currentValue = $this->getRawValue();
if (!in_array($element, $currentValue)) {
$currentValue[] = $element;
$this->setRawValue($currentValue);
}
return $this;
} | php | {
"resource": ""
} |
q10470 | TextListConfig.remove | train | public function remove($element)
{
$currentValue = $this->getRawValue();
if (($key = array_search($element, $currentValue)) !== false) {
unset($currentValue[$key]);
$this->setRawValue($currentValue);
}
} | php | {
"resource": ""
} |
q10471 | JqPlot.useCursor | train | public function useCursor()
{
$this->files = array_merge_recursive( array( 'jqplot.cursor.js' ), $this->files );
$this->setNestedOptVal( $this->options, 'cursor', 'show', true );
$this->setNestedOptVal( $this->options, 'cursor', 'showTooltip', true );
return $this;
} | php | {
"resource": ""
} |
q10472 | JqPlot.setAxisOptions | train | public function setAxisOptions($axis, $name, $value)
{
if(strtolower($axis) === 'x' || strtolower($axis) === 'y') {
$axis = strtolower($axis) . 'axis';
if ( in_array( $name, array( 'min', 'max', 'numberTicks', 'tickInterval', 'numberTicks' ) ) ) {
$t... | php | {
"resource": ""
} |
q10473 | JqPlot.setType | train | public function setType( $type, $options = array(), $series = 'default' )
{
parent::setType( $type, $options, $series );
if ( $series == 'default' ) {
$rendererOptions = $this->types['default']->getRendererOptions();
if ( $renderer = $this->types['default']->getRenderer() ) {... | php | {
"resource": ""
} |
q10474 | JqPlot.getOptionsJS | train | protected function getOptionsJS()
{
$opts = $this->options;
foreach ( $opts['seriesStorage'] as $label => $options ) {
$options['label'] = $label;
$opts['series'][] = $options;
}
if ( $this->chart->titleHidden() ) {
unset( $opts['title'] );
... | php | {
"resource": ""
} |
q10475 | JqPlot.setSeriesLabelSetting | train | public function setSeriesLabelSetting( $series, $name, $value )
{
if ( ( $name === 'location' && in_array( $value, array( 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw' ) ) )
||( in_array( $name, array( 'xpadding', 'ypadding', 'edgeTolerance', 'stackValue' ) ) ) ) {
return $this->setNe... | php | {
"resource": ""
} |
q10476 | TitleRenderer.preRender | train | public static function preRender( \Altamira\Chart $chart, array $styleOptions = array() )
{
if ( $chart->titleHidden() ) {
return '';
}
$tagType = isset( $styleOptions['titleTag'] ) ? $styleOptions['titleTag'] : 'h3';
$title = $chart->getTitle();
$output = <<<E... | php | {
"resource": ""
} |
q10477 | AdminGroups.getUserGroups | train | public function getUserGroups()
{
$groups = [];
foreach ($this->adminGroupConfiguration->getGroups() as $groupName) {
$groups[] = $this->getUserGroup("$groupName");
}
$groups[] = $this->getUserGroup('guest');
return $groups;
} | php | {
"resource": ""
} |
q10478 | AdminGroups.getLoginUserGroups | train | public function getLoginUserGroups($login)
{
$groupName = $this->adminGroupConfiguration->getLoginGroupName($login);
if (empty($groupName)) {
$groupName = 'guest';
}
return $this->getUserGroup("$groupName");
} | php | {
"resource": ""
} |
q10479 | AdminGroups.hasPermission | train | public function hasPermission($recipient, $permission)
{
if ($recipient instanceof Group) {
$check = true;
foreach ($recipient->getLogins() as $login) {
if ($this->hasLoginPermission($login, $permission) === false) {
$check = false;
... | php | {
"resource": ""
} |
q10480 | AdminGroups.hasGroupPermission | train | public function hasGroupPermission($groupName, $permission)
{
if (strpos($groupName, 'admin:') === 0) {
$groupName = str_replace("admin:", '', $groupName);
}
$logins = $this->adminGroupConfiguration->getGroupLogins($groupName);
if (!empty($logins)) {
return $... | php | {
"resource": ""
} |
q10481 | EmbedViewHelper.render | train | public function render($uri, $maxWidth = 0, $maxHeight = 0, $objectName = null)
{
$consumer = new Consumer();
$this->prepareRequestParameters($maxWidth, $maxHeight, $consumer);
$resourceObject = $consumer->consume($uri);
if ($resourceObject !== null) {
if ($objectName ... | php | {
"resource": ""
} |
q10482 | ActiveRecord.removeAll | train | public final function removeAll($whereParams): int
{
$whereParams = [$whereParams];
if ($whereParams[0] === null || $whereParams[0] === '') {
throw new InvalidValueException('You need to pass a parameter for delete action!');
}
$return = $this->db->getLink()->getAgent()
... | php | {
"resource": ""
} |
q10483 | ThriftyFileSession.end | train | public function end()
{
if ($this->isStarted()) {
if (is_callable($this->getCleanupCallback())) {
call_user_func($this->getCleanupCallback());
}
session_write_close();
}
return $this;
} | php | {
"resource": ""
} |
q10484 | ThriftyFileSession.setCleanupCallback | train | public function setCleanupCallback($callback)
{
if (!is_null($callback)
&& !is_callable($callback)
) {
throw new InvalidArgumentException("No callable function provided");
}
$this->cleanupCallback = $callback;
return $this;
} | php | {
"resource": ""
} |
q10485 | ThriftyFileSession.setCookieLifetime | train | public function setCookieLifetime($ttl)
{
if (!is_null($ttl)
&& !is_numeric($ttl)
) {
throw new InvalidArgumentException("No valid ttl provided");
}
$this->cookieLifetime = (int)$ttl;
return $this;
} | php | {
"resource": ""
} |
q10486 | ID.fixSforceId | train | public static function fixSforceId($shortId)
{
$shortId = (string)$shortId;
if (strlen($shortId) !== 15)
{
return new self($shortId);
}
$suffix = '';
for ($i = 0; $i < 3; $i++)
{
$flags = 0;
for ($j = 0; $j < 5; $j++)
... | php | {
"resource": ""
} |
q10487 | Entity.getRoot | train | public function getRoot()
{
$tmp_parent = $this->getParent();
$root = $tmp_parent;
while ($tmp_parent) {
$root = $tmp_parent;
$tmp_parent = $tmp_parent->getParent();
}
return $root;
} | php | {
"resource": ""
} |
q10488 | Entity.setValue | train | public function setValue($attribute_name, $attribute_value)
{
$value_holder = $this->getValueHolderFor($attribute_name);
$this->validation_results->setItem(
$attribute_name,
$value_holder->setValue($attribute_value, $this)
);
return $this->isValid();
} | php | {
"resource": ""
} |
q10489 | Entity.setValues | train | public function setValues(array $values)
{
foreach ($this->type->getAttributes()->getKeys() as $attribute_name) {
if (array_key_exists($attribute_name, $values)) {
$this->setValue($attribute_name, $values[$attribute_name]);
}
}
return $this->isValid()... | php | {
"resource": ""
} |
q10490 | Entity.toArray | train | public function toArray()
{
$attribute_values = [ self::OBJECT_TYPE => $this->getType()->getPrefix() ];
foreach ($this->value_holder_map as $attribute_name => $value_holder) {
$attribute_value = $value_holder->getValue();
if (is_object($attribute_value) && is_callable([ $at... | php | {
"resource": ""
} |
q10491 | Entity.isEqualTo | train | public function isEqualTo(EntityInterface $entity)
{
if ($entity->getType() !== $this->getType()) {
return false;
}
if ($this->getType()->getAttributes()->getSize() !== $this->value_holder_map->getSize()) {
return false;
}
foreach ($this->getType()->... | php | {
"resource": ""
} |
q10492 | Entity.addEntityChangedListener | train | public function addEntityChangedListener(EntityChangedListenerInterface $listener)
{
if (!$this->listeners->hasItem($listener)) {
$this->listeners->push($listener);
}
} | php | {
"resource": ""
} |
q10493 | Entity.removeEntityChangedListener | train | public function removeEntityChangedListener(EntityChangedListenerInterface $listener)
{
if ($this->listeners->hasItem($listener)) {
$this->listeners->removeItem($listener);
}
} | php | {
"resource": ""
} |
q10494 | Entity.onValueChanged | train | public function onValueChanged(ValueChangedEvent $event)
{
// @todo Possible optimization: only track events for EmbedRoot entities,
// what will save some memory when dealing with deeply nested embed structures.
$this->changes->push($event);
$this->propagateEntityChangedEvent($event... | php | {
"resource": ""
} |
q10495 | Entity.collateChildren | train | public function collateChildren(Closure $criteria, $recursive = true)
{
$entity_map = new EntityMap;
$nested_attribute_types = [ EmbeddedEntityListAttribute::CLASS, EntityReferenceListAttribute::CLASS ];
foreach ($this->getType()->getAttributes([], $nested_attribute_types) as $attribute) {
... | php | {
"resource": ""
} |
q10496 | WindowHelpFactory.getChatCommands | train | protected function getChatCommands(ManialinkInterface $manialink)
{
$login = $manialink->getUserGroup()->getLogins()[0];
return array_map(
function ($command) {
/** @var AbstractChatCommand $command */
return [
'command' => $command->g... | php | {
"resource": ""
} |
q10497 | WindowHelpFactory.callbackCallCommand | train | public function callbackCallCommand(ManialinkInterface $manialink, $login, $params, $arguments)
{
$this->chatCommandDataProvider->onPlayerChat(-1, $login, '/'.$arguments['command'], true);
} | php | {
"resource": ""
} |
q10498 | WindowHelpFactory.callbackDescription | train | public function callbackDescription(ManialinkInterface $manialink, $login, $params, $arguments)
{
$chatCommands = $this->chatCommands->getChatCommands();
$this->windowHelpDetailsFactory->setCurrentCommand($chatCommands[$arguments['command']]);
$this->windowHelpDetailsFactory->create($login)... | php | {
"resource": ""
} |
q10499 | ErrorObject.addError | train | public function addError(string $msg, string ...$args): void
{
$this->errors[] = sprintf($msg, ...$args);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.