_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 33
8k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q3300
|
ClientFactory.clearSessionTokens
|
train
|
public function clearSessionTokens()
{
$this->session->remove(self::SESSION_TOKEN_KEY);
|
php
|
{
"resource": ""
}
|
q3301
|
ClientFactory.hasSessionTokens
|
train
|
public function hasSessionTokens()
{
return ($this->session->has(self::SESSION_TOKEN_KEY)
|
php
|
{
"resource": ""
}
|
q3302
|
Tweet.createTweet
|
train
|
private function createTweet(array $tweet, User $user)
{
$this->fields = [
'id' => $this->getValue('id', $tweet),
'text' => $this->getValue('text', $tweet),
'source' => $this->getValue('source', $tweet),
'url' => $this->getValue('url', $tweet),
|
php
|
{
"resource": ""
}
|
q3303
|
Tweet.listHashTags
|
train
|
private function listHashTags(array $tweet)
{
$list = [];
if (array_key_exists('entities', $tweet) and array_key_exists('hashtags', $tweet['entities']))
{
$hashTags = $tweet['entities']['hashtags'];
foreach ($hashTags as $hashTag)
{
|
php
|
{
"resource": ""
}
|
q3304
|
Tx_Oelib_HeaderProxyFactory.getHeaderProxy
|
train
|
public function getHeaderProxy()
{
if ($this->isTestMode) {
$className = \Tx_Oelib_HeaderCollector::class;
} else {
$className = \Tx_Oelib_RealHeaderProxy::class;
}
|
php
|
{
"resource": ""
}
|
q3305
|
DbConfig.read
|
train
|
public function read($key)
{
$query = $this->_table->find('kv');
if ($key !== '*') {
$query->where([
$this->_table->aliasField('namespace') . ' IS' => $key
]);
}
|
php
|
{
"resource": ""
}
|
q3306
|
ImageSizes.addImageSizes
|
train
|
private function addImageSizes()
{
$data = $this->getData();
foreach ($data as $slug => $props)
{
|
php
|
{
"resource": ""
}
|
q3307
|
ImageSizes.addSizesToDropDownList
|
train
|
public function addSizesToDropDownList($sizes)
{
$new = array();
$data = $this->getData();
foreach ($data as $slug => $props)
{
// If no 4th option, stop the loop.
if ( !isset($props['media']) || false == $props['media'])
|
php
|
{
"resource": ""
}
|
q3308
|
Tx_Oelib_Geocoding_Calculator.calculateDistanceInKilometers
|
train
|
public function calculateDistanceInKilometers(
\Tx_Oelib_Interface_Geo $object1,
\Tx_Oelib_Interface_Geo $object2
) {
if ($object1->hasGeoError()) {
throw new \InvalidArgumentException('$object1 has a geo error.');
}
if ($object2->hasGeoError()) {
throw new \InvalidArgumentException('$object2 has a geo error.');
}
if (!$object1->hasGeoCoordinates()) {
throw new \InvalidArgumentException(
'$object1 needs to have coordinates, but has none.'
|
php
|
{
"resource": ""
}
|
q3309
|
Tx_Oelib_Geocoding_Calculator.filterByDistance
|
train
|
public function filterByDistance(\Tx_Oelib_List $unfilteredObjects, \Tx_Oelib_Interface_Geo $center, $distance)
{
$objectsWithinDistance = new \Tx_Oelib_List();
/** @var \Tx_Oelib_Interface_Geo|\Tx_Oelib_Model $object */
foreach ($unfilteredObjects as $object) {
|
php
|
{
"resource": ""
}
|
q3310
|
CrudCommand.addRoutes
|
train
|
protected function addRoutes()
{
return ["Route::delete('" . $this->routeName . "/arr-delete', '" . $this->controller . "@arrDelete')->name('" . $this->myAddrName
|
php
|
{
"resource": ""
}
|
q3311
|
CrudCommand.processJSONFields
|
train
|
protected function processJSONFields($file)
{
$json = File::get($file);
$fields = json_decode($json);
$fieldsString = '';
foreach ($fields->fields as $field) {
if ($field->type === 'select' || $field->type === 'enum') {
$fieldsString .= $field->name . '#' . $field->type . '#options=' . json_encode($field->options) . ';';
|
php
|
{
"resource": ""
}
|
q3312
|
SitewideContentReport.columns
|
train
|
public function columns($itemType = 'Pages')
{
$columns = [
'Title' => [
'title' => _t(__CLASS__ . '.Name', 'Name'),
'link' => true,
],
'Created' => [
'title' => _t(__CLASS__ . '.Created', 'Date created'),
'formatting' => function ($value, $item) {
return $item->dbObject('Created')->Nice();
},
],
'LastEdited' => [
'title' => _t(__CLASS__ . '.LastEdited', 'Date last edited'),
'formatting' => function ($value, $item) {
return $item->dbObject('LastEdited')->Nice();
},
],
];
if ($itemType === 'Pages') {
// Page specific fields
$columns['i18n_singular_name'] = _t(__CLASS__ . '.PageType', 'Page type');
$columns['StageState'] = [
'title' => _t(__CLASS__ . '.Stage', 'Stage'),
'formatting' => function ($value, $item) {
// Stage only
if (!$item->isPublished()) {
return _t(__CLASS__ . '.Draft', 'Draft');
}
// Pending changes
if ($item->isModifiedOnDraft()) {
return _t(__CLASS__ . '.PublishedWithChanges', 'Published (with changes)');
}
// If on live and unmodified
return _t(__CLASS__ . '.Published', 'Published');
},
];
|
php
|
{
"resource": ""
}
|
q3313
|
SitewideContentReport.getPrintExportColumns
|
train
|
public function getPrintExportColumns($gridField, $itemType, $exportColumns)
{
// Swap RelativeLink for AbsoluteLink for export
$exportColumns['AbsoluteLink'] = _t(__CLASS__ . '.Link', 'Link');
unset($exportColumns['RelativeLink']);
|
php
|
{
"resource": ""
}
|
q3314
|
RegExp.checkUnicodeSupport
|
train
|
public function checkUnicodeSupport()
{
if (null === self::$unicodeEnabled) {
|
php
|
{
"resource": ""
}
|
q3315
|
Tx_Oelib_ViewHelpers_GoogleMapsViewHelper.generateJavaScript
|
train
|
protected function generateJavaScript($mapId, array $mapPoints, $initializeFunctionName)
{
// Note: If there are several map points with coordinates and the map
// is fit to the map points, the Google Maps API still requires a center
// point. In that case, any point will do (e.g., the first point).
$centerCoordinates = $mapPoints[0]->getGeoCoordinates();
return 'var mapMarkersByUid = mapMarkersByUid || {};' . LF .
'function ' . $initializeFunctionName . '() {' . LF .
'var center = new google.maps.LatLng(' . \number_format($centerCoordinates['latitude'], 6, '.', '') . ', ' .
\number_format($centerCoordinates['longitude'], 6, '.', '') . ');' . LF .
'var mapOptions = {' . LF .
|
php
|
{
"resource": ""
}
|
q3316
|
SiteView.scopeOlderThanOrBetween
|
train
|
public function scopeOlderThanOrBetween(Builder $query, $until = null, $from = null)
{
if (is_null($until))
{
$until = Carbon::now();
|
php
|
{
"resource": ""
}
|
q3317
|
LanguageLa.convertGrammar
|
train
|
function convertGrammar( $word, $case ) {
global $wgGrammarForms;
if ( isset( $wgGrammarForms['la'][$case][$word] ) ) {
return $wgGrammarForms['la'][$case][$word];
}
switch ( $case ) {
case 'genitive':
// only a few declensions, and even for those mostly the singular only
$in = array( '/u[ms]$/', # 2nd declension singular
'/ommunia$/', # 3rd declension neuter plural (partly)
'/a$/', # 1st declension singular
'/libri$/', '/nuntii$/', # 2nd declension plural (partly)
'/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
'/es$/' # 5th declension singular
);
$out = array( 'i',
'ommunium',
'ae',
'librorum', 'nuntiorum',
'tionis', 'ntis', 'atis',
'ei'
);
return preg_replace( $in, $out, $word );
case 'accusative':
// only a few declensions, and even for those mostly the singular only
$in = array( '/u[ms]$/', # 2nd declension singular
'/a$/', # 1st declension singular
'/ommuniam$/', # 3rd declension neuter plural (partly)
'/libri$/', '/nuntii$/', # 2nd declension plural (partly)
'/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
'/es$/'
|
php
|
{
"resource": ""
}
|
q3318
|
Dialog.getLibrary
|
train
|
public function getLibrary($sName)
{
try
{
$library = $this->di[$sName];
|
php
|
{
"resource": ""
}
|
q3319
|
Dialog.getModalLibrary
|
train
|
protected function getModalLibrary()
{
// Get the current modal library
if(($this->sModalLibrary) &&
($library = $this->getLibrary($this->sModalLibrary)) && ($library instanceof Modal))
{
return $library;
}
|
php
|
{
"resource": ""
}
|
q3320
|
Dialog.getAlertLibrary
|
train
|
protected function getAlertLibrary($bReturnDefault = false)
{
// Get the current alert library
if(($this->sAlertLibrary) &&
($library = $this->getLibrary($this->sAlertLibrary)) && ($library instanceof Alert))
{
return $library;
}
// Get the configured alert library
if(($sName = $this->getOption('dialogs.default.alert', ''))
|
php
|
{
"resource": ""
}
|
q3321
|
Dialog.getConfirmLibrary
|
train
|
protected function getConfirmLibrary($bReturnDefault = false)
{
// Get the current confirm library
if(($this->sConfirmLibrary) &&
($library = $this->getLibrary($this->sConfirmLibrary)) && ($library instanceof Confirm))
{
return $library;
}
// Get the configured confirm library
if(($sName = $this->getOption('dialogs.default.confirm', ''))
|
php
|
{
"resource": ""
}
|
q3322
|
Dialog.getLibrariesInUse
|
train
|
protected function getLibrariesInUse()
{
$aNames = $this->getOption('dialogs.libraries', array());
if(!is_array($aNames))
{
$aNames = array();
}
$libraries = array();
foreach($aNames as $sName)
{
if(($library = $this->getLibrary($sName)))
{
$libraries[$library->getName()] = $library;
}
}
if(($library = $this->getModalLibrary()))
{
|
php
|
{
"resource": ""
}
|
q3323
|
Dialog.getJs
|
train
|
public function getJs()
{
if(!$this->includeAssets())
{
return '';
}
$libraries = $this->getLibrariesInUse();
$code = '';
|
php
|
{
"resource": ""
}
|
q3324
|
Dialog.getCss
|
train
|
public function getCss()
{
if(!$this->includeAssets())
{
return '';
}
$libraries = $this->getLibrariesInUse();
$code = '';
|
php
|
{
"resource": ""
}
|
q3325
|
Dialog.success
|
train
|
public function success($message, $title = null)
{
return
|
php
|
{
"resource": ""
}
|
q3326
|
Dialog.info
|
train
|
public function info($message, $title = null)
{
return
|
php
|
{
"resource": ""
}
|
q3327
|
Dialog.warning
|
train
|
public function warning($message, $title = null)
{
return
|
php
|
{
"resource": ""
}
|
q3328
|
Dialog.error
|
train
|
public function error($message, $title = null)
{
return
|
php
|
{
"resource": ""
}
|
q3329
|
CNabuIContactProspectStatusTypeLanguageBase.setIcontactProspectStatusTypeId
|
train
|
public function setIcontactProspectStatusTypeId(int $nb_icontact_prospect_status_type_id) : CNabuDataObject
{
if ($nb_icontact_prospect_status_type_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3330
|
CNabuIContactProspectStatusTypeLanguageBase.setLanguageId
|
train
|
public function setLanguageId(int $nb_language_id) : CNabuDataObject
{
if ($nb_language_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3331
|
CallbackService.getAll
|
train
|
public function getAll(array $queryParams = [])
{
$response = $this->api->callbacks()->getAll($queryParams);
|
php
|
{
"resource": ""
}
|
q3332
|
CallbackService.getById
|
train
|
public function getById($callbackId, array $queryParams = [])
{
$response = $this->api->callbacks()->getById($callbackId,
|
php
|
{
"resource": ""
}
|
q3333
|
CallbackService.create
|
train
|
public function create(CallbackBuilder $input, array $queryParams = [])
{
$response = $this->api->callbacks()->create($input->toArray(),
|
php
|
{
"resource": ""
}
|
q3334
|
CallbackService.update
|
train
|
public function update($callbackId, CallbackBuilder $input, array $queryParams = [])
{
$response = $this->api->callbacks()->update($callbackId,
|
php
|
{
"resource": ""
}
|
q3335
|
CallbackService.deleteAll
|
train
|
public function deleteAll(array $queryParams = [])
{
$response
|
php
|
{
"resource": ""
}
|
q3336
|
CallbackService.deleteById
|
train
|
public function deleteById($callbackId, array $queryParams = [])
{
$response = $this->api->callbacks()->deleteById($callbackId,
|
php
|
{
"resource": ""
}
|
q3337
|
ValueObject.equals
|
train
|
public function equals(ValueObjectContract $valueObject)
{
foreach (get_object_vars($this) as $name => $value) {
if ($this->{$name} !==
|
php
|
{
"resource": ""
}
|
q3338
|
SettingService.get
|
train
|
public function get($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->settings()->get($appId,
|
php
|
{
"resource": ""
}
|
q3339
|
SettingService.update
|
train
|
public function update($appId, $profileId, SettingBuilder $input, array $queryParams = [])
{
$response
|
php
|
{
"resource": ""
}
|
q3340
|
LanguageMap.withEntry
|
train
|
public function withEntry(string $languageTag, string $value): self
{
|
php
|
{
"resource": ""
}
|
q3341
|
ActivityService.getAll
|
train
|
public function getAll(array $queryParams = [])
{
$response = $this->api->activities()->getAll($queryParams);
|
php
|
{
"resource": ""
}
|
q3342
|
ActivityService.getById
|
train
|
public function getById($activityId, array $queryParams = [])
{
$response = $this->api->activities()->getById($activityId,
|
php
|
{
"resource": ""
}
|
q3343
|
RegistersExceptionHandlers.handleShutdown
|
train
|
protected function handleShutdown()
{
if (! \is_null($error = \error_get_last()) && $this->isFatalError($error['type'])) {
|
php
|
{
"resource": ""
}
|
q3344
|
RegistersExceptionHandlers.isFatalError
|
train
|
protected function isFatalError($type)
{
$errorCodes = [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE];
if (\defined('FATAL_ERROR')) {
|
php
|
{
"resource": ""
}
|
q3345
|
Compiler.addDbup
|
train
|
protected function addDbup(\Phar $phar)
{
$content = file_get_contents(__DIR__ . '/../../../dbup');
$content
|
php
|
{
"resource": ""
}
|
q3346
|
CNabuSiteTargetSectionLanguageBase.setSiteTargetSectionId
|
train
|
public function setSiteTargetSectionId(int $nb_site_target_section_id) : CNabuDataObject
{
if ($nb_site_target_section_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3347
|
CNabuProjectBase.refresh
|
train
|
public function refresh(bool $force = false, bool $cascade = false) : bool
|
php
|
{
"resource": ""
}
|
q3348
|
CNabuProjectBase.getAllProjects
|
train
|
public static function getAllProjects(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_project_id',
'select * '
. 'from nb_project '
. 'where
|
php
|
{
"resource": ""
}
|
q3349
|
CNabuProjectBase.setCustomerId
|
train
|
public function setCustomerId(int $nb_customer_id) : CNabuDataObject
{
if ($nb_customer_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3350
|
ModificationHydrator.hydrateCollection
|
train
|
public static function hydrateCollection(array $modifications)
{
$hydrated = [];
foreach ($modifications as $modification) {
|
php
|
{
"resource": ""
}
|
q3351
|
ModificationHydrator.hydrate
|
train
|
public static function hydrate(stdClass $modification)
{
$hydrated = new ModificationEntity();
if (isset($modification->id)) {
$hydrated->setId($modification->id);
}
if (isset($modification->virtual_line)) {
$hydrated->setVirtualLine($modification->virtual_line);
}
if (isset($modification->original_line)) {
$hydrated->setOriginalLine($modification->original_line);
}
if (isset($modification->column_start)) {
$hydrated->setColumnStart($modification->column_start);
}
if (isset($modification->column_end)) {
$hydrated->setColumnEnd($modification->column_end);
}
if (isset($modification->content)) {
|
php
|
{
"resource": ""
}
|
q3352
|
Controller.getMiddlewareForMethod
|
train
|
public function getMiddlewareForMethod($method)
{
$middleware = [];
foreach ($this->middleware as $name => $options) {
if (isset($options['only']) && ! \in_array($method, (array) $options['only'])) {
continue;
}
|
php
|
{
"resource": ""
}
|
q3353
|
TeamHydrator.hydrateCollection
|
train
|
public static function hydrateCollection(array $teams)
{
$hydrated = [];
foreach ($teams as $team) {
|
php
|
{
"resource": ""
}
|
q3354
|
TeamHydrator.hydrate
|
train
|
public static function hydrate(stdClass $team)
{
$hydrated = new TeamEntity();
if (isset($team->id)) {
$hydrated->setId($team->id);
}
if (isset($team->name)) {
$hydrated->setName($team->name);
}
if (isset($team->organization)) {
$hydrated->setOrganization(OrgHydrator::hydrate($team->organization));
}
if (isset($team->users) && is_array($team->users)) {
$hydrated->setUsers(UserHydrator::hydrateCollection($team->users));
|
php
|
{
"resource": ""
}
|
q3355
|
CNabuCommerceProductLanguageBase.setCommerceProductId
|
train
|
public function setCommerceProductId(int $nb_commerce_product_id) : CNabuDataObject
{
if ($nb_commerce_product_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3356
|
CNabuIContactProspectStatusTypeBase.getLanguages
|
train
|
public function getLanguages($force = false)
{
if (!CNabuEngine::getEngine()->isOperationModeStandalone() &&
($this->languages_list->getSize() === 0 || $force)
) {
|
php
|
{
"resource": ""
}
|
q3357
|
CNabuIContactProspectStatusTypeBase.getTranslations
|
train
|
public function getTranslations($force = false)
{
if (!CNabuEngine::getEngine()->isOperationModeStandalone() &&
($this->translations_list->getSize() === 0 || $force)
) {
|
php
|
{
"resource": ""
}
|
q3358
|
CNabuCustomer.refresh
|
train
|
public function refresh(bool $force = false, bool $cascade = false) : bool
{
if (($retval = parent::refresh($force, $cascade))===true && $cascade) {
$this->getMediotecas($force);
$this->getSites($force);
$this->getCommerces($force);
|
php
|
{
"resource": ""
}
|
q3359
|
CNabuCustomer.getMediotecas
|
train
|
public function getMediotecas($force = false)
{
if ($this->nb_medioteca_list->isEmpty() || $force) {
$this->nb_medioteca_list->clear();
|
php
|
{
"resource": ""
}
|
q3360
|
CNabuCustomer.getMedioteca
|
train
|
public function getMedioteca($nb_medioteca)
{
$retval = false;
if (is_object($nb_medioteca) && !($nb_medioteca instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_medioteca', get_class($nb_medioteca))
);
}
if ($nb_medioteca !== null) {
|
php
|
{
"resource": ""
}
|
q3361
|
CNabuCustomer.getMediotecaByKey
|
train
|
public function getMediotecaByKey(string $key)
{
if (strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key,
|
php
|
{
"resource": ""
}
|
q3362
|
CNabuCustomer.getSite
|
train
|
public function getSite($nb_site)
{
$retval = false;
if (is_object($nb_site) && !($nb_site instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_site', get_class($nb_site))
);
}
if ($nb_site !== null) {
$nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID);
if (is_numeric($nb_site_id) || nb_isValidGUID($nb_site_id)) {
$retval = $this->nb_site_list->getItem($nb_site_id);
if ($retval instanceof CNabuSite) {
if (!$retval->validateCustomer($this)) {
$this->nb_site_list->removeItem($retval);
$retval = false;
} else {
|
php
|
{
"resource": ""
}
|
q3363
|
CNabuCustomer.getSiteByKey
|
train
|
public function getSiteByKey(string $key)
{
$retval = false;
if (strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
|
php
|
{
"resource": ""
}
|
q3364
|
CNabuCustomer.getSiteByAlias
|
train
|
public function getSiteByAlias(string $alias)
{
$retval = false;
if (!is_string($alias) || strlen($alias) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$alias', print_r($alias, true))
|
php
|
{
"resource": ""
}
|
q3365
|
CNabuCustomer.getSites
|
train
|
public function getSites($force = false)
{
if ($force) {
$this->nb_site_list->clear();
|
php
|
{
"resource": ""
}
|
q3366
|
CNabuCustomer.getCommerces
|
train
|
public function getCommerces($force = false)
{
if ($this->nb_commerce_list->isEmpty() || $force) {
$this->nb_commerce_list->clear();
|
php
|
{
"resource": ""
}
|
q3367
|
CNabuCustomer.getCommerce
|
train
|
public function getCommerce($nb_commerce)
{
$retval = false;
if (is_object($nb_commerce) && !($nb_commerce instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_commerce', get_class($nb_commerce))
);
}
if ($nb_commerce !== null) {
|
php
|
{
"resource": ""
}
|
q3368
|
CNabuCustomer.getCatalog
|
train
|
public function getCatalog($nb_catalog)
{
$retval = false;
if (is_object($nb_catalog) && !($nb_catalog instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_catalog', get_class($nb_catalog))
);
}
if ($nb_catalog !== null) {
|
php
|
{
"resource": ""
}
|
q3369
|
CNabuCustomer.getCatalogByKey
|
train
|
public function getCatalogByKey($key)
{
if (!is_string($key) || strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
|
php
|
{
"resource": ""
}
|
q3370
|
CNabuCustomer.getCatalogBySlug
|
train
|
public function getCatalogBySlug($slug, $nb_language = null)
{
if (!is_string($slug) || strlen($slug) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$slug', print_r($slug, true))
);
}
$nb_final_catalog = null;
$nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);
$this->nb_catalog_list->iterate(
function ($key, CNabuCatalog $nb_catalog)
use ($slug, &$nb_final_catalog, $nb_language_id)
{
if (is_numeric($nb_language_id)) {
$nb_translation = $nb_catalog->getTranslation($nb_language_id);
if ($nb_translation instanceof CNabuCatalogLanguage &&
$nb_translation->getSlug() === $slug
) {
$nb_final_catalog = $nb_catalog;
}
} else {
|
php
|
{
"resource": ""
}
|
q3371
|
CNabuCustomer.getCatalogs
|
train
|
public function getCatalogs($force = false)
{
if ($this->nb_catalog_list->isEmpty() || $force) {
$this->nb_catalog_list->clear();
|
php
|
{
"resource": ""
}
|
q3372
|
CNabuCustomer.getMessagings
|
train
|
public function getMessagings($force = false)
{
if ($this->nb_messaging_list->isEmpty() || $force) {
$this->nb_messaging_list->clear();
|
php
|
{
"resource": ""
}
|
q3373
|
CNabuCustomer.getMessaging
|
train
|
public function getMessaging($nb_messaging)
{
$retval = false;
if (is_object($nb_messaging) && !($nb_messaging instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_messaging', get_class($nb_messaging))
);
}
if ($nb_messaging !== null) {
|
php
|
{
"resource": ""
}
|
q3374
|
CNabuCustomer.getProjects
|
train
|
public function getProjects($force = false)
{
if ($this->nb_project_list === null) {
$this->nb_project_list = new CNabuProjectList($this);
}
if ($force) {
$this->nb_role_list->clear();
|
php
|
{
"resource": ""
}
|
q3375
|
CNabuCustomer.getProject
|
train
|
public function getProject($nb_project)
{
$retval = false;
if (is_object($nb_project) && !($nb_project instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_project', get_class($nb_project))
);
}
if ($nb_project !== null) {
|
php
|
{
"resource": ""
}
|
q3376
|
CNabuCustomer.getUser
|
train
|
public function getUser($nb_user)
{
$retval = null;
$nb_user_id = nb_getMixedValue($nb_user, NABU_USER_FIELD_ID);
if (is_numeric($nb_user_id)) {
$nb_new_user = new CNabuUser($nb_user_id);
|
php
|
{
"resource": ""
}
|
q3377
|
CNabuCustomer.getUserByLogin
|
train
|
public function getUserByLogin(string $login)
{
$retval = null;
if (strlen($login) > 0) {
$nb_user = CNabuUser::findByLogin($this, $login);
if ($nb_user instanceof CNabuUser && $nb_user->validateCustomer($this)) {
|
php
|
{
"resource": ""
}
|
q3378
|
CNabuCustomer.getUserByEMail
|
train
|
public function getUserByEMail(string $email)
{
$retval = null;
if (strlen($email) > 0) {
$nb_user = CNabuUser::findByEMail($this, $email);
if ($nb_user instanceof CNabuUser && $nb_user->validateCustomer($this)) {
|
php
|
{
"resource": ""
}
|
q3379
|
CNabuCustomer.getRoles
|
train
|
public function getRoles(bool $force = false)
{
if ($this->nb_role_list->isEmpty() || $force) {
$this->nb_role_list->clear();
|
php
|
{
"resource": ""
}
|
q3380
|
CNabuCustomer.getRole
|
train
|
public function getRole($nb_role)
{
$retval = false;
if (is_object($nb_role) && !($nb_role instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_role', get_class($nb_role))
);
}
if ($nb_role !== null) {
$nb_role_id = nb_getMixedValue($nb_role, NABU_ROLE_FIELD_ID);
if (is_numeric($nb_role_id) || nb_isValidGUID($nb_role_id)) {
$retval = $this->nb_role_list->getItem($nb_role_id);
if ($retval instanceof CNabuRole) {
if (!$retval->validateCustomer($this)) {
$this->nb_role_list->removeItem($retval);
$retval = false;
} else {
|
php
|
{
"resource": ""
}
|
q3381
|
CNabuCustomer.getRoleByKey
|
train
|
public function getRoleByKey(string $key)
{
if (strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key',
|
php
|
{
"resource": ""
}
|
q3382
|
CNabuCustomer.getIContacts
|
train
|
public function getIContacts($force = false)
{
if ($this->nb_icontact_list->isEmpty() || $force) {
$this->nb_icontact_list->clear();
|
php
|
{
"resource": ""
}
|
q3383
|
CNabuCustomer.getIContact
|
train
|
public function getIContact($nb_icontact)
{
$retval = false;
if (is_object($nb_icontact) && !($nb_icontact instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_icontact', get_class($nb_icontact))
);
}
if ($nb_icontact !== null) {
|
php
|
{
"resource": ""
}
|
q3384
|
CNabuCustomer.getIContactByKey
|
train
|
public function getIContactByKey(string $key)
{
if (!is_string($key) || strlen($key) === 0) {
throw new ENabuCoreException(
|
php
|
{
"resource": ""
}
|
q3385
|
TypeService.getAll
|
train
|
public function getAll(array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->origins()
|
php
|
{
"resource": ""
}
|
q3386
|
TypeService.getById
|
train
|
public function getById($typeId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
|
php
|
{
"resource": ""
}
|
q3387
|
CNabuClusterUserBase.setGroupId
|
train
|
public function setGroupId(int $group_id) : CNabuDataObject
{
if ($group_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$group_id")
|
php
|
{
"resource": ""
}
|
q3388
|
CNabuClusterUserBase.setOSNick
|
train
|
public function setOSNick(string $os_nick) : CNabuDataObject
{
if ($os_nick === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$os_nick")
|
php
|
{
"resource": ""
}
|
q3389
|
Result.equals
|
train
|
public function equals(Result $result): bool
{
if (null !== $this->score xor null !== $result->score) {
return false;
}
if (null !== $this->score && !$this->score->equals($result->score)) {
return false;
}
if ($this->success !== $result->success) {
return false;
}
if ($this->completion !== $result->completion) {
return false;
}
if ($this->response !== $result->response) {
return false;
}
if
|
php
|
{
"resource": ""
}
|
q3390
|
CNabuIContactProspectAttachment.putFile
|
train
|
public function putFile(string $sourcefile)
{
if (file_exists($sourcefile)) {
if (($nb_icontact_prospect = $this->getIContactProspect()) instanceof CNabuIContactProspect &&
($nb_icontact = $nb_icontact_prospect->getIContact()) instanceof CNabuIContact
) {
$this->grantHash();
$nb_icontact->grantStorageFolder();
$base_path = $nb_icontact->getBasePath();
move_uploaded_file($sourcefile, $base_path . DIRECTORY_SEPARATOR . $this->getFilename());
} else {
|
php
|
{
"resource": ""
}
|
q3391
|
CNabuIContactProspectAttachment.deleteFile
|
train
|
public function deleteFile()
{
$retval = false;
if (($nb_icontact_prospect = $this->getIContactProspect()) instanceof CNabuIContactProspect &&
($nb_icontact = $nb_icontact_prospect->getIContact()) instanceof CNabuIContact
) {
$base_path = $nb_icontact->getBasePath();
|
php
|
{
"resource": ""
}
|
q3392
|
CNabuIContactProspectAttachment.getAttachmentsForProspect
|
train
|
public static function getAttachmentsForProspect($nb_prospect)
{
if (is_numeric($nb_prospect_id = nb_getMixedValue($nb_prospect, NABU_ICONTACT_PROSPECT_FIELD_ID))) {
$retval = CNabuIContactProspectAttachment::buildObjectListFromSQL(
NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID,
'SELECT ipa.*
FROM nb_icontact_prospect_attachment ipa, nb_icontact_prospect ip
WHERE ipa.nb_icontact_prospect_id=ip.nb_icontact_prospect_id
AND ip.nb_icontact_prospect_id=%prospect_id$d
ORDER BY ipa.nb_icontact_prospect_attachment_id',
array(
'prospect_id' => $nb_prospect_id
),
($nb_prospect instanceof CNabuIContactProspect ? $nb_prospect : null)
);
if ($nb_prospect instanceof CNabuIContactProspect) {
|
php
|
{
"resource": ""
}
|
q3393
|
CNabuHTTPSiteTargetPluginAdapter.trap
|
train
|
public function trap(CNabuHTTPRequest $nb_request, CNabuHTTPResponse $nb_response) : bool
{
if (($this->nb_request = $nb_request) === null ||
($this->nb_response = $nb_response) === null ||
($this->nb_engine = CNabuEngine::getEngine()) === null ||
($this->nb_application = $this->nb_engine->getApplication()) === null ||
($this->nb_session = CNabuHTTPSession::getSession()) === null ||
($this->nb_server = $this->nb_engine->getHTTPServer()->getServer()) === null ||
($this->nb_customer = $this->nb_engine->getCustomer()) === null ||
($this->nb_site = $this->nb_request->getSite()) === null ||
($this->nb_site_alias = $this->nb_request->getSiteAlias()) === null ||
($this->nb_site_target = $this->nb_request->getSiteTarget()) === null ||
($this->nb_language = $this->nb_request->getLanguage()) === null
) {
$retval = false;
|
php
|
{
"resource": ""
}
|
q3394
|
IssueService.getAll
|
train
|
public function getAll($applicationID, $scanID, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
|
php
|
{
"resource": ""
}
|
q3395
|
IssueService.getStats
|
train
|
public function getStats($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
|
php
|
{
"resource": ""
}
|
q3396
|
IssueService.getById
|
train
|
public function getById($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
|
php
|
{
"resource": ""
}
|
q3397
|
IssueService.create
|
train
|
public function create($appId, $scanId, $input, array $queryParams = [])
{
if ($input instanceof IssueBuilder) {
$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]
|
php
|
{
"resource": ""
}
|
q3398
|
CNabuSiteRoleBase.setSiteId
|
train
|
public function setSiteId(int $nb_site_id) : CNabuDataObject
{
if ($nb_site_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
q3399
|
CNabuSiteRoleBase.setRoleId
|
train
|
public function setRoleId(int $nb_role_id) : CNabuDataObject
{
if ($nb_role_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
|
php
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.