_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q11900 | Score.getValues | train | public static function getValues($mask, $value)
{
$parse = self::parseChartMask($mask);
$negative = 0 === strpos($value, '-');
$value = $negative ? (int)substr($value, 1) : $value;
$data = [];
$laValue = $value;
for ($k = count($parse) - 1; $k >= 0; $k--) {
$size = $parse[$k]['size'];
if (strlen($laValue) > $size) {
$result = substr($laValue, strlen($laValue) - $size, $size);
$laValue = substr($laValue, 0, strlen($laValue) - $size);
} else {
if ($k !== 0) {
$result = str_pad($laValue, $size, '0', STR_PAD_LEFT);
$laValue = '';
} else {
$result = $laValue;
if ('' === $laValue) {
$result = '0';
}
if ($negative) {
$result = '-' . $result;
}
}
}
if ($value === null) {
$result = '';
}
$data[] = ['value' => $result];
}
return array_reverse($data);
} | php | {
"resource": ""
} |
q11901 | Score.formToBdd | train | public static function formToBdd($mask, $values)
{
$parse = self::parseChartMask($mask);
$nbInput = count($parse);
$value = '';
foreach ($values as $row) {
$value .= $row['value'];
}
if ($value == '') {
return null;
}
if ($nbInput === 1) {
return $values[0]['value'];
}
$value = '';
for ($k = 0; $k <= $nbInput - 1; $k++) {
$part = $values[$k]['value'];
$length = $parse[$k]['size'];
if (strlen($part) < $length) {
if ($k === 0) {
if ($part === '') {
$part = '0';
}
} else {
if ($k === $nbInput - 1) {
$part = str_pad($part, $length, '0', STR_PAD_RIGHT);
} else {
$part = str_pad($part, $length, '0', STR_PAD_LEFT);
}
}
}
$value .= $part;
}
return $value;
} | php | {
"resource": ""
} |
q11902 | Tag.render | train | public function render($content, $class = '', $id = '', array $attrs = array())
{
$attrs = $this->_setId($attrs, $id);
$attrs = $this->_cleanAttrs($attrs);
if (!empty($class)) {
$attrs = $this->_normalizeClassAttr($attrs, $class);
}
$tag = $this->_tag;
if (Arr::key('tag', $attrs)) {
$tag = $attrs['tag'];
unset($attrs['tag']);
}
$format = (!empty($attrs)) ? '<%s %s>%s</%s>' : '<%s%s>%s</%s>';
$output = sprintf($format, $tag, $this->buildAttrs($attrs), $content, $tag);
return $output;
} | php | {
"resource": ""
} |
q11903 | PlayerDataProvider.onPlayerConnect | train | public function onPlayerConnect($login, $isSpectator = false, $dispatch = true)
{
try {
$playerData = $this->playerStorage->getPlayerInfo($login);
} catch (\Exception $e) {
// TODO log that player disconnected very fast.
return;
}
$this->playerStorage->onPlayerConnect($playerData);
if ($dispatch) {
$this->dispatch(__FUNCTION__, [$playerData]);
}
} | php | {
"resource": ""
} |
q11904 | PlayerDataProvider.onPlayerDisconnect | train | public function onPlayerDisconnect($login, $disconnectionReason)
{
$playerData = $this->playerStorage->getPlayerInfo($login);
// dedicated server sends disconnect for server itself when it's closed...
// so it's time to stop application gracefully.
if ($playerData->getPlayerId() == 0) {
// emit event to plugins
$this->application->stopApplication();
return;
}
$this->playerStorage->onPlayerDisconnect($playerData, $disconnectionReason);
$this->dispatch(__FUNCTION__, [$playerData, $disconnectionReason]);
} | php | {
"resource": ""
} |
q11905 | PlayerDataProvider.onPlayerAlliesChanged | train | public function onPlayerAlliesChanged($login)
{
$playerData = $this->playerStorage->getPlayerInfo($login);
$newPlayerData = $this->playerStorage->getPlayerInfo($login, true);
$this->playerStorage->onPlayerAlliesChanged($playerData, $newPlayerData);
$this->dispatch(__FUNCTION__, [$playerData, $newPlayerData]);
} | php | {
"resource": ""
} |
q11906 | ActionFactory.createManialinkAction | train | public function createManialinkAction(ManialinkInterface $manialink, $callable, $args, $permanent = false)
{
$class = $this->class;
/** @var Action $action */
$action = new $class($callable, $args, $permanent);
$this->actions[$action->getId()] = $action;
$this->actionsByManialink[$manialink->getId()][$action->getId()] = $action;
$this->manialinkByAction[$action->getId()] = $manialink;
return $action->getId();
} | php | {
"resource": ""
} |
q11907 | ActionFactory.destroyManialinkActions | train | public function destroyManialinkActions(ManialinkInterface $manialink)
{
if (isset($this->actionsByManialink[$manialink->getId()])) {
foreach ($this->actionsByManialink[$manialink->getId()] as $actionId => $action) {
unset($this->actions[$actionId]);
unset($this->manialinkByAction[$actionId]);
}
unset($this->actionsByManialink[$manialink->getId()]);
}
} | php | {
"resource": ""
} |
q11908 | ActionFactory.destroyNotPermanentActions | train | public function destroyNotPermanentActions(ManialinkInterface $manialink)
{
if (isset($this->actionsByManialink[$manialink->getId()])) {
foreach ($this->actionsByManialink[$manialink->getId()] as $actionId => $action) {
if (!$action->isPermanent()) {
$this->destroyAction($actionId);
}
}
}
} | php | {
"resource": ""
} |
q11909 | ActionFactory.destroyAction | train | public function destroyAction($actionId)
{
if (isset($this->manialinkByAction[$actionId])) {
unset($this->actionsByManialink[$this->manialinkByAction[$actionId]->getId()][$actionId]);
unset($this->actions[$actionId]);
}
} | php | {
"resource": ""
} |
q11910 | WidgetCurrentMap.onMapRatingsLoaded | train | public function onMapRatingsLoaded($ratings)
{
$this->widget->setMapRatings($ratings);
$this->widget->update($this->players);
} | php | {
"resource": ""
} |
q11911 | WidgetCurrentMap.onMapRatingsChanged | train | public function onMapRatingsChanged($login, $score, $ratings)
{
$this->widget->setMapRatings($ratings);
$this->widget->update($this->players);
} | php | {
"resource": ""
} |
q11912 | XslCallbacks.addCallback | train | public function addCallback(string $name, $callback)
{
if (!is_object($callback)) {
throw new \InvalidArgumentException('Given callback must be an object');
}
$this->callbacks[$name] = $callback;
} | php | {
"resource": ""
} |
q11913 | XslCallbacks.callback | train | private function callback(string $name)
{
if (!$this->hasCallback($name)) {
throw new XslCallbackException('A callback with the name ' . $name . ' does not exist.');
}
return $this->callbacks[$name];
} | php | {
"resource": ""
} |
q11914 | RssFeedItem.create | train | public static function create(string $title, string $link, string $description): self
{
return new self($title, $link, $description);
} | php | {
"resource": ""
} |
q11915 | RssFeedItem.fromEntity | train | public static function fromEntity($entity, array $overrides = []): self
{
if (!is_object($entity)) {
throw new \InvalidArgumentException('Given entity must be an object.');
}
$annotations = annotationsOf($entity);
if (!$annotations->contain('RssFeedItem')) {
throw new XmlException(
'Class ' . get_class($entity) . ' is not annotated with @RssFeedItem.'
);
}
$rssFeedItemAnnotation = $annotations->firstNamed('RssFeedItem');
$self = new self(
$overrides['title'] ??
self::getRequiredAttribute(
$entity,
'title',
$rssFeedItemAnnotation->getTitleMethod('getTitle')
),
$overrides['link'] ??
self::getRequiredAttribute(
$entity,
'link',
$rssFeedItemAnnotation->getLinkMethod('getLink')
),
$overrides['description'] ??
self::getRequiredAttribute(
$entity,
'description',
$rssFeedItemAnnotation->getDescriptionMethod('getDescription')
)
);
foreach (self::METHODS as $itemMethod => $defaultMethod) {
if (isset($overrides[$itemMethod])) {
$self->$itemMethod($overrides[$itemMethod]);
continue;
}
if (substr($defaultMethod, 0, 3) === 'get') {
$annotationMethod = $defaultMethod . 'Method';
} else {
$annotationMethod = 'get' . $defaultMethod . 'Method';
}
$entityMethod = $rssFeedItemAnnotation->$annotationMethod($defaultMethod);
if (method_exists($entity, $entityMethod)) {
$self->$itemMethod($entity->$entityMethod());
}
}
return $self;
} | php | {
"resource": ""
} |
q11916 | RssFeedItem.getRequiredAttribute | train | private static function getRequiredAttribute(
$entity,
string $name,
string $method
) {
if (!method_exists($entity, $method)) {
throw new XmlException(
'RSSFeedItem ' . get_class($entity)
. ' does not offer a method named "' . $method
. '" to return the ' . $name . ', but ' . $name
. ' is required.'
);
}
return $entity->$method();
} | php | {
"resource": ""
} |
q11917 | RssFeedItem.byAuthor | train | public function byAuthor(string $author): self
{
if (!strstr($author, '@')) {
$this->author = 'nospam@example.com (' . $author . ')';
} else {
$this->author = $author;
}
return $this;
} | php | {
"resource": ""
} |
q11918 | RssFeedItem.inCategory | train | public function inCategory(string $category, string $domain = ''): self
{
$this->categories[] = ['category' => $category, 'domain' => $domain];
return $this;
} | php | {
"resource": ""
} |
q11919 | RssFeedItem.inCategories | train | public function inCategories(array $categories): self
{
foreach ($categories as $category) {
if (is_array($category)) {
$this->inCategory($category['category'], $category['domain']);
} else {
$this->inCategory($category);
}
}
return $this;
} | php | {
"resource": ""
} |
q11920 | RssFeedItem.deliveringEnclosure | train | public function deliveringEnclosure(string $url, int $length, string $type): self
{
$this->enclosures[] = [
'url' => $url,
'length' => $length,
'type' => $type
];
return $this;
} | php | {
"resource": ""
} |
q11921 | RssFeedItem.withGuid | train | public function withGuid(string $guid): self
{
$this->guid = $guid;
$this->isPermaLink = true;
return $this;
} | php | {
"resource": ""
} |
q11922 | RssFeedItem.inspiredBySource | train | public function inspiredBySource(string $name, string $url): self
{
$this->sources[] = ['name' => $name, 'url' => $url];
return $this;
} | php | {
"resource": ""
} |
q11923 | Content.parse | train | public static function parse(Tag &$Tag)
{
if (!empty($Tag->content) && $Tag->hasOption('translate') && is_callable(Config::get('translator'))) {
$Tag->content = call_user_func_array(
Config::get('translator'),
array(
$Tag->content,
Config::get('textdomain')
)
);
}
if ($Tag->hasOption('bbContent')) {
self::bb($Tag->content);
}
if ($Tag->hasOption('markdown')) {
$Tag->addOption('cleanContent');
self::markdown($Tag->content);
}
if ($Tag->hasOption('compress')) {
self::compress($Tag);
}
return $Tag->content;
} | php | {
"resource": ""
} |
q11924 | Content.bb | train | public static function bb(&$content)
{
$content = preg_replace(array_flip(self::$_bbs), self::$_bbs, $content);
return $content;
} | php | {
"resource": ""
} |
q11925 | Content.markdown | train | public static function markdown(&$content)
{
if (self::$MarkdownParser === null) {
if (class_exists('dflydev\markdown\MarkdownParser')) {
self::$MarkdownParser = new \dflydev\markdown\MarkdownParser;
} else {
self::$MarkdownParser = false;
}
}
if (self::$MarkdownParser !== false) {
$content = trim(self::$MarkdownParser->transformMarkdown($content));
}
return $content;
} | php | {
"resource": ""
} |
q11926 | Worker.run | train | public function run($sessionId = null)
{
$this->sessionId = ($sessionId !== null) ? $sessionId : uniqid();
if (function_exists('pcntl_signal')) {
pcntl_signal(SIGTERM, [$this, 'signalHandler']);
pcntl_signal(SIGINT, [$this, 'signalHandler']);
pcntl_signal(SIGHUP, [$this, 'signalHandler']);
}
$this->daemon->start();
} | php | {
"resource": ""
} |
q11927 | Store.add | train | public static function add(Tag &$Tag)
{
if (Config::get('store') == 'global') {
self::$_tagStore[$Tag->ID] = &$Tag;
} elseif (Config::get('store') == 'internal') {
Config::getHTMLInstance()->tagStore[$Tag->ID] = &$Tag;
}
} | php | {
"resource": ""
} |
q11928 | Store.get | train | public static function get($ID = 'latest', $offset = 0)
{
if ($ID === 'latest') {
if ($offset > 0) {
$offset = $offset*-1;
}
if (Config::get('store') == 'global') {
$k = array_splice(@array_keys(self::$_tagStore), -1+$offset, 1);
return self::$_tagStore[$k[0]];
} elseif (Config::get('store') == 'internal') {
$Store = Config::getHTMLInstance()->tagStore;
$k = array_splice(@array_keys($Store), -1+$offset, 1);
return $Store[$k[0]];
}
} elseif (is_int($ID)) {
if (Config::get('store') == 'global' && isset(self::$_tagStore[$ID])) {
return self::$_tagStore[$ID];
} elseif (Config::get('store') == 'internal'
&& isset(Config::getHTMLInstance()->tagStore[$ID])
) {
return Config::getHTMLInstance()->tagStore[$ID];
}
}
return false;
} | php | {
"resource": ""
} |
q11929 | Store.remove | train | public static function remove(Tag &$Tag)
{
if (Config::get('store') == 'global' && isset(self::$_tagStore[$Tag->ID])) {
unset(self::$_tagStore[$Tag->ID]);
} elseif (Config::get('store') == 'internal'
&& isset(Config::getHTMLInstance()->tagStore[$Tag->ID])
) {
unset(Config::getHTMLInstance()->tagStore[$Tag->ID]);
}
} | php | {
"resource": ""
} |
q11930 | Store.hasTags | train | public static function hasTags()
{
if (Config::get('store') == 'global') {
return count(self::$_tagStore);
} elseif (Config::get('store') == 'internal') {
return count(Config::getHTMLInstance()->tagStore);
}
} | php | {
"resource": ""
} |
q11931 | Input.sure | train | public function sure()
{
$this->_label = null;
switch ($this->called) {
case 'textarea':
$i = 2;
break;
default:
$i = 1;
break;
}
if (isset($this->args[$i])) {
$this->_label = $this->args[$i];
}
return true;
} | php | {
"resource": ""
} |
q11932 | LibXmlStreamWriter.asDom | train | public function asDom(): \DOMDocument
{
$doc = new \DOMDocument();
$doc->loadXML($this->writer->outputMemory());
return $doc;
} | php | {
"resource": ""
} |
q11933 | RssFeed.addItem | train | public function addItem(string $title, string $link, string $description): RssFeedItem
{
return $this->items[] = RssFeedItem::create($title, $link, $description);
} | php | {
"resource": ""
} |
q11934 | RssFeed.addEntity | train | public function addEntity($entity, array $overrides = []): RssFeedItem
{
return $this->items[] = RssFeedItem::fromEntity($entity, $overrides);
} | php | {
"resource": ""
} |
q11935 | RssFeed.setManagingEditor | train | public function setManagingEditor(string $managingEditor): self
{
if (!strstr($managingEditor, '@')) {
$this->managingEditor = 'nospam@example.com (' . $managingEditor . ')';
} else {
$this->managingEditor = $managingEditor;
}
return $this;
} | php | {
"resource": ""
} |
q11936 | RssFeed.setWebMaster | train | public function setWebMaster(string $webMaster): self
{
if (!strstr($webMaster, '@')) {
$this->webMaster = 'nospam@example.com (' . $webMaster . ')';
} else {
$this->webMaster = $webMaster;
}
return $this;
} | php | {
"resource": ""
} |
q11937 | RssFeed.setImage | train | public function setImage(
string $url,
string $description,
int $width = 88,
int $height = 31
): self {
if (144 < $width || 0 > $width) {
throw new \InvalidArgumentException('Width must be a value between 0 and 144.');
}
if (400 < $height || 0 > $height) {
throw new \InvalidArgumentException('Height must be a value between 0 and 400.');
}
$this->image = [
'url' => $url,
'description' => $description,
'width' => $width,
'height' => $height
];
return $this;
} | php | {
"resource": ""
} |
q11938 | Script.sure | train | public function sure()
{
if ($this->hasOption('start')) {
$this->addOption('doNotSelfQlose');
}
if (empty($this->args[0])) {
$this->args[0] = array();
}
switch ($this->called) {
case 'jquery':
$this->called = 'script';
$this->args[0] = array_merge(
array(
'type' => 'text/javascript',
'src' => 'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'
),
$this->args[0]
);
return false;
case 'jqueryui':
$this->called = 'script';
$this->args[0] = array_merge(
array(
'type' => 'text/javascript',
'src' => 'https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js'
),
$this->args[0]
);
return false;
default:
$this->called = 'script';
break;
}
if (empty($this->args[0])) {
return false;
}
return is_array($this->args[0])
|| !(substr($this->args[0], 0, 4) == 'http'
|| substr($this->args[0], 0, 3) == '../'
|| substr($this->args[0], 0, 3) == '\./'
|| substr($this->args[0], 0, 2) == './'
|| substr($this->args[0], 0, 1) == '/'
);
} | php | {
"resource": ""
} |
q11939 | Config.init | train | public static function init(array $initArgs = array())
{
if (!self::$_initiated) {
if (!defined('XIPHE_HTML_BASE_FOLDER')) {
define('XIPHE_HTML_BASE_FOLDER', dirname(__DIR__).DIRECTORY_SEPARATOR);
}
foreach (self::getThemasterSettings() as $key => $s) {
if (is_array($s) && isset($s['default'])) {
self::$_defaults[$key] = $s['default'];
}
}
/*
* Get the config array from config.php
*/
$config = array();
if (file_exists(XIPHE_HTML_BASE_FOLDER.'config.php')) {
call_user_func(
function () use (&$config) {
include XIPHE_HTML_BASE_FOLDER.'config.php';
}
);
} elseif(!file_exists(XIPHE_HTML_BASE_FOLDER.'config-sample.php')) {
self::_createSampleConfig();
}
/*
* Make sure config is an array.
*/
if (!is_array($config)) {
Generator::debug('$config is not an array.', 3, 7);
$config = array();
}
/*
* Merge it into the defaults
*/
$defaults = array_merge(self::$_defaults, $config);
/*
* Remove invalid keys and merge the initArgs.
*/
foreach (self::$_defaults as $k => $v) {
self::$_config[$k] = (isset($initArgs[$k]) ? $initArgs[$k] : $defaults[$k]);
}
self::$_initiated = true;
}
} | php | {
"resource": ""
} |
q11940 | Config.ajax | train | public static function ajax($activate = true)
{
if ($activate && !in_array('ajax', self::$modes)) {
self::setMode('ajax');
} else {
self::unsetMode('ajax');
}
} | php | {
"resource": ""
} |
q11941 | Config.get | train | public static function get($key, $preferGlobal = false)
{
if (!self::$_initiated) {
self::init();
}
if (!isset(self::$_config[$key])) {
return null;
}
foreach (self::$modes as $mode) {
if (isset(self::$modeSettings[$mode][$key])) {
return self::$modeSettings[$mode][$key];
}
}
if (!$preferGlobal && self::$_CurrentHTMLInstance && isset(self::$_CurrentHTMLInstance->$key)) {
return self::$_CurrentHTMLInstance->$key;
} else {
if (class_exists('Xiphe\THEMASTER\core\THE')
&& class_exists(TM\THE::WPSETTINGS)
) {
try {
return TM\THEWPSETTINGS::sGet_setting($key, XIPHE_HTML_TEXTID);
} catch(\Exception $c) {
return self::$_config[$key];
}
}
return self::$_config[$key];
}
} | php | {
"resource": ""
} |
q11942 | Config.set | train | public static function set($key, $value, $preferGlobal = false)
{
if (!isset(self::$_config[$key])) {
return false;
}
if (!$preferGlobal && self::$_CurrentHTMLInstance && isset(self::$_CurrentHTMLInstance->$key)) {
self::s3t(self::$_CurrentHTMLInstance->$key, $value);
} else {
if (class_exists('Xiphe\THEMASTER\core\THE')
&& class_exists(TM\THE::SETTINGS)
) {
$prev = TM\THEWPSETTINGS::sGet_setting($key, XIPHE_HTML_TEXTID);
self::s3t($prev, $value);
TM\THESETTINGS::sSet_setting($key, XIPHE_HTML_TEXTID, $prev);
} else {
self::s3t(self::$_config[$key], $value);
}
}
return true;
} | php | {
"resource": ""
} |
q11943 | Config.s3t | train | public static function s3t(&$target, $value)
{
if ($value === '++' && is_numeric(($oldValue = $target))) {
$value = $oldValue + 1;
} elseif ($value === '--' && is_numeric(($oldValue = $target))) {
$value = $oldValue - 1;
}
$target = $value;
} | php | {
"resource": ""
} |
q11944 | GuzzleResponseAdapter.getHeaderValue | train | public function getHeaderValue($header, $glue = '')
{
if ($header = $this->response->getHeader($header, true)) {
if (is_array($header)) {
return implode($glue, $header);
}
}
return $header;
} | php | {
"resource": ""
} |
q11945 | PublisherFactory.buildAsync | train | public static function buildAsync(
$host,
$port,
$user,
$pass,
$exchangeName,
$escapeMode = self::ESCAPE_MODE_SERIALIZE,
$timeout = 0
) {
return self::build($host, $port, $user, $pass, $exchangeName, false, $escapeMode, $timeout);
} | php | {
"resource": ""
} |
q11946 | PublisherFactory.buildSync | train | public static function buildSync(
$host,
$port,
$user,
$pass,
$exchangeName,
$escapeMode = self::ESCAPE_MODE_SERIALIZE,
$timeout = 0
) {
return self::build($host, $port, $user, $pass, $exchangeName, true, $escapeMode, $timeout);
} | php | {
"resource": ""
} |
q11947 | PublisherFactory.build | train | private static function build(
$host,
$port,
$user,
$pass,
$exchangeName,
$sync,
$escapeMode,
$timeout
) {
$driver = DriverFactory::getDriver([
'host' => $host,
'port' => $port,
'user' => $user,
'pwd' => $pass
]);
$publisher = ($sync) ?
new SyncPublisher($driver, $exchangeName, $timeout):
new AsyncPublisher($driver, $exchangeName);
if ($escapeMode === self::ESCAPE_MODE_NONE) {
return $publisher;
}
if ($escapeMode === self::ESCAPE_MODE_JSON) {
return new SerializingPublisher($publisher, new JsonSerializer());
}
if ($escapeMode === self::ESCAPE_MODE_SERIALIZE) {
return new SerializingPublisher($publisher, new PhpSerializer());
}
throw new \InvalidArgumentException('Bad serializer name');
} | php | {
"resource": ""
} |
q11948 | DomXmlStreamWriter.doWriteStartElement | train | protected function doWriteStartElement(string $elementName)
{
$this->append(
function(\DOMNode $parent) use ($elementName)
{
$element = $this->doc->createElement($elementName);
$parent->appendChild($element);
array_push($this->openElements, $element);
},
'start element: "' . $elementName . '"'
);
} | php | {
"resource": ""
} |
q11949 | DomXmlStreamWriter.writeText | train | public function writeText(string $data): XmlStreamWriter
{
return $this->append(
function(\DOMNode $parent) use ($data)
{
$parent->appendChild(
$this->doc->createTextNode($this->encode($data))
);
},
'text'
);
} | php | {
"resource": ""
} |
q11950 | DomXmlStreamWriter.writeCData | train | public function writeCData(string $cdata): XmlStreamWriter
{
return $this->append(
function(\DOMNode $parent) use ($cdata)
{
$parent->appendChild(
$this->doc->createCDATASection($this->encode($cdata))
);
},
'cdata'
);
} | php | {
"resource": ""
} |
q11951 | DomXmlStreamWriter.writeComment | train | public function writeComment(string $comment): XmlStreamWriter
{
return $this->append(
function(\DOMNode $parent) use ($comment)
{
$parent->appendChild(
$this->doc->createComment($this->encode($comment))
);
},
'comment'
);
} | php | {
"resource": ""
} |
q11952 | DomXmlStreamWriter.writeXmlFragment | train | public function writeXmlFragment(string $fragment): XmlStreamWriter
{
return $this->append(
function(\DOMNode $parent) use ($fragment)
{
$fragmentNode = $this->doc->createDocumentFragment();
$fragmentNode->appendXML($fragment);
@$parent->appendChild($fragmentNode);
},
'document fragment'
);
} | php | {
"resource": ""
} |
q11953 | DomXmlStreamWriter.importStreamWriter | train | public function importStreamWriter(XmlStreamWriter $writer): XmlStreamWriter
{
return $this->append(
function(\DOMNode $parent) use ($writer)
{
$parent->appendChild($this->doc->importNode(
$writer->asDom()->documentElement,
true
));
},
'imported nodes'
);
} | php | {
"resource": ""
} |
q11954 | DomXmlStreamWriter.append | train | private function append(\Closure $appendTo, string $type): XmlStreamWriter
{
libxml_use_internal_errors(true);
try {
$appendTo(end($this->openElements));
} catch (\DOMException $e) {
throw new XmlException('Error writing "' . $type, $e);
}
$errors = libxml_get_errors();
if (!empty($errors)) {
libxml_clear_errors();
throw new XmlException(
'Error writing "' . $type . '": '
. implode(', ', array_map(
function($error) { return trim($error->message); },
$errors
))
);
}
return $this;
} | php | {
"resource": ""
} |
q11955 | Tag.addOption | train | public function addOption($option)
{
if (in_array($option, Generator::$tagOptionKeys)
&& !$this->hasOption($option)
) {
$this->options[] = $option;
}
} | php | {
"resource": ""
} |
q11956 | Tag.removeOption | train | public function removeOption($option)
{
if ($this->hasOption($option)) {
$key = array_search($option, $this->options);
unset($this->options[$key]);
}
} | php | {
"resource": ""
} |
q11957 | Tag.update | train | public function update($what = 'all')
{
/*
* Generate Class array.
*/
if ($what == 'all' || $what == 'classes') {
Generator::updateClasses($this);
}
/*
* Generate Class array.
*/
if ($what == 'all' || $what == 'urls') {
Generator::magicUrls($this);
}
/*
* Parse the content.
*/
if ($what == 'content') {
Content::parse($this);
}
if ($what == 'content' || $what == 'all' || $what == 'inlineInner') {
if ($this->hasOption('inlineInner')
|| ($this->name !== 'blank'
&& !$this->hasOption('forbidInlineInner')
&& !$this->isSelfClosing()
&& !$this->hasOption('start')
&& strlen($this->content) < Config::get('maxLineWidth')
&& !preg_match('/\r\n|\n|\r/', $this->content))
) {
$this->inlineInner = true;
} else {
$this->inlineInner = false;
}
}
if ($what == 'all' || $what == 'attributes') {
/*
* Sort Atrributes and Classes.
*/
ksort($this->attributes);
/*
* Parse the attributes to string format.
*/
$this->attributeString = Generator::attsToString($this);
}
} | php | {
"resource": ""
} |
q11958 | Tag.setAttrs | train | public function setAttrs($attrs)
{
$oldAttrs = $this->attributes;
$oldClasses = $this->classes;
$this->attributes = $attrs;
$this->attributes = Generator::parseAtts($this);
$this->attributes = array_merge($oldAttrs, $this->attributes);
$this->classes = null;
$this->update('classes');
if (!empty($oldClasses) && !empty($this->classes)) {
$this->attributes['class'] = implode(' ', array_merge($oldClasses, $this->classes));
}
$this->classes = null;
if (!empty($oldAttrs['style']) && !empty($this->attributes['style'])) {
$this->attributes['style'] = Generator::mergeStyles($this->attributes['style'], $oldAttrs['style']);
}
$this->update();
} | php | {
"resource": ""
} |
q11959 | Tag.isSelfclosing | train | public function isSelfclosing()
{
if (isset($this->selfclosing)) {
return (bool) $this->selfclosing;
}
if ($this->hasOption('selfQlose')) {
$this->selfclosing = true;
return true;
} elseif ($this->hasOption('doNotSelfQlose')) {
$this->selfclosing = false;
return false;
}
return in_array($this->realName, TagInfo::$selfClosing);
} | php | {
"resource": ""
} |
q11960 | Tag.closingComment | train | public function closingComment()
{
if (!empty($this->attributes['id'])) {
$hint = '#'.$this->attributes['id'];
} elseif (!empty($this->classes)) {
$hint = '.'.$this->classes[0];
} else {
return false;
}
Generator::call('il_comment', array($hint));
} | php | {
"resource": ""
} |
q11961 | Tag.content | train | public function content()
{
if (!$this->_contentPrinted) {
if (!$this->inlineInner) {
Generator::tabs();
}
if ($this->hasOption('cleanContent')
|| (Config::get('clean') && !$this->hasOption('doNotCleanContent'))
) {
echo trim(Cleaner::getClean($this->content));
} else {
echo $this->content;
}
if (!$this->inlineInner) {
Generator::lineBreak();
}
$this->_contentPrinted = true;
}
} | php | {
"resource": ""
} |
q11962 | MemoryMonitor.monitor | train | public function monitor(Daemon $daemon, $currentObject = null)
{
$currentMemory = $this->getMemoryUsage();
if ($this->memory > 0 && $currentMemory > $this->memory) {
$this->logger
->warning(
'Memory usage increased',
[
'bytes_increased_by' => $currentMemory - $this->memory,
'bytes_current_memory' => $currentMemory
]
);
}
$this->memory = $currentMemory;
} | php | {
"resource": ""
} |
q11963 | Css.sure | train | public function sure()
{
return !(substr($this->args[0], 0, 4) == 'http'
|| substr($this->args[0], 0, 3) == '../'
|| substr($this->args[0], 0, 3) == '\./'
|| substr($this->args[0], 0, 2) == './'
|| substr($this->args[0], 0, 1) == '/'
);
} | php | {
"resource": ""
} |
q11964 | Modules.appendAlias | train | public static function appendAlias(&$moduleName)
{
if (isset(self::$moduleAliases[$moduleName])) {
$moduleName = self::$moduleAliases[$moduleName];
}
} | php | {
"resource": ""
} |
q11965 | Modules.execute | train | public static function execute($name, &$args, &$options, $called)
{
$moduleClass = 'Xiphe\HTML\modules\\'.ucfirst($name);
if (is_object(self::$_loadedModules[$name])) {
self::$_loadedModules[$name]->execute($args, $options, $called);
} else {
$Module = new $moduleClass();
$Module->execute($args, $options, $called);
}
} | php | {
"resource": ""
} |
q11966 | Modules.get | train | public static function get($name, &$args, &$options, &$called)
{
$moduleClass = 'Xiphe\HTML\modules\\'.ucfirst($name);
if (!isset(self::$_loadedModules[$name])) {
self::$_loadedModules[$name] = new $moduleClass();
self::$_loadedModules[$name]->name = $name;
}
self::$_loadedModules[$name]->init($args, $options, $called);
return self::$_loadedModules[$name];
} | php | {
"resource": ""
} |
q11967 | Modules.exist | train | public static function exist($name)
{
$name = ucfirst($name);
/*
* If it was checked before negatively - direct return.
*/
if (in_array($name, self::$_unavailableModules)) {
return false;
}
/*
* Check if it was already loaded.
*/
if (isset(self::$_loadedModules[$name])) {
return true;
}
/*
* Or the file exists.
*/
if (file_exists(self::getModulePath().$name.'.php')) {
return true;
} else {
self::$_unavailableModules[] = $name;
}
/*
* Module does not exist.
*/
return false;
} | php | {
"resource": ""
} |
q11968 | AnnotationBasedObjectXmlSerializer.fromObject | train | public static function fromObject($object): self
{
$className = get_class($object);
if (isset(self::$cache[$className])) {
return self::$cache[$className];
}
self::$cache[$className] = new self(new \ReflectionObject($object));
return self::$cache[$className];
} | php | {
"resource": ""
} |
q11969 | AnnotationBasedObjectXmlSerializer.extractProperties | train | private function extractProperties(\ReflectionClass $objectClass): array
{
return propertiesOf($objectClass, \ReflectionProperty::IS_PUBLIC)
->filter(function(\ReflectionProperty $property)
{
return !$property->isStatic()
&& !annotationsOf($property)->contain('XmlIgnore');
}
)->map(function(\ReflectionProperty $property)
{
return $this->createSerializerDelegate(
annotationsOf($property),
$property->getName()
);
}
)->data();
} | php | {
"resource": ""
} |
q11970 | AnnotationBasedObjectXmlSerializer.extractMethods | train | private function extractMethods(\ReflectionClass $objectClass): array
{
return methodsOf($objectClass, \ReflectionMethod::IS_PUBLIC)
->filter(function(\ReflectionMethod $method)
{
if ($method->getNumberOfParameters() != 0
|| $method->isStatic()
|| $method->isConstructor()
|| $method->isDestructor()
|| 0 == strncmp($method->getName(), '__', 2)) {
return false;
}
return !annotationsOf($method)->contain('XmlIgnore');
}
)->map(function(\ReflectionMethod $method)
{
return $this->createSerializerDelegate(
annotationsOf($method),
$method->getName()
);
}
)->data();
} | php | {
"resource": ""
} |
q11971 | AnnotationBasedObjectXmlSerializer.createSerializerDelegate | train | private function createSerializerDelegate(
Annotations $annotations,
string $defaultTagName
): XmlSerializerDelegate {
if ($annotations->contain('XmlAttribute')) {
$xmlAttribute = $annotations->firstNamed('XmlAttribute');
return new Attribute(
$xmlAttribute->attributeName(),
$xmlAttribute->getValueByName('skipEmpty', true)
);
} elseif ($annotations->contain('XmlFragment')) {
$xmlFragment = $annotations->firstNamed('XmlFragment');
return new Fragment(
false !== $xmlFragment->tagName() ? $xmlFragment->tagName() : null,
$xmlFragment->getValueByName('transformNewLineToBr', false)
);
} elseif ($annotations->contain('XmlTag')) {
$xmlTag = $annotations->firstNamed('XmlTag');
return new Tag(
false !== $xmlTag->tagName() ? $xmlTag->tagName() : '',
$xmlTag->getValueByName('elementTagName')
);
}
return new Tag($defaultTagName);
} | php | {
"resource": ""
} |
q11972 | Select.isSelected | train | public function isSelected($selected, $value, $i)
{
if (is_array($selected)) {
foreach ($selected as $s) {
if ($this->isSelected($s, $value, $i)) {
return true;
}
}
} elseif (is_int($selected) && $i === $selected) {
return true;
} elseif ($value === $selected) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q11973 | TransactionalConsumer.consume | train | public function consume($message, array $headers = [])
{
try {
$this->transactionManager->beginTransaction();
} catch (BeginException $e) {
throw new ConsumerException($e->getMessage(), $e->getCode(), $e);
}
try {
$this->consumer->consume($message, $headers);
$this->transactionManager->commit();
} catch (\Exception $e) {
$this->transactionManager->rollback();
throw $e;
}
} | php | {
"resource": ""
} |
q11974 | HTML.get | train | public static function get($initArgs = array())
{
if (get_class(Core\Config::getHTMLInstance()) == 'Xiphe\HTML') {
return Core\Config::getHTMLInstance();
} elseif (get_class($GLOBALS['HTML']) == 'Xiphe\HTML') {
return $GLOBALS['HTML'];
} else {
return new HTML($initArgs);
}
} | php | {
"resource": ""
} |
q11975 | HTML.getOption | train | public function getOption($key)
{
if (Core\Config::isValidOptionName($key)) {
if (isset($this->$key)) {
return $this->$key;
} else {
return Core\Config::get($key, true);
}
}
} | php | {
"resource": ""
} |
q11976 | HTML.setOption | train | public function setOption($key, $value)
{
if (Core\Config::isValidOptionName($key)) {
Core\Config::s3t($this->$key, $value);
}
return $this;
} | php | {
"resource": ""
} |
q11977 | HTML.unsetOption | train | public function unsetOption($key)
{
if (Core\Config::isValidOptionName($key) && isset($this->$key)) {
unset($this->$key);
}
return $this;
} | php | {
"resource": ""
} |
q11978 | HTML.unsetInstanceOptions | train | public function unsetInstanceOptions()
{
foreach (Core\Config::getDefaults() as $k => $v) {
if (isset($this->$k)) {
unset($this->$k);
}
}
return $this;
} | php | {
"resource": ""
} |
q11979 | HTML.addTabs | train | public function addTabs($i = 1)
{
Core\Config::setHTMLInstance($this);
Core\Config::set('tabs', (Core\Config::get('tabs') + $i));
return $this;
} | php | {
"resource": ""
} |
q11980 | Openinghtml.xhtml | train | public function xhtml()
{
$this->htmlattrs['xmlns'] = 'http://www.w3.org/1999/xhtml';
echo '<?xml version="1.0" ?>'."\n";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"';
Core\Generator::lineBreak();
Core\Config::set('tabs', '++');
Core\Generator::tabs();
echo '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
Core\Generator::lineBreak();
Core\Config::set('tabs', '--');
echo $this->getHtml();
echo $this->getHead();
} | php | {
"resource": ""
} |
q11981 | Openinghtml.html5 | train | public function html5()
{
echo '<!DOCTYPE HTML>'."\n";
Core\Generator::lineBreak();
echo $this->getHtml();
echo $this->getHead();
\Xiphe\HTML::get()->utf8()
->meta('http-equiv=X-UA-Compatible|content=IE\=edge,chrome\=1');
} | php | {
"resource": ""
} |
q11982 | Openinghtml.getHtml | train | public function getHtml()
{
$html = new Core\Tag(
'html',
array((isset($this->args[1]) ? $this->args[1] : null)),
array('generate', 'start')
);
$html->setAttrs($this->htmlattrs);
return $html;
} | php | {
"resource": ""
} |
q11983 | Openinghtml.getHead | train | public function getHead()
{
$head = new Core\Tag(
'head',
array((isset($this->args[0]) ? $this->args[0] : null)),
array('generate', 'start')
);
$head->setAttrs($this->headattrs);
return $head;
} | php | {
"resource": ""
} |
q11984 | Openinghtml.ieClass | train | public function ieClass($before = '')
{
$sIeClass = '';
if (class_exists('Xiphe\THEMASTER\core\THEMASTER')) {
if (\Xiphe\THETOOLS::is_browser('ie')) {
if (\Xiphe\THETOOLS::is_browser('ie<=6')) {
$sIeClass = $before.'lt-ie10 lt-ie9 lt-ie8 lt-ie7';
} elseif (\Xiphe\THETOOLS::is_browser('ie<=7')) {
$sIeClass = $before.'lt-ie10 lt-ie9 lt-ie8';
} elseif (\Xiphe\THETOOLS::is_browser('ie<=8')) {
$sIeClass = $before.'lt-ie10 lt-ie9';
} elseif (\Xiphe\THETOOLS::is_browser('ie<=9')) {
$sIeClass = $before.'lt-ie10';
}
}
}
return $sIeClass;
} | php | {
"resource": ""
} |
q11985 | Openinghtml.browserClass | train | public function browserClass($before = '')
{
if (class_exists('Xiphe\THEMASTER\core\THEMASTER')) {
$browser = str_replace(' ', '_', strtolower(\Xiphe\THETOOLS::get_browser()));
$version = str_replace('.', '-', \Xiphe\THETOOLS::get_browserVersion());
$engine = strtolower(\Xiphe\THETOOLS::get_layoutEngine());
if (!empty($engine)) {
$engine .=' ';
}
if (\Xiphe\THETOOLS::is_browser('mobile')) {
$mobile = 'mobile no-desktop';
} else {
$mobile = 'desktop no-mobile';
}
return "$before$engine$browser $browser-$version $mobile";
}
return '';
} | php | {
"resource": ""
} |
q11986 | DaemonFactory.buildAsync | train | public static function buildAsync(
$host,
$port,
$user,
$pass,
$queueName,
QueueConsumer $consumer,
$escapeMode = self::ESCAPE_MODE_SERIALIZE,
$requeueOnFailure = true,
LoggerInterface $logger = null,
$stopOnFailure = false
) {
return self::build(
$host,
$port,
$user,
$pass,
$queueName,
$consumer,
false,
$escapeMode,
$requeueOnFailure,
$stopOnFailure
);
} | php | {
"resource": ""
} |
q11987 | DaemonFactory.build | train | private static function build(
$host,
$port,
$user,
$pass,
$queueName,
QueueConsumer $consumer,
$sync,
$escapeMode,
$requeueOnFailure,
LoggerInterface $logger = null,
$stopOnFailure = false
) {
$consumer = self::getSerializingConsumer($consumer, $escapeMode);
$driver = DriverFactory::getDriver([
'host' => $host,
'port' => $port,
'user' => $user,
'pwd' => $pass
]);
$builder = new HandlerBuilder($driver);
if ($sync) {
$builder->sync($consumer);
} else {
$builder->async($consumer);
}
if (! $stopOnFailure) {
$builder->continueOnFailure();
}
if (! $requeueOnFailure) {
$builder->doNotRequeueOnFailure();
}
$builder->log(($logger === null) ? new NullLogger() : $logger);
return new QueueHandlingDaemon($driver, $builder->build(), $queueName);
} | php | {
"resource": ""
} |
q11988 | Generator._applyPreGenerationFilters | train | private static function _applyPreGenerationFilters(&$Obj)
{
if ($Obj->name == 'comment' && Config::get('noComments')) {
$Obj->destroy();
return false;
}
if (in_array('justGetObject', $Obj->options)) {
return $Obj;
}
if (in_array('return', $Obj->options)) {
ob_start();
}
} | php | {
"resource": ""
} |
q11989 | Generator._applyPostGenerationFilters | train | private static function _applyPostGenerationFilters(&$Obj)
{
if (in_array('return', $Obj->options)) {
return ob_get_clean();
}
if (in_array('getObject', $Obj->options)) {
return $Obj;
}
} | php | {
"resource": ""
} |
q11990 | Generator.parseAtts | train | public static function parseAtts($input)
{
if (is_object($input) && get_class($input) == 'Xiphe\HTML\core\Tag') {
$Tag = $input;
$input = $Tag->attributes;
}
/*
* Check if attributes are already in array form.
*/
if (is_array($input)) {
return $input;
}
/*
* If no attributes were passed - return empty array.
*/
if (empty($input)) {
return array();
}
/*
* Split the attribute string into separated attributes by |
*/
$atts = preg_split('/(?<=[^\\\])[|]+/', $input, -1, PREG_SPLIT_NO_EMPTY);
/*
* Set the tags attributes to array
*/
$input = array();
/*
* Split the attributes in key an value by =
*/
foreach ($atts as $k => $attr) {
$attr = preg_split('/(?<=[^\\\])[=]+/', $attr, 2);
foreach ($attr as $k => $v) {
/*
* replace escaped pipe and equal glyphs.
*/
$attr[$k] = preg_replace('/[\\\]([=|\|])/', '$1', $v);
}
/*
* Has no value or key
*/
if (count($attr) == 1) {
/*
* A single attribute was passed
*/
if (isset($Tag) && count($atts) == 1) {
if (($t = self::getKeyAlias($attr)) && !self::_ignoreKeyAlias($t, $Tag) ) {
extract($t);
$attr[1] = substr($attr[0], strlen($alias));
$attr[0] = $key;
} else {
/*
* use the key from TagInfo::$singleAttrkeys
*/
$key = self::getSingleAttrKey($Tag);
if (false !== $key) {
$attr[1] = $attr[0];
$attr[0] = $key;
} else {
$attr[1] = null;
}
}
} elseif (isset($Tag) && ($t = self::getKeyAlias($attr))) {
extract($t);
$attr[1] = substr($attr[0], strlen($alias));
$attr[0] = $key;
} else {
$attr[1] = null;
}
if (isset($Tag) && $attr[0] === '%default') {
$attr[0] = TagInfo::$singleAttrkeys[$Tag->name];
}
}
/*
* Write Attribute to tag.
*/
$input[$attr[0]] = $attr[1];
}
return $input;
} | php | {
"resource": ""
} |
q11991 | Generator.updateClasses | train | public static function updateClasses(Tag &$Tag)
{
if (empty($Tag->classes) && isset($Tag->attributes['class'])) {
$classes = explode(' ', $Tag->attributes['class']);
} elseif (!empty($Tag->classes)) {
$classes = $Tag->classes;
}
if (isset($classes)) {
sort($classes);
$Tag->classes = $classes;
$Tag->attributes['class'] = implode(' ', $classes);
}
} | php | {
"resource": ""
} |
q11992 | Generator.mergeStyles | train | public static function mergeStyles($a, $b)
{
/*
* Cut the styles at the ; symbols
*/
$a = explode(';', $a);
/*
* Will contain all style keys and the indexes of them in $a.
*/
$amap = array();
/*
* Getter for the style key.
*/
$gk = function ($s) {
return trim(substr($s, 0, strpos($s, ':')));
};
/*
* Cleanup $a and build the map.
*/
foreach ($a as $k => $v) {
if (trim($v) == '') {
unset($a[$k]);
continue;
}
$a[$k] = trim($v);
$amap[$gk($v)] = $k;
}
/*
* Merge $b
*/
foreach (explode(';', $b) as $st) {
if (trim($st) == '') {
continue;
}
/*
* If the current key is set in the map.
* remove it from $a
*/
if (isset($amap[$gk($st)])) {
unset($a[$amap[$gk($st)]]);
}
$a[] = trim($st);
}
/*
* sort, minimize and return.
*/
sort($a);
return str_replace(array(': ', ': '), ':', implode(';', $a)).';';
} | php | {
"resource": ""
} |
q11993 | Generator.mergeClasses | train | public static function mergeClasses($a, $b)
{
$str = 0;
if (!is_array($a)) {
$str++;
$a = explode(' ', $a);
}
if (!is_array($b)) {
$str++;
$b = explode(' ', $b);
}
$b = array_filter($b, function ($item) use ($a) {
return !in_array($item, $a);
});
$r = array_merge($a, $b);
sort($r);
if ($str === 2) {
$r = implode(' ', $r);
}
return $r;
} | php | {
"resource": ""
} |
q11994 | Generator.mergeAttrs | train | public static function mergeAttrs($b, $a, $combineClasses = true, $combineStyles = true)
{
$a = self::parseAtts($a);
$b = self::parseAtts($b);
if ($combineClasses && isset($a['class']) && isset($b['class'])) {
$a['class'] = self::mergeClasses($a['class'], $b['class']);
unset($b['class']);
}
if ($combineStyles && isset($a['style']) && isset($b['style'])) {
$a['style'] = self::mergeStyles($a['style'], $b['style']);
unset($b['style']);
}
$r = array_merge($b, $a);
ksort($r);
return $r;
} | php | {
"resource": ""
} |
q11995 | Generator.addDefaultAttributes | train | public static function addDefaultAttributes(Tag &$Tag)
{
if (isset(TagInfo::$defaultAttributes[$Tag->name])) {
$Tag->attributes = array_merge(
TagInfo::$defaultAttributes[$Tag->name],
$Tag->attributes
);
}
} | php | {
"resource": ""
} |
q11996 | Generator.addDefaultOptions | train | public static function addDefaultOptions(Tag &$Tag)
{
if (isset(TagInfo::$defaultOptions[$Tag->name])) {
foreach (TagInfo::$defaultOptions[$Tag->name] as $defopt) {
if (!in_array($defopt, $Tag->options)) {
$Tag->options[] = $defopt;
}
}
}
} | php | {
"resource": ""
} |
q11997 | Generator.addDoubleAttributes | train | public static function addDoubleAttributes(Tag &$Tag)
{
if (isset(TagInfo::$doubleAttrs[$Tag->name])) {
$missing = array();
$found = '';
foreach (TagInfo::$doubleAttrs[$Tag->name] as $k => $name) {
if ($k === '%callback') {
$callback = $name;
continue;
}
if (isset($Tag->attributes[$name])) {
$found = $Tag->attributes[$name];
} else {
$missing[] = $name;
}
}
if (empty($found) || empty($missing)) {
return;
}
foreach ($missing as $k) {
$Tag->attributes[$k] = $found;
}
if (count($missing) && isset($callback) && is_callable($callback)) {
call_user_func_array($callback, array(&$Tag, $missing));
}
}
} | php | {
"resource": ""
} |
q11998 | Generator.magicAlt | train | public static function magicAlt(Tag &$Tag, $changed)
{
switch ($Tag->realName) {
case 'img':
if (in_array('alt', $changed)) {
$Tag->attributes['alt'] = basename($Tag->attributes['alt']);
}
break;
default:
break;
}
} | php | {
"resource": ""
} |
q11999 | Generator.getKeyAlias | train | public static function getKeyAlias(array &$attr)
{
foreach (TagInfo::$attrKeyAliases as $alias => $key) {
if (strpos($attr[0], $alias) === 0) {
return compact('key', 'alias');
}
}
return false;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.