_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3 values | text stringlengths 83 13k | language stringclasses 1 value | meta_information dict |
|---|---|---|---|---|---|
q4000 | CNabuSiteBase.setPageNotFoundTargetUseURI | train | public function setPageNotFoundTargetUseURI(string $page_not_found_target_use_uri = "N") : CNabuDataObject
{
if ($page_not_found_target_use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$page_not_found_target_use_uri")
);
}
$this->setValue('nb_site_page_not_found_target_use_uri', $page_not_found_target_use_uri);
return $this;
} | php | {
"resource": ""
} |
q4001 | CNabuSiteBase.setPageNotFoundErrorCode | train | public function setPageNotFoundErrorCode(int $page_not_found_error_code = 404) : CNabuDataObject
{
if ($page_not_found_error_code === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$page_not_found_error_code")
);
}
$this->setValue('nb_site_page_not_found_error_code', $page_not_found_error_code);
return $this;
} | php | {
"resource": ""
} |
q4002 | CNabuSiteBase.setLoginMaxFailsTargetUseURI | train | public function setLoginMaxFailsTargetUseURI(string $login_max_fails_target_use_uri = "N") : CNabuDataObject
{
if ($login_max_fails_target_use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$login_max_fails_target_use_uri")
);
}
$this->setValue('nb_site_login_max_fails_target_use_uri', $login_max_fails_target_use_uri);
return $this;
} | php | {
"resource": ""
} |
q4003 | CNabuSiteBase.setAliasNotFoundTargetUseURI | train | public function setAliasNotFoundTargetUseURI(string $alias_not_found_target_use_uri = "N") : CNabuDataObject
{
if ($alias_not_found_target_use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$alias_not_found_target_use_uri")
);
}
$this->setValue('nb_site_alias_not_found_target_use_uri', $alias_not_found_target_use_uri);
return $this;
} | php | {
"resource": ""
} |
q4004 | CNabuSiteBase.setAliasLockedTargetUseURI | train | public function setAliasLockedTargetUseURI(string $alias_locked_target_use_uri = "N") : CNabuDataObject
{
if ($alias_locked_target_use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$alias_locked_target_use_uri")
);
}
$this->setValue('nb_site_alias_locked_target_use_uri', $alias_locked_target_use_uri);
return $this;
} | php | {
"resource": ""
} |
q4005 | CNabuSiteBase.setRequirePoliciesAfterLogin | train | public function setRequirePoliciesAfterLogin(string $require_policies_after_login = "F") : CNabuDataObject
{
if ($require_policies_after_login === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$require_policies_after_login")
);
}
$this->setValue('nb_site_require_policies_after_login', $require_policies_after_login);
return $this;
} | php | {
"resource": ""
} |
q4006 | CNabuSiteBase.setUseCache | train | public function setUseCache(string $use_cache = "F") : CNabuDataObject
{
if ($use_cache === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_cache")
);
}
$this->setValue('nb_site_use_cache', $use_cache);
return $this;
} | php | {
"resource": ""
} |
q4007 | CNabuSiteBase.setHTTPSupport | train | public function setHTTPSupport(string $http_support = "F") : CNabuDataObject
{
if ($http_support === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$http_support")
);
}
$this->setValue('nb_site_http_support', $http_support);
return $this;
} | php | {
"resource": ""
} |
q4008 | CNabuSiteBase.setHTTPSSupport | train | public function setHTTPSSupport(string $https_support = "F") : CNabuDataObject
{
if ($https_support === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$https_support")
);
}
$this->setValue('nb_site_https_support', $https_support);
return $this;
} | php | {
"resource": ""
} |
q4009 | CNabuSiteBase.setUseAWStats | train | public function setUseAWStats(string $use_awstats = "F") : CNabuDataObject
{
if ($use_awstats === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_awstats")
);
}
$this->setValue('nb_site_use_awstats', $use_awstats);
return $this;
} | php | {
"resource": ""
} |
q4010 | CNabuSiteBase.setWSearchEnabled | train | public function setWSearchEnabled(string $wsearch_enabled = "F") : CNabuDataObject
{
if ($wsearch_enabled === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$wsearch_enabled")
);
}
$this->setValue('nb_site_wsearch_enabled', $wsearch_enabled);
return $this;
} | php | {
"resource": ""
} |
q4011 | CNabuSiteBase.setUseFramework | train | public function setUseFramework(string $use_framework = "F") : CNabuDataObject
{
if ($use_framework === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_framework")
);
}
$this->setValue('nb_site_use_framework', $use_framework);
return $this;
} | php | {
"resource": ""
} |
q4012 | CNabuSiteBase.setEnableVirtualHostFile | train | public function setEnableVirtualHostFile(string $enable_vhost_file = "F") : CNabuDataObject
{
if ($enable_vhost_file === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$enable_vhost_file")
);
}
$this->setValue('nb_site_enable_vhost_file', $enable_vhost_file);
return $this;
} | php | {
"resource": ""
} |
q4013 | CNabuSiteBase.setEnableSessionStrictPolicies | train | public function setEnableSessionStrictPolicies(string $enable_session_strict_policies = "F") : CNabuDataObject
{
if ($enable_session_strict_policies === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$enable_session_strict_policies")
);
}
$this->setValue('nb_site_enable_session_strict_policies', $enable_session_strict_policies);
return $this;
} | php | {
"resource": ""
} |
q4014 | CNabuSiteBase.setStaticContentUseAlternative | train | public function setStaticContentUseAlternative(string $static_content_use_alternative = "D") : CNabuDataObject
{
if ($static_content_use_alternative === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$static_content_use_alternative")
);
}
$this->setValue('nb_site_static_content_use_alternative', $static_content_use_alternative);
return $this;
} | php | {
"resource": ""
} |
q4015 | CNabuSiteBase.setForceCookieAsSecure | train | public function setForceCookieAsSecure(string $force_cookie_as_secure = "F") : CNabuDataObject
{
if ($force_cookie_as_secure === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$force_cookie_as_secure")
);
}
$this->setValue('nb_site_force_cookie_as_secure', $force_cookie_as_secure);
return $this;
} | php | {
"resource": ""
} |
q4016 | CNabuSiteBase.setMaxSignInRetries | train | public function setMaxSignInRetries(int $max_signin_retries = 0) : CNabuDataObject
{
if ($max_signin_retries === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$max_signin_retries")
);
}
$this->setValue('nb_site_max_signin_retries', $max_signin_retries);
return $this;
} | php | {
"resource": ""
} |
q4017 | CNabuSiteBase.setSignInLockDelay | train | public function setSignInLockDelay(int $signin_lock_delay = 0) : CNabuDataObject
{
if ($signin_lock_delay === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$signin_lock_delay")
);
}
$this->setValue('nb_site_signin_lock_delay', $signin_lock_delay);
return $this;
} | php | {
"resource": ""
} |
q4018 | StatusHydrator.hydrate | train | public static function hydrate(stdClass $status)
{
$hydrated = new StatusEntity();
if (isset($status->version)) {
$hydrated->setVersion($status->version);
}
if (isset($status->cloud)) {
$hydrated->setCloud($status->cloud);
}
if (isset($status->maintenance)) {
$hydrated->setMaintenance($status->maintenance);
}
if (isset($status->hardware_id)) {
$hydrated->setHardwareId($status->hardware_id);
}
if (isset($status->census)) {
$hydrated->setCensus(CensusHydrator::hydrate($status->census));
}
if (isset($status->trial_issue_types) && is_array($status->trial_issue_types)) {
$hydrated->setTrialIssueTypes(TypeHydrator::hydrateCollection($status->trial_issue_types));
}
if (isset($status->user)) {
$hydrated->setUser(UserHydrator::hydrate($status->user));
}
if (isset($status->organization)) {
$hydrated->setOrganization(OrgHydrator::hydrate($status->organization));
}
return $hydrated;
} | php | {
"resource": ""
} |
q4019 | CNabuXMLSiteTargetLanguageListBase.locateDataObject | train | protected function locateDataObject(SimpleXMLElement $element, CNabuDataObject $data_parent = null) : bool
{
$retval = false;
if (isset($element['GUID'])) {
$guid = (string)$element['GUID'];
if (!($this->nb_data_object instanceof CNabuSiteTargetLanguageList)) {
$this->nb_data_object = CNabuSiteTargetLanguageList::findByHash($guid);
} else {
$this->nb_data_object = null;
}
if (!($this->nb_data_object instanceof CNabuSiteTargetLanguageList)) {
$this->nb_data_object = new CNabuSiteTargetLanguageList();
$this->nb_data_object->setHash($guid);
}
$retval = true;
}
return $retval;
} | php | {
"resource": ""
} |
q4020 | CNabuOS.getOS | train | public static function getOS()
{
if (self::$nb_os === null) {
self::$nb_os = new CNabuOS();
self::$nb_os->init();
}
return self::$nb_os;
} | php | {
"resource": ""
} |
q4021 | CNabuOS.init | train | private function init()
{
$this->os_name = php_uname('s');
$this->os_version = php_uname('r');
$this->os_architecture = php_uname('m');
$this->php_version = preg_split('/\\./', phpversion());
} | php | {
"resource": ""
} |
q4022 | Data.getDefaultCountry | train | public function getDefaultCountry($store = null)
{
/**
* null = not cached
* false = couldn't get country from IP
*/
if ($store === null && $this->country === null) {
$country = $this->geoService->getCountry();
$this->country = $country !== null ? $country : false;
}
return $this->country ? $this->country : parent::getDefaultCountry($store);
} | php | {
"resource": ""
} |
q4023 | Table.sync | train | public function sync(){
$this->data = $this->parent->driver->getData($this->name);
return $this;
} | php | {
"resource": ""
} |
q4024 | Table.autoincrement | train | function autoincrement(){
if(!isset($this->data['_NonDB_System_']['_AutoIncrement_'])){
$this->data['_NonDB_System_']['_AutoIncrement_'] = 1;
}
$number = ($this->data['_NonDB_System_']['_AutoIncrement_'] ++);
$this->save();
return $number;
} | php | {
"resource": ""
} |
q4025 | CNabuHTTPRequest.init | train | private function init()
{
$this->nb_response = new CNabuHTTPResponse($this->nb_plugins_manager, $this);
$this->nb_site = null;
$this->nb_site_alias = null;
$this->nb_site_target = null;
$this->nb_language = null;
$this->user_remote_ip = null;
$this->user_agent = null;
$this->accept_mimetypes = null;
$this->accept_languages = null;
$this->method = null;
$this->secure = false;
$this->zone = null;
$this->page_uri = null;
$this->variables = array();
// This block is intended for XDR IE8 & IE9 compatibility
/*
if (count($_POST) === 0) {
if (isset($HTTP_RAW_POST_DATA)) {
parse_str($HTTP_RAW_POST_DATA, $this->xdr_post);
} else {
parse_str(file_get_contents('php://input'), $this->xdr_post);
}
}
*/
} | php | {
"resource": ""
} |
q4026 | CNabuHTTPRequest.locateURI | train | private function locateURI() : string
{
$this->page_uri = filter_input(
INPUT_GET,
NABU_PATH_PARAM,
FILTER_SANITIZE_STRING,
FILTER_FLAG_EMPTY_STRING_NULL
);
if (!is_string($this->page_uri) || strlen($this->page_uri) === 0) {
$this->page_uri = $this->nb_application->getHTTPServer()->getRequestURI();
}
if (!is_string($this->page_uri) || strlen($this->page_uri) === 0) {
throw new ENabuCoreException(ENabuCoreException::ERROR_PAGE_URI_NOT_FOUND);
}
CNabuEngine::getEngine()->traceLog("Page requested", $this->page_uri);
return $this->page_uri;
} | php | {
"resource": ""
} |
q4027 | CNabuHTTPRequest.getCombinedPostIndexes | train | public function getCombinedPostIndexes(array $fields = null)
{
if ($fields === null) {
$fields = $this->getPOSTFieldNames();
}
$keys = array();
if (count($fields) > 0) {
if (is_array($this->xdr_post)) {
foreach ($fields as $field) {
if (array_key_exists($field, $this->xdr_post) && is_array($this->xdr_post[$field])) {
$keys = array_merge($keys, array_keys($this->xdr_post[$field]));
}
}
} elseif (is_array($_POST)) {
foreach ($fields as $field) {
if (array_key_exists($field, $_POST) && is_array($_POST[$field])) {
$keys = array_merge($keys, array_keys($_POST[$field]));
}
}
}
$keys = array_unique($keys);
}
return count($keys) > 0 ? $keys : null;
} | php | {
"resource": ""
} |
q4028 | Builder.create | train | public function create(array $metadata)
{
$schema = $this->getSchemaFromMetadata($metadata);
$statements = $schema->toSql($this->platform);
$this->build($statements);
return $statements;
} | php | {
"resource": ""
} |
q4029 | Builder.update | train | public function update(array $metadata, $saveMode=false)
{
$fromSchema = $this->schemaManager->createSchema();
$toSchema = $this->getSchemaFromMetadata($metadata);
$comparator = new Comparator;
$schemaDiff = $comparator->compare($fromSchema, $toSchema);
if ($saveMode) {
$statements = $schemaDiff->toSaveSql($this->platform);
} else {
$statements = $schemaDiff->toSql($this->platform);
}
$this->build($statements);
return $statements;
} | php | {
"resource": ""
} |
q4030 | Builder.drop | train | public function drop(array $metadata)
{
$visitor = new DropSchemaSqlCollector($this->platform);
$schema = $this->getSchemaFromMetadata($metadata);
$fullSchema = $this->schemaManager->createSchema();
foreach ($fullSchema->getTables() as $table) {
if ($schema->hasTable($table->getName())) {
$visitor->acceptTable($table);
}
}
$statements = $visitor->getQueries();
$this->build($statements);
return $statements;
} | php | {
"resource": ""
} |
q4031 | Builder.getSchemaFromMetadata | train | public function getSchemaFromMetadata(array $metadata)
{
$entityMetadataSchemaConfig = $this->schemaManager->createSchemaConfig();
$schema = new Schema([], [], $entityMetadataSchemaConfig);
$pivotTables = [];
foreach ($metadata as $entityMetadata) {
$this->generateTableFromMetadata($schema, $entityMetadata['table']);
// create version table
if (! empty($entityMetadata['versionTable'])) {
$this->generateTableFromMetadata($schema, $entityMetadata['versionTable']);
}
foreach ($entityMetadata['relations'] as $relationMetadata) {
if (! empty($relationMetadata['pivotTable'])) {
// create pivot table for many to many relations
if (! in_array($relationMetadata['pivotTable']['name'], $pivotTables)) {
$this->generateTableFromMetadata($schema, $relationMetadata['pivotTable']);
}
$pivotTables[] = $relationMetadata['pivotTable']['name'];
}
}
}
return $schema;
} | php | {
"resource": ""
} |
q4032 | Builder.generateTableFromMetadata | train | protected function generateTableFromMetadata($schema, TableDefinition $tableMetadata)
{
$primaryKeys = [];
$uniqueIndexes = [];
$indexes = [];
$table = $schema->createTable($this->connection->getTablePrefix().$tableMetadata['name']);
foreach ($tableMetadata['columns'] as $columnMetadata) {
$columnMetadata = $this->getDoctrineColumnAliases($columnMetadata);
// add column
$options = $this->getDoctrineColumnOptions($columnMetadata);
$table->addColumn($columnMetadata['name'], $columnMetadata['type'], $options);
// add primary keys, unique indexes and indexes
if (! empty($columnMetadata['primary'])) {
$primaryKeys[] = $columnMetadata['name'];
}
if (! empty($columnMetadata['unique'])) {
$uniqueIndexes[] = $columnMetadata['name'];
}
if (! empty($columnMetadata['index'])) {
$indexes[] = $columnMetadata['name'];
}
}
// add primary keys, unique indexes and indexes
if (! empty($primaryKeys)) {
$table->setPrimaryKey($primaryKeys);
}
if (! empty($uniqueIndexes)) {
$table->addUniqueIndex($uniqueIndexes);
}
if (! empty($indexes)) {
$table->addIndex($indexes);
}
} | php | {
"resource": ""
} |
q4033 | Builder.getDoctrineColumnOptions | train | protected function getDoctrineColumnOptions(ColumnDefinition $columnMetadata)
{
$options = $columnMetadata['options'];
// alias for nullable option
if (! empty($columnMetadata['nullable'])) {
$options['notnull'] = ! $columnMetadata['nullable'];
}
// alias for default option
if (! empty($columnMetadata['default'])) {
$options['default'] = $columnMetadata['default'];
}
// alias for unsigned option
if (! empty($columnMetadata['options']['unsigned'])) {
$options['unsigned'] = $columnMetadata['options']['unsigned'];
}
// alias for autoincrement option
if (! empty($columnMetadata['options']['autoIncrement'])) {
$options['autoincrement'] = $columnMetadata['options']['autoIncrement'];
}
// alias for fixed option
if (! empty($columnMetadata['options']['fixed'])) {
$options['fixed'] = $columnMetadata['options']['fixed'];
}
return $options;
} | php | {
"resource": ""
} |
q4034 | CNabuUserGroupMember.getMembersOfGroup | train | public static function getMembersOfGroup($nb_user_group) : CNabuUserGroupMemberList
{
if (is_numeric($nb_user_group_id = nb_getMixedValue($nb_user_group, 'nb_user_group_id'))) {
$retval = CNabuUserGroupMember::buildObjectListFromSQL(
'nb_user_id',
"select ugm.* "
. "from nb_user_group_member ugm, nb_user_group ug "
. "where ugm.nb_user_group_id=ug.nb_user_group_id "
. "and ugm.nb_user_group_id=%group_id\$d",
array(
'group_id' => $nb_user_group_id
)
);
} else {
$retval = new CNabuUserGroupMemberList();
}
return $retval;
} | php | {
"resource": ""
} |
q4035 | SinkService.getAll | train | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->sinks()
->getAll($appId, $scanId, $queryParams);
return new SinksResponse($response);
} | php | {
"resource": ""
} |
q4036 | SinkService.getById | train | public function getById($appId, $scanId, $sinkId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->sinks()
->getById($appId, $scanId, $sinkId, $queryParams);
return new SinkResponse($response);
} | php | {
"resource": ""
} |
q4037 | TeamService.getAll | train | public function getAll(array $queryParams = [])
{
$response = $this->api->teams()->getAll($queryParams);
return new TeamsResponse($response);
} | php | {
"resource": ""
} |
q4038 | TeamService.getById | train | public function getById($teamId, array $queryParams = [])
{
$response = $this->api->teams()->getById($teamId, $queryParams);
return new TeamResponse($response);
} | php | {
"resource": ""
} |
q4039 | TeamService.create | train | public function create(TeamBuilder $input, array $queryParams = [])
{
$response = $this->api->teams()->create($input->toArray(), $queryParams);
return new TeamResponse($response);
} | php | {
"resource": ""
} |
q4040 | TeamService.update | train | public function update($teamId, TeamBuilder $input, array $queryParams = [])
{
$response = $this->api->teams()->update($teamId, $input->toArray(), $queryParams);
return new TeamResponse($response);
} | php | {
"resource": ""
} |
q4041 | TeamService.deleteAll | train | public function deleteAll(array $queryParams = [])
{
$response = $this->api->teams()->deleteAll($queryParams);
return new BaseResponse($response);
} | php | {
"resource": ""
} |
q4042 | TeamService.deleteById | train | public function deleteById($teamId, array $queryParams = [])
{
$response = $this->api->teams()->deleteById($teamId, $queryParams);
return new BaseResponse($response);
} | php | {
"resource": ""
} |
q4043 | CNabuCatalogItemBase.getAllCatalogItems | train | public static function getAllCatalogItems(CNabuCatalog $nb_catalog)
{
$nb_catalog_id = nb_getMixedValue($nb_catalog, 'nb_catalog_id');
if (is_numeric($nb_catalog_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_catalog_item_id',
'select * '
. 'from nb_catalog_item '
. 'where nb_catalog_id=%catalog_id$d',
array(
'catalog_id' => $nb_catalog_id
),
$nb_catalog
);
} else {
$retval = new CNabuCatalogItemList();
}
return $retval;
} | php | {
"resource": ""
} |
q4044 | CNabuHTTPRendersManager.setResponseTransform | train | public function setResponseTransform(CNabuHTTPResponse $nb_response, string $interface_key = null)
{
if ($interface_key === null) {
$nb_response->setTransformFactory(null);
} else {
$nb_engine = CNabuEngine::getEngine();
$nb_descriptor = $nb_engine->getProviderInterfaceDescriptorByKey(
CNabuProviderFactory::INTERFACE_RENDER_TRANSFORM,
$interface_key
);
if ($nb_descriptor instanceof CNabuRenderTransformInterfaceDescriptor &&
($nb_pool_manager = $nb_engine->getRenderPoolManager()) instanceof CNabuRenderPoolManager &&
($nb_transform_factory = $nb_pool_manager->getTransformFactory($nb_descriptor))
instanceof CNabuRenderTransformFactory
) {
$nb_response->setTransformFactory($nb_transform_factory);
} else {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_TRANSFORM_NOT_FOUND,
array($interface_key)
);
}
}
return $this;
} | php | {
"resource": ""
} |
q4045 | CNabuSiteUserBase.setForceDefaultLang | train | public function setForceDefaultLang(string $force_default_lang = "T") : CNabuDataObject
{
if ($force_default_lang === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$force_default_lang")
);
}
$this->setValue('nb_site_user_force_default_lang', $force_default_lang);
return $this;
} | php | {
"resource": ""
} |
q4046 | ScanService.getAll | train | public function getAll($appId = null, array $queryParams = [])
{
$response = $this->api->applications()->scans()->getAll($appId, $queryParams);
return new ScansResponse($response);
} | php | {
"resource": ""
} |
q4047 | ScanService.getById | train | public function getById($appId, $scanId, array $queryParams = [])
{
$response = $this->api->applications()->scans()->getById($appId, $scanId, $queryParams);
return new ScanResponse($response);
} | php | {
"resource": ""
} |
q4048 | ScanService.create | train | public function create($appId, $input, array $queryParams = [])
{
if ($input instanceof ScanBuilder) {
$inputArray = $input->toArray();
$defaultInput = true;
} else {
$inputArray = [];
foreach ($input as $key => $value) {
if ($value instanceof BaseBuilder) {
$inputArray[$key] = $value->toArray();
} else if (is_array($value)) {
foreach ($value as $key2 => $value2) {
if ($value2 instanceof BaseBuilder) {
$inputArray[$key][$key2] = $value2->toArray();
} else if (is_string($value2)) {
$inputArray[$key][$key2] = $value2;
}
}
}
}
$defaultInput = false;
}
$response = $this->api->applications()->scans()->create($appId, $inputArray, $queryParams, $defaultInput);
return new ScanResponse($response);
} | php | {
"resource": ""
} |
q4049 | ScanService.update | train | public function update($appId, $scanId, $input, array $queryParams = [])
{
if ($input instanceof ScanBuilder) {
$inputArray = $input->toArray();
$defaultInput = true;
} else {
$inputArray = [];
foreach ($input as $key => $value) {
if ($value instanceof BaseBuilder) {
$inputArray[$key] = $value->toArray();
}
}
$defaultInput = false;
}
$response = $this->api->applications()->scans()->update($appId, $scanId, $inputArray, $queryParams, $defaultInput);
return new ScanResponse($response);
} | php | {
"resource": ""
} |
q4050 | ScanService.blockUntilDone | train | public function blockUntilDone($appId, $scanId, $waitTime = 0, $sleepTime = 5, array $queryParams = [])
{
$response = $this->api->applications()->scans()->blockUntilDone($appId, $scanId, $waitTime, $sleepTime, $queryParams);
return new ScanResponse($response);
} | php | {
"resource": ""
} |
q4051 | Kernel.getCommands | train | protected function getCommands()
{
return \array_merge($this->commands, [
\Illuminate\Console\Scheduling\ScheduleRunCommand::class,
\Laravel\Lumen\Console\Commands\ServeCommand::class,
]);
} | php | {
"resource": ""
} |
q4052 | UploadHydrator.hydrateCollection | train | public static function hydrateCollection(array $uploads)
{
$hydrated = [];
foreach ($uploads as $upload) {
$hydrated[] = self::hydrate($upload);
}
return $hydrated;
} | php | {
"resource": ""
} |
q4053 | UploadHydrator.hydrate | train | public static function hydrate(stdClass $upload)
{
$hydrated = new UploadEntity;
if (isset($upload->id)) {
$hydrated->setId($upload->id);
}
if (isset($upload->created_at)) {
$hydrated->setCreatedAt(new DateTime($upload->created_at));
}
if (isset($upload->name)) {
$hydrated->setName($upload->name);
}
if (isset($upload->extension)) {
$hydrated->setExtension($upload->extension);
}
if (isset($upload->size)) {
$hydrated->setSize($upload->size);
}
if (isset($upload->file)) {
$hydrated->setFile($upload->file);
}
if (isset($upload->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($upload->created_by));
}
if (isset($upload->application)) {
$hydrated->setApplication(ApplicationHydrator::hydrate($upload->application));
}
return $hydrated;
} | php | {
"resource": ""
} |
q4054 | ActivityHydrator.hydrateCollection | train | public static function hydrateCollection(array $activities)
{
$hydrated = [];
foreach ($activities as $activity) {
$hydrated[] = self::hydrate($activity);
}
return $hydrated;
} | php | {
"resource": ""
} |
q4055 | ActivityHydrator.hydrate | train | public static function hydrate(stdClass $activity)
{
$hydrated = new ActivityEntity();
if (isset($activity->id)) {
$hydrated->setId($activity->id);
}
if (isset($activity->type)) {
$hydrated->setType($activity->type);
}
if (isset($activity->context)) {
$hydrated->setContext(json_decode(json_encode($activity->context), true));
}
if (isset($activity->application)) {
$hydrated->setApplication(ApplicationHydrator::hydrate($activity->application));
}
if (isset($activity->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($activity->created_by));
}
if (isset($activity->created_at)) {
$hydrated->setCreatedAt(new DateTime($activity->created_at));
}
return $hydrated;
} | php | {
"resource": ""
} |
q4056 | TNabuSiteMapChild.setSiteMap | train | public function setSiteMap(CNabuSiteMap $nb_site_map, $field = NABU_SITE_MAP_FIELD_ID)
{
$this->nb_site_map = $nb_site_map;
if ($this instanceof CNabuDataObject) {
$this->transferValue($nb_site_map, NABU_SITE_MAP_FIELD_ID, $field);
}
return $this;
} | php | {
"resource": ""
} |
q4057 | CommentService.getAll | train | public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()->getAll($appId, $scanId, $issueId, $queryParams);
return new CommentsResponse($response);
} | php | {
"resource": ""
} |
q4058 | CommentService.getById | train | public function getById($appId, $scanId, $issueId, $commentId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()
->getById($appId, $scanId, $issueId, $commentId, $queryParams);
return new CommentResponse($response);
} | php | {
"resource": ""
} |
q4059 | CommentService.create | train | public function create($appId, $scanId, $issueId, CommentBuilder $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()
->create($appId, $scanId, $issueId, $input->toArray(), $queryParams);
return new CommentResponse($response);
} | php | {
"resource": ""
} |
q4060 | CommentService.deleteAll | train | public function deleteAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->comments()
->deleteAll($appId, $scanId, $issueId, $queryParams);
return new BaseResponse($response);
} | php | {
"resource": ""
} |
q4061 | Wizard.getCurrentStage | train | public function getCurrentStage(string $name): StageInterface
{
// compute the stageClass from Request parameter
$stageClass = $this->getStageClassName($name);
// loop each stage until finds the first that is necessary
do {
$useCurrentStage = false;
/** @var StageInterface $currentStage */
if (!isset($currentStage)) {
$currentStage = $this->getStageInstance($stageClass);
}
$this->currentStageName = $currentStage->getName();
try {
$isNecessary = $currentStage->isNecessary();
} catch (AbortStageException $e) {
$this->warning = $e->getMessage();
$isNecessary = true;
}
if ($isNecessary) {
$useCurrentStage = true;
} else {
$currentStage = $this->getNextStage();
}
} while (false === $useCurrentStage);
return $currentStage;
} | php | {
"resource": ""
} |
q4062 | Wizard.getSequentialStage | train | private function getSequentialStage(string $direction): ?StageInterface
{
$dir = in_array($direction, ['prev', 'next']) ? $direction : 'next';
ksort($this->stageOrder);
// forward the array pointer to the current index
while (current($this->stageOrder) !== $this->currentStageName && null !== key($this->stageOrder)) {
next($this->stageOrder);
}
$key = $dir($this->stageOrder);
if (null !== $key && false !== $key) {
return $this->getStageInstance($this->stagesByName[$key]);
}
return null;
} | php | {
"resource": ""
} |
q4063 | Wizard.getStageInstance | train | private function getStageInstance(string $stageClass): StageInterface
{
if (!class_exists($stageClass)) {
throw new RuntimeException('Error: Could not find requested stage class.');
}
if (in_array("Zikula\\Component\\Wizard\\InjectContainerInterface", class_implements($stageClass), true)) {
return new $stageClass($this->container);
}
return new $stageClass();
} | php | {
"resource": ""
} |
q4064 | Wizard.getStageClassName | train | private function getStageClassName(string $name): string
{
if (!empty($this->stagesByName[$name])) {
return $this->stagesByName[$name];
}
if (!empty($this->defaultStage) && !empty($this->stagesByName[$this->defaultStage])) {
return $this->stagesByName[$this->defaultStage];
}
throw new InvalidArgumentException('The request stage could not be found and there is no default stage defined.');
} | php | {
"resource": ""
} |
q4065 | CustomFunctionService.getAll | train | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->functions()
->getAll($appId, $scanId, $queryParams);
return new CustomFunctionsResponse($response);
} | php | {
"resource": ""
} |
q4066 | CustomFunctionService.getById | train | public function getById($appId, $scanId, $functionId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->functions()
->getById($appId, $scanId, $functionId, $queryParams);
return new CustomFunctionResponse($response);
} | php | {
"resource": ""
} |
q4067 | CustomFunctionService.create | train | public function create($appId, $scanId, $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->functions()
->create($appId, $scanId, $input->toArray(), $queryParams);
return new CustomFunctionResponse($response);
} | php | {
"resource": ""
} |
q4068 | SummaryService.getAll | train | public function getAll($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->summaries()
->getAll($appId, $scanId, $issueId, $queryParams);
return new SummariesResponse($response);
} | php | {
"resource": ""
} |
q4069 | SummaryService.getById | train | public function getById($appId, $scanId, $issueId, $summaryId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->summaries()
->getById($appId, $scanId, $issueId, $summaryId, $queryParams);
return new SummaryResponse($response);
} | php | {
"resource": ""
} |
q4070 | CNabuRenderModuleManagerAdapter.registerRenderInterface | train | protected function registerRenderInterface(INabuRenderInterface $interface) : bool
{
$hash = $interface->getHash();
if (is_array($this->render_interface_list) && array_key_exists($hash, $this->render_interface_list)) {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_INSTANCE_ALREADY_REGISTERED,
array(get_class($interface))
);
}
if ($this->render_interface_list === null) {
$this->render_interface_list = array($hash => $interface);
} else {
$this->render_interface_list[$hash] = $interface;
}
return $interface->init();
} | php | {
"resource": ""
} |
q4071 | CNabuRenderModuleManagerAdapter.registerTransformInterface | train | protected function registerTransformInterface(INabuRenderTransformInterface $interface) : bool
{
$hash = $interface->getHash();
if (is_array($this->render_transform_interface_list) &&
array_key_exists($hash, $this->render_transform_interface_list)
) {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_TRANSFORM_INSTANCE_ALREADY_REGISTERED,
array(get_class($interface))
);
}
if ($this->render_transform_interface_list === null) {
$this->render_transform_interface_list = array($hash => $interface);
} else {
$this->render_transform_interface_list[$hash] = $interface;
}
return $interface->init();
} | php | {
"resource": ""
} |
q4072 | ProvidesSignedRoute.hasValidSignature | train | public function hasValidSignature(Request $request)
{
$url = $request->url();
$original = rtrim($url.'?'.Arr::query(
Arr::except($request->query(), 'signature')
), '?');
$expires = $request->query()['expires'] ?? null;
$signature = \hash_hmac('sha256', $original, \call_user_func($this->keyResolver));
return \hash_equals($signature, (string) $request->query('signature', '')) &&
! ($expires && Carbon::now()->getTimestamp() > $expires);
} | php | {
"resource": ""
} |
q4073 | CNabuSiteTargetCTABase.setTargetUseURI | train | public function setTargetUseURI(string $target_use_uri = "N") : CNabuDataObject
{
if ($target_use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$target_use_uri")
);
}
$this->setValue('nb_site_target_cta_target_use_uri', $target_use_uri);
return $this;
} | php | {
"resource": ""
} |
q4074 | CNabuUserBase.getAllUsers | train | public static function getAllUsers(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_user_id',
'select * '
. 'from nb_user '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuUserList();
}
return $retval;
} | php | {
"resource": ""
} |
q4075 | CNabuUserBase.setSearchVisibility | train | public function setSearchVisibility(string $search_visibility = "N") : CNabuDataObject
{
if ($search_visibility === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$search_visibility")
);
}
$this->setValue('nb_user_search_visibility', $search_visibility);
return $this;
} | php | {
"resource": ""
} |
q4076 | CNabuUserBase.setLogin | train | public function setLogin(string $login) : CNabuDataObject
{
if ($login === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$login")
);
}
$this->setValue('nb_user_login', $login);
return $this;
} | php | {
"resource": ""
} |
q4077 | CNabuUserBase.setPassword | train | public function setPassword(string $passwd) : CNabuDataObject
{
if ($passwd === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$passwd")
);
}
$this->setValue('nb_user_passwd', $passwd);
return $this;
} | php | {
"resource": ""
} |
q4078 | CNabuUserBase.setValidationStatus | train | public function setValidationStatus(string $validation_status = "F") : CNabuDataObject
{
if ($validation_status === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$validation_status")
);
}
$this->setValue('nb_user_validation_status', $validation_status);
return $this;
} | php | {
"resource": ""
} |
q4079 | CNabuUserBase.setPoliciesAccepted | train | public function setPoliciesAccepted(string $policies_accepted = "F") : CNabuDataObject
{
if ($policies_accepted === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$policies_accepted")
);
}
$this->setValue('nb_user_policies_accepted', $policies_accepted);
return $this;
} | php | {
"resource": ""
} |
q4080 | CNabuUserBase.setCreationDatetime | train | public function setCreationDatetime($creation_datetime) : CNabuDataObject
{
if ($creation_datetime === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$creation_datetime")
);
}
$this->setValue('nb_user_creation_datetime', $creation_datetime);
return $this;
} | php | {
"resource": ""
} |
q4081 | CNabuUserBase.setEmail | train | public function setEmail(string $email) : CNabuDataObject
{
if ($email === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$email")
);
}
$this->setValue('nb_user_email', $email);
return $this;
} | php | {
"resource": ""
} |
q4082 | CNabuUserBase.setAllowNotification | train | public function setAllowNotification(string $allow_notification = "F") : CNabuDataObject
{
if ($allow_notification === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$allow_notification")
);
}
$this->setValue('nb_user_allow_notification', $allow_notification);
return $this;
} | php | {
"resource": ""
} |
q4083 | Application.sort | train | public function sort()
{
return function (\SplFileInfo $a, \SplFileInfo $b) {
preg_match(self::PATTERN, $a->getFileName(), $version_a);
preg_match(self::PATTERN, $b->getFileName(), $version_b);
return ((int)$version_a[1] < (int)$version_b[1]) ? -1 : 1;
};
} | php | {
"resource": ""
} |
q4084 | Application.getSqlFiles | train | public function getSqlFiles()
{
$sqlFinder = $this->getFinder();
$files = $sqlFinder->files()
->in($this->sqlFilesDir)
->name(self::PATTERN)
->sort($this->sort())
;
return $files;
} | php | {
"resource": ""
} |
q4085 | Application.getSqlFileByName | train | public function getSqlFileByName($fileName)
{
$sqlFinder = $this->getFinder();
$files = $sqlFinder->files()
->in($this->sqlFilesDir)
->name($fileName)
;
if ($files->count() !== 1) {
throw new RuntimeException('cannot find File:' . $fileName);
}
foreach ($files as $file){
return $file;
}
} | php | {
"resource": ""
} |
q4086 | Application.getAppliedFiles | train | public function getAppliedFiles()
{
$appliedFinder = $this->getFinder();
$files = $appliedFinder->files()
->in($this->appliedFilesDir)
->name(self::PATTERN)
->sort($this->sort())
;
return $files;
} | php | {
"resource": ""
} |
q4087 | Application.getStatuses | train | public function getStatuses()
{
$files = $this->getSqlFiles();
$appliedFiles = $this->getAppliedFiles();
/**
* is file applied or not
* @param $file
* @return bool if applied, return true.
*/
$isApplied = function($file) use ($appliedFiles){
foreach ($appliedFiles as $appliedFile) {
if ($appliedFile->getFileName() === $file->getFileName()){
return true;
}
}
return false;
};
$statuses = [];
foreach($files as $file){
$appliedAt = $isApplied($file)? date('Y-m-d H:i:s', $file->getMTime()): "";
$statuses[] = new Status($appliedAt, $file);
}
return $statuses;
} | php | {
"resource": ""
} |
q4088 | Application.getUpCandidates | train | public function getUpCandidates()
{
$statuses = $this->getStatuses();
// search latest applied migration
$latest = '';
foreach ($statuses as $status) {
if ($status->appliedAt !== "") {
$latest = $status->file->getFileName();
}
}
// make statuses without being applied
$candidates = [];
$isSkipped = ($latest === '')? false: true;
foreach ($statuses as $status) {
if (false === $isSkipped) {
$candidates[] = $status;
}
if($status->file->getFileName() !== $latest) {
continue;
} else {
$isSkipped = false;
}
}
return $candidates;
} | php | {
"resource": ""
} |
q4089 | Application.copyToAppliedDir | train | public function copyToAppliedDir($file)
{
if (false === @copy($file->getPathName(), $this->appliedFilesDir . '/' . $file->getFileName())) {
throw new RuntimeException('cannot copy the sql file to applied directory. check the <info>'. $this->appliedFilesDir . '</info> directory.');
}
} | php | {
"resource": ""
} |
q4090 | CNabuIContact.getProspect | train | public function getProspect($nb_prospect)
{
$retval = false;
if (is_numeric($nb_prospect_id = nb_getMixedValue($nb_prospect, NABU_ICONTACT_PROSPECT_FIELD_ID))) {
$retval = $this->nb_icontact_prospect_list->getItem($nb_prospect_id);
}
return $retval;
} | php | {
"resource": ""
} |
q4091 | CNabuIContact.getProspectsOfUser | train | public function getProspectsOfUser($nb_user, CNabuIContactProspectStatusType $nb_status_type = null) : CNabuIContactProspectList
{
$this->nb_icontact_prospect_list->clear();
$this->nb_icontact_prospect_list->merge(CNabuIContactProspect::getProspectsOfUser($this, $nb_user, $nb_status_type));
return $this->nb_icontact_prospect_list;
} | php | {
"resource": ""
} |
q4092 | CNabuIContact.getCountProspectsOfUser | train | public function getCountProspectsOfUser($nb_user, CNabuIContactProspectStatusType $nb_status_type = null) : int
{
return CNabuIContactProspect::getCountProspectsOfUser($this, $nb_user, $nb_status_type);
} | php | {
"resource": ""
} |
q4093 | CNabuIContact.getProspects | train | public function getProspects(CNabuIContactProspectStatusType $nb_status_type = null) : CNabuIContactProspectList
{
$this->nb_icontact_prospect_list->clear();
$this->nb_icontact_prospect_list->merge(CNabuIContactProspect::getProspectsForIContact($this, $nb_status_type));
return $this->nb_icontact_prospect_list;
} | php | {
"resource": ""
} |
q4094 | CNabuIContact.getProspectStatusTypes | train | public function getProspectStatusTypes(bool $force = false) : CNabuIContactProspectStatusTypeList
{
if ($this->nb_icontact_prospect_status_type_list->isEmpty() || $force) {
$this->nb_icontact_prospect_status_type_list->clear();
$this->nb_icontact_prospect_status_type_list->merge(CNabuIContactProspectStatusType::getTypesForIContact($this));
}
return $this->nb_icontact_prospect_status_type_list;
} | php | {
"resource": ""
} |
q4095 | CNabuIContact.getProspectStatusType | train | public function getProspectStatusType($nb_type)
{
$retval = false;
if (is_numeric($nb_type_id = nb_getMixedValue($nb_type, 'nb_icontact_prospect_status_type_id'))) {
$retval = $this->nb_icontact_prospect_status_type_list->getItem($nb_type_id);
}
return $retval;
} | php | {
"resource": ""
} |
q4096 | CNabuIContact.getProspectStatusTypeByKey | train | public function getProspectStatusTypeByKey(string $key)
{
$retval = false;
if (is_string($key)) {
$this->getProspectStatusTypes();
$retval = $this->nb_icontact_prospect_status_type_list->getItem($key, CNabuIContactProspectStatusTypeList::INDEX_KEY);
}
return $retval;
} | php | {
"resource": ""
} |
q4097 | CNabuIContact.refresh | train | public function refresh(bool $force = false, bool $cascade = false) : bool
{
return parent::refresh($force, $cascade) &&
(!$cascade || (
$this->getProspectStatusTypes($force)
))
;
} | php | {
"resource": ""
} |
q4098 | CNabuIContact.grantStorageFolder | train | public function grantStorageFolder(bool $save = true)
{
$base_path = $this->getBasePath();
if (!is_string($base_path) || strlen($base_path) === 0 || !file_exists($base_path)) {
$hash = mb_strtolower(str_replace(array('{', '}'), '', $this->grantHash()));
$base_path = NABU_ICONTACT_PATH . DIRECTORY_SEPARATOR . $hash;
if (!file_exists($base_path) && (!mkdir($base_path) || !file_exists($base_path))) {
throw new ENabuIContactException(
ENabuIContactException::ERROR_MAIN_PATH_CANNOT_BE_CREATED,
array($base_path)
);
}
$this->setBasePath($base_path);
if ($save) $this->save();
}
} | php | {
"resource": ""
} |
q4099 | Router.parseAction | train | protected function parseAction($action)
{
if (\is_string($action)) {
return ['uses' => $action];
} elseif (! \is_array($action)) {
return [$action];
}
if (isset($action['middleware']) && \is_string($action['middleware'])) {
$action['middleware'] = \explode('|', $action['middleware']);
}
return $action;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.