_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3 values | text stringlengths 83 13k | language stringclasses 1 value | meta_information dict |
|---|---|---|---|---|---|
q3500 | TNabuTranslated.setTranslation | train | public function setTranslation(INabuTranslation $nb_translation)
{
if ($this->checkForValidTranslationInstance($nb_translation) &&
($nb_translation->isValueNumeric(NABU_LANG_FIELD_ID) || $nb_translation->isValueGUID(NABU_LANG_FIELD_ID))
) {
$nb_translation->setTranslatedObject($this);
$nb_language_id = $nb_translation->getValue(NABU_LANG_FIELD_ID);
$this->translations_list->addItem($nb_translation);
if ($this->translations_removed->containsKey($nb_language_id)) {
$this->translations_removed->removeItem($nb_language_id);
}
}
return $nb_translation;
} | php | {
"resource": ""
} |
q3501 | TNabuTranslated.removeTranslation | train | public function removeTranslation($nb_translation)
{
if ($this->checkForValidTranslationInstance($nb_translation) &&
($nb_translation->isValueNumeric(NABU_LANG_FIELD_ID)||
$nb_translation->isValueGUID(NABU_LANG_FIELD_ID))
) {
$nb_language_id = $nb_translation->getValue(NABU_LANG_FIELD_ID);
$this->translations_removed->addItem($nb_translation);
if ($this->translations_list->containsKey($nb_language_id)) {
$this->translations_list->removeItem($nb_translation);
}
}
} | php | {
"resource": ""
} |
q3502 | SchemaCommand.getClasses | train | protected function getClasses()
{
$class = $this->argument('class');
// set classes
if ($class) {
if (class_exists($class)) {
$classes = [$class];
} elseif (class_exists($this->config['models_namespace'] . '\\' . $class)) {
$classes = [$this->config['models_namespace'] . '\\' . $class];
} else {
throw new UnexpectedValueException('Classname is not valid.');
}
} else {
$classes = $this->finder->getClassesFromNamespace($this->config['models_namespace']);
}
return $classes;
} | php | {
"resource": ""
} |
q3503 | SchemaCommand.outputQueries | train | protected function outputQueries($statements)
{
$this->info(PHP_EOL . 'Outputting queries:');
if (empty($statements)) {
$this->info("No queries found.");
} else {
$this->info(implode(';' . PHP_EOL, $statements));
}
} | php | {
"resource": ""
} |
q3504 | CNabuRenderInterfaceAdapter.dumpFile | train | protected function dumpFile(string $filename)
{
if (strlen($filename) > 0 && file_exists($filename) && is_file($filename)) {
echo file_get_contents($filename);
return true;
}
return false;
} | php | {
"resource": ""
} |
q3505 | AnnotationLoader.registerAll | train | public function registerAll()
{
foreach ($this->files->allFiles($this->path) as $file) {
AnnotationRegistry::registerFile($file->getRealPath());
}
} | php | {
"resource": ""
} |
q3506 | CNabuSiteMapList.populate | train | public function populate(int $deep = 0)
{
$nb_site = $this->getSite();
$this->merge(CNabuSiteMap::getMapsForSite($nb_site));
$translations = CNabuSiteMapLanguage::getMapTranslationsForSite($nb_site);
if (is_array($translations) && count($translations) > 0) {
foreach ($translations as $translation) {
$item = $this->getItem($translation->getSiteMapId());
$item->setTranslation($translation);
}
}
$roles = CNabuSiteMapRole::getMapRolesForSite($nb_site);
if (is_array($roles) && count($roles) > 0) {
foreach ($roles as $role) {
$item = $this->getItem($role->getSiteMapId());
$item->addRole($role);
}
}
} | php | {
"resource": ""
} |
q3507 | CNabuRoleList.fillFromSite | train | public function fillFromSite($nb_site) : int
{
$this->clear();
$this->merge(CNabuRole::getRolesForSite($nb_site));
return $this->getSize();
} | php | {
"resource": ""
} |
q3508 | CNabuCommerceProductCategoryBase.findByKey | train | public static function findByKey($nb_commerce, $key)
{
$nb_commerce_id = nb_getMixedValue($nb_commerce, 'nb_commerce_id');
if (is_numeric($nb_commerce_id)) {
$retval = CNabuCommerceProductCategory::buildObjectFromSQL(
'select * '
. 'from nb_commerce_product_category '
. 'where nb_commerce_id=%commerce_id$d '
. "and nb_commerce_product_category_key='%key\$s'",
array(
'commerce_id' => $nb_commerce_id,
'key' => $key
)
);
} else {
$retval = null;
}
return $retval;
} | php | {
"resource": ""
} |
q3509 | CNabuCommerceProductCategoryBase.getAllCommerceProductCategories | train | public static function getAllCommerceProductCategories(CNabuCommerce $nb_commerce)
{
$nb_commerce_id = nb_getMixedValue($nb_commerce, 'nb_commerce_id');
if (is_numeric($nb_commerce_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_commerce_product_category_id',
'select * '
. 'from nb_commerce_product_category '
. 'where nb_commerce_id=%commerce_id$d',
array(
'commerce_id' => $nb_commerce_id
),
$nb_commerce
);
} else {
$retval = new CNabuCommerceProductCategoryList();
}
return $retval;
} | php | {
"resource": ""
} |
q3510 | CNabuCommerceProductCategoryBase.setCommerceId | train | public function setCommerceId(int $nb_commerce_id) : CNabuDataObject
{
if ($nb_commerce_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_commerce_id")
);
}
$this->setValue('nb_commerce_id', $nb_commerce_id);
return $this;
} | php | {
"resource": ""
} |
q3511 | ComparisonHydrator.hydrateCollection | train | public static function hydrateCollection(array $comparisons)
{
$hydrated = [];
foreach ($comparisons as $comparison) {
$hydrated[] = self::hydrate($comparison);
}
return $hydrated;
} | php | {
"resource": ""
} |
q3512 | ComparisonHydrator.hydrate | train | public static function hydrate(stdClass $comparison)
{
$hydrated = new ComparisonEntity();
if (isset($comparison->id)) {
$hydrated->setId($comparison->id);
}
if (isset($comparison->allowedMisses)) {
$hydrated->setAllowedMisses($comparison->allowedMisses);
}
if (isset($comparison->filesThreshold)) {
$hydrated->setFilesThreshold($comparison->filesThreshold);
}
if (isset($comparison->scannedOldFiles)) {
$hydrated->setScannedOldFiles($comparison->scannedOldFiles);
}
if (isset($comparison->scannedNewFiles)) {
$hydrated->setScannedNewFiles($comparison->scannedNewFiles);
}
if (isset($comparison->skippedOldFiles)) {
$hydrated->setSkippedOldFiles($comparison->skippedOldFiles);
}
if (isset($comparison->skippedNewFiles)) {
$hydrated->setSkippedNewFiles($comparison->skippedNewFiles);
}
if (isset($comparison->misses)) {
$hydrated->setMisses($comparison->misses);
}
return $hydrated;
} | php | {
"resource": ""
} |
q3513 | CNabuMessaging.getTemplates | train | public function getTemplates($force = false)
{
if ($this->nb_messaging_template_list === null) {
$this->nb_messaging_template_list = new CNabuMessagingTemplateList();
}
if ($this->nb_messaging_template_list->isEmpty() || $force) {
$this->nb_messaging_template_list->clear();
$this->nb_messaging_template_list->merge(CNabuMessagingTemplate::getAllMessagingTemplates($this));
$this->nb_messaging_template_list->iterate(function($key, CNabuMessagingTemplate $nb_template) {
$nb_template->setMessaging($this);
return true;
});
}
return $this->nb_messaging_template_list;
} | php | {
"resource": ""
} |
q3514 | CNabuMessaging.getTemplate | train | public function getTemplate($nb_template)
{
$retval = false;
if (is_numeric($nb_template_id = nb_getMixedValue($nb_template, NABU_MESSAGING_TEMPLATE_FIELD_ID))) {
$retval = $this->nb_messaging_template_list->getItem($nb_template_id);
if ($retval instanceof CNabuMessagingTemplate && $retval->getMessaging() === null) {
$retval->setMessaging($this);
}
}
return $retval;
} | php | {
"resource": ""
} |
q3515 | CNabuMessaging.getTemplateByKey | train | public function getTemplateByKey(string $key)
{
$retval = false;
if (is_string($key) && strlen($key) > 0) {
$this->getTemplates();
$retval = $this->nb_messaging_template_list->getItem($key, CNabuMessagingTemplateList::INDEX_KEY);
}
return $retval;
} | php | {
"resource": ""
} |
q3516 | CNabuMessaging.getFactory | train | public function getFactory()
{
$nb_engine = CNabuEngine::getEngine();
if (!($this->nb_messaging_pool_manager instanceof CNabuMessagingPoolManager)) {
$this->nb_messaging_pool_manager = CNabuEngine::getEngine()->getMessagingPoolManager();
}
if (!($this->nb_messaging_factory instanceof CNabuMessagingFactory)) {
$this->nb_messaging_factory = $this->nb_messaging_pool_manager->getFactory($this);
}
return $this->nb_messaging_factory;
} | php | {
"resource": ""
} |
q3517 | BaseServiceProvider.scanEntities | train | protected function scanEntities()
{
$app = $this->app;
// get classes
$classes = $app['datamapper.classfinder']->getClassesFromNamespace($app['config']['datamapper.models_namespace']);
// build metadata
$metadata = $app['datamapper.entity.scanner']->scan($classes, $app['config']['datamapper.namespace_tablenames'], $app['config']['datamapper.morphclass_abbreviations']);
// generate eloquent models
$app['datamapper.eloquent.generator']->generate($metadata, false);
// build schema
$app['datamapper.schema.builder']->update($metadata, false);
} | php | {
"resource": ""
} |
q3518 | BaseServiceProvider.registerEloquentModels | train | protected function registerEloquentModels()
{
$files = $this->app['files']->files(storage_path('framework/entities'));
foreach ($files as $file) {
if ($this->app['files']->extension($file) == '') {
require_once $file;
}
}
} | php | {
"resource": ""
} |
q3519 | CNabuServer.getSitesIndex | train | public function getSitesIndex() {
if ($this->isValueNumeric('nb_server_id')) {
$retval = CNabuSite::buildObjectListFromSQL('nb_site_id',
"SELECT distinct si.*
FROM nb_site si
INNER JOIN nb_cluster_group cg
ON si.nb_cluster_group_id=cg.nb_cluster_group_id
INNER JOIN nb_cluster_group_service cgs
ON cg.nb_cluster_group_id=cgs.nb_cluster_group_id
INNER JOIN nb_server_host sh
ON cgs.nb_cluster_group_service_id=sh.nb_cluster_group_service_id
INNER JOIN nb_server se
ON sh.nb_server_id=se.nb_server_id
AND se.nb_server_id=%server_id\$d
INNER JOIN nb_site_alias sa
ON si.nb_site_id=sa.nb_site_id
ORDER BY si.nb_site_mounting_order ASC",
array('server_id' => $this->getValue('nb_server_id'))
);
} else {
$retval = new CNabuSiteList();
}
return $retval;
} | php | {
"resource": ""
} |
q3520 | CNabuServer.getAdminUser | train | public function getAdminUser($force = false) {
if ($this->nb_admin_user === null || $force) {
$this->nb_admin_user = null;
if ($this->isValueNumeric('nb_server_admin_user_id')) {
$nb_user = new CNabuUser($this->getAdminUserId());
if ($nb_user->isFetched()) {
$this->nb_admin_user = $nb_user;
}
}
}
return $this->nb_admin_user;
} | php | {
"resource": ""
} |
q3521 | GeoService.getCountry | train | public function getCountry()
{
try {
$address = $this->remoteAddress->getRemoteAddress();
return $this->getReader()->country($address)->country->isoCode;
} catch (\Exception $e) {
return null;
}
} | php | {
"resource": ""
} |
q3522 | CNabuRenderFactory.render | train | public function render()
{
if ($this->discoverInterface()) {
$this->nb_interface->render();
} else {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_NOT_FOUND,
array($this->nb_descriptor->getKey())
);
}
} | php | {
"resource": ""
} |
q3523 | CNabuRenderFactory.setMIMEType | train | public function setMIMEType(string $mimetype)
{
if ($this->discoverInterface()) {
$this->nb_interface->setMIMEType($mimetype);
} else {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_NOT_FOUND,
array($this->nb_descriptor->getKey())
);
}
return $this;
} | php | {
"resource": ""
} |
q3524 | ControllerService.getAll | train | public function getAll($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->controllers()->getAll($appId, $profileId, $queryParams);
return new ControllersResponse($response);
} | php | {
"resource": ""
} |
q3525 | ControllerService.getById | train | public function getById($appId, $profileId, $controllerId, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->controllers()->getById($appId, $profileId, $controllerId, $queryParams);
return new ControllerResponse($response);
} | php | {
"resource": ""
} |
q3526 | ControllerService.create | train | public function create($appId, $profileId, ControllerBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->controllers()->create($appId, $profileId, $input->toArray(), $queryParams);
return new ControllerResponse($response);
} | php | {
"resource": ""
} |
q3527 | PatchService.getAll | train | public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->patches()
->getAll($appId, $scanId, $issueId, $queryParams);
return new PatchesResponse($response);
} | php | {
"resource": ""
} |
q3528 | PatchService.getById | train | public function getById($appId, $scanId, $issueId, $patchId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->patches()
->getById($appId, $scanId, $issueId, $patchId, $queryParams);
return new PatchResponse($response);
} | php | {
"resource": ""
} |
q3529 | ReviewHydrator.hydrateCollection | train | public static function hydrateCollection(array $reviews)
{
$hydrated = [];
foreach ($reviews as $review) {
$hydrated[] = self::hydrate($review);
}
return $hydrated;
} | php | {
"resource": ""
} |
q3530 | ReviewHydrator.hydrate | train | public static function hydrate(stdClass $review)
{
$hydrated = new ReviewEntity();
if (isset($review->id)) {
$hydrated->setId($review->id);
}
if (isset($review->created_at)) {
$hydrated->setCreatedAt(new DateTime($review->created_at));
}
if (isset($review->type)) {
$hydrated->setType(ReviewTypeHydrator::hydrate($review->type));
}
if (isset($review->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($review->created_by));
}
if (isset($review->source)) {
$hydrated->setSource($review->source);
}
if (isset($review->issue)) {
$hydrated->setIssue(IssueHydrator::hydrate($review->issue));
}
return $hydrated;
} | php | {
"resource": ""
} |
q3531 | TNabuIContactProspectChild.getIContactProspect | train | public function getIContactProspect($force = false)
{
if ($this->nb_icontact_prospect === null || $force) {
$this->nb_icontact_prospect = null;
if ($this instanceof CNabuDataObject &&
!$this->isBuiltIn()
&& $this->isValueNumeric(NABU_ICONTACT_PROSPECT_FIELD_ID)
) {
$nb_icontact_prospect = new CNabuIContactProspect($this->getValue(NABU_ICONTACT_PROSPECT_FIELD_ID));
if ($nb_icontact_prospect->isFetched()) {
$this->nb_icontact_prospect = $nb_icontact_prospect;
}
}
}
return $this->nb_icontact_prospect;
} | php | {
"resource": ""
} |
q3532 | TNabuIContactProspectChild.setIContactProspect | train | public function setIContactProspect(CNabuIContactProspect $nb_icontact_prospect)
{
$this->nb_icontact_prospect = $nb_icontact_prospect;
if ($this instanceof CNabuDataObject && $nb_icontact_prospect->contains(NABU_ICONTACT_PROSPECT_FIELD_ID)) {
$this->transferValue($nb_icontact_prospect, NABU_ICONTACT_PROSPECT_FIELD_ID);
}
return $this;
} | php | {
"resource": ""
} |
q3533 | CNabuSiteTargetCTARole.getCTARolesForSiteTarget | train | static public function getCTARolesForSiteTarget($nb_site_target)
{
$nb_site_target_id = nb_getMixedValue($nb_site_target, NABU_SITE_TARGET_FIELD_ID);
if (is_numeric($nb_site_target_id)) {
$retval = CNabuEngine::getEngine()
->getMainDB()
->getQueryAsObjectArray(
'\nabu\data\site\CNabuSiteTargetCTARole', null,
'select stcr.* '
. 'from nb_site_target_cta stc, nb_site_target_cta_role stcr '
. 'where stc.nb_site_target_cta_id=stcr.nb_site_target_cta_id '
. 'and stc.nb_site_target_id=%target_id$d',
array(
'target_id' => $nb_site_target_id
)
)
;
} else {
$retval = null;
}
return $retval;
} | php | {
"resource": ""
} |
q3534 | Collection.toDatamapperObject | train | public function toDatamapperObject()
{
$entities = new DatamapperCollection;
foreach ($this->items as $name => $item) {
$entities->put($name, $item->toDatamapperObject());
}
return $entities;
} | php | {
"resource": ""
} |
q3535 | Collection.toDataTransferObject | train | public function toDataTransferObject(string $root, array $schema, array $transformations, $path='')
{
$entities = new DatamapperCollection;
foreach ($this->items as $name => $item) {
$entities->put($name, $item->toDataTransferObject($root, $schema, $transformations, $path));
}
return $entities;
} | php | {
"resource": ""
} |
q3536 | Collection.newFromDatamapperObject | train | public static function newFromDatamapperObject($entities, $lastObjectId, $lastEloquentModel)
{
$eloquentModels = new static;
foreach ($entities as $name => $item) {
if (spl_object_hash($item) == $lastObjectId) {
$model = $lastEloquentModel;
} else {
$model = Model::newFromDatamapperObject($item, $lastObjectId, $lastEloquentModel);
}
$eloquentModels->put($name, $model);
}
return $eloquentModels;
} | php | {
"resource": ""
} |
q3537 | CNabuMessagingLanguageBase.setTemplatesStatus | train | public function setTemplatesStatus(string $templates_status = "D") : CNabuDataObject
{
if ($templates_status === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$templates_status")
);
}
$this->setValue('nb_messaging_lang_templates_status', $templates_status);
return $this;
} | php | {
"resource": ""
} |
q3538 | LogService.getAll | train | public function getAll(array $queryParams = [])
{
$response = $this->api->logs()->getAll($queryParams);
return new LogsResponse($response);
} | php | {
"resource": ""
} |
q3539 | LogService.getById | train | public function getById($logId, array $queryParams = [])
{
$response = $this->api->logs()->getById($logId, $queryParams);
return new LogResponse($response);
} | php | {
"resource": ""
} |
q3540 | LogService.create | train | public function create(LogBuilder $input, array $queryParams = [])
{
$response = $this->api->logs()->create($input->toArray(), $queryParams);
return new LogResponse($response);
} | php | {
"resource": ""
} |
q3541 | CNabuRoleBase.getAllRoles | train | public static function getAllRoles(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_role_id',
'select * '
. 'from nb_role '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuRoleList();
}
return $retval;
} | php | {
"resource": ""
} |
q3542 | CNabuRoleBase.setRoot | train | public function setRoot(string $root = "F") : CNabuDataObject
{
if ($root === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$root")
);
}
$this->setValue('nb_role_root', $root);
return $this;
} | php | {
"resource": ""
} |
q3543 | PatchHydrator.hydrateCollection | train | public static function hydrateCollection(array $patches)
{
$hydrated = [];
foreach ($patches as $patch) {
$hydrated[] = self::hydrate($patch);
}
return $hydrated;
} | php | {
"resource": ""
} |
q3544 | CNabuSiteTargetSection.getSiteTargetSections | train | static public function getSiteTargetSections($nb_site_target)
{
$nb_site_target_id = nb_getMixedValue($nb_site_target, 'nb_site_target_id');
if (is_numeric($nb_site_target_id)) {
$retval = CNabuSiteTargetSection::buildObjectListFromSQL(
'nb_site_target_section_id',
'select * '
. 'from nb_site_target_section '
. 'where nb_site_target_id=%target_id$d '
. 'order by nb_site_target_section_order',
array(
'target_id' => $nb_site_target_id
)
);
if ($nb_site_target instanceof CNabuSiteTarget) {
$retval->iterate(function($key, $nb_site_target_section) use ($nb_site_target) {
$nb_site_target_section->setSiteTarget($nb_site_target);
return true;
});
}
} else {
$retval = new CNabuSiteTargetSectionList();
}
return $retval;
} | php | {
"resource": ""
} |
q3545 | CNabuEngine.registerApplication | train | public function registerApplication(INabuApplication $nb_application)
{
if ($this->nb_application !== null) {
throw new ENabuCoreException(ENabuCoreException::ERROR_RUNNING_APPLICATION);
}
$this->nb_application = $nb_application;
$this->nb_provider_factory->registerApplication($this->nb_application);
} | php | {
"resource": ""
} |
q3546 | CNabuEngine.getMessagingPoolManager | train | public function getMessagingPoolManager(bool $force = false) : CNabuMessagingPoolManager
{
if ($this->nb_customer instanceof CNabuCustomer) {
if ($this->nb_messaging_pool_manager === null || $force) {
if ($this->nb_messaging_pool_manager instanceof CNabuMessagingPoolManager) {
$this->nb_messaging_pool_manager->finish();
}
$this->nb_messaging_pool_manager = new CNabuMessagingPoolManager($this->nb_customer);
$this->nb_messaging_pool_manager->init();
} elseif (
!(($nb_aux_customer = $this->nb_messaging_pool_manager->getCustomer()) instanceof CNabuCustomer) ||
$this->nb_customer->getId() !== $nb_aux_customer->getId()
) {
throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_MESSAGING_POOL_MANAGER);
}
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_CUSTOMER_NOT_FOUND);
}
return $this->nb_messaging_pool_manager;
} | php | {
"resource": ""
} |
q3547 | CNabuEngine.getRenderPoolManager | train | public function getRenderPoolManager(bool $force = false) : CNabuRenderPoolManager
{
if ($this->nb_customer instanceof CNabuCustomer) {
if ($this->nb_render_pool_manager === null || $force) {
if ($this->nb_render_pool_manager instanceof CNabuRenderPoolManager) {
$this->nb_render_pool_manager->finish();
}
$this->nb_render_pool_manager = new CNabuRenderPoolManager($this->nb_customer);
$this->nb_render_pool_manager->init();
} elseif (
!(($nb_aux_customer = $this->nb_render_pool_manager->getCustomer()) instanceof CNabuCustomer) ||
$this->nb_customer->getId() !== $nb_aux_customer->getId()
) {
throw new ENabuRenderException(ENabuRenderException::ERROR_INVALID_RENDER_POOL_MANAGER);
}
} else {
throw new ENabuCoreException(ENabuCoreException::EROR_CUSTOMER_NOT_FOUND);
}
return $this->nb_render_pool_manager;
} | php | {
"resource": ""
} |
q3548 | CNabuEngine.getHTTPServerPoolManager | train | public function getHTTPServerPoolManager(bool $force = false) : CNabuHTTPServerPoolManager
{
if ($this->nb_http_server_pool_manager === null || $force) {
if ($this->nb_http_server_pool_manager instanceof CNabuHTTPServerPoolManager) {
$this->nb_http_server_pool_manager->finish();
}
$this->nb_http_server_pool_manager = new CNabuHTTPServerPoolManager();
$this->nb_http_server_pool_manager->init();
}
return $this->nb_http_server_pool_manager;
} | php | {
"resource": ""
} |
q3549 | CNabuEngine.class2Filename | train | private function class2Filename($class_name, $php_suffix = '.php')
{
return DIRECTORY_SEPARATOR
. str_replace('\\', DIRECTORY_SEPARATOR, $class_name)
. ($php_suffix === false ? '' : $php_suffix);
} | php | {
"resource": ""
} |
q3550 | CNabuEngine.init | train | private function init()
{
$this->microtime_start = microtime(true);
$this->nb_os = CNabuOS::getOS();
try {
$this->registerHandlers();
$this->registerProviderFactory();
} catch (ENabuException $nb_exception) {
if ($this->isCLIEnvironment()) {
throw $nb_exception;
} else {
nb_displayErrorPage(500, $nb_exception);
die;
}
}
} | php | {
"resource": ""
} |
q3551 | CNabuEngine.finish | train | private function finish()
{
if ($this->main_database !== null) {
$this->main_database->disconnect();
}
$this->microtime_end = microtime(true);
$this->microtime_elapsed = $this->microtime_end - $this->microtime_start;
$this->traceLog("Execution time", sprintf("%.3f ms", $this->microtime_elapsed * 1000));
} | php | {
"resource": ""
} |
q3552 | CNabuEngine.registerMainDatabase | train | private function registerMainDatabase()
{
$filename = NABU_ETC_PATH.DIRECTORY_SEPARATOR.NABU_DB_DEFAULT_FILENAME_CONFIG;
if (!file_exists($filename) && ($file = fopen($filename, "w")) !== false) {
fwrite($file,
"<?php\n".
"\$db_user = \"nabu-3\";\n".
"\$db_passwd = \"nabu-3\";\n".
"\$db_host = \"localhost:3306\";\n".
"\$db_schema = \"nabu-3\";\n".
"\$db_trace_query = false;\n".
"?>\n"
);
fclose($file);
}
$this->main_database = new CMySQLConnector($filename);
$this->main_database->setSpaceOptimization(true);
if ($this->main_database->connect()) {
if (!$this->main_database->testConnection()) {
//throw new exceptions\ENabuCoreException(exceptions\ENabuCoreException::ERROR_M)
$this->errorLog("Database Test error: ".$this->main_database->getLastErrorMessage());
}
} else {
throw new ENabuDBException(ENabuDBException::ERROR_NOT_CONNECTED);
}
} | php | {
"resource": ""
} |
q3553 | CNabuEngine.getMainDB | train | public function getMainDB()
{
if ($this->main_database === null &&
($this->isOperationModeCLI() || $this->isOperationModeStandalone())
) {
$this->registerMainDatabase();
}
return $this->main_database;
} | php | {
"resource": ""
} |
q3554 | CNabuEngine.setMainDB | train | public function setMainDB(INabuDBConnector $connector)
{
if ($this->isInstallMode()) {
if ($this->main_database === null) {
$this->main_database = $connector;
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_MAIN_DB_ALREADY_EXISTS);
}
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_INSTALL_MODE_REQUIRED);
}
} | php | {
"resource": ""
} |
q3555 | CNabuEngine.traceLog | train | public function traceLog($key, $message)
{
if ($this->nb_error_handler) {
$this->nb_error_handler->traceLog($key, $message);
}
return $this;
} | php | {
"resource": ""
} |
q3556 | CNabuEngine.triggerError | train | public function triggerError($error_message = null, $error_type = null) {
if ($error_message !== null && $error_type !== null) {
trigger_error($error_message, $error_type);
}
} | php | {
"resource": ""
} |
q3557 | CNabuEngine.runApplication | train | public function runApplication($class_name)
{
$this->traceLog('Request timestamp', $this->microtime_start);
try {
switch (self::$operation_mode) {
case self::ENGINE_MODE_STANDALONE:
$this->locateHTTPServer();
$this->createBuiltInServer();
$this->createBuiltInSite();
break;
case self::ENGINE_MODE_HOSTED:
$this->registerMainDatabase();
$this->locateHTTPServer();
$this->createBuiltInServer();
$this->locateRunningConfiguration();
break;
case self::ENGINE_MODE_CLUSTERED:
$this->registerMainDatabase();
$this->locateHTTPServer();
$this->locateRunningConfiguration();
break;
default:
}
$retval = forward_static_call(array($class_name, 'launch'));
} catch (Exception $e) {
$this->nb_error_handler->dumpStack(
$e->getMessage(), E_CORE_ERROR, $e->getFile(), $e->getLine(), null, $e->getTrace()
);
if ($this->isOperationModeStandalone() ||
$this->isOperationModeStored() ||
$this->isOperationModeClustered()
) {
nb_displayErrorPage(500, $e);
}
$retval = false;
}
if (self::isInstantiated()) {
self::getEngine()->finish();
/** @todo Implement CNabuEngine Dump Popup Trace action */
/** @source $nb_engine->dumpPopupTrace(); */
}
return $retval;
} | php | {
"resource": ""
} |
q3558 | CNabuEngine.callLocateHTTPServerHook | train | private function callLocateHTTPServerHook()
{
if (is_string(self::$locateHTTPServerHook)) {
${self::$locateHTTPServerHook}($this->nb_http_server);
} elseif (self::$locateHTTPServerHook instanceof Closure) {
(self::$locateHTTPServerHook)($this->nb_http_server);
}
} | php | {
"resource": ""
} |
q3559 | CNabuEngine.locateHTTPServer | train | private function locateHTTPServer()
{
$this->nb_http_server = null;
if (self::isCLIEnvironment()) {
throw new ENabuCoreException(ENabuCoreException::ERROR_METHOD_NOT_AVAILABLE, array(__METHOD__));
} elseif ($this->nb_http_server === null) {
$this->getHTTPServerPoolManager();
$this->nb_provider_factory
->getInterfaceDescriptors(CNabuProviderFactory::INTERFACE_HTTP_SERVER_SERVICE)
->iterate(function(string $key, CNabuHTTPServerInterfaceDescriptor $descriptor) {
$nb_factory = $this->nb_http_server_pool_manager->getHTTPServerFactory($descriptor);
$nb_interface = $nb_factory->getInterface();
if ($nb_interface instanceof INabuHTTPServerInterface && $nb_interface->recognizeSoftware()) {
$this->nb_http_server = $nb_interface;
$this->callLocateHTTPServerHook();
}
return is_null($this->nb_http_server);
})
;
}
if (is_null($this->nb_http_server)) {
throw new ENabuHTTPException(ENabuHTTPException::ERROR_HTTP_SERVER_PROVIDER_NOT_FOUND);
}
return $this->nb_http_server;
} | php | {
"resource": ""
} |
q3560 | CNabuEngine.createBuiltInServer | train | private function createBuiltInServer()
{
$nb_server = new CNabuBuiltInServer();
$nb_server_host = new CNabuBuiltInServerHost();
$host_path = $this->nb_http_server->getHostBaseDirectory();
$server_path = dirname($host_path);
$nb_server->setBasePath(NABU_BASE_PATH);
$nb_server->setVirtualHostsPath($server_path);
$this->nb_http_server->setServer($nb_server);
$this->nb_http_server->setServerHost($nb_server_host);
} | php | {
"resource": ""
} |
q3561 | CNabuEngine.createBuiltInSite | train | private function createBuiltInSite()
{
$this->nb_customer = new CNabuBuiltInCustomer();
$nb_site = new CNabuBuiltInSite();
$nb_site_alias = new CNabuBuiltInSiteAlias();
$nb_domain_zone = new CNabuBuiltInDomainZone();
$nb_domain_zone_host = new CNabuBuiltInDomainZoneHost();
$server_name = $this->nb_http_server->getServerName();
$sname_parts = preg_split('/\\./', $server_name, 2);
if (count($sname_parts) === 2) {
list($host, $domain) = $sname_parts;
} elseif (count($sname_parts) === 1) {
$host = $sname_parts[0];
$domain = '';
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_DOMAIN_ZONE_NOT_FOUND);
}
$nb_domain_zone->setName($domain);
$nb_domain_zone_host->setName($host);
$nb_domain_zone_host->setDomainZone($nb_domain_zone);
$host_path = $this->nb_http_server->getHostBaseDirectory();
$site_path = basename($host_path);
$nb_site->setBasePath(DIRECTORY_SEPARATOR . $site_path);
/** @source $nb_site->setPHPUtilsPath(NABU_PHPUTILS_FOLDER); */
$nb_site->setClassesPath(NABU_CLASSES_FOLDER);
$nb_site->setPluginsPath(NABU_PLUGINS_FOLDER);
$nb_site->setMainAlias($nb_site_alias);
$nb_site_alias->setDomainZoneHost($nb_domain_zone_host);
$this->nb_http_server->setSite($nb_site);
$this->nb_http_server->setSiteAlias($nb_site_alias);
} | php | {
"resource": ""
} |
q3562 | CNabuEngine.getPHPIncludeFolders | train | public function getPHPIncludeFolders()
{
if (!is_array($this->framework_folders)) {
$this->framework_folders = array();
if (is_dir(NABU_SRC_PATH)) {
$this->framework_folders[] = realpath(NABU_SRC_PATH);
}
if (is_dir(NABU_SDK_PATH)) {
$this->framework_folders[] = realpath(NABU_SDK_PATH);
}
if (is_dir(NABU_PUB_PATH)) {
$this->framework_folders[] = realpath(NABU_PUB_PATH);
}
if (is_dir(NABU_LIB_PATH)) {
$this->framework_folders[] = realpath(NABU_LIB_PATH);
}
if (is_dir(NABU_ICONTACT_PATH)) {
$this->framework_folders[] = realpath(NABU_ICONTACT_PATH);
}
if (count($this->framework_folders) === 0) {
$this->framework_folders = null;
}
}
return $this->framework_folders;
} | php | {
"resource": ""
} |
q3563 | CNabuEngine.getProviderManager | train | public function getProviderManager(string $vendor_key, string $module_key)
{
if ($this->nb_provider_factory instanceof CNabuProviderFactory) {
return $this->nb_provider_factory->getManager($vendor_key, $module_key);
} else {
throw new ENabuProviderException(ENabuProviderException::ERROR_PROVIDER_FACTORY_NOT_AVAILABLE);
}
} | php | {
"resource": ""
} |
q3564 | CNabuEngine.getProviderInterfaceDescriptor | train | public function getProviderInterfaceDescriptor(string $vendor, string $module, int $interface_type, string $interface)
{
return $this->nb_provider_factory->getInterfaceDescriptor($vendor, $module, $interface_type, $interface);
} | php | {
"resource": ""
} |
q3565 | CNabuEngine.getProviderInterfaceDescriptorByKey | train | public function getProviderInterfaceDescriptorByKey(int $interface_type, string $interface_key)
{
return $this->nb_provider_factory->getInterfaceDescriptors($interface_type)->getItem($interface_key);
} | php | {
"resource": ""
} |
q3566 | CNabuDataObjectListIndexLanguage.extractNodes | train | protected function extractNodes(CNabuDataObject $item)
{
$retval = null;
if ($item instanceof INabuTranslated) {
if ($item->hasTranslations()) {
$nodes = array();
$main_index_name = $this->list->getIndexedFieldName();
$item->getTranslations()->iterate(
function ($key, $translation) use (&$nodes, $main_index_name, $item) {
if (($translation->isValueNumeric($main_index_name) ||
$translation->isValueGUID($main_index_name)
) &&
($translation->isValueString($this->key_field) ||
$translation->isValueNumeric($this->key_field)
)
) {
$key = $translation->getValue($this->key_field);
$nodes[$key] = array(
'key' => $key,
'pointer' => $translation->getValue($main_index_name)
);
if ($translation->isValueNumeric($this->order_field) ||
$translation->isValueString($this->order_field)
) {
$nodes[$key]['order'] = $translation->getValue($this->order_field);
} elseif ($item->isValueNumeric($this->order_field) ||
$item->isValueString($this->order_field)
) {
$nodes[$key]['order'] = $item->getValue($this->order_field);
}
}
}
);
if (count($nodes) > 0) {
$retval = $nodes;
}
}
} else {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$item', get_class($item))
);
}
return $retval;
} | php | {
"resource": ""
} |
q3567 | CNabuMessagingServiceTemplate.getTemplatesForService | train | public static function getTemplatesForService($nb_messaging_service) : CNabuMessagingServiceTemplateList
{
if (is_numeric($nb_messaging_service_id = nb_getMixedValue($nb_messaging_service, NABU_MESSAGING_SERVICE_FIELD_ID))) {
$retval = CNabuMessagingServiceTemplate::buildObjectListFromSQL(
'nb_messaging_template_id',
'select * '
. 'from nb_messaging_service_template '
. 'where nb_messaging_service_id=%service_id$d',
array(
'service_id' => $nb_messaging_service_id
)
);
if ($nb_messaging_service instanceof CNabuMessagingService) {
$retval->iterate(function($key, CNabuMessagingServiceTemplate $nb_template) use ($nb_messaging_service) {
$nb_template->setMessagingService($nb_messaging_service);
return true;
});
}
} else {
$retval = new CNabuMessagingServiceTemplateList();
}
return $retval;
} | php | {
"resource": ""
} |
q3568 | ScanHydrator.hydrateCollection | train | public static function hydrateCollection(array $scans)
{
$hydrated = [];
foreach ($scans as $scan) {
$hydrated[] = self::hydrate($scan);
}
return $hydrated;
} | php | {
"resource": ""
} |
q3569 | TNabuRoleMaskList.applyRoleMask | train | public function applyRoleMask(CNabuRole $nb_role, array $additional = null)
{
$total = $this->getSize();
$count = 0;
$this->iterate(function($key, INabuRoleMask $item) use($count, $nb_role, $additional) {
if ($item->applyRoleMask($nb_role, $additional)) {
$count++;
} else {
$this->removeItem($item);
}
return true;
});
$this->role_applied = true;
return $total === 0 || ($count > 0 && $count <= $total);
} | php | {
"resource": ""
} |
q3570 | CNabuIContactLanguageBase.setIcontactId | train | public function setIcontactId(int $nb_icontact_id) : CNabuDataObject
{
if ($nb_icontact_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_icontact_id")
);
}
$this->setValue('nb_icontact_id', $nb_icontact_id);
return $this;
} | php | {
"resource": ""
} |
q3571 | LicenseHydrator.hydrateCollection | train | public static function hydrateCollection(array $licenses)
{
$hydrated = [];
foreach ($licenses as $license) {
$hydrated[] = self::hydrate($license);
}
return $hydrated;
} | php | {
"resource": ""
} |
q3572 | LicenseHydrator.hydrate | train | public static function hydrate(stdClass $license)
{
$hydrated = new LicenseEntity();
if (isset($license->id)) {
$hydrated->setId($license->id);
}
if (isset($license->created_at)) {
$hydrated->setCreatedAt(new DateTime($license->created_at));
}
if (isset($license->valid_until)) {
$hydrated->setValidUntil(new DateTime($license->valid_until));
}
if (isset($license->quota_distributed)) {
$hydrated->setQuotaDistributed($license->quota_distributed);
}
if (isset($license->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($license->created_by));
}
if (isset($license->parent)) {
$hydrated->setParent(self::hydrate($license->parent));
}
if (isset($license->child)) {
$hydrated->setChild(self::hydrate($license->child));
}
if (isset($license->organization)) {
$hydrated->setOrganization(OrgHydrator::hydrate($license->organization));
}
return $hydrated;
} | php | {
"resource": ""
} |
q3573 | CNabuCustomerUserBase.setUserId | train | public function setUserId(int $nb_user_id) : CNabuDataObject
{
if ($nb_user_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_user_id")
);
}
$this->setValue('nb_user_id', $nb_user_id);
return $this;
} | php | {
"resource": ""
} |
q3574 | CNabuCatalogTaxonomyLanguageBase.setCatalogTaxonomyId | train | public function setCatalogTaxonomyId(int $nb_catalog_taxonomy_id) : CNabuDataObject
{
if ($nb_catalog_taxonomy_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_catalog_taxonomy_id")
);
}
$this->setValue('nb_catalog_taxonomy_id', $nb_catalog_taxonomy_id);
return $this;
} | php | {
"resource": ""
} |
q3575 | OrgService.getAll | train | public function getAll(array $queryParams = [])
{
$response = $this->api->orgs()->getAll($queryParams);
return new OrgsResponse($response);
} | php | {
"resource": ""
} |
q3576 | OrgService.getById | train | public function getById($orgId, array $queryParams = [])
{
$response = $this->api->orgs()->getById($orgId, $queryParams);
return new OrgResponse($response);
} | php | {
"resource": ""
} |
q3577 | OrgService.update | train | public function update($orgId, OrgBuilder $input, array $queryParams = [])
{
$response = $this->api->orgs()->update($orgId, $input->toArray(), $queryParams);
return new OrgResponse($response);
} | php | {
"resource": ""
} |
q3578 | OrgService.deleteAll | train | public function deleteAll(array $queryParams = [])
{
$response = $this->api->orgs()->deleteAll($queryParams);
return new BaseResponse($response);
} | php | {
"resource": ""
} |
q3579 | OrgService.deleteById | train | public function deleteById($orgId, array $queryParams = [])
{
$response = $this->api->orgs()->deleteById($orgId, $queryParams);
return new BaseResponse($response);
} | php | {
"resource": ""
} |
q3580 | CNabuSiteLanguageBase.setEnabled | train | public function setEnabled(string $enabled = "T") : CNabuDataObject
{
if ($enabled === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$enabled")
);
}
$this->setValue('nb_site_lang_enabled', $enabled);
return $this;
} | php | {
"resource": ""
} |
q3581 | CNabuSiteLanguageBase.setTranslationStatus | train | public function setTranslationStatus(string $translation_status = "D") : CNabuDataObject
{
if ($translation_status === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$translation_status")
);
}
$this->setValue('nb_site_lang_translation_status', $translation_status);
return $this;
} | php | {
"resource": ""
} |
q3582 | CNabuSiteLanguageBase.setEditable | train | public function setEditable(string $editable = "F") : CNabuDataObject
{
if ($editable === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$editable")
);
}
$this->setValue('nb_site_lang_editable', $editable);
return $this;
} | php | {
"resource": ""
} |
q3583 | ZendCacheConnector.normalizeKey | train | protected function normalizeKey($cacheId)
{
$cacheId = parent::normalizeKey($cacheId);
if (($pattern = $this->cache->getOptions()->getKeyPattern())
&& !preg_match($pattern, $cacheId)
) {
$pattern = str_replace(array('^[', '*$'), array('[^', ''), $pattern);
$cacheId = preg_replace($pattern, '_', $cacheId);
}
return $cacheId;
} | php | {
"resource": ""
} |
q3584 | ZendCacheConnector.flush | train | public function flush()
{
if (!($this->cache instanceof FlushableInterface)) {
return false;
}
try {
return $this->cache->flush();
} catch (ZendException\ExceptionInterface $ex) {
return false;
}
} | php | {
"resource": ""
} |
q3585 | CNabuMediotecaLanguageBase.setMediotecaId | train | public function setMediotecaId(int $nb_medioteca_id) : CNabuDataObject
{
if ($nb_medioteca_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_medioteca_id")
);
}
$this->setValue('nb_medioteca_id', $nb_medioteca_id);
return $this;
} | php | {
"resource": ""
} |
q3586 | Data.findOne | train | public function findOne(){
foreach($this->data as $k=>$v){
$key = $k;
break;
}
if(is_array($this->data[$key])){
return (new \NonDB\Data($this->data[$key], $key))->setParent($this);
}else{
return $this->data[$key];
}
} | php | {
"resource": ""
} |
q3587 | Data.findByKey | train | public function findByKey($rule){
$r = [];
foreach($this->data as $k=>$v){
if($rule($k)){
$r[] = $this->{$k};
}
}
return $r;
} | php | {
"resource": ""
} |
q3588 | Data.sort | train | public function sort($rule, $algorithm = "DefaultSort"){
$class = "\\NonDB\\Sorter\\" . $algorithm;
if(!class_exists($class) || !( \NonDB\Components\Tool::checkImplement($class, "NonDB\\Interfaces\\Sorter") )){
throw new \NonDB\Exceptions\DataException("Sorter $class didn't exists.", "0011");
return false;
}
$sorter = eval("return new ". $class . "(\$rule);");
$sorted = $sorter->sort($this->getArray());
$result = (new \NonDB\Data($sorted, $this->key))->setParent($this->parent);
return $result;
} | php | {
"resource": ""
} |
q3589 | ClientHydrator.hydrateCollection | train | public static function hydrateCollection(array $clients)
{
$hydrated = [];
foreach ($clients as $client) {
$hydrated[] = self::hydrate($client);
}
return $hydrated;
} | php | {
"resource": ""
} |
q3590 | ClientHydrator.hydrate | train | public static function hydrate(stdClass $client)
{
$hydrated = new ClientEntity();
if (isset($client->id)) {
$hydrated->setId($client->id);
}
if (isset($client->name)) {
$hydrated->setName($client->name);
}
if (isset($client->random_id)) {
$hydrated->setRandomId($client->random_id);
}
if (isset($client->secret)) {
$hydrated->setSecret($client->secret);
}
if (isset($client->allowed_grant_types)) {
$hydrated->setAllowedGrantTypes($client->allowed_grant_types);
}
if (isset($client->redirect_uris)) {
$hydrated->setRedirectUris($client->redirect_uris);
}
return $hydrated;
} | php | {
"resource": ""
} |
q3591 | CNabuCatalogBase.getAllCatalogs | train | public static function getAllCatalogs(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_catalog_id',
'select * '
. 'from nb_catalog '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuCatalogList();
}
return $retval;
} | php | {
"resource": ""
} |
q3592 | TNabuCatalogChild.getCatalog | train | public function getCatalog($force = false)
{
if ($this->nb_catalog === null || $force) {
$this->nb_catalog = null;
if ($this instanceof CNabuDataObject &&
!$this->isBuiltIn()
&& $this->isValueNumeric(NABU_CATALOG_FIELD_ID)
) {
$nb_aux_catalog = new CNabuCatalog($this->getValue(NABU_CATALOG_FIELD_ID));
if ($nb_aux_catalog->isFetched()) {
$this->nb_catalog = $nb_aux_catalog;
}
}
}
return $this->nb_catalog;
} | php | {
"resource": ""
} |
q3593 | TNabuCatalogChild.setCatalog | train | public function setCatalog(CNabuCatalog $nb_catalog)
{
$this->nb_catalog = $nb_catalog;
if ($this instanceof CNabuDataObject && $nb_catalog->contains(NABU_CATALOG_FIELD_ID)) {
$this->transferValue($nb_catalog, NABU_CATALOG_FIELD_ID);
}
return $this;
} | php | {
"resource": ""
} |
q3594 | CNabuProviderFactory.getFactory | train | public static function getFactory()
{
if (self::$nb_provider_factory === null) {
self::$nb_provider_factory = new CNabuProviderFactory();
self::$nb_provider_factory->init();
}
return self::$nb_provider_factory;
} | php | {
"resource": ""
} |
q3595 | CNabuProviderFactory.scanProvidersFolder | train | public function scanProvidersFolder()
{
$folders = array();
$this->scanVendorFolders($folders);
if (count($folders) > 0) {
foreach ($folders as $provider) {
try {
nb_requireOnceIsolated($provider, true, true);
} catch (Exception $ex) {
throw new ENabuProviderException(
ENabuProviderException::ERROR_MANAGER_NOT_INITIALIZED,
array($provider)
);
}
}
}
} | php | {
"resource": ""
} |
q3596 | CNabuProviderFactory.scanVendorFolders | train | private function scanVendorFolders(&$folders)
{
$basedir = realpath(NABU_PROVIDERS_PATH);
if (is_dir($basedir) && ($h = opendir($basedir))) {
while (($folder = readdir($h))) {
if ($folder !== '.' && $folder !== '..') {
$this->scanModuleFolders($basedir . DIRECTORY_SEPARATOR . $folder, $folders);
}
}
closedir($h);
}
} | php | {
"resource": ""
} |
q3597 | CNabuProviderFactory.scanModuleFolders | train | private function scanModuleFolders($basedir, &$folders)
{
if (is_dir($basedir) && ($h = opendir($basedir))) {
while (($folder = readdir($h))) {
if ($folder !== '.' && $folder !== '..') {
$this->scanModuleFiles($basedir . DIRECTORY_SEPARATOR . $folder, $folders);
}
}
closedir($h);
}
} | php | {
"resource": ""
} |
q3598 | CNabuProviderFactory.scanModuleFiles | train | private function scanModuleFiles($basedir, &$folders)
{
if (is_dir($basedir) && ($h = opendir($basedir))) {
while (($filename = readdir($h))) {
$phpfile = $basedir . DIRECTORY_SEPARATOR . $filename;
if (preg_match('/^init[_|-](.+)\.php$/', $filename) && file_exists($phpfile) && filesize($phpfile) > 0) {
$folders[] = $phpfile;
}
}
closedir($h);
}
} | php | {
"resource": ""
} |
q3599 | CNabuProviderFactory.addManager | train | public function addManager(INabuProviderManager $nb_manager)
{
$vendor_key = $nb_manager->getVendorKey();
if (nb_isValidKey($vendor_key)) {
$module_key = $nb_manager->getModuleKey();
if (!nb_isValidKey($module_key)) {
throw new ENabuProviderException(
ENabuProviderException::ERROR_MODULE_KEY_NOT_VALID,
array($module_key)
);
}
} else {
throw new ENabuProviderException(
ENabuProviderException::ERROR_VENDOR_KEY_NOT_VALID,
array($vendor_key)
);
}
$this->nb_manager_list->addItem($nb_manager);
if (!$nb_manager->enableManager()) {
throw new ENabuProviderException(
ENabuProviderException::ERROR_PROVIDER_MANAGER_FAIL,
array(get_class($nb_manager))
);
}
$nb_application = CNabuEngine::getEngine()->getApplication();
if ($nb_application instanceof INabuApplication) {
$nb_manager->registerApplication($nb_application);
}
return $nb_manager;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.