_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3 values | text stringlengths 83 13k | language stringclasses 1 value | meta_information dict |
|---|---|---|---|---|---|
q3300 | ClientFactory.clearSessionTokens | train | public function clearSessionTokens()
{
$this->session->remove(self::SESSION_TOKEN_KEY);
$this->session->remove(self::SESSION_TOKEN_SECRET_KEY);
} | php | {
"resource": ""
} |
q3301 | ClientFactory.hasSessionTokens | train | public function hasSessionTokens()
{
return ($this->session->has(self::SESSION_TOKEN_KEY)
&& $this->session->has(self::SESSION_TOKEN_SECRET_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),
'retweet_count' => $this->getValue('retweet_count', $tweet),
'favorite_count' => $this->getValue('favorite_count', $tweet),
'created_at' => $this->getValue('created_at', $tweet),
'hashtags' => $this->listHashTags($tweet),
'user' => $user
];
} | 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)
{
if (array_key_exists('text', $hashTag))
{
$list[] = $hashTag['text'];
}
}
}
return $list;
} | 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;
}
if (!is_object($this->headerProxy) || (get_class($this->headerProxy) !== $className)) {
$this->headerProxy = GeneralUtility::makeInstance($className);
}
return $this->headerProxy;
} | 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
]);
}
return $query
->cache(function ($q) {
return md5(serialize($q->clause('where')));
}, $this->_cacheConfig)
->toArray();
} | php | {
"resource": ""
} |
q3306 | ImageSizes.addImageSizes | train | private function addImageSizes()
{
$data = $this->getData();
foreach ($data as $slug => $props)
{
add_image_size($slug, $props['width'], $props['height'], $props['crop']);
}
} | 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'])
{
continue;
}
$new[$slug] = isset($props['mediaLabel']) ? $props['mediaLabel'] : Strings::labelizeSlug($slug);
// Internationalize what has to be
$new[$slug] = Strings::translate($new[$slug]);
}
return array_merge($sizes, $new);
} | 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.'
);
}
if (!$object2->hasGeoCoordinates()) {
throw new \InvalidArgumentException(
'$object2 needs to have coordinates, but has none.'
);
}
$coordinates1 = $object1->getGeoCoordinates();
$latitude1 = \deg2rad($coordinates1['latitude']);
$longitude1 = \deg2rad($coordinates1['longitude']);
$coordinates2 = $object2->getGeoCoordinates();
$latitude2 = \deg2rad($coordinates2['latitude']);
$longitude2 = \deg2rad($coordinates2['longitude']);
return \acos(
\sin($latitude1) * \sin($latitude2)
+ \cos($latitude1) * \cos($latitude2) * \cos($longitude2 - $longitude1)
) * self::EARTH_RADIUS_IN_KILOMETERS;
} | 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) {
if ($this->calculateDistanceInKilometers($center, $object) <= $distance) {
$objectsWithinDistance->add($object);
}
}
return $objectsWithinDistance;
} | php | {
"resource": ""
} |
q3310 | CrudCommand.addRoutes | train | protected function addRoutes()
{
return ["Route::delete('" . $this->routeName . "/arr-delete', '" . $this->controller . "@arrDelete')->name('" . $this->myAddrName . ".arrDelete');\nRoute::resource('" . $this->routeName . "', '" . $this->controller . "');"];
} | 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) . ';';
} else {
$fieldsString .= $field->name . '#' . $field->type . ';';
}
}
$fieldsString = rtrim($fieldsString, ';');
return $fieldsString;
} | 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');
},
];
$columns['RelativeLink'] = _t(__CLASS__ . '.Link', 'Link');
$columns['MetaDescription'] = [
'title' => _t(__CLASS__ . '.MetaDescription', 'Description'),
'printonly' => true,
];
} else {
// File specific fields
$columns['FileType'] = [
'title' => _t(__CLASS__ . '.FileType', 'File type'),
'datasource' => function ($record) {
// Handle folders separately
if ($record instanceof Folder) {
return $record->i18n_singular_name();
}
return $record->getFileType();
}
];
$columns['Size'] = _t(__CLASS__ . '.Size', 'Size');
$columns['Filename'] = _t(__CLASS__ . '.Directory', 'Directory');
}
$this->extend('updateColumns', $itemType, $columns);
return $columns;
} | 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']);
$this->extend('updatePrintExportColumns', $gridField, $itemType, $exportColumns);
return $exportColumns;
} | php | {
"resource": ""
} |
q3314 | RegExp.checkUnicodeSupport | train | public function checkUnicodeSupport()
{
if (null === self::$unicodeEnabled) {
self::$unicodeEnabled = (@preg_match('/\pL/u', 'a')) ? true : false;
}
return 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 .
' mapTypeId: google.maps.MapTypeId.ROADMAP,' . LF .
' scrollwheel: false, ' . LF .
' zoom: ' . self::DEFAULT_ZOOM_LEVEL . ', ' . LF .
' center: center' . LF .
'};' . LF .
'mapMarkersByUid.' . $mapId . ' = {};' . LF .
'var map = new google.maps.Map(document.getElementById("' . $mapId . '"), mapOptions);' . LF .
'var bounds = new google.maps.LatLngBounds();' . LF .
$this->createMapMarkers($mapPoints, $mapId) .
'}';
} | php | {
"resource": ""
} |
q3316 | SiteView.scopeOlderThanOrBetween | train | public function scopeOlderThanOrBetween(Builder $query, $until = null, $from = null)
{
if (is_null($until))
{
$until = Carbon::now();
}
$query->where('created_at', '<', $until);
if ( ! is_null($from))
{
$query->where('created_at', '>=', $from);
}
return $query;
} | 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$/' # 5th declension singular
);
$out = array( 'um',
'am',
'ommunia',
'libros', 'nuntios',
'tionem', 'ntem', 'atem',
'em'
);
return preg_replace( $in, $out, $word );
case 'ablative':
// 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( 'o',
'ommunibus',
'a',
'libris', 'nuntiis',
'tione', 'nte', 'ate',
'e'
);
return preg_replace( $in, $out, $word );
default:
return $word;
}
} | php | {
"resource": ""
} |
q3318 | Dialog.getLibrary | train | public function getLibrary($sName)
{
try
{
$library = $this->di[$sName];
}
catch(\Exception $e)
{
$library = null;
}
return $library;
} | 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;
}
// Get the default modal library
if(($sName = $this->getOption('dialogs.default.modal', '')) &&
($library = $this->getLibrary($sName)) && ($library instanceof Modal))
{
return $library;
}
return null;
} | 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', '')) &&
($library = $this->getLibrary($sName)) && ($library instanceof Alert))
{
return $library;
}
// Get the default alert library
return ($bReturnDefault ? $this->getPluginManager()->getDefaultAlert() : null);
} | 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', '')) &&
($library = $this->getLibrary($sName)) && ($library instanceof Confirm))
{
return $library;
}
// Get the default confirm library
return ($bReturnDefault ? $this->getPluginManager()->getDefaultConfirm() : null);
} | 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()))
{
$libraries[$library->getName()] = $library;
}
if(($library = $this->getAlertLibrary()))
{
$libraries[$library->getName()] = $library;
}
if(($library = $this->getConfirmLibrary()))
{
$libraries[$library->getName()] = $library;
}
return $libraries;
} | php | {
"resource": ""
} |
q3323 | Dialog.getJs | train | public function getJs()
{
if(!$this->includeAssets())
{
return '';
}
$libraries = $this->getLibrariesInUse();
$code = '';
foreach($libraries as $library)
{
$code .= "\n" . $library->getJs() . "\n";
}
return $code;
} | php | {
"resource": ""
} |
q3324 | Dialog.getCss | train | public function getCss()
{
if(!$this->includeAssets())
{
return '';
}
$libraries = $this->getLibrariesInUse();
$code = '';
foreach($libraries as $library)
{
$code .= $library->getCss() . "\n";
}
return $code;
} | php | {
"resource": ""
} |
q3325 | Dialog.success | train | public function success($message, $title = null)
{
return $this->getAlertLibrary(true)->success((string)$message, (string)$title);
} | php | {
"resource": ""
} |
q3326 | Dialog.info | train | public function info($message, $title = null)
{
return $this->getAlertLibrary(true)->info((string)$message, (string)$title);
} | php | {
"resource": ""
} |
q3327 | Dialog.warning | train | public function warning($message, $title = null)
{
return $this->getAlertLibrary(true)->warning((string)$message, (string)$title);
} | php | {
"resource": ""
} |
q3328 | Dialog.error | train | public function error($message, $title = null)
{
return $this->getAlertLibrary(true)->error((string)$message, (string)$title);
} | 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,
array("\$nb_icontact_prospect_status_type_id")
);
}
$this->setValue('nb_icontact_prospect_status_type_id', $nb_icontact_prospect_status_type_id);
return $this;
} | 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,
array("\$nb_language_id")
);
}
$this->setValue('nb_language_id', $nb_language_id);
return $this;
} | php | {
"resource": ""
} |
q3331 | CallbackService.getAll | train | public function getAll(array $queryParams = [])
{
$response = $this->api->callbacks()->getAll($queryParams);
return new CallbacksResponse($response);
} | php | {
"resource": ""
} |
q3332 | CallbackService.getById | train | public function getById($callbackId, array $queryParams = [])
{
$response = $this->api->callbacks()->getById($callbackId, $queryParams);
return new CallbackResponse($response);
} | php | {
"resource": ""
} |
q3333 | CallbackService.create | train | public function create(CallbackBuilder $input, array $queryParams = [])
{
$response = $this->api->callbacks()->create($input->toArray(), $queryParams);
return new CallbackResponse($response);
} | php | {
"resource": ""
} |
q3334 | CallbackService.update | train | public function update($callbackId, CallbackBuilder $input, array $queryParams = [])
{
$response = $this->api->callbacks()->update($callbackId, $input->toArray(), $queryParams);
return new CallbackResponse($response);
} | php | {
"resource": ""
} |
q3335 | CallbackService.deleteAll | train | public function deleteAll(array $queryParams = [])
{
$response = $this->api->callbacks()->deleteAll($queryParams);
return new BaseResponse($response);
} | php | {
"resource": ""
} |
q3336 | CallbackService.deleteById | train | public function deleteById($callbackId, array $queryParams = [])
{
$response = $this->api->callbacks()->deleteById($callbackId, $queryParams);
return new BaseResponse($response);
} | php | {
"resource": ""
} |
q3337 | ValueObject.equals | train | public function equals(ValueObjectContract $valueObject)
{
foreach (get_object_vars($this) as $name => $value) {
if ($this->{$name} !== $valueObject->{$name}) {
return false;
}
}
return true;
} | php | {
"resource": ""
} |
q3338 | SettingService.get | train | public function get($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->settings()->get($appId, $profileId, $queryParams);
return new SettingResponse($response);
} | php | {
"resource": ""
} |
q3339 | SettingService.update | train | public function update($appId, $profileId, SettingBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->settings()->update($appId, $profileId, $input->toArray(), $queryParams);
return new SettingResponse($response);
} | php | {
"resource": ""
} |
q3340 | LanguageMap.withEntry | train | public function withEntry(string $languageTag, string $value): self
{
$languageMap = clone $this;
$languageMap->map[$languageTag] = $value;
return $languageMap;
} | php | {
"resource": ""
} |
q3341 | ActivityService.getAll | train | public function getAll(array $queryParams = [])
{
$response = $this->api->activities()->getAll($queryParams);
return new ActivitiesResponse($response);
} | php | {
"resource": ""
} |
q3342 | ActivityService.getById | train | public function getById($activityId, array $queryParams = [])
{
$response = $this->api->activities()->getById($activityId, $queryParams);
return new ActivityResponse($response);
} | php | {
"resource": ""
} |
q3343 | RegistersExceptionHandlers.handleShutdown | train | protected function handleShutdown()
{
if (! \is_null($error = \error_get_last()) && $this->isFatalError($error['type'])) {
$this->handleUncaughtException(new FatalErrorException(
$error['message'], $error['type'], 0, $error['file'], $error['line']
));
}
} | 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')) {
$errorCodes[] = FATAL_ERROR;
}
return \in_array($type, $errorCodes);
} | php | {
"resource": ""
} |
q3345 | Compiler.addDbup | train | protected function addDbup(\Phar $phar)
{
$content = file_get_contents(__DIR__ . '/../../../dbup');
$content = preg_replace('{^#!/usr/bin/env php\s*}', '', $content);
$phar->addFromString('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,
array("\$nb_site_target_section_id")
);
}
$this->setValue('nb_site_target_section_id', $nb_site_target_section_id);
return $this;
} | php | {
"resource": ""
} |
q3347 | CNabuProjectBase.refresh | train | public function refresh(bool $force = false, bool $cascade = false) : bool
{
return parent::refresh($force, $cascade) && $this->appendTranslatedRefresh($force);
} | 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 nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuProjectList();
}
return $retval;
} | 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,
array("\$nb_customer_id")
);
}
$this->setValue('nb_customer_id', $nb_customer_id);
return $this;
} | php | {
"resource": ""
} |
q3350 | ModificationHydrator.hydrateCollection | train | public static function hydrateCollection(array $modifications)
{
$hydrated = [];
foreach ($modifications as $modification) {
$hydrated[] = self::hydrate($modification);
}
return $hydrated;
} | 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)) {
$hydrated->setContent($modification->content);
}
if (isset($modification->highlighted_content)) {
$hydrated->setHighlightedContent($modification->highlighted_content);
}
if (isset($modification->original_content)) {
$hydrated->setOriginalContent($modification->original_content);
}
if (isset($modification->file)) {
$hydrated->setFile(FileHydrator::hydrate($modification->file));
}
return $hydrated;
} | 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;
}
if (isset($options['except']) && \in_array($method, (array) $options['except'])) {
continue;
}
$middleware[] = $name;
}
return $middleware;
} | php | {
"resource": ""
} |
q3353 | TeamHydrator.hydrateCollection | train | public static function hydrateCollection(array $teams)
{
$hydrated = [];
foreach ($teams as $team) {
$hydrated[] = self::hydrate($team);
}
return $hydrated;
} | 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));
}
if (isset($team->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($team->created_by));
}
if (isset($team->created_at)) {
$hydrated->setCreatedAt(new DateTime($team->created_at));
}
return $hydrated;
} | 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,
array("\$nb_commerce_product_id")
);
}
$this->setValue('nb_commerce_product_id', $nb_commerce_product_id);
return $this;
} | php | {
"resource": ""
} |
q3356 | CNabuIContactProspectStatusTypeBase.getLanguages | train | public function getLanguages($force = false)
{
if (!CNabuEngine::getEngine()->isOperationModeStandalone() &&
($this->languages_list->getSize() === 0 || $force)
) {
$this->languages_list = CNabuIContactProspectStatusTypeLanguage::getLanguagesForTranslatedObject($this);
}
return $this->languages_list;
} | php | {
"resource": ""
} |
q3357 | CNabuIContactProspectStatusTypeBase.getTranslations | train | public function getTranslations($force = false)
{
if (!CNabuEngine::getEngine()->isOperationModeStandalone() &&
($this->translations_list->getSize() === 0 || $force)
) {
$this->translations_list = CNabuIContactProspectStatusTypeLanguage::getTranslationsForTranslatedObject($this);
}
return $this->translations_list;
} | 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);
$this->getCatalogs($force);
$this->getMessagings($force);
$this->getProjects($force);
$this->getRoles($force);
}
return $retval;
} | php | {
"resource": ""
} |
q3359 | CNabuCustomer.getMediotecas | train | public function getMediotecas($force = false)
{
if ($this->nb_medioteca_list->isEmpty() || $force) {
$this->nb_medioteca_list->clear();
$this->nb_medioteca_list->merge(CNabuMedioteca::getAllMediotecas($this));
}
return $this->nb_medioteca_list->getItems();
} | 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) {
$nb_medioteca_id = nb_getMixedValue($nb_medioteca, NABU_MEDIOTECA_FIELD_ID);
if (is_numeric($nb_medioteca_id) || nb_isValidGUID($nb_medioteca_id)) {
$retval = $this->nb_medioteca_list->getItem($nb_medioteca_id);
} elseif ($nb_medioteca_id !== null && $nb_medioteca_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_medioteca', print_r($nb_medioteca, true))
);
}
}
return $retval;
} | 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, true))
);
}
return $this->nb_medioteca_list->getItem($key, CNabuMediotecaList::INDEX_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 {
$retval->setCustomer($this);
}
}
} elseif ($nb_site_id !== null && $nb_site_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_site', print_r($nb_site, true))
);
}
}
return $retval;
} | 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))
);
}
$nb_site = $this->nb_site_list->getItem($key, CNabuSiteList::INDEX_KEY);
if ($nb_site instanceof CNabuSite) {
$nb_site->setCustomer($this);
$retval = $nb_site;
}
return $retval;
} | 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))
);
}
$nb_site = CNabuSite::findByAlias($alias);
if ($nb_site instanceof CNabuSite && $nb_site->validateCustomer($this)) {
if (!$this->nb_site_list->containsKey($nb_site->getId())) {
$this->nb_site_list->addItem($nb_site);
}
$retval = $nb_site;
}
return $retval;
} | php | {
"resource": ""
} |
q3365 | CNabuCustomer.getSites | train | public function getSites($force = false)
{
if ($force) {
$this->nb_site_list->clear();
$this->nb_site_list->merge(CNabuSite::getAllSites($this));
}
return $this->nb_site_list->getItems();
} | php | {
"resource": ""
} |
q3366 | CNabuCustomer.getCommerces | train | public function getCommerces($force = false)
{
if ($this->nb_commerce_list->isEmpty() || $force) {
$this->nb_commerce_list->clear();
$this->nb_commerce_list->merge(CNabuCommerce::getAllCommerces($this));
}
return $this->nb_commerce_list->getItems();
} | 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) {
$nb_commerce_id = nb_getMixedValue($nb_commerce, NABU_COMMERCE_FIELD_ID);
if (is_numeric($nb_commerce_id) || nb_isValidGUID($nb_commerce_id)) {
$retval = $this->nb_commerce_list->getItem($nb_commerce_id);
} elseif ($nb_commerce_id !== null && $nb_commerce_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_commerce', print_r($nb_commerce, true))
);
}
}
return $retval;
} | 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) {
$nb_catalog_id = nb_getMixedValue($nb_catalog, NABU_CATALOG_FIELD_ID);
if (is_numeric($nb_catalog_id) || nb_isValidGUID($nb_catalog_id)) {
$retval = $this->nb_catalog_list->getItem($nb_catalog_id);
} elseif ($nb_catalog_id !== null && $nb_catalog_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_catalog', print_r($nb_catalog, true))
);
}
}
return $retval;
} | 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,
array('$key', print_r($key, true))
);
}
return $this->nb_catalog_list->getItem($key, CNabuCatalogList::INDEX_KEY);
} | 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 {
$nb_catalog->getTranslations(true)->iterate(
function ($key, CNabuCatalogLanguage $nb_catalog_language)
use ($slug, $nb_catalog, &$nb_final_catalog)
{
if ($nb_catalog_language->getSlug() === $slug) {
$nb_final_catalog = $nb_catalog;
}
return ($nb_final_catalog === null);
}
);
}
return ($nb_final_catalog === null);
}
);
return ($nb_final_catalog === null ? false : $nb_final_catalog);
} | php | {
"resource": ""
} |
q3371 | CNabuCustomer.getCatalogs | train | public function getCatalogs($force = false)
{
if ($this->nb_catalog_list->isEmpty() || $force) {
$this->nb_catalog_list->clear();
$this->nb_catalog_list->merge(CNabuCatalog::getAllCatalogs($this));
}
return $this->nb_catalog_list->getItems();
} | php | {
"resource": ""
} |
q3372 | CNabuCustomer.getMessagings | train | public function getMessagings($force = false)
{
if ($this->nb_messaging_list->isEmpty() || $force) {
$this->nb_messaging_list->clear();
$this->nb_messaging_list->merge(CNabuMessaging::getAllMessagings($this));
}
return $this->nb_messaging_list->getItems();
} | 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) {
$nb_messaging_id = nb_getMixedValue($nb_messaging, NABU_MESSAGING_FIELD_ID);
if (is_numeric($nb_messaging_id) || nb_isValidGUID($nb_messaging_id)) {
$retval = $this->nb_messaging_list->getItem($nb_messaging_id);
} elseif ($nb_messaging_id !== null && $nb_messaging_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_messaging', print_r($nb_messaging, true))
);
}
}
return $retval;
} | 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();
$this->nb_project_list->merge(CNabuProject::getAllProjects($this));
}
return $this->nb_project_list->getItems();
} | 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) {
$nb_project_id = nb_getMixedValue($nb_project, NABU_PROJECT_FIELD_ID);
if (is_numeric($nb_project_id) || nb_isValidGUID($nb_project_id)) {
$retval = $this->nb_project_list->getItem($nb_project_id);
} elseif ($nb_project_id !== null && $nb_project_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_project', print_r($nb_project, true))
);
}
}
return $retval;
} | 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);
if ($nb_new_user->isFetched() && $nb_new_user->validateCustomer($this)) {
$nb_new_user->setCustomer($this);
$retval = $nb_new_user;
}
}
return $retval;
} | 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)) {
$nb_user->setCustomer($this);
$retval = $nb_user;
}
}
return $retval;
} | 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)) {
$nb_user->setCustomer($this);
$retval = $nb_user;
}
}
return $retval;
} | php | {
"resource": ""
} |
q3379 | CNabuCustomer.getRoles | train | public function getRoles(bool $force = false)
{
if ($this->nb_role_list->isEmpty() || $force) {
$this->nb_role_list->clear();
$this->nb_role_list->merge(CNabuRole::getAllRoles($this));
}
return $this->nb_role_list;
} | 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 {
$retval->setCustomer($this);
}
}
} elseif ($nb_role_id !== null && $nb_role_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array(print_r($nb_role, true), '$nb_role')
);
}
}
return $retval;
} | 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', print_r($key, true))
);
}
return $this->nb_role_list->getItem($key, CNabuRoleList::INDEX_KEY);
} | php | {
"resource": ""
} |
q3382 | CNabuCustomer.getIContacts | train | public function getIContacts($force = false)
{
if ($this->nb_icontact_list->isEmpty() || $force) {
$this->nb_icontact_list->clear();
$this->nb_icontact_list->merge(CNabuIContact::getAlliContacts($this));
}
return $this->nb_icontact_list->getItems();
} | 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) {
$nb_icontact_id = nb_getMixedValue($nb_icontact, NABU_ICONTACT_FIELD_ID);
if (is_numeric($nb_icontact_id) || nb_isValidGUID($nb_icontact_id)) {
$retval = $this->nb_icontact_list->getItem($nb_icontact_id);
} elseif ($nb_icontact_id !== null && $nb_icontact_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array(print_r($nb_icontact, true), '$nb_icontact')
);
}
}
return $retval;
} | php | {
"resource": ""
} |
q3384 | CNabuCustomer.getIContactByKey | train | public function getIContactByKey(string $key)
{
if (!is_string($key) || strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
}
return $this->nb_icontact_list->getItem($key, CNabuIContactList::INDEX_KEY);
} | php | {
"resource": ""
} |
q3385 | TypeService.getAll | train | public function getAll(array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->origins()
->types()
->getAll($queryParams);
return new TypesResponse($response);
} | php | {
"resource": ""
} |
q3386 | TypeService.getById | train | public function getById($typeId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->origins()
->types()
->getById($typeId, $queryParams);
return new TypeResponse($response);
} | 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")
);
}
$this->setValue('nb_cluster_user_group_id', $group_id);
return $this;
} | 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")
);
}
$this->setValue('nb_cluster_user_os_nick', $os_nick);
return $this;
} | 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 ($this->duration !== $result->duration) {
return false;
}
if (null !== $this->extensions xor null !== $result->extensions) {
return false;
}
if (null !== $this->extensions && null !== $result->extensions && !$this->extensions->equals($result->extensions)) {
return false;
}
return true;
} | 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 {
throw new ENabuIContactException(ENabuIContactException::ERROR_ICONTACT_NOT_FOUND);
}
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_FILE_NOT_FOUND, array($sourcefile));
}
} | 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();
$filename = $base_path . DIRECTORY_SEPARATOR . $this->getFilename();
if (file_exists($filename)) {
unlink($filename);
$retval = !file_exists($filename);
}
}
return $retval;
} | 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) {
$retval->iterate(
function($key, CNabuIContactProspectAttachment $nb_attachment) use ($nb_prospect)
{
$nb_attachment->setIContactProspect($nb_prospect);
return true;
}
);
}
} else {
$retval = new CNabuIContactProspectList(($nb_prospect instanceof CNabuIContactProspect ? $nb_prospect : null));
}
return $retval;
} | 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;
} else {
$this->nb_work_customer = $this->nb_application->getSecurityManager()->getWorkCustomer();
$this->nb_user = $this->nb_application->getSecurityManager()->getUser();
$this->nb_role = $this->nb_application->getSecurityManager()->getRole();
$this->nb_site_role = $this->nb_application->getSecurityManager()->getSiteRole();
$this->nb_site_user = $this->nb_application->getSecurityManager()->getSiteUser();
$this->nb_site_alias_role = $this->nb_request->getSiteAliasRole();
$this->nb_commerce = $this->nb_request->getCommerce();
//$this->nb_apps_morphs = $this->nb_engine->getAppsMorphs();
$retval = true;
}
return $retval;
} | php | {
"resource": ""
} |
q3394 | IssueService.getAll | train | public function getAll($applicationID, $scanID, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->getAll($applicationID, $scanID, $queryParams);
return new IssuesResponse($response);
} | php | {
"resource": ""
} |
q3395 | IssueService.getStats | train | public function getStats($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->getStats($appId, $scanId, $queryParams);
return new IssueStatsResponse($response);
} | php | {
"resource": ""
} |
q3396 | IssueService.getById | train | public function getById($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->getById($appId, $scanId, $issueId, $queryParams);
return new IssueResponse($response);
} | 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] = $value2;
}
}
}
}
$defaultInput = false;
}
$response = $this->api
->applications()
->scans()
->issues()
->create($appId, $scanId, $inputArray, $queryParams, $defaultInput);
return new IssueResponse($response);
} | 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,
array("\$nb_site_id")
);
}
$this->setValue('nb_site_id', $nb_site_id);
return $this;
} | 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,
array("\$nb_role_id")
);
}
$this->setValue('nb_role_id', $nb_role_id);
return $this;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.