_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q13000 | DeviceInfo.toProtobuf | train | public function toProtobuf() : SignatureDeviceInfo
{
$deviceInfo = new SignatureDeviceInfo();
if ($this->deviceId !== null) {
$deviceInfo->setDeviceId($this->deviceId);
}
$deviceInfo->setDeviceBrand($this->deviceBrand);
| php | {
"resource": ""
} |
q13001 | WindowsAzureDistributionExtension.loadKeyValueStore | train | protected function loadKeyValueStore($config, $container, $loader)
{
if (empty($config['key_value_store']['connection_name'])) {
return;
}
| php | {
"resource": ""
} |
q13002 | Router.getNamedUrl | train | public function getNamedUrl($name, $params = array(), $version = null, $locale = null)
{
if ($version == null) {
$version = Registry::get('version');
}
if ($locale == null) {
$locale = Registry::get('locale');
}
$foundRoute = false;
if (isset($this->allRoutesByVersionAndLocale[$version][$locale][$name])) {
$url = $this->allRoutesByVersionAndLocale[$version][$locale][$name]['regexp'];
$foundRoute = true;
} elseif (isset($this->allRoutesByVersionAndLocale[$version]['*'][$name])) {
$url = $this->allRoutesByVersionAndLocale[$version]['*'][$name]['regexp'];
$foundRoute = true;
} elseif (isset($this->allRoutesByVersionAndLocale['*']['*'][$name])) {
$url = $this->allRoutesByVersionAndLocale['*']['*'][$name]['regexp'];
$foundRoute = true; | php | {
"resource": ""
} |
q13003 | NodeElement.appendChildWithText | train | public function appendChildWithText(NodeElement $nodeElement, $text, $append = true)
{
$content = $nodeElement->render();
if ($append === true) {
$content = $content.$text;
| php | {
"resource": ""
} |
q13004 | NodeElement.setText | train | public function setText($text, $finalize = true)
{
if ($finalize && !$this->isFinalized()) {
$this->finalize();
| php | {
"resource": ""
} |
q13005 | NodeElement.finalize | train | public function finalize($singular = false)
{
$this->finalized = true;
if ($singular === true) {
$text = ' />';
} else {
| php | {
"resource": ""
} |
q13006 | NodeElement.openTag | train | public function openTag($tagName)
{
$this->append(sprintf('<%s', $tagName));
| php | {
"resource": ""
} |
q13007 | NodeElement.closeTag | train | public function closeTag($tag = null)
{
if ($tag === null) {
$tag = $this->tag;
| php | {
"resource": ""
} |
q13008 | NodeElement.addPropertyOnDemand | train | public function addPropertyOnDemand($property, $value)
{
if ((bool) $value | php | {
"resource": ""
} |
q13009 | NodeElement.addAttribute | train | public function addAttribute($attribute, $value)
{
// Escape special characters
$value = Filter::filterAttribute($value);
if ($this->isProperty($attribute)) {
$this->addPropertyOnDemand($attribute, $value);
} else {
if ($this->hasAttribute($attribute)) {
| php | {
"resource": ""
} |
q13010 | NodeElement.addAttributes | train | public function addAttributes(array $attributes)
{
foreach ($attributes as | php | {
"resource": ""
} |
q13011 | NodeElement.hasClass | train | public function hasClass($class = null)
{
if ($class !== null) {
$classes = explode(' ', $this->getClass());
return in_array($class, $classes);
| php | {
"resource": ""
} |
q13012 | Data.isActiveDefaultPayment | train | public function isActiveDefaultPayment()
{
return $this->scopeConfig->isSetFlag(
self::XML_PAYMENT_DEFAULT_ACTIVE_DEFAULT_PAYMENT,
| php | {
"resource": ""
} |
q13013 | Data.getDefaultMethod | train | public function getDefaultMethod()
{
return $this->scopeConfig->getValue(
self::XML_PAYMENT_DEFAULT_METHOD,
| php | {
"resource": ""
} |
q13014 | Data.isActiveGoogleAddress | train | public function isActiveGoogleAddress()
{
$flag = $this->scopeConfig->isSetFlag(
self::XML_GOOGLE_MAP_ADDRESS_ACTIVE_GOOGLE_ADDRESS,
| php | {
"resource": ""
} |
q13015 | Data.isActiveBillingGoogleAddress | train | public function isActiveBillingGoogleAddress()
{
$flag = $this->scopeConfig->isSetFlag(
self::XML_GOOGLE_MAP_ADDRESS_ACTIVE_GOOGLE_ADDRESS_BILLING,
| php | {
"resource": ""
} |
q13016 | Data.getGoogleMapApiKey | train | public function getGoogleMapApiKey()
{
$str = $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_API_KEY,
| php | {
"resource": ""
} |
q13017 | Data.getGoogleMapAddressLibraries | train | public function getGoogleMapAddressLibraries()
{
return $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_ADDRESS_LIBRARIES,
| php | {
"resource": ""
} |
q13018 | Data.getGoogleMapAddressCountries | train | public function getGoogleMapAddressCountries()
{
return explode(
',',
(string) $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_ADDRESS_COUNTRY,
| php | {
"resource": ""
} |
q13019 | Data.getGoogleMapAddressLanguage | train | public function getGoogleMapAddressLanguage()
{
return $this->scopeConfig->getValue(
self::XML_GOOGLE_MAP_ADDRESS_LANGUAGE,
| php | {
"resource": ""
} |
q13020 | API.checkChallenge | train | public function checkChallenge()
{
$request = new CheckChallenge();
/** @var CheckChallengeResponse $response */
$response = $this->service->execute($request, $this->position);
$challengeUrl = trim($response->getChallengeUrl());
if ($response->getShowChallenge() || !empty($challengeUrl)) {
if (!$this->captchaSolver instanceof Solver) {
$this->getLogger()->alert("Account has been flagged for CAPTCHA. No CAPTCHA-solver defined, returning challenge.");
return $challengeUrl;
}
$this->getLogger()->alert("Account has been flagged for CAPTCHA. Attempting to solve CAPTCHA with defined resolver.");
/* Attempt to | php | {
"resource": ""
} |
q13021 | API.acceptTerms | train | public function acceptTerms() : MarkTutorialCompleteResponse
{
$request = new MarkTutorialComplete();
| php | {
"resource": ""
} |
q13022 | API.getPlayerData | train | public function getPlayerData() : GetPlayerResponse
{
$request = new GetPlayer();
| php | {
"resource": ""
} |
q13023 | API.getInventory | train | public function getInventory() : GetInventoryResponse
{
$request = new GetInventory();
| php | {
"resource": ""
} |
q13024 | API.getMapObjects | train | public function getMapObjects() : GetMapObjectsResponse
{
$request = new GetMapObjects($this->position);
| php | {
"resource": ""
} |
q13025 | PluginBag.appendInternal | train | private function appendInternal($unit, array &$stack)
{
$unit = $this->normalizeAssetPath($unit);
| php | {
"resource": ""
} |
q13026 | PluginBag.normalizeAssetPath | train | private function normalizeAssetPath($path)
{
$pattern = '~@(\w+)~';
$replacement = sprintf('/%s/$1/%s', | php | {
"resource": ""
} |
q13027 | PluginBag.register | train | public function register(array $collection)
{
foreach ($collection as | php | {
"resource": ""
} |
q13028 | PluginBag.load | train | public function load($plugins)
{
if (!is_array($plugins)) {
$plugins = (array) $plugins;
}
foreach ($plugins as $plugin) {
if (!isset($this->plugins[$plugin])) {
trigger_error(sprintf('Attempted to load non-existing plugin %s', $plugin));
| php | {
"resource": ""
} |
q13029 | ReportTasks.reportLighthouse | train | public function reportLighthouse($opts = [
'hostname' => null,
'protocol' => 'http'
])
{
$host = ProjectX::getProjectConfig()
->getHost();
$protocol = $opts['protocol'];
$hostname = isset($opts['hostname'])
? $opts['hostname']
: (isset($host['name']) ? $host['name'] : 'localhost');
| php | {
"resource": ""
} |
q13030 | ReportTasks.getReportsPath | train | protected function getReportsPath()
{
$project_root = ProjectX::projectRoot();
$reports_path = | php | {
"resource": ""
} |
q13031 | EngineTasks.engineUp | train | public function engineUp($opts = ['no-hostname' => false, 'no-browser' => false])
{
$this->executeCommandHook(__FUNCTION__, 'before');
| php | {
"resource": ""
} |
q13032 | EngineTasks.engineRebuild | train | public function engineRebuild()
{
$this->executeCommandHook(__FUNCTION__, 'before');
| php | {
"resource": ""
} |
q13033 | EngineTasks.engineDown | train | public function engineDown($opts = [
'include-network' => false
])
{
$this->executeCommandHook(__FUNCTION__, 'before');
| php | {
"resource": ""
} |
q13034 | EngineTasks.engineResume | train | public function engineResume()
{
$this->executeCommandHook(__FUNCTION__, 'before');
| php | {
"resource": ""
} |
q13035 | EngineTasks.engineRestart | train | public function engineRestart()
{
$this->executeCommandHook(__FUNCTION__, 'before');
| php | {
"resource": ""
} |
q13036 | EngineTasks.engineReboot | train | public function engineReboot()
{
$this->executeCommandHook(__FUNCTION__, 'before');
| php | {
"resource": ""
} |
q13037 | EngineTasks.engineInstall | train | public function engineInstall()
{
$this->executeCommandHook(__FUNCTION__, 'before');
| php | {
"resource": ""
} |
q13038 | EngineTasks.executeExistingCommand | train | protected function executeExistingCommand(
$command_name,
InputInterface $input = null,
OutputInterface $output = null
) {
if (!isset($command_name)) {
return 1;
}
$input = isset($input) ? | php | {
"resource": ""
} |
q13039 | StatusGenerator.getDescriptionByStatusCode | train | public function getDescriptionByStatusCode($code)
{
// Make sure the expected type supplied
$code = (int) $code;
if (isset($this->statuses[$code])) {
return $this->statuses[$code];
} else {
| php | {
"resource": ""
} |
q13040 | StatusGenerator.generate | train | public function generate($code)
{
if ($this->isValid($code)) {
return sprintf('HTTP/%s %s %s', $this->version, $code, | php | {
"resource": ""
} |
q13041 | ProjectX.discoverCommands | train | public function discoverCommands()
{
$commands = (new PhpClassDiscovery())
->addSearchLocation(APP_ROOT . '/src/Command')
| php | {
"resource": ""
} |
q13042 | ProjectX.setEnvVariables | train | public static function setEnvVariables()
{
$env_variables = [];
if (file_exists(static::projectRoot() . '/.env')) {
$env_variables = (new | php | {
"resource": ""
} |
q13043 | ProjectX.setDefaultServices | train | public static function setDefaultServices($container)
{
$project_root = self::projectRoot();
$container
->share('projectXTemplate', \Droath\ProjectX\Template\TemplateManager::class);
$container
->share('projectXGitHubUserAuth', \Droath\ProjectX\Service\GitHubUserAuthStore::class);
$container
->share('projectXHostChecker', \Droath\ProjectX\Service\HostChecker::class);
$container
->add('projectXEngine', function () use ($container) {
return (new \Droath\ProjectX\Engine\EngineTypeFactory(
$container->get('projectXEngineResolver')
))->createInstance();
});
$container
->share('projectXEngineResolver', \Droath\ProjectX\Engine\EngineTypeResolver::class)
->withArgument('projectXFilesystemCache');
$container
->add('projectXProject', function () use ($container) {
return (new \Droath\ProjectX\Project\ProjectTypeFactory(
$container->get('projectXProjectResolver')
))->createInstance();
});
$container
->share('projectXProjectResolver', \Droath\ProjectX\Project\ProjectTypeResolver::class)
| php | {
"resource": ""
} |
q13044 | ProjectX.taskLocations | train | public static function taskLocations()
{
$locations = array_merge(
[self::projectRoot()],
self::getEngineType()->taskDirectories(),
self::getProjectType()->taskDirectories(),
self::getPlatformType()->taskDirectories()
);
| php | {
"resource": ""
} |
q13045 | ProjectX.getPlatformType | train | public static function getPlatformType()
{
$container = self::getContainer();
$builder = CollectionBuilder::create($container, false);
| php | {
"resource": ""
} |
q13046 | ProjectX.getProjectType | train | public static function getProjectType()
{
$container = self::getContainer();
$builder = CollectionBuilder::create($container, new ProjectTasks());
| php | {
"resource": ""
} |
q13047 | ProjectX.getEngineType | train | public static function getEngineType()
{
$container = self::getContainer();
$builder = CollectionBuilder::create($container, new EngineTasks());
| php | {
"resource": ""
} |
q13048 | ProjectX.getProjectConfig | train | public static function getProjectConfig()
{
if (!isset(self::$projectConfig)) {
$config = self::getConfigInstance();
$values = self::getLocalConfigValues();
self::$projectConfig = empty($values)
| php | {
"resource": ""
} |
q13049 | ProjectX.getRemoteEnvironments | train | public static function getRemoteEnvironments()
{
$environments = [];
foreach (self::getProjectConfig()->getRemote() as $remote) {
foreach ($remote as $environment) {
if (!isset($environment['realm'])) {
continue;
}
$realm = $environment['realm'];
| php | {
"resource": ""
} |
q13050 | ProjectX.getLocalConfigValues | train | protected static function getLocalConfigValues()
{
$root = self::projectRoot();
$path = "{$root}/project-x.local.yml";
if (!file_exists($path)) {
return [];
}
| php | {
"resource": ""
} |
q13051 | AttemptLimit.getCurrentFailAttemptCount | train | public function getCurrentFailAttemptCount()
{
if (!$this->sessionBag->has(self::PARAM_ATTEMPT_NS)) {
$this->reset();
| php | {
"resource": ""
} |
q13052 | AttemptLimit.getLastLogin | train | public function getLastLogin()
{
if ($this->sessionBag->has(self::PARAM_LAST_LOGIN_NS)) {
| php | {
"resource": ""
} |
q13053 | Filter.fromList | train | public function fromList($value): self
{
$value = collect($value)->implode(self::SEPARATOR); | php | {
"resource": ""
} |
q13054 | FileManager.humanSize | train | public static function humanSize($bytes)
{
// Make sure we can't divide by zero
if ($bytes == 0) {
return '0 B';
}
$value = | php | {
"resource": ""
} |
q13055 | FileManager.hasExtension | train | public static function hasExtension($baseName, array $extensions)
{
// Lowercase names
$baseName = strtolower($baseName);
$extensions = array_map(function($key){
| php | {
"resource": ""
} |
q13056 | FileManager.getMimeType | train | public static function getMimeType($file)
{
$mimeType = new MimeTypeGuesser();
$extension | php | {
"resource": ""
} |
q13057 | FileManager.rmfile | train | public static function rmfile($file)
{
if (is_file($file)) {
return chmod($file, 0777) && unlink($file);
| php | {
"resource": ""
} |
q13058 | FileManager.getDirTree | train | public static function getDirTree($dir, $self = false)
{
if (!is_dir($dir)) {
throw new RuntimeException(sprintf(
'Can not build directory tree because of invalid path "%s"', $dir
));
}
$target = array();
$tree = array();
$iterator = new RecursiveIteratorIterator(
| php | {
"resource": ""
} |
q13059 | FileManager.getDirSizeCount | train | public static function getDirSizeCount($dir)
{
if (!is_dir($dir)) {
throw new RuntimeException(sprintf('Invalid directory path supplied "%s"', $dir));
| php | {
"resource": ""
} |
q13060 | FileManager.chmod | train | public static function chmod($file, $mode, array &$ignored = array())
{
if (is_file($file)) {
if (!chmod($file, $mode)) {
array_push($ignored, $file);
return false;
}
} else if (is_dir($file)) {
$items = self::getDirTree($file, true);
foreach ($items as $item) {
if (!chmod($item, $mode)) {
array_push($ignored, $item);
| php | {
"resource": ""
} |
q13061 | FileManager.copy | train | public static function copy($src, $dst)
{
if (!is_dir($src)) {
throw new RuntimeException(sprintf('Invalid directory path supplied "%s"', $src));
}
$dir = opendir($src);
if (!is_dir($dst)) {
mkdir($dst, 0777);
}
while (false !== ($file = readdir($dir))) {
// We must ensure a file isn't a dot
if (($file != '.' ) && ($file != '..' )) {
if (is_dir($src . '/' . $file)) {
| php | {
"resource": ""
} |
q13062 | FileManager.move | train | public static function move($from, $to)
{
return | php | {
"resource": ""
} |
q13063 | FileManager.isFileEmpty | train | public static function isFileEmpty($file)
{
if (!is_file($file)) {
throw new RuntimeException(sprintf('Invalid file path supplied'));
}
| php | {
"resource": ""
} |
q13064 | FileManager.getFirstLevelDirs | train | public static function getFirstLevelDirs($dir)
{
$iterator = new DirectoryIterator($dir);
$result = array();
foreach ($iterator as $item) {
if (!$item->isDot() && $item->isDir()) {
| php | {
"resource": ""
} |
q13065 | News.summaryFields | train | public function summaryFields()
{
$summaryFields = parent::summaryFields();
$summaryFields = array_merge(
$summaryFields, array(
'Title' => _t('News.TITLE', 'Title'),
'Author' => _t('News.AUTHOR', 'Author'),
| php | {
"resource": ""
} |
q13066 | News.searchableFields | train | public function searchableFields()
{
$searchableFields = parent::searchableFields();
unset($searchableFields['PublishFrom']);
$searchableFields['Title'] = array(
'field' => 'TextField',
| php | {
"resource": ""
} |
q13067 | News.fieldLabels | train | public function fieldLabels($includerelations = true)
{
$labels = parent::fieldLabels($includerelations);
$newsLabels = array(
'Title' => _t('News.TITLE', 'Title'),
'Author' => _t('News.AUTHOR', 'Author'),
'Synopsis' => _t('News.SUMMARY', 'Summary/Abstract'),
'Content' => _t('News.CONTENT', 'Content'),
'PublishFrom' => _t('News.PUBDATE', 'Publish from'),
'Live' => _t('News.PUSHLIVE', 'Published'),
'Commenting' => _t('News.COMMENTING', 'Allow comments on this item'),
'Type' => _t('News.NEWSTYPE', 'Type of item'),
'External' | php | {
"resource": ""
} |
q13068 | News.onBeforeWrite | train | public function onBeforeWrite()
{
parent::onBeforeWrite();
/** Check if we have translatable and a NewsHolderPage. If no HolderPage available, skip (Create an orphan) */
if (!$this->NewsHolderPages()->count()) {
if (!class_exists('Translatable') && $page = NewsHolderPage::get()->first()) {
$this->NewsHolderPages()->add($page);
} elseif (class_exists('Translatable')) {
Translatable::disable_locale_filter();
$page = NewsHolderPage::get()->first();
| php | {
"resource": ""
} |
q13069 | News.setURLValue | train | private function setURLValue()
{
if (!$this->URLSegment || ($this->isChanged('Title') && !$this->isChanged('URLSegment'))) {
if ($this->ID > 0) {
$Renamed = new Renamed();
$Renamed->OldLink = $this->URLSegment;
$Renamed->NewsID = $this->ID;
$Renamed->write();
$this->URLSegment = singleton('SiteTree')->generateURLSegment($this->Title);
if (strpos($this->URLSegment, 'page-') === false) {
$URLSegment = $this->URLSegment;
| php | {
"resource": ""
} |
q13070 | News.LookForExistingURLSegment | train | private function LookForExistingURLSegment($URLSegment)
{
return (News::get()
->filter(array('URLSegment' => $URLSegment))
| php | {
"resource": ""
} |
q13071 | News.LinkingMode | train | public function LinkingMode()
{
/** @var Page_Controller $controller */
$controller = | php | {
"resource": ""
} |
q13072 | News.getStatus | train | public function getStatus()
{
$published = $this->isPublished() ? _t('News.IsPublished', 'published') : _t('News.IsUnpublished', 'not published');
if ($this->isPublished() && $this->PublishFrom > SS_Datetime::now()->Rfc2822()) {
| php | {
"resource": ""
} |
q13073 | News.doPublish | train | public function doPublish()
{
if (!$this->canEdit()) {
throw new ValidationException(_t('News.PublishPermissionFailure', 'No permission to publish | php | {
"resource": ""
} |
q13074 | News.doUnpublish | train | public function doUnpublish()
{
if (!$this->canEdit()) {
throw new ValidationException(_t('News.PublishPermissionFailure', 'No permission to publish | php | {
"resource": ""
} |
q13075 | Checkout.CreateFreePostageObject | train | public static function CreateFreePostageObject()
{
$postage = new PostageArea();
$postage->ID = -1;
$postage->Title = _t("Checkout.FreeShipping", "Free Shipping");
| php | {
"resource": ""
} |
q13076 | Application.create | train | public static function create(string $basePath): Application {
self::$instance | php | {
"resource": ""
} |
q13077 | Application.basePath | train | public function basePath(?string $basePath = null) {
if ($basePath != | php | {
"resource": ""
} |
q13078 | Application.storagePath | train | public function storagePath(?string $storagePath = null) {
if ($storagePath != null) {
$this->storagePath = $storagePath;
}
else if (!isset($this->storagePath)) {
| php | {
"resource": ""
} |
q13079 | Application.resourcesPath | train | public function resourcesPath(?string $resourcesPath = null) {
if ($resourcesPath != null) {
$this->resourcesPath = $resourcesPath;
| php | {
"resource": ""
} |
q13080 | Application.configPath | train | public function configPath(?string $configPath = null) {
if ($configPath != null) {
$this->configPath = $configPath;
}
else {
if (!isset($this->configPath)) {
| php | {
"resource": ""
} |
q13081 | Application.localConfigPath | train | public function localConfigPath(?string $localConfigPath = null) {
if ($localConfigPath != null) {
$this->localConfigPath = $localConfigPath;
}
else {
if (!isset($this->localConfigPath)) {
| php | {
"resource": ""
} |
q13082 | Application.start | train | public function start() {
foreach ($this->modules as $module) {
$module->start();
}
if (php_sapi_name() == "cli") {
| php | {
"resource": ""
} |
q13083 | Application.getParameterValues | train | private function getParameterValues ($function, array $parameters = []) {
$functionParams = [];
$parameterIndex = 0;
foreach ($function->getParameters() as $parameter) {
$parameterName = $parameter->getName();
$parameterValue = null;
if (array_key_exists($parameterName, $parameters)) {
$parameterValue = $parameters[$parameterName];
}
else if ($parameter->hasType()) {
$type = $parameter->getType();
if (!$type->isBuiltin()) {
$typeName = (string)$type;
if (array_key_exists($typeName, $parameters)) {
$parameterValue = $parameters[$typeName];
}
else if (!$parameter->isDefaultValueAvailable()) {
$typeClass = new ReflectionClass($typeName);
foreach ($typeClass->getMethods(ReflectionMethod::IS_STATIC) as $staticMethod) {
if ($staticMethod->getReturnType() != null && ((string)$staticMethod->getReturnType() == $typeName) && $staticMethod->getNumberOfParameters() == 0) {
| php | {
"resource": ""
} |
q13084 | Application.handleError | train | public function handleError($errno, $errstr, $errfile, $errline, $errcontext) {
| php | {
"resource": ""
} |
q13085 | Translator.translate | train | public function translate($text, $autoDetect = true)
{
if (! $this->getTargetLang()) {
throw new TranslateException('No target language was set.');
}
if (! $this->getSourceLang() && $autoDetect) {
// Detect language if source language was not provided and auto detect is turned on
$this->setSourceLang($this->detect($text));
} else {
if (! $this->getSourceLang()) {
throw new TranslateException('No source language was set with autodetect turned off.');
}
}
$requestUrl = $this->buildRequestUrl($this->getTranslateUrl(), [
| php | {
"resource": ""
} |
q13086 | Translator.detect | train | public function detect($text)
{
$requestUrl = $this->buildRequestUrl($this->getDetectUrl(), [
'q' => $text
]);
$response = $this->getResponse($requestUrl);
if (isset($response['data']['detections'])) {
| php | {
"resource": ""
} |
q13087 | Translator.getResponse | train | protected function getResponse($requestUrl)
{
$response = $this->getHttpClient()->get($requestUrl);
return | php | {
"resource": ""
} |
q13088 | DoctrineOrmDataSource.setQuery | train | public function setQuery($query)
{
$this->cacheRows = null;
$this->size = null;
| php | {
"resource": ""
} |
q13089 | AbstractConstraint.violate | train | public function violate($message)
{
if (!empty($this->messages)){
$message = $this->messages[0];
| php | {
"resource": ""
} |
q13090 | TreeBuilder.applyToChildNodes | train | public function applyToChildNodes($parentId, Closure $callback)
{
$ids = $this->findChildNodeIds($parentId);
// If there's at least one child id, then start working next
if (!empty($ids)) {
foreach ($ids as $id) {
| php | {
"resource": ""
} |
q13091 | TreeBuilder.findParentNodesByChildId | train | public function findParentNodesByChildId($id)
{
// To be returned
$result = array();
$rl = $this->getRelations();
$data = $rl[RelationBuilder::TREE_PARAM_ITEMS];
// If can't find, then return empty array
if (!isset($data[$id])) {
return array();
}
$current = $data[$id]; | php | {
"resource": ""
} |
q13092 | TreeBuilder.findAll | train | public function findAll($id)
{
$result = array();
$root = $this->findById($id);
if ($root !== false) {
$result = array_merge($result, | php | {
"resource": ""
} |
q13093 | TreeBuilder.findById | train | public function findById($id)
{
$result = array();
$relations = $this->getRelations();
$items = | php | {
"resource": ""
} |
q13094 | TreeBuilder.render | train | public function render(AbstractRenderer $renderer = null, $active = null)
{
if (is_null($renderer)) {
$renderer = $this->getRenderer();
| php | {
"resource": ""
} |
q13095 | TreeBuilder.getRelations | train | private function getRelations()
{
if (is_null($this->relations)) {
$builder = | php | {
"resource": ""
} |
q13096 | TreeBuilder.findChildNodeWithKey | train | private function findChildNodeWithKey($parentId, $key)
{
$result = array();
$relations = $this->getRelations();
if (isset($relations[RelationBuilder::TREE_PARAM_PARENTS][$parentId])) {
foreach ($relations[RelationBuilder::TREE_PARAM_PARENTS][$parentId] as $id) {
// Current found node
| php | {
"resource": ""
} |
q13097 | Request.toProtobufRequest | train | public function toProtobufRequest()
{
$request = new \POGOProtos\Networking\Requests\Request();
$request->setRequestType($this->getType());
if (($message = $this->getMessage()) !== null) {
| php | {
"resource": ""
} |
q13098 | AbstractModule.loadArray | train | final protected function loadArray($file)
{
if (is_file($file)) {
$array = include($file);
if (is_array($array)) {
return $array;
} else {
| php | {
"resource": ""
} |
q13099 | AbstractModule.getConfig | train | final public function getConfig($key = null)
{
if (method_exists($this, 'getConfigData')) {
if ($this->config === null) {
$this->config = $this->getConfigData();
if (!is_array($this->config)) {
throw new LogicException('Configuration provider should return an array');
}
}
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.