_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q11300 | LdapFetcher.fullFetch | train | public function fullFetch($uSNChangedTo)
{
$searchFilter = Filter::andFilter(
Filter::greaterOrEqual('uSNChanged', 0),
Filter::lessOrEqual('uSNChanged', $uSNChangedTo)
);
if ($this->fullSyncEntryFilter) {
$searchFilter = $searchFilter->addAnd($this->fullSyncEntryFilter);
}
$entries = $this->search($searchFilter);
return $entries;
} | php | {
"resource": ""
} |
q11301 | LdapFetcher.incrementalFetch | train | public function incrementalFetch($uSNChangedFrom, $uSNChangedTo, $detectDeleted = false)
{
// fetch changed
$changedFilter = Filter::andFilter(
Filter::greaterOrEqual('uSNChanged', $uSNChangedFrom),
Filter::lessOrEqual('uSNChanged', $uSNChangedTo)
);
if ($this->incrementalSyncEntryFilter) {
$changedFilter = $changedFilter->addAnd($this->incrementalSyncEntryFilter);
}
$changed = $this->search($changedFilter);
// fetch deleted
$deleted = [];
if ($detectDeleted) {
$defaultNamingContext = $this->getRootDse()->getDefaultNamingContext();
$options = $this->ldap->getOptions();
$originalHost = isset($options['host']) ? $options['host'] : '';
$hostForDeleted = rtrim($originalHost, "/") . "/" .urlencode(
sprintf("<WKGUID=%s,%s>", self::WK_GUID_DELETED_OBJECTS_CONTAINER_W, $defaultNamingContext)
)
;
// hack that workarounds zendframework/zend-ldap connection issues.
// should be removed after resolution of https://github.com/zendframework/zend-ldap/pull/69
if (!preg_match('~^ldap(?:i|s)?://~', $hostForDeleted)) {
$schema = "ldap://";
if ((isset($options['port']) && $options['port'] == 636) || (isset($options['useSsl']) && $options['useSsl'] == true)) {
$schema = "ldaps://";
}
$hostForDeleted = $schema.$hostForDeleted;
}
// end of hack
$options['host'] = $hostForDeleted;
// force reconnection for search of deleted entries
$this->ldap->setOptions($options);
$this->ldap->disconnect();
$deletedFilter = Filter::andFilter(
Filter::equals('isDeleted', 'TRUE'),
Filter::greaterOrEqual('uSNChanged', $uSNChangedFrom),
Filter::lessOrEqual('uSNChanged', $uSNChangedTo)
);
if ($this->deletedSyncEntryFilter) {
$deletedFilter = $deletedFilter->addAnd($this->deletedSyncEntryFilter);
}
$deleted = $this->search($deletedFilter);
}
return [$changed, $deleted];
} | php | {
"resource": ""
} |
q11302 | LdapFetcher.getRootDse | train | private function getRootDse()
{
if (!$this->rootDse) {
$rootDse = $this->ldap->getRootDse();
if (!$rootDse instanceof ActiveDirectory) {
throw new UnsupportedRootDseException($rootDse);
}
$this->rootDse = $rootDse;
}
return $this->rootDse;
} | php | {
"resource": ""
} |
q11303 | LdapFetcher.setupEntryFilter | train | private function setupEntryFilter($entryFilter)
{
if ($entryFilter == null) {
return null;
}
if (is_string($entryFilter)) {
$filter = new Filter\StringFilter($entryFilter);
} elseif ($entryFilter instanceof AbstractFilter) {
$filter = $entryFilter;
} else {
throw new InvalidArgumentException(
sprintf(
'baseEntryFilter argument must be either instance of %s or string. %s given',
AbstractFilter::class,
gettype($entryFilter)
)
);
}
return $filter;
} | php | {
"resource": ""
} |
q11304 | LdapFetcher.search | train | private function search(AbstractFilter $filter)
{
if ($this->ldapSearchOptions) {
$ldapResource = $this->ldap->getResource();
foreach ($this->ldapSearchOptions as $name => $options) {
ldap_set_option($ldapResource, $name, $options);
}
}
return $this->ldap->searchEntries($filter, null, Ldap::SEARCH_SCOPE_SUB, $this->entryAttributesToFetch);
} | php | {
"resource": ""
} |
q11305 | ValueHolder.setValue | train | public function setValue($value, EntityInterface $entity = null)
{
$attribute_validator = $this->getAttribute()->getValidator();
$validation_result = $attribute_validator->validate($value, $entity);
if ($validation_result->getSeverity() <= IncidentInterface::NOTICE) {
$previous_native_value = $this->toNative();
$this->value = $validation_result->getSanitizedValue();
if (!$this->sameValueAs($previous_native_value)) {
$value_changed_event = $this->createValueHolderChangedEvent($previous_native_value);
$this->propagateValueChangedEvent($value_changed_event);
}
if ($this->value instanceof CollectionInterface) {
$this->value->addListener($this);
}
if ($this->value instanceof EntityList) {
$this->value->addEntityChangedListener($this);
}
}
return $validation_result;
} | php | {
"resource": ""
} |
q11306 | ValueHolder.sameValueAs | train | public function sameValueAs($other_value)
{
$null_value = $this->attribute->getNullValue();
if ($null_value === $this->getValue() && $null_value === $other_value) {
return true;
}
$validation_result = $this->getAttribute()->getValidator()->validate($other_value);
if ($validation_result->getSeverity() !== IncidentInterface::SUCCESS) {
return false;
}
return $this->valueEquals($validation_result->getSanitizedValue());
} | php | {
"resource": ""
} |
q11307 | ValueHolder.isEqualTo | train | public function isEqualTo(ValueHolderInterface $other_value_holder)
{
if (get_class($this) !== get_class($other_value_holder)) {
return false;
}
return $this->sameValueAs($other_value_holder->getValue());
} | php | {
"resource": ""
} |
q11308 | ValueHolder.addValueChangedListener | train | public function addValueChangedListener(ValueChangedListenerInterface $listener)
{
if (!$this->listeners->hasItem($listener)) {
$this->listeners->push($listener);
}
} | php | {
"resource": ""
} |
q11309 | ValueHolder.removedValueChangedListener | train | public function removedValueChangedListener(ValueChangedListenerInterface $listener)
{
if ($this->listeners->hasItem($listener)) {
$this->listeners->removeItem($listener);
}
} | php | {
"resource": ""
} |
q11310 | ValueHolder.onEntityChanged | train | public function onEntityChanged(EntityChangedEvent $embedded_entity_event)
{
$value_changed_event = $embedded_entity_event->getValueChangedEvent();
$this->propagateValueChangedEvent(
new ValueChangedEvent(
array(
'attribute_name' => $value_changed_event->getAttributeName(),
'prev_value' => $value_changed_event->getOldValue(),
'value' => $value_changed_event->getNewValue(),
'embedded_event' => $embedded_entity_event
)
)
);
} | php | {
"resource": ""
} |
q11311 | ValueHolder.propagateValueChangedEvent | train | protected function propagateValueChangedEvent(ValueChangedEvent $event)
{
foreach ($this->listeners as $listener) {
$listener->onValueChanged($event);
}
} | php | {
"resource": ""
} |
q11312 | ValueHolder.createValueHolderChangedEvent | train | protected function createValueHolderChangedEvent($prev_value, EventInterface $embedded_event = null)
{
return new ValueChangedEvent(
array(
'attribute_name' => $this->getAttribute()->getName(),
'prev_value' => $prev_value,
'value' => $this->toNative(),
'embedded_event' => $embedded_event
)
);
} | php | {
"resource": ""
} |
q11313 | EventHandlerResolver.resolveHandlingMethod | train | protected function resolveHandlingMethod($eventType)
{
// Remove namespace
$pos = strrpos($eventType, '\\');
if ($pos !== false) {
$eventType = substr($eventType, $pos + 1);
}
// Remove "Event" suffix
if (substr($eventType, -5) === 'Event') {
$eventType = substr($eventType, 0, -5);
}
return 'on' . $eventType;
} | php | {
"resource": ""
} |
q11314 | Configurable.setOptions | train | protected function setOptions($options)
{
if (!$options instanceof OptionsInterface) {
$options = is_array($options) ? $options : [];
$options = new Options($options);
}
$this->options = $options;
} | php | {
"resource": ""
} |
q11315 | ValidatorWithExclusion.shouldSkip | train | protected function shouldSkip($object, $propertyPath)
{
if (!\is_object($object) && !\is_array($object)) {
return false;
}
if (!empty($propertyPath)) {
$parts = \explode('.', $propertyPath);
$accessor = new PropertyAccessor();
$parent = $object;
foreach ($parts as $childSubPath) {
if ($parent instanceof EntityInterface && $this->shouldSkipObjectProperty($parent, $childSubPath)) {
return true;
}
if ($accessor->isReadable($parent, $childSubPath)) {
$parent = $accessor->getValue($parent, $childSubPath);
} else {
return false;
}
}
}
return false;
} | php | {
"resource": ""
} |
q11316 | UseAs.getAliasForClassname | train | public function getAliasForClassname(Classname $class)
{
foreach ($this->classnames as $c) {
if ($c['classname']->equals($class)) {
return str_replace('\\', '_', ltrim($class->classname, '\\'));
}
}
return str_replace('\\', '_', ltrim($class->classname, '\\'));
} | php | {
"resource": ""
} |
q11317 | Context.getParameter | train | private function getParameter($paramName)
{
if (array_key_exists($paramName, $_REQUEST))
{
return str_replace(FileUtil::Slash().FileUtil::Slash(), FileUtil::Slash(), $_REQUEST[$paramName]);
}
else
{
return "";
}
} | php | {
"resource": ""
} |
q11318 | Context.get | train | public function get($key, $persistent = false)
{
if ($persistent) {
$origKey = $key;
$key = "PVALUE.$key";
}
$key = strtoupper($key);
if (isset($this->_config[$key]))
{
$value = $this->_config[$key];
if ($value instanceof IProcessParameter)
{
return $value->getParameter();
}
else
{
return $value;
}
}
elseif ($persistent)
{
if ($this->get($origKey) != "")
$value = $this->get($origKey);
else if ($this->getSession($key))
$value = $this->getSession($key);
else
$value = "";
$this->setSession($key, $value);
$this->set($key, $value);
return $value;
}
else
{
return "";
}
} | php | {
"resource": ""
} |
q11319 | Context.authenticatedUser | train | public function authenticatedUser()
{
if ($this->IsAuthenticated())
{
$user = UserContext::getInstance()->userInfo();
return $user[$this->getUsersDatabase()->getUserTable()->username];
}
else
{
return "";
}
} | php | {
"resource": ""
} |
q11320 | Context.MakeLogin | train | public function MakeLogin($user, $id)
{
$userObj = $this->getUsersDatabase()->getById($id);
UserContext::getInstance()->registerLogin($userObj->toArray());
} | php | {
"resource": ""
} |
q11321 | Context.AddCollectionToConfig | train | private function AddCollectionToConfig($collection)
{
foreach($collection as $key=>$value)
{
if ($key[0] == '/')
$this->_virtualCommand = str_replace('_', '.', substr($key, 1));
$this->addPairToConfig($key, $value);
}
} | php | {
"resource": ""
} |
q11322 | Context.AddSessionToConfig | train | private function AddSessionToConfig($collection)
{
if (is_array($collection))
{
foreach($collection as $key => $value)
{
$this->addPairToConfig('session.' . $key, $value);
}
}
} | php | {
"resource": ""
} |
q11323 | Context.AddCookieToConfig | train | private function AddCookieToConfig($collection)
{
foreach($collection as $key => $value)
{
$this->addPairToConfig('cookie.' . $key, $value);
}
} | php | {
"resource": ""
} |
q11324 | Context.redirectUrl | train | public function redirectUrl($url)
{
$processor = new ParamProcessor();
$url = $processor->GetFullLink($url);
$url = str_replace("&", "&", $url);
// IIS running CGI mode has a bug related to POST and header(LOCATION) to the SAME script.
// In this environment the behavior expected causes a loop to the same page
// To reproduce this behavior comment the this and try use any processpage state class
$isBugVersion = stristr(PHP_OS, "win") && stristr($this->get("GATEWAY_INTERFACE"), "cgi") && stristr($this->get("SERVER_SOFTWARE"), "iis");
ob_clean();
if (!$isBugVersion)
{
header("Location: " . $url);
}
echo "<html>";
echo "<head>";
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1;URL=$url\">";
echo "<style type='text/css'> ";
echo " #logo{";
echo " width:32px;";
echo " height:32px;";
echo " top: 50%;";
echo " left: 50%;";
echo " margin-top: -16px;";
echo " margin-left: -16px;";
echo " position:absolute;";
echo "} </style>";
echo "</head>";
echo "<h1></h1>";
echo "<div id='logo'><a href='$url'><img src='common/imgs/ajax-loader.gif' border='0' title='If this page does not refresh, Click here' alt='If this page does not refresh, Click here' /></a></div>";
echo "</html>";
exit;
} | php | {
"resource": ""
} |
q11325 | Context.getUploadFileNames | train | public function getUploadFileNames($systemArray=false)
{
if ($systemArray)
{
return $_FILES;
}
else
{
$ret = array();
foreach($_FILES as $file => $property)
{
$ret[$file] = $property["name"];
}
}
return $ret;
} | php | {
"resource": ""
} |
q11326 | Context.processUpload | train | public function processUpload($filenameProcessor, $useProcessorForName, $field = null)
{
if (!($filenameProcessor instanceof UploadFilenameProcessor))
{
throw new UploadUtilException("processUpload must receive a UploadFilenameProcessor class");
}
else if (is_null($field))
{
$ret = array();
foreach($_FILES as $file => $property)
{
$ret[] = $this->processUpload($filenameProcessor, $useProcessorForName, $property);
}
return $ret;
}
else if (is_string($field))
{
$ret = array();
$ret[] = $this->processUpload($filenameProcessor, $useProcessorForName, $_FILES[$field]);
return $ret;
}
else if (is_array($field))
{
if ($useProcessorForName)
{
$uploadfile = $filenameProcessor->FullQualifiedNameAndPath();
}
else
{
$uploadfile = $filenameProcessor->PathSuggested() . FileUtil::Slash() . $field["name"];
}
if (move_uploaded_file($field['tmp_name'], $uploadfile))
{
return $uploadfile;
}
else
{
$message = "Unknow error: " . $field['error'];
switch ($field['error'])
{
case UPLOAD_ERR_CANT_WRITE:
$message = "Can't write";
break;
case UPLOAD_ERR_EXTENSION:
$message = "Extension is not permitted";
break;
case UPLOAD_ERR_FORM_SIZE:
$message = "Max post size reached";
break;
case UPLOAD_ERR_INI_SIZE:
$message = "Max system size reached";
break;
case UPLOAD_ERR_NO_FILE:
$message = "No file was uploaded";
break;
case UPLOAD_ERR_NO_TMP_DIR:
$message = "No temp dir";
break;
case UPLOAD_ERR_PARTIAL:
$message = "The uploaded file was only partially uploaded";
break;
}
throw new UploadUtilException($message);
}
}
else
{
throw new UploadUtilException("Something is wrong with Upload file.");
}
} | php | {
"resource": ""
} |
q11327 | Context.getSuggestedContentType | train | public function getSuggestedContentType()
{
if (count($this->_contentType) == 0)
{
$this->_contentType["xsl"] = $this->getXsl();
$this->_contentType["content-type"] = "text/html";
$this->_contentType["content-disposition"] = "";
$this->_contentType["extension"] = "";
if ($this->get("xmlnuke.CHECKCONTENTTYPE"))
{
$filename = new AnydatasetFilenameProcessor("contenttype");
$anydataset = new AnyDataset($filename->FullQualifiedNameAndPath());
$itf = new IteratorFilter();
$itf->addRelation("xsl", Relation::EQUAL, $this->getXsl());
$it = $anydataset->getIterator($itf);
if ($it->hasNext())
{
$sr = $it->moveNext();
$this->_contentType = $sr->getOriginalRawFormat();
}
else
{
$filename = new AnydatasetSetupFilenameProcessor("contenttype");
$anydataset = new AnyDataset($filename->FullQualifiedNameAndPath());
$itf = new IteratorFilter();
$itf->addRelation("xsl", Relation::EQUAL, $this->getXsl());
$it = $anydataset->getIterator($itf);
if ($it->hasNext())
{
$sr = $it->moveNext();
$this->_contentType = $sr->getOriginalRawFormat();
}
}
}
}
return ($this->_contentType);
} | php | {
"resource": ""
} |
q11328 | Price.createFromArray | train | public static function createFromArray($properties, string $priceType = self::GROSS, $validate = true)
{
if (!is_array($properties) && !$properties instanceof Traversable) {
throw new InvalidArgumentException("prices must be iterable");
}
$price = new static(null, $priceType);
// Make sure default type is set first in order to be able to sanitize sign of other properties
if (isset($properties[$priceType])) {
$properties = [$priceType => $properties[$priceType]] + $properties;
}
foreach ($properties as $property => $value) {
$value = Text::trim($value);
if (mb_strlen($value)) {
$value = ConvertPrice::getInstance()->sanitize($value);
$price->set($property, $value, false, true);
}
}
if (count($properties) > 1) {
$price->calculate();
}
if ($validate) {
$price->validate();
}
return $price;
} | php | {
"resource": ""
} |
q11329 | DirectAdminClient.da_request | train | public function da_request(string $method, string $uri = '', array $options = []): array
{
$this->lastRequest = microtime(true);
try {
$response = $this->request($method, $uri, $options);
}
catch(\Exception $e) {
if($e instanceof RequestException) {
throw new DirectAdminRequestException(sprintf('DirectAdmin %s %s request failed.', $method, $uri));
}
if($e instanceof TransferException) {
throw new DirectAdminTransferException(sprintf('DirectAdmin %s %s transfer failed.', $method, $uri));
}
}
if($response->getHeader('Content-Type')[0] === 'text/html') {
throw new DirectAdminBadContentException(sprintf('DirectAdmin %s %s returned text/html.', $method, $uri));
}
$body = $response->getBody()->getContents();
return $this->responseToArray($body);
} | php | {
"resource": ""
} |
q11330 | CustomConfig.generateLanguageInput | train | protected function generateLanguageInput($form)
{
$curValueArray = $this->_context->get("xmlnuke.LANGUAGESAVAILABLE");
foreach ($curValueArray as $key => $value)
{
$form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "languagesavailable$key", "xmlnuke.LANGUAGESAVAILABLE", $this->getLangArray(), $value));
}
$form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "languagesavailable" . ++$key, "xmlnuke.LANGUAGESAVAILABLE", $this->getLangArray()));
$form->addXmlnukeObject(new XmlEasyList(EasyListType::SELECTLIST, "languagesavailable" . ++$key, "xmlnuke.LANGUAGESAVAILABLE", $this->getLangArray()));
$form->addXmlnukeObject(new XmlInputHidden("languagesavailable", $key));
} | php | {
"resource": ""
} |
q11331 | ConnectionFactory.needsRelogin | train | private function needsRelogin(SfdcConnectionInterface $con)
{
return ! $con->isLoggedIn() || (time() - $con->getLastLoginTime()) > $this->connectionTTL;
} | php | {
"resource": ""
} |
q11332 | Blacklist.getMinutesUntilExpired | train | protected function getMinutesUntilExpired(Payload $payload)
{
$exp = Utils::timestamp($payload['exp']);
$iat = Utils::timestamp($payload['iat']);
// get the latter of the two expiration dates and find
// the number of minutes until the expiration date,
// plus 1 minute to avoid overlap
return $exp->max($iat->addMinutes($this->refreshTTL))->addMinute()->diffInMinutes();
} | php | {
"resource": ""
} |
q11333 | MxmapQuery.filterByTrackuid | train | public function filterByTrackuid($trackuid = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($trackuid)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_TRACKUID, $trackuid, $comparison);
} | php | {
"resource": ""
} |
q11334 | MxmapQuery.filterByGbxmapname | train | public function filterByGbxmapname($gbxmapname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($gbxmapname)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_GBXMAPNAME, $gbxmapname, $comparison);
} | php | {
"resource": ""
} |
q11335 | MxmapQuery.filterByTrackid | train | public function filterByTrackid($trackid = null, $comparison = null)
{
if (is_array($trackid)) {
$useMinMax = false;
if (isset($trackid['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_TRACKID, $trackid['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($trackid['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_TRACKID, $trackid['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_TRACKID, $trackid, $comparison);
} | php | {
"resource": ""
} |
q11336 | MxmapQuery.filterByUserid | train | public function filterByUserid($userid = null, $comparison = null)
{
if (is_array($userid)) {
$useMinMax = false;
if (isset($userid['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_USERID, $userid['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($userid['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_USERID, $userid['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_USERID, $userid, $comparison);
} | php | {
"resource": ""
} |
q11337 | MxmapQuery.filterByUploadedat | train | public function filterByUploadedat($uploadedat = null, $comparison = null)
{
if (is_array($uploadedat)) {
$useMinMax = false;
if (isset($uploadedat['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_UPLOADEDAT, $uploadedat['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($uploadedat['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_UPLOADEDAT, $uploadedat['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_UPLOADEDAT, $uploadedat, $comparison);
} | php | {
"resource": ""
} |
q11338 | MxmapQuery.filterByUpdatedat | train | public function filterByUpdatedat($updatedat = null, $comparison = null)
{
if (is_array($updatedat)) {
$useMinMax = false;
if (isset($updatedat['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_UPDATEDAT, $updatedat['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedat['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_UPDATEDAT, $updatedat['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_UPDATEDAT, $updatedat, $comparison);
} | php | {
"resource": ""
} |
q11339 | MxmapQuery.filterByMaptype | train | public function filterByMaptype($maptype = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($maptype)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_MAPTYPE, $maptype, $comparison);
} | php | {
"resource": ""
} |
q11340 | MxmapQuery.filterByTitlepack | train | public function filterByTitlepack($titlepack = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($titlepack)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_TITLEPACK, $titlepack, $comparison);
} | php | {
"resource": ""
} |
q11341 | MxmapQuery.filterByStylename | train | public function filterByStylename($stylename = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($stylename)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_STYLENAME, $stylename, $comparison);
} | php | {
"resource": ""
} |
q11342 | MxmapQuery.filterByDisplaycost | train | public function filterByDisplaycost($displaycost = null, $comparison = null)
{
if (is_array($displaycost)) {
$useMinMax = false;
if (isset($displaycost['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_DISPLAYCOST, $displaycost['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($displaycost['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_DISPLAYCOST, $displaycost['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_DISPLAYCOST, $displaycost, $comparison);
} | php | {
"resource": ""
} |
q11343 | MxmapQuery.filterByModname | train | public function filterByModname($modname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($modname)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_MODNAME, $modname, $comparison);
} | php | {
"resource": ""
} |
q11344 | MxmapQuery.filterByLightmap | train | public function filterByLightmap($lightmap = null, $comparison = null)
{
if (is_array($lightmap)) {
$useMinMax = false;
if (isset($lightmap['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_LIGHTMAP, $lightmap['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($lightmap['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_LIGHTMAP, $lightmap['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_LIGHTMAP, $lightmap, $comparison);
} | php | {
"resource": ""
} |
q11345 | MxmapQuery.filterByExeversion | train | public function filterByExeversion($exeversion = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($exeversion)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_EXEVERSION, $exeversion, $comparison);
} | php | {
"resource": ""
} |
q11346 | MxmapQuery.filterByExebuild | train | public function filterByExebuild($exebuild = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($exebuild)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_EXEBUILD, $exebuild, $comparison);
} | php | {
"resource": ""
} |
q11347 | MxmapQuery.filterByEnvironmentname | train | public function filterByEnvironmentname($environmentname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($environmentname)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_ENVIRONMENTNAME, $environmentname, $comparison);
} | php | {
"resource": ""
} |
q11348 | MxmapQuery.filterByVehiclename | train | public function filterByVehiclename($vehiclename = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($vehiclename)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_VEHICLENAME, $vehiclename, $comparison);
} | php | {
"resource": ""
} |
q11349 | MxmapQuery.filterByUnlimiterrequired | train | public function filterByUnlimiterrequired($unlimiterrequired = null, $comparison = null)
{
if (is_string($unlimiterrequired)) {
$unlimiterrequired = in_array(strtolower($unlimiterrequired), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(MxmapTableMap::COL_UNLIMITERREQUIRED, $unlimiterrequired, $comparison);
} | php | {
"resource": ""
} |
q11350 | MxmapQuery.filterByRoutename | train | public function filterByRoutename($routename = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($routename)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_ROUTENAME, $routename, $comparison);
} | php | {
"resource": ""
} |
q11351 | MxmapQuery.filterByLengthname | train | public function filterByLengthname($lengthname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($lengthname)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_LENGTHNAME, $lengthname, $comparison);
} | php | {
"resource": ""
} |
q11352 | MxmapQuery.filterByLaps | train | public function filterByLaps($laps = null, $comparison = null)
{
if (is_array($laps)) {
$useMinMax = false;
if (isset($laps['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_LAPS, $laps['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($laps['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_LAPS, $laps['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_LAPS, $laps, $comparison);
} | php | {
"resource": ""
} |
q11353 | MxmapQuery.filterByDifficultyname | train | public function filterByDifficultyname($difficultyname = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($difficultyname)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_DIFFICULTYNAME, $difficultyname, $comparison);
} | php | {
"resource": ""
} |
q11354 | MxmapQuery.filterByReplaytypename | train | public function filterByReplaytypename($replaytypename = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($replaytypename)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_REPLAYTYPENAME, $replaytypename, $comparison);
} | php | {
"resource": ""
} |
q11355 | MxmapQuery.filterByReplaywrid | train | public function filterByReplaywrid($replaywrid = null, $comparison = null)
{
if (is_array($replaywrid)) {
$useMinMax = false;
if (isset($replaywrid['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_REPLAYWRID, $replaywrid['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($replaywrid['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_REPLAYWRID, $replaywrid['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_REPLAYWRID, $replaywrid, $comparison);
} | php | {
"resource": ""
} |
q11356 | MxmapQuery.filterByReplaywrtime | train | public function filterByReplaywrtime($replaywrtime = null, $comparison = null)
{
if (is_array($replaywrtime)) {
$useMinMax = false;
if (isset($replaywrtime['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_REPLAYWRTIME, $replaywrtime['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($replaywrtime['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_REPLAYWRTIME, $replaywrtime['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_REPLAYWRTIME, $replaywrtime, $comparison);
} | php | {
"resource": ""
} |
q11357 | MxmapQuery.filterByReplaywruserid | train | public function filterByReplaywruserid($replaywruserid = null, $comparison = null)
{
if (is_array($replaywruserid)) {
$useMinMax = false;
if (isset($replaywruserid['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_REPLAYWRUSERID, $replaywruserid['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($replaywruserid['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_REPLAYWRUSERID, $replaywruserid['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_REPLAYWRUSERID, $replaywruserid, $comparison);
} | php | {
"resource": ""
} |
q11358 | MxmapQuery.filterByReplaywrusername | train | public function filterByReplaywrusername($replaywrusername = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($replaywrusername)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_REPLAYWRUSERNAME, $replaywrusername, $comparison);
} | php | {
"resource": ""
} |
q11359 | MxmapQuery.filterByRatingvotecount | train | public function filterByRatingvotecount($ratingvotecount = null, $comparison = null)
{
if (is_array($ratingvotecount)) {
$useMinMax = false;
if (isset($ratingvotecount['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_RATINGVOTECOUNT, $ratingvotecount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($ratingvotecount['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_RATINGVOTECOUNT, $ratingvotecount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_RATINGVOTECOUNT, $ratingvotecount, $comparison);
} | php | {
"resource": ""
} |
q11360 | MxmapQuery.filterByRatingvoteaverage | train | public function filterByRatingvoteaverage($ratingvoteaverage = null, $comparison = null)
{
if (is_array($ratingvoteaverage)) {
$useMinMax = false;
if (isset($ratingvoteaverage['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_RATINGVOTEAVERAGE, $ratingvoteaverage['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($ratingvoteaverage['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_RATINGVOTEAVERAGE, $ratingvoteaverage['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_RATINGVOTEAVERAGE, $ratingvoteaverage, $comparison);
} | php | {
"resource": ""
} |
q11361 | MxmapQuery.filterByReplaycount | train | public function filterByReplaycount($replaycount = null, $comparison = null)
{
if (is_array($replaycount)) {
$useMinMax = false;
if (isset($replaycount['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_REPLAYCOUNT, $replaycount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($replaycount['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_REPLAYCOUNT, $replaycount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_REPLAYCOUNT, $replaycount, $comparison);
} | php | {
"resource": ""
} |
q11362 | MxmapQuery.filterByTrackvalue | train | public function filterByTrackvalue($trackvalue = null, $comparison = null)
{
if (is_array($trackvalue)) {
$useMinMax = false;
if (isset($trackvalue['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_TRACKVALUE, $trackvalue['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($trackvalue['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_TRACKVALUE, $trackvalue['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_TRACKVALUE, $trackvalue, $comparison);
} | php | {
"resource": ""
} |
q11363 | MxmapQuery.filterByComments | train | public function filterByComments($comments = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($comments)) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_COMMENTS, $comments, $comparison);
} | php | {
"resource": ""
} |
q11364 | MxmapQuery.filterByCommentscount | train | public function filterByCommentscount($commentscount = null, $comparison = null)
{
if (is_array($commentscount)) {
$useMinMax = false;
if (isset($commentscount['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_COMMENTSCOUNT, $commentscount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($commentscount['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_COMMENTSCOUNT, $commentscount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_COMMENTSCOUNT, $commentscount, $comparison);
} | php | {
"resource": ""
} |
q11365 | MxmapQuery.filterByAwardcount | train | public function filterByAwardcount($awardcount = null, $comparison = null)
{
if (is_array($awardcount)) {
$useMinMax = false;
if (isset($awardcount['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_AWARDCOUNT, $awardcount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($awardcount['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_AWARDCOUNT, $awardcount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_AWARDCOUNT, $awardcount, $comparison);
} | php | {
"resource": ""
} |
q11366 | MxmapQuery.filterByHasscreenshot | train | public function filterByHasscreenshot($hasscreenshot = null, $comparison = null)
{
if (is_string($hasscreenshot)) {
$hasscreenshot = in_array(strtolower($hasscreenshot), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(MxmapTableMap::COL_HASSCREENSHOT, $hasscreenshot, $comparison);
} | php | {
"resource": ""
} |
q11367 | MxmapQuery.filterByHasthumbnail | train | public function filterByHasthumbnail($hasthumbnail = null, $comparison = null)
{
if (is_string($hasthumbnail)) {
$hasthumbnail = in_array(strtolower($hasthumbnail), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(MxmapTableMap::COL_HASTHUMBNAIL, $hasthumbnail, $comparison);
} | php | {
"resource": ""
} |
q11368 | MxmapQuery.filterByHasghostblocks | train | public function filterByHasghostblocks($hasghostblocks = null, $comparison = null)
{
if (is_string($hasghostblocks)) {
$hasghostblocks = in_array(strtolower($hasghostblocks), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(MxmapTableMap::COL_HASGHOSTBLOCKS, $hasghostblocks, $comparison);
} | php | {
"resource": ""
} |
q11369 | MxmapQuery.filterByEmbeddedobjectscount | train | public function filterByEmbeddedobjectscount($embeddedobjectscount = null, $comparison = null)
{
if (is_array($embeddedobjectscount)) {
$useMinMax = false;
if (isset($embeddedobjectscount['min'])) {
$this->addUsingAlias(MxmapTableMap::COL_EMBEDDEDOBJECTSCOUNT, $embeddedobjectscount['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($embeddedobjectscount['max'])) {
$this->addUsingAlias(MxmapTableMap::COL_EMBEDDEDOBJECTSCOUNT, $embeddedobjectscount['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(MxmapTableMap::COL_EMBEDDEDOBJECTSCOUNT, $embeddedobjectscount, $comparison);
} | php | {
"resource": ""
} |
q11370 | MxmapQuery.filterByMap | train | public function filterByMap($map, $comparison = null)
{
if ($map instanceof \eXpansion\Bundle\Maps\Model\Map) {
return $this
->addUsingAlias(MxmapTableMap::COL_TRACKUID, $map->getMapuid(), $comparison);
} elseif ($map instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(MxmapTableMap::COL_TRACKUID, $map->toKeyValue('PrimaryKey', 'Mapuid'), $comparison);
} else {
throw new PropelException('filterByMap() only accepts arguments of type \eXpansion\Bundle\Maps\Model\Map or Collection');
}
} | php | {
"resource": ""
} |
q11371 | MxmapQuery.useMapQuery | train | public function useMapQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinMap($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Map', '\eXpansion\Bundle\Maps\Model\MapQuery');
} | php | {
"resource": ""
} |
q11372 | LogglyFormatter.format | train | public function format(array $record)
{
if (isset($record["datetime"]) && ($record["datetime"] instanceof \DateTime)) {
$record["timestamp"] = $record["datetime"]->format("Y-m-d\TH:i:s.uO");
// TODO 2.0 unset the 'datetime' parameter, retained for BC
}
return parent::format($record);
} | php | {
"resource": ""
} |
q11373 | SuccessController.init | train | public function init()
{
parent::init();
$reservation = $this->getReservation();
// If we get to the success controller form any state except PENDING or PAID
// This would mean someone would be clever and change the url from summary to success bypassing the payment
// End the session, thus removing the reservation, and redirect back
if (!in_array($reservation->Status, array('PENDING', 'PAID'))) {
ReservationSession::end();
$this->redirect($this->Link('/'));
} elseif ($reservation->Status !== 'PAID') {
// todo move to TicketPayment::onCaptured()
$this->extend('afterPaymentComplete', $reservation);
}
} | php | {
"resource": ""
} |
q11374 | Config.loadAndMerge | train | public function loadAndMerge(string $filename)
{
# Attempt to load config file
if ( \file_exists($filename) ) {
# Set filename
$this->filename = $filename;
# Load the config
$configArray = \json_decode( \file_get_contents($filename), true);
if ($configArray) {
// $configArray = $this->array_change_key_case_recursive($configArray); // Lowercase the keys
# Merge the Config with existing config
$this->confValues = \array_replace_recursive($this->confValues, $configArray);
} else {
throw new SpinException('Invalid JSON file "'.$filename.'"');
}
}
return $this;
} | php | {
"resource": ""
} |
q11375 | NativeMailerHandler.addHeader | train | public function addHeader($headers)
{
foreach ((array) $headers as $header) {
if (strpos($header, "\n") !== false || strpos($header, "\r") !== false) {
throw new \InvalidArgumentException('Headers can not contain newline characters for security reasons');
}
$this->headers[] = $header;
}
return $this;
} | php | {
"resource": ""
} |
q11376 | Dlstats.logDLStats | train | protected function logDLStats()
{
$q = \Database::getInstance()->prepare("SELECT id FROM `tl_dlstats` WHERE `filename`=?")
->execute($this->_filename);
if ($q->next())
{
$this->_statId = $q->id;
\Database::getInstance()->prepare("UPDATE `tl_dlstats` SET `tstamp`=?, `downloads`=`downloads`+1 WHERE `id`=?")
->execute(time(), $this->_statId);
}
else
{
$q = \Database::getInstance()->prepare("INSERT IGNORE INTO `tl_dlstats` %s")
->set(array('tstamp' => time(),
'filename' => $this->_filename,
'downloads' => 1)
)
->execute();
$this->_statId = $q->insertId;
} // if
$this->setBlockingIP($this->IP, $this->_filename);
} | php | {
"resource": ""
} |
q11377 | Vote.countVote | train | protected function countVote($toCount)
{
$value = 0;
foreach ($this->votes as $login => $vote) {
if ($vote === $toCount) {
$value++;
}
}
return $value;
} | php | {
"resource": ""
} |
q11378 | BaseController.generateEtag | train | protected function generateEtag(\DateTime $timeStamp)
{
$user = $this->securityService->findGitUser();
$userString = '';
if (null !== $user) {
$userString = $user->getGitUserName();
}
return md5($timeStamp->getTimestamp() . $userString);
} | php | {
"resource": ""
} |
q11379 | FileSystemTrait.scanDirectory | train | public function scanDirectory($directory)
{
$extensions = $this->getOption('extensions');
foreach (scandir($directory) as $object) {
if ($object === '.' || $object === '..') {
continue;
}
$inputFile = $directory.DIRECTORY_SEPARATOR.$object;
if (is_dir($inputFile)) {
foreach ($this->scanDirectory($inputFile) as $file) {
yield $file;
}
continue;
}
if ($this->fileMatchExtensions($object, $extensions)) {
yield $inputFile;
}
}
} | php | {
"resource": ""
} |
q11380 | PollCommand.execute | train | protected function execute(InputInterface $input, OutputInterface $output)
{
$pollerNames = $input->getOption('poller');
$forceFullSync = $input->getOption('force-full-sync');
if ($pollerNames) {
$pollersToRun = [];
foreach ($pollerNames as $name) {
$pollersToRun[] = $this->pollerCollection->getPoller($name);
}
} else {
$pollersToRun = $this->pollerCollection;
}
$exitCode = 0;
foreach ($pollersToRun as $poller) {
$isSuccessfulRun = $this->runPoller($poller, $forceFullSync, $output);
if (!$isSuccessfulRun) {
$exitCode = 1;
}
}
return $exitCode;
} | php | {
"resource": ""
} |
q11381 | PollCommand.runPoller | train | private function runPoller(Poller $poller, $forceFullSync, OutputInterface $output)
{
$output->write(
sprintf("Run poller <info>%s</info>, force mode is <comment>%s</comment>: ", $poller->getName(), $forceFullSync ? 'on' : 'off')
);
try {
$processed = $poller->poll($forceFullSync);
$output->writeln("<info>OK</info> (Processed: <comment>$processed</comment>)");
return true;
} catch (Exception $e) {
$output->writeln("<error>FAIL</error> (Details: <error>{$e->getMessage()}</error>)");
return false;
}
} | php | {
"resource": ""
} |
q11382 | ConfigHandler.getAvailableOverrides | train | public function getAvailableOverrides()
{
$path = $this->getPath();
$suffix = $this->getSuffix();
$glob = "{$path}/*{$suffix}";
$result = [];
foreach (glob($glob) as $file) {
$identifier = basename($file, $suffix);
$result[$identifier] = $file;
}
return $result;
} | php | {
"resource": ""
} |
q11383 | ConfigHandler.setFormat | train | public function setFormat($format)
{
if ($format) {
$format = strtolower($format);
if (!in_array($format, static::$validFormats)) {
throw new Exception("Format {$format} is not supported");
}
$this->format = $format;
if (!$this->suffix) {
$this->setSuffix(".{$format}");
}
}
return $this;
} | php | {
"resource": ""
} |
q11384 | Dedimania.sendRequest | train | final public function sendRequest(Request $request, $callback)
{
if ($this->enabled->get() == false) {
return;
}
$this->webaccess->request(
self::dedimaniaUrl,
[[$this, "process"], $callback],
$request->getXml(),
true,
600,
3,
5,
'eXpansion server controller',
'application/x-www-form-urlencoded; charset=UTF-8'
);
} | php | {
"resource": ""
} |
q11385 | Dedimania.setGReplay | train | protected function setGReplay($login)
{
if ($this->enabled->get() == false) {
return;
}
$tempReplay = new IXR_Base64("");
$this->dedimaniaService->setGReplay("", $tempReplay);
$player = new Player();
$player->login = $login;
try {
$this->factory->getConnection()->saveBestGhostsReplay($player, "exp2_temp_replay");
$replay = new IXR_Base64(
$this->fileSystem->getUserData()->readAndDelete(
"Replays".DIRECTORY_SEPARATOR."exp2_temp_replay.Replay.Gbx")
);
$this->dedimaniaService->setGReplay($login, $replay);
} catch (\Exception $e) {
$this->console->writeln('Dedimania: $f00Error while fetching GhostsReplay');
}
} | php | {
"resource": ""
} |
q11386 | Dedimania.onEndMapStart | train | public function onEndMapStart($count, $time, $restarted, Map $map)
{
if ($this->enabled->get() == false) {
return;
}
if (!$restarted) {
$this->setRecords();
}
} | php | {
"resource": ""
} |
q11387 | MbWrapper.getNormalizedCharset | train | private function getNormalizedCharset($charset)
{
$upper = null;
if (is_array($charset)) {
$upper = array_map('strtoupper', $charset);
} else {
$upper = strtoupper($charset);
}
return preg_replace('/[^A-Z0-9]+/', '', $upper);
} | php | {
"resource": ""
} |
q11388 | MbWrapper.getMbCharset | train | private function getMbCharset($cs)
{
$normalized = $this->getNormalizedCharset($cs);
if (array_key_exists($normalized, self::$mbListedEncodings)) {
return self::$mbListedEncodings[$normalized];
} elseif (array_key_exists($normalized, self::$mbAliases)) {
return self::$mbAliases[$normalized];
}
return false;
} | php | {
"resource": ""
} |
q11389 | MxKarma.setVote | train | public function setVote($login, $vote)
{
$player = $this->playerStorage->getPlayerInfo($login);
$obj = [
"login" => $login,
"nickname" => $player->getNickName(),
"vote" => $vote,
];
$this->changedVotes[$player->getLogin()] = new MxVote((object)$obj);
$this->chatNotification->sendMessage('expansion_mxkarma.chat.votechanged', $login);
} | php | {
"resource": ""
} |
q11390 | MxKarma.onStartMapEnd | train | public function onStartMapEnd($count, $time, $restarted, Map $map)
{
$this->startTime = time();
$this->mxKarma->loadVotes(array_keys($this->playerStorage->getOnline()), false);
} | php | {
"resource": ""
} |
q11391 | MxKarma.onEndMapEnd | train | public function onEndMapEnd($count, $time, $restarted, Map $map)
{
if (!empty($this->changedVotes)) {
$votes = [];
foreach ($this->changedVotes as $vote) {
$votes[] = $vote;
}
$this->mxKarma->saveVotes($map, (time() - $this->startTime), $votes);
}
} | php | {
"resource": ""
} |
q11392 | RequestHandler.add | train | public function add($middleware)
{
if (!is_string($middleware) && !$middleware instanceof MiddlewareInterface) {
throw new \InvalidArgumentException('Middleware must be a string or an instance of MiddlewareInterface');
}
$class = is_string($middleware) ? new $middleware : $middleware;
array_push($this->middleware, $class);
} | php | {
"resource": ""
} |
q11393 | RequestHandler.prepend | train | public function prepend($middleware)
{
if (!is_string($middleware) && !$middleware instanceof MiddlewareInterface) {
throw new \InvalidArgumentException('Middleware must be a string or an instance of MiddlewareInterface');
}
$class = is_string($middleware) ? new $middleware : $middleware;
array_unshift($this->middleware, $class);
} | php | {
"resource": ""
} |
q11394 | RequestHandler.dispatch | train | public function dispatch(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
{
reset($this->middleware);
$this->response = $response;
return $this->handle($request);
} | php | {
"resource": ""
} |
q11395 | RequestHandler.handle | train | public function handle(ServerRequestInterface $request): ResponseInterface
{
if (!isset($this->middleware[$this->index])) {
return $this->response;
}
$middleware = $this->middleware[$this->index];
return $middleware->process($request, $this->next());
} | php | {
"resource": ""
} |
q11396 | QueueService.push | train | public function push(array $message, callable $messageHandler) {
$this->beanstalkMapper->put(serialize(
array_merge(
$messageHandler(), $message
)
));
return null;
} | php | {
"resource": ""
} |
q11397 | MethodGetNumberLapsDataProvider.request | train | public function request()
{
$scriptSettings = $this->gameDataStorage->getScriptOptions();
$currentMap = $this->mapStorage->getCurrentMap();
$nbLaps = 1;
if ($currentMap->lapRace) {
$nbLaps = $currentMap->nbLaps;
}
if ($scriptSettings['S_ForceLapsNb'] != -1) {
$nbLaps = $scriptSettings['S_ForceLapsNb'];
}
$this->dispatch('set', [$nbLaps]);
} | php | {
"resource": ""
} |
q11398 | EloquentJournalVoucher.getMaxJournalVoucherNumber | train | public function getMaxJournalVoucherNumber($id, $databaseConnectionName = null)
{
if(empty($databaseConnectionName))
{
$databaseConnectionName = $this->databaseConnectionName;
}
return $this->JournalVoucher->setConnection($databaseConnectionName)->where('organization_id', '=', $id)->max('number');
} | php | {
"resource": ""
} |
q11399 | EloquentJournalVoucher.getByOrganizationByPeriodAndByStatus | train | public function getByOrganizationByPeriodAndByStatus($organizationId, $periodIds, $status, $databaseConnectionName = null)
{
if(empty($databaseConnectionName))
{
$databaseConnectionName = $this->databaseConnectionName;
}
return $this->JournalVoucher->setConnection($databaseConnectionName)
->where('organization_id', '=', $organizationId)
->whereIn('period_id', $periodIds)
->where('status', '=', $status)
->get();
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.