_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q3700
CNabuSiteTargetList.acquireItem
train
public function acquireItem($key, $index = false) { if ($index === self::INDEX_KEY) { $nb_site = CNabuEngine::getEngine()->getApplication()->getRequest()->getSite(); $retval = CNabuSiteTarget::findByKey($nb_site, $key); } else { $retval = parent::acquireItem($key, $index); } return $retval; }
php
{ "resource": "" }
q3701
CNabuSiteTargetCTARoleBase.setSiteTargetCTAId
train
public function setSiteTargetCTAId(int $nb_site_target_cta_id) : CNabuDataObject { if ($nb_site_target_cta_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$nb_site_target_cta_id") ); } $this->setValue('nb_site_target_cta_id', $nb_site_target_cta_id); return $this; }
php
{ "resource": "" }
q3702
CNabuSiteTargetSectionBase.findByKey
train
public static function findByKey($nb_medioteca, $key) { $nb_medioteca_id = nb_getMixedValue($nb_medioteca, 'nb_medioteca_id'); if (is_numeric($nb_medioteca_id)) { $retval = CNabuSiteTargetSection::buildObjectFromSQL( 'select * ' . 'from nb_site_target_section ' . 'where nb_medioteca_id=%medioteca_id$d ' . "and nb_site_target_section_key='%key\$s'", array( 'medioteca_id' => $nb_medioteca_id, 'key' => $key ) ); } else { $retval = null; } return $retval; }
php
{ "resource": "" }
q3703
CNabuSiteTargetSectionBase.getAllSiteTargetSections
train
public static function getAllSiteTargetSections(CNabuMedioteca $nb_medioteca) { $nb_medioteca_id = nb_getMixedValue($nb_medioteca, 'nb_medioteca_id'); if (is_numeric($nb_medioteca_id)) { $retval = forward_static_call( array(get_called_class(), 'buildObjectListFromSQL'), 'nb_site_target_section_id', 'select * ' . 'from nb_site_target_section ' . 'where nb_medioteca_id=%medioteca_id$d', array( 'medioteca_id' => $nb_medioteca_id ), $nb_medioteca ); } else { $retval = new CNabuSiteTargetSectionList(); } return $retval; }
php
{ "resource": "" }
q3704
CNabuSiteTargetSectionBase.getFilteredSiteTargetSectionList
train
public static function getFilteredSiteTargetSectionList($nb_medioteca = null, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0) { $nb_medioteca_id = nb_getMixedValue($nb_customer, NABU_MEDIOTECA_FIELD_ID); if (is_numeric($nb_medioteca_id)) { $fields_part = nb_prefixFieldList(CNabuSiteTargetSectionBase::getStorageName(), $fields, false, true, '`'); $order_part = nb_prefixFieldList(CNabuSiteTargetSectionBase::getStorageName(), $fields, false, false, '`'); if ($num_items !== 0) { $limit_part = ($offset > 0 ? $offset . ', ' : '') . $num_items; } else { $limit_part = false; } $nb_item_list = CNabuEngine::getEngine()->getMainDB()->getQueryAsArray( "select " . ($fields_part ? $fields_part . ' ' : '* ') . 'from nb_site_target_section ' . 'where ' . NABU_MEDIOTECA_FIELD_ID . '=%medioteca_id$d ' . ($order_part ? "order by $order_part " : '') . ($limit_part ? "limit $limit_part" : ''), array( 'medioteca_id' => $nb_medioteca_id ) ); } else { $nb_item_list = null; } return $nb_item_list; }
php
{ "resource": "" }
q3705
CNabuSiteTargetSectionBase.setOrder
train
public function setOrder(int $order) : CNabuDataObject { if ($order === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$order") ); } $this->setValue('nb_site_target_section_order', $order); return $this; }
php
{ "resource": "" }
q3706
AuthController.deauthenticate
train
public function deauthenticate(ResponseFactory $response, Guard $guard, JWTAuth $auth) { $guard->logout(); $auth->invalidate(); return $response->json([]); }
php
{ "resource": "" }
q3707
AuthController.refresh
train
public function refresh(ResponseFactory $response, JWTAuth $auth) { try { $token = $auth->parseToken()->refresh(); } catch (JWTException $e) { throw new UnauthorizedHttpException('jwt-auth', $e->getMessage()); } return $response->json(['token' => $token]); }
php
{ "resource": "" }
q3708
CNabuCommerceProductBase.getAllCommerceProducts
train
public static function getAllCommerceProducts(CNabuCommerce $nb_commerce) { $nb_commerce_id = nb_getMixedValue($nb_commerce, 'nb_commerce_id'); if (is_numeric($nb_commerce_id)) { $retval = forward_static_call( array(get_called_class(), 'buildObjectListFromSQL'), 'nb_commerce_product_id', 'select * ' . 'from nb_commerce_product ' . 'where nb_commerce_id=%commerce_id$d', array( 'commerce_id' => $nb_commerce_id ), $nb_commerce ); } else { $retval = new CNabuCommerceProductList(); } return $retval; }
php
{ "resource": "" }
q3709
CNabuCommerceProductBase.getFilteredCommerceProductList
train
public static function getFilteredCommerceProductList($q = null, $fields = null, $order = null, $offset = 0, $num_items = 0) { $nb_commerce_id = nb_getMixedValue($nb_customer, NABU_COMMERCE_FIELD_ID); if (is_numeric($nb_commerce_id)) { $fields_part = nb_prefixFieldList(CNabuCommerceProductBase::getStorageName(), $fields, false, true, '`'); $order_part = nb_prefixFieldList(CNabuCommerceProductBase::getStorageName(), $fields, false, false, '`'); if ($num_items !== 0) { $limit_part = ($offset > 0 ? $offset . ', ' : '') . $num_items; } else { $limit_part = false; } $nb_item_list = CNabuEngine::getEngine()->getMainDB()->getQueryAsArray( "select " . ($fields_part ? $fields_part . ' ' : '* ') . 'from nb_commerce_product ' . 'where ' . NABU_COMMERCE_FIELD_ID . '=%commerce_id$d ' . ($order_part ? "order by $order_part " : '') . ($limit_part ? "limit $limit_part" : ''), array( 'commerce_id' => $nb_commerce_id ) ); } else { $nb_item_list = null; } return $nb_item_list; }
php
{ "resource": "" }
q3710
CNabuCommerceProductBase.setTaxPercentage
train
public function setTaxPercentage($tax_percentage) : CNabuDataObject { if ($tax_percentage === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$tax_percentage") ); } $this->setValue('nb_commerce_product_tax_percentage', $tax_percentage); return $this; }
php
{ "resource": "" }
q3711
CNabuCommerceProductBase.setTaxAmount
train
public function setTaxAmount($tax_amount) : CNabuDataObject { if ($tax_amount === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$tax_amount") ); } $this->setValue('nb_commerce_product_tax_amount', $tax_amount); return $this; }
php
{ "resource": "" }
q3712
CNabuCommerceProductBase.setPriceWithTax
train
public function setPriceWithTax($price_with_tax) : CNabuDataObject { if ($price_with_tax === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$price_with_tax") ); } $this->setValue('nb_commerce_product_price_with_tax', $price_with_tax); return $this; }
php
{ "resource": "" }
q3713
CNabuCommerceProductBase.setIsUpselling
train
public function setIsUpselling(string $is_upselling = "F") : CNabuDataObject { if ($is_upselling === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$is_upselling") ); } $this->setValue('nb_commerce_product_is_upselling', $is_upselling); return $this; }
php
{ "resource": "" }
q3714
CNabuCommerceProductBase.setSoldIndividually
train
public function setSoldIndividually(string $sold_individually = "T") : CNabuDataObject { if ($sold_individually === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$sold_individually") ); } $this->setValue('nb_commerce_product_sold_individually', $sold_individually); return $this; }
php
{ "resource": "" }
q3715
CNabuCommerceProductBase.setIsVirtual
train
public function setIsVirtual(string $is_virtual = "F") : CNabuDataObject { if ($is_virtual === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$is_virtual") ); } $this->setValue('nb_commerce_product_is_virtual', $is_virtual); return $this; }
php
{ "resource": "" }
q3716
TNabuCommerceChild.getCommerce
train
public function getCommerce($force = false) { if ($this->nb_commerce === null || $force) { $this->nb_commerce = null; if (!$this->isBuiltIn() && $this->isValueNumeric(NABU_COMMERCE_FIELD_ID)) { $nb_commerce = new CNabuCommerce($this->getValue(NABU_COMMERCE_FIELD_ID)); if ($nb_commerce->isFetched()) { $this->nb_commerce = $nb_commerce; } } } return $this->nb_commerce; }
php
{ "resource": "" }
q3717
TNabuCommerceChild.setCommerce
train
public function setCommerce(CNabuCommerce $nb_commerce) { $this->nb_commerce = $nb_commerce; $this->transferValue($nb_commerce, NABU_COMMERCE_FIELD_ID); return $this; }
php
{ "resource": "" }
q3718
CNabuIContactProspect.getProspectsForIContact
train
public static function getProspectsForIContact( $nb_icontact, CNabuIContactProspectStatusType $nb_status_type = null ) : CNabuIContactProspectList { if (is_numeric($nb_icontact_id = nb_getMixedValue($nb_icontact, 'nb_icontact_id'))) { $status_id = nb_getMixedValue($nb_status_type, 'nb_icontact_prospect_status_type_id'); $retval = CNabuIContactProspect::buildObjectListFromSQL( 'nb_icontact_prospect_id', 'SELECT ip.* FROM nb_icontact_prospect ip, nb_icontact i WHERE ip.nb_icontact_id=i.nb_icontact_id AND i.nb_icontact_id=%cont_id$d ' . (is_numeric($status_id) ? 'AND ip.nb_icontact_prospect_status_id=%status_id$d ' : '') . 'ORDER BY ip.nb_icontact_prospect_creation_datetime DESC', array( 'cont_id' => $nb_icontact_id, 'status_id' => $status_id ), ($nb_icontact instanceof CNabuIContact ? $nb_icontact : null) ); if ($nb_icontact instanceof CNabuIContact) { $retval->iterate(function ($key, $nb_prospect) use ($nb_icontact) { $nb_prospect->setIContact($nb_icontact); return true; }); } } else { $retval = new CNabuIContactProspectList(); } return $retval; }
php
{ "resource": "" }
q3719
CNabuIContactProspect.getCountProspectsOfUser
train
public static function getCountProspectsOfUser( $nb_icontact, $nb_user, CNabuIContactProspectStatusType $nb_status_type = null ) : int { if (is_numeric($nb_icontact_id = nb_getMixedValue($nb_icontact, 'nb_icontact_id')) && is_numeric($nb_user_id = nb_getMixedValue($nb_user, 'nb_user_id')) ) { $status_id = nb_getMixedValue($nb_status_type, 'nb_icontact_prospect_status_type_id'); $retval = CNabuEngine::getEngine()->getMainDB()->getQueryAsCount( 'nb_icontact_prospect ip, nb_icontact i', null, "ip.nb_icontact_id=i.nb_icontact_id AND i.nb_icontact_id=$nb_icontact_id" ." AND ip.nb_user_id=$nb_user_id" . (is_numeric($status_id) ? " AND ip.nb_icontact_prospect_status_id=$status_id " : '') ); } else { $retval = 0; } return $retval; }
php
{ "resource": "" }
q3720
CNabuIContactProspect.encodeEmail
train
public static function encodeEmail(string $email) : string { return md5(self::EMAIL_PREF . preg_replace('/\\s/', '', mb_strtolower($email)) . self::EMAIL_SUFF); }
php
{ "resource": "" }
q3721
CNabuIContactProspect.setEmail
train
public function setEmail(string $email = null) : CNabuDataObject { parent::setEmail($email); return parent::setEmailHash(is_string($email) ? self::encodeEmail($email) : null); }
php
{ "resource": "" }
q3722
CNabuIContactProspect.findIContactProspectsByEmailHash
train
public static function findIContactProspectsByEmailHash( CNabuIContact $nb_icontact, string $hash ) : CNabuIContactProspectList { if (is_numeric($nb_icontact_id = nb_getMixedValue($nb_icontact, 'nb_icontact_id')) && strlen($hash) === 32 ) { $list = CNabuIContactProspect::buildObjectListFromSQL( 'nb_icontact_prospect_id', 'SELECT * FROM nb_icontact_prospect WHERE nb_icontact_id=%icontact_id$d AND nb_icontact_prospect_email_hash=\'%hash$s\'', array( 'icontact_id' => $nb_icontact_id, 'hash' => $hash ) ); } else { throw new ENabuCoreException(ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE, array('$hash')); } return $list; }
php
{ "resource": "" }
q3723
CNabuIContactProspect.getAttachments
train
public function getAttachments(bool $force = false) : CNabuIContactProspectAttachmentList { if ($this->nb_attachment_list->isEmpty() || $force) { $this->nb_attachment_list->clear(); $this->nb_attachment_list->merge(CNabuIContactProspectAttachment::getAttachmentsForProspect($this)); } return $this->nb_attachment_list; }
php
{ "resource": "" }
q3724
CNabuIContactProspect.addAttachment
train
public function addAttachment( string $name, string $mimetype, string $file, CNabuIContactProspectDiary $nb_diary = null, bool $save = true ) { if ($this->isFetched()) { $nb_icontact = $this->getIContact(); $base_path = $nb_icontact->getBasePath(); $retval = $nb_attachment = new CNabuIContactProspectAttachment(); $nb_attachment->setIcontactProspect($this); $nb_attachment->setIcontactProspectDiaryId( $nb_diary instanceof CNabuIContactProspectDiary ? $nb_diary->getId() : null ); $nb_attachment->setName($name); $nb_attachment->setMIMEType($mimetype); $nb_attachment->grantHash(); $nb_attachment->putFile($file); if ($save) { $nb_attachment->save(); $this->nb_attachment_list->addItem($nb_attachment); } return $retval; } else { throw new ENabuIContactException(ENabuIContactException::ERROR_ICONTACT_NOT_FETCHED); } }
php
{ "resource": "" }
q3725
CNabuIContactProspect.deleteAttachment
train
public function deleteAttachment($nb_attachment) : bool { $retval = false; $nb_attachment_id = nb_getMixedValue($nb_attachment, NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID); if (is_numeric($nb_attachment_id)) { $nb_attachment = $this->nb_attachment_list->getItem($nb_attachment_id); if ($nb_attachment->getIContactProspectId() == $this->getId()) { $nb_attachment->deleteFile(); $this->nb_attachment_list->removeItem($nb_attachment); $nb_attachment->delete(); $retval = true; } } return $retval; }
php
{ "resource": "" }
q3726
CNabuIContactProspect.save
train
public function save($trace = false) { $retval = parent::save($trace); $this->nb_attachment_list->iterate( function ($key, CNabuIContactProspectAttachment $nb_attachment) use ($retval) { $retval |= $nb_attachment->save(); return true; } ); return $retval; }
php
{ "resource": "" }
q3727
MetadataServiceProvider.registerAnnotations
train
public function registerAnnotations() { $app = $this->app; $loader = new AnnotationLoader($app['files'], __DIR__ . '/../Annotations'); $loader->registerAll(); }
php
{ "resource": "" }
q3728
CNabuLanguageBase.setIsApi
train
public function setIsApi(string $is_api = "F") : CNabuDataObject { if ($is_api === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$is_api") ); } $this->setValue('nb_language_is_api', $is_api); return $this; }
php
{ "resource": "" }
q3729
CNabuLanguageBase.setName
train
public function setName(string $name) : CNabuDataObject { if ($name === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$name") ); } $this->setValue('nb_language_name', $name); return $this; }
php
{ "resource": "" }
q3730
SummaryHydrator.hydrateCollection
train
public static function hydrateCollection(array $summaries) { $hydrated = []; foreach ($summaries as $summary) { $hydrated[] = self::hydrate($summary); } return $hydrated; }
php
{ "resource": "" }
q3731
SummaryHydrator.hydrate
train
public static function hydrate(stdClass $summary) { $hydrated = new SummaryEntity(); if (isset($summary->id)) { $hydrated->setId($summary->id); } if (isset($summary->line)) { $hydrated->setLine($summary->line); } if (isset($summary->content)) { $hydrated->setContent($summary->content); } if (isset($summary->highlighted_content)) { $hydrated->setHighlightedContent($summary->highlighted_content); } if (isset($summary->file)) { $hydrated->setFile(FileHydrator::hydrate($summary->file)); } if (isset($summary->function)) { $hydrated->setFunction(CustomFunctionHydrator::hydrate($summary->function)); } if (isset($summary->class)) { $hydrated->setClass(CustomClassHydrator::hydrate($summary->class)); } return $hydrated; }
php
{ "resource": "" }
q3732
CNabuXMLSite.setRedirections
train
private function setRedirections(SimpleXMLElement $element) { $pages = $element->addChild('redirections'); $this->setRedirection($pages, 'default', 'default'); $this->setRedirection($pages, 'page_not_found', 'pageNotFound'); $this->setRedirection($pages, 'login', 'login'); $this->setRedirection($pages, 'login_redirection', 'loginRedirection'); $this->setRedirection($pages, 'logout_redirection', 'logoutRedirection'); $this->setRedirection($pages, 'alias_not_found', 'aliasNotFound'); $this->setRedirection($pages, 'alias_locked', 'aliasLocked'); }
php
{ "resource": "" }
q3733
CNabuXMLSite.setRedirection
train
private function setRedirection(SimpleXMLElement $element, string $field, string $tag_name) { $page = $element->addChild($tag_name); switch ($this->nb_data_object->getValue("nb_site_${field}_target_use_uri")) { case 'T': $id = $this->nb_data_object->getValue("nb_site_${field}_target_id"); if (is_numeric($id) && is_string($hash = $this->grantTargetHash($id))) { $page->addAttribute('useURI', 'T'); $page->addAttribute('id', $hash); $this->putAttributesFromList($page, array( "nb_site_${field}_error_code" => "errorCode" )); } break; case 'U': $translations = $this->nb_data_object->getTranslations(); $urls = array(); $translations->iterate(function($lang, $nb_translation) use(&$urls, $field) { $urls[$lang] = $nb_translation->getValue("nb_site_lang_${field}_target_url"); return true; }); if (count($urls) > 0) { $page->addAttribute('useURI', 'U'); foreach ($urls as $lang => $url) { if (strlen($url) > 0) { $nb_language = $this->nb_data_object->getLanguage($lang); $address = $page->addChild('url'); $address->addAttribute('lang', $nb_language->getHash()); $address->addAttribute('url', $url); } } } $this->putAttributesFromList($page, array( "nb_site_${field}_error_code" => "errorCode" ), true); break; } }
php
{ "resource": "" }
q3734
CNabuXMLSite.setTargets
train
private function setTargets(SimpleXMLElement $parent) { $xml_targets = new CNabuXMLSiteTargetList($this->nb_data_object->getTargets(true)); $xml_targets->build($parent); }
php
{ "resource": "" }
q3735
CNabuXMLSite.setMaps
train
private function setMaps(SimpleXMLElement $parent) { $xml_targets = new CNabuXMLSiteMapList($this->nb_data_object->getSiteMaps(true)); $xml_targets->build($parent); }
php
{ "resource": "" }
q3736
CNabuXMLSite.setStaticContents
train
private function setStaticContents(SimpleXMLElement $parent) { $xml_statics = new CNabuXMLSiteStaticContentList($this->nb_data_object->getStaticContents(true)); $xml_statics->build($parent); }
php
{ "resource": "" }
q3737
CNabuXMLSite.grantTargetHash
train
private function grantTargetHash(int $nb_site_target_id) : string { $nb_site_target = $this->nb_data_object->getTarget($nb_site_target_id); return $nb_site_target->isFetched() ? $nb_site_target->grantHash(true) : null; }
php
{ "resource": "" }
q3738
FileHydrator.hydrateCollection
train
public static function hydrateCollection(array $files) { $hydrated = []; foreach ($files as $file) { $hydrated[] = self::hydrate($file); } return $hydrated; }
php
{ "resource": "" }
q3739
FileHydrator.hydrate
train
public static function hydrate(stdClass $file) { $hydrated = new FileEntity(); if (isset($file->id)) { $hydrated->setId($file->id); } if (isset($file->loc)) { $hydrated->setLoc($file->loc); } if (isset($file->path)) { $hydrated->setPath($file->path); } if (isset($file->scanned)) { $hydrated->setScanned($file->scanned); } if (isset($file->code)) { $hydrated->setCode($file->code); } return $hydrated; }
php
{ "resource": "" }
q3740
CNabuSite.addTarget
train
public function addTarget(CNabuSiteTarget $nb_site_target, $default = false) { $nb_site_target->setSite($this); if ($default) { $this->setDefaultTarget($nb_site_target); } return $this->nb_site_target_list->addItem($nb_site_target); }
php
{ "resource": "" }
q3741
CNabuSite.getTarget
train
public function getTarget($nb_site_target) { $nb_site_target_id = nb_getMixedValue($nb_site_target, 'nb_site_target_id'); return (is_numeric($nb_site_target_id) || nb_isValidGUID($nb_site_target_id)) ? $this->nb_site_target_list->getItem($nb_site_target_id)->setSite($this) : null ; }
php
{ "resource": "" }
q3742
CNabuSite.getTargets
train
public function getTargets($force = false) : CNabuSiteTargetList { if (!$this->isBuiltIn() && ($this->nb_site_target_list->isEmpty() || $force) ) { $this->nb_site_target_list->clear(); $this->nb_site_target_list->merge(CNabuSiteTarget::getAllSiteTargets($this)); $this->nb_site_target_list->iterate(function ($key, $nb_site_target) { $nb_site_target->setSite($this); return true; }); } return $this->nb_site_target_list; }
php
{ "resource": "" }
q3743
CNabuSite.addStaticContent
train
public function addStaticContent(CNabuSiteStaticContent $nb_site_static_content) { $nb_site_static_content->setSite($this); return $this->nb_site_static_content_list->addItem($nb_site_static_content); }
php
{ "resource": "" }
q3744
CNabuSite.getStaticContent
train
public function getStaticContent($nb_site_static_content) { $nb_site_static_content_id = nb_getMixedValue($nb_site_static_content, 'nb_site_static_content_id'); return (is_numeric($nb_site_static_content_id) || nb_isValidGUID($nb_site_static_content_id)) ? $this->nb_site_static_content_list->getItem($nb_site_static_content_id) : null ; }
php
{ "resource": "" }
q3745
CNabuSite.getStaticContents
train
public function getStaticContents($force = false) : CNabuSiteStaticContentList { if (!$this->isBuiltIn() && ($this->nb_site_static_content_list->isEmpty() || $force) ) { $this->nb_site_static_content_list = CNabuSiteStaticContent::getStaticContentsForSite($this); $this->nb_site_static_content_list->sort(); } return $this->nb_site_static_content_list; }
php
{ "resource": "" }
q3746
CNabuSite.isDefaultTargetUsingTarget
train
public function isDefaultTargetUsingTarget() { return $this->getDefaultTargetUseURI() === CNabuSiteTargetLink::USE_URI_TRANSLATED && $this->nb_site_target_list->containsKey($this->getDefaultTargetId()); }
php
{ "resource": "" }
q3747
CNabuSite.setDefaultTarget
train
public function setDefaultTarget(CNabuDataObject $nb_site_target) { $this->setDefaultTargetUseURI(CNabuSiteTargetLink::USE_URI_TRANSLATED); $this->transferValue($nb_site_target, 'nb_site_target_id', 'nb_site_default_target_id'); return $this; }
php
{ "resource": "" }
q3748
CNabuSite.setLoginTarget
train
public function setLoginTarget(CNabuDataObject $nb_site_target) { $this->setLoginTargetUseURI(CNabuSiteTargetLink::USE_URI_TRANSLATED); $this->transferValue($nb_site_target, 'nb_site_target_id', 'nb_site_login_target_id'); return $this; }
php
{ "resource": "" }
q3749
CNabuSite.getSiteMap
train
public function getSiteMap($nb_site_map, $cascade = false) { $retval = null; $nb_site_map_id = nb_getMixedValue($nb_site_map, 'nb_site_map_id'); if (is_numeric($nb_site_map_id) || nb_isValidGUID($nb_site_map_id)) { $retval = $this->nb_site_map_tree->getItem($nb_site_map_id); } return $retval; }
php
{ "resource": "" }
q3750
CNabuSite.addSiteMap
train
public function addSiteMap(CNabuSiteMap $nb_site_map) { $nb_site_map->transferValue($this, 'nb_site_id'); return $this->nb_site_map_tree->addItem($nb_site_map); }
php
{ "resource": "" }
q3751
CNabuSite.getNaturalLanguages
train
public function getNaturalLanguages(bool $force = false) : CNabuLanguageList { $nb_natural = new CNabuLanguageList(); $this->getLanguages($force)->iterate(function ($key, CNabuLanguage $nb_language) use ($nb_natural) { if ($nb_language->isNaturalLanguage()) { $nb_natural->addItem($nb_language); } return true; }); return $nb_natural; }
php
{ "resource": "" }
q3752
CNabuSite.getAPILanguages
train
public function getAPILanguages(bool $force = false) : CNabuLanguageList { $nb_api = new CNabuLanguageList(); $this->getLanguages($force)->iterate(function ($key, CNabuLanguage $nb_language) use ($nb_api) { if ($nb_language->isAPILanguage()) { $nb_api->addItem($nb_language); } return true; }); return $nb_api; }
php
{ "resource": "" }
q3753
CNabuSite.getRoles
train
public function getRoles(bool $force = false) : CNabuRoleList { if ($this->nb_role_list->isEmpty() || $force) { $this->nb_role_list->fillFromSite($this); } return $this->nb_role_list; }
php
{ "resource": "" }
q3754
CNabuSite.getSiteRoles
train
public function getSiteRoles(bool $force = false) : CNabuSiteRoleList { if ($this->nb_site_role_list->isEmpty() || $force) { $this->nb_site_role_list->clear(); $this->nb_site_role_list->merge(CNabuSiteRole::getSiteRolesForSite($this)); } return $this->nb_site_role_list; }
php
{ "resource": "" }
q3755
CNabuSite.getSiteRole
train
public function getSiteRole($nb_site_role) { if (is_numeric($nb_role_id = nb_getMixedValue($nb_site_role, NABU_ROLE_FIELD_ID))) { $retval = $this->getSiteRoles()->getItem($nb_role_id); } else { $retval = false; } return $retval; }
php
{ "resource": "" }
q3756
CNabuSite.sendNewUserNotification
train
public function sendNewUserNotification(CNabuUser $nb_user, array $params = null) : bool { $retval = false; $nb_engine = CNabuEngine::getEngine(); if (($nb_profile = $this->getUserProfile($nb_user)) instanceof CNabuSiteUser && ($nb_language_id = $nb_profile->getLanguageId()) ) { if (count($params) === 0) { $params = array(); } foreach ($nb_user->getTreeData($nb_language_id, true) as $key => $item) { if (is_scalar($item)) { $params["target_user_$key"] = $item; } } $nb_site_role = $this->getSiteRole($nb_profile); $nb_template_id = $nb_site_role instanceof CNabuSiteRole && $nb_site_role->isValueNumeric('nb_messaging_template_new_user') ? $nb_template_id = $nb_site_role->getMessagingTemplateNewUser() : $this->getMessagingTemplateNewUser() ; return is_numeric($nb_template_id) && ($nb_messaging = $this->getMessaging($this->getCustomer())) instanceof CNabuMessaging && ($nb_messaging_factory = $nb_messaging->getFactory()) instanceof CNabuMessagingFactory && $nb_messaging_factory->postTemplateMessage($nb_template_id, $nb_language_id, $nb_user, null, null, $params) ; } else { throw new ENabuSecurityException(ENabuSecurityException::ERROR_USER_NOT_ALLOWED, array($nb_user->getId())); } }
php
{ "resource": "" }
q3757
Statement.withAuthority
train
public function withAuthority(Actor $authority = null): self { $statement = clone $this; $statement->authority = $authority; return $statement; }
php
{ "resource": "" }
q3758
Statement.getVoidStatement
train
public function getVoidStatement(Actor $actor): self { return new Statement( null, $actor, Verb::createVoidVerb(), $this->getStatementReference() ); }
php
{ "resource": "" }
q3759
Statement.equals
train
public function equals(Statement $statement): bool { if (null !== $this->id xor null !== $statement->id) { return false; } if (null !== $this->id && null !== $statement->id && !$this->id->equals($statement->id)) { return false; } if (!$this->actor->equals($statement->actor)) { return false; } if (!$this->verb->equals($statement->verb)) { return false; } if (!$this->object->equals($statement->object)) { return false; } if (null === $this->result && null !== $statement->result) { return false; } if (null !== $this->result && null === $statement->result) { return false; } if (null !== $this->result && !$this->result->equals($statement->result)) { return false; } if (null === $this->authority && null !== $statement->authority) { return false; } if (null !== $this->authority && null === $statement->authority) { return false; } if (null !== $this->authority && !$this->authority->equals($statement->authority)) { return false; } if ($this->created != $statement->created) { return false; } if (null !== $this->context xor null !== $statement->context) { return false; } if (null !== $this->context && null !== $statement->context && !$this->context->equals($statement->context)) { return false; } if (null !== $this->attachments xor null !== $statement->attachments) { return false; } if (null !== $this->attachments && null !== $statement->attachments) { if (count($this->attachments) !== count($statement->attachments)) { return false; } foreach ($this->attachments as $key => $attachment) { if (!$attachment->equals($statement->attachments[$key])) { return false; } } } return true; }
php
{ "resource": "" }
q3760
QueueHydrator.hydrateCollection
train
public static function hydrateCollection(array $queues) { $hydrated = []; foreach ($queues as $queue) { $hydrated[] = self::hydrate($queue); } return $hydrated; }
php
{ "resource": "" }
q3761
QueueHydrator.hydrate
train
public static function hydrate(stdClass $queue) { $hydrated = new QueueEntity(); if (isset($queue->id)) { $hydrated->setId($queue->id); } if (isset($queue->started_at)) { $hydrated->setStartedAt(new DateTime($queue->started_at)); } if (isset($queue->finished_at)) { $hydrated->setFinishedAt(new DateTime($queue->finished_at)); } return $hydrated; }
php
{ "resource": "" }
q3762
TNabuIContactChild.getIContact
train
public function getIContact($force = false) { if ($this->nb_icontact === null || $force) { $this->nb_icontact = null; if ($this instanceof CNabuDataObject && !$this->isBuiltIn() && $this->isValueNumeric(NABU_ICONTACT_FIELD_ID) ) { $nb_icontact = new CNabuIContact($this->getValue(NABU_ICONTACT_FIELD_ID)); if ($nb_icontact->isFetched()) { $this->nb_icontact = $nb_icontact; } } } return $this->nb_icontact; }
php
{ "resource": "" }
q3763
TNabuIContactChild.setIContact
train
public function setIContact(CNabuIContact $nb_icontact) { $this->nb_icontact = $nb_icontact; if ($this instanceof CNabuDataObject && $nb_icontact->contains(NABU_ICONTACT_FIELD_ID)) { $this->transferValue($nb_icontact, NABU_ICONTACT_FIELD_ID); } return $this; }
php
{ "resource": "" }
q3764
CNabuUserGroup.getMembers
train
public function getMembers($force = false) { if ($this->nb_user_group_member_list->isEmpty() || $force) { $this->nb_user_group_member_list->clear(); if ($this->isValueNumeric('nb_user_group_id')) { $this->nb_user_group_member_list->merge(CNabuUserGroupMember::getMembersOfGroup($this)); } } return $this->nb_user_group_member_list; }
php
{ "resource": "" }
q3765
CNabuUserGroup.getAdminMembers
train
public function getAdminMembers($force = false) : CNabuUserGroupMemberList { $this->getMembers($force); $nb_admin_list = new CNabuUserGroupMemberList(); $this->nb_user_group_member_list->iterate( function($key, CNabuUserGroupMember $nb_user_group_member) use ($nb_admin_list) { if ($nb_user_group_member->getAdmin() === 'T' && $nb_user_group_member->getStatus() === 'E') { $nb_admin_list->addItem($nb_user_group_member); } return true; } ); return $nb_admin_list; }
php
{ "resource": "" }
q3766
ApplicationHydrator.hydrateCollection
train
public static function hydrateCollection(array $applications) { $hydrated = []; foreach ($applications as $application) { $hydrated[] = self::hydrate($application); } return $hydrated; }
php
{ "resource": "" }
q3767
ApplicationHydrator.hydrate
train
public static function hydrate(stdClass $application) { $hydrated = new ApplicationEntity(); if (isset($application->id)) { $hydrated->setId($application->id); } if (isset($application->name)) { $hydrated->setName($application->name); } if (isset($application->current_scan)) { $hydrated->setCurrentScan($application->current_scan); } if (isset($application->created_by)) { $hydrated->setCreatedBy(UserHydrator::hydrate($application->created_by)); } if (isset($application->charged_quota)) { $hydrated->setChargedQuota(QuotaHydrator::hydrate($application->charged_quota)); } if (isset($application->created_at)) { $hydrated->setCreatedAt(new DateTime($application->created_at)); } if (isset($application->organization)) { $hydrated->setOrganization(OrgHydrator::hydrate($application->organization)); } if (isset($application->auto_renew)) { $hydrated->setAutoRenew($application->auto_renew); } return $hydrated; }
php
{ "resource": "" }
q3768
CNabuHTTPSecurityManager.validateZone
train
public function validateZone(CNabuSiteTarget $nb_site_target) { $nb_engine = CNabuEngine::getEngine(); if (!(($nb_site = $nb_site_target->getSite()) instanceof CNabuSite)) { throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND); } $this->zone = ($this->nb_user !== null ? 'P' : 'O'); $nb_engine->traceLog("Request Zone", ($this->zone === 'P' ? 'Private' : 'Public')); $site_target_zone = $nb_site_target->getZone(); $nb_engine->traceLog( "Page Zone", ($site_target_zone === 'P' ? 'Private' : ($site_target_zone === 'O' ? 'Public' : 'Both')) ); $retval = ($site_target_zone === 'B') || ($site_target_zone !== null && $site_target_zone === $this->zone); if ($retval && $this->zone === 'P' && $nb_site->getRequirePoliciesAfterLogin() === 'T') { if ($this->nb_user->getPoliciesAccepted() === 'T') { $nb_engine->traceLog('Policies', 'Accepted'); } else { $nb_engine->traceLog('Policies', 'Not accepted'); if ($nb_site_target->getIgnorePolicies() === 'F' && ($link = $nb_site->getPoliciesTargetLink())->isLinkable() && !($link->matchTarget($nb_site_target)) ) { throw new ENabuRedirectionException(428, new CNabuHTTPRedirection(428, $link->getBestQualifiedURL())); } } } return $retval; }
php
{ "resource": "" }
q3769
CNabuHTTPSecurityManager.isSignInLocked
train
public function isSignInLocked() { $nb_session = $this->nb_application->getSession(); if ($nb_session === null || !($nb_session instanceof CNabuHTTPSession)) { throw new ENabuCoreException(ENabuCoreException::ERROR_SESSION_NOT_FOUND); } $nb_site = $this->nb_application->getHTTPServer()->getSite(); if ($nb_site === null || !($nb_site instanceof CNabuSite)) { throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND); } $max_signin_retries = $nb_site->getMaxSignInRetries(); $signin_locked_delay = $nb_site->getSignInLockDelay(); $signin_retries = $nb_session->getVariable('signin_retries', 0); $signin_last_fail_timestamp = $nb_session->getVariable('signin_last_fail_timestamp', 0); $now = time() - $signin_last_fail_timestamp; if ($now > $signin_locked_delay) { $this->resetSignInLock(); $retval = false; } else { $retval = $max_signin_retries > 0 && $signin_retries >= $max_signin_retries && $now < $signin_locked_delay; } return $retval; }
php
{ "resource": "" }
q3770
CNabuHTTPSecurityManager.resetSignInLock
train
public function resetSignInLock() { $nb_session = $this->nb_application->getSession(); if ($nb_session === null || !($nb_session instanceof CNabuHTTPSession)) { throw new ENabuCoreException(ENabuCoreException::ERROR_SESSION_NOT_FOUND); } $nb_session->unsetVariable('signin_retries'); $nb_session->unsetVariable('signin_last_fail_timestamp'); }
php
{ "resource": "" }
q3771
CNabuHTTPSecurityManager.lockSignIn
train
public function lockSignIn() { $retval = false; $nb_session = $this->nb_application->getSession(); if ($nb_session === null || !($nb_session instanceof CNabuHTTPSession)) { throw new ENabuCoreException(ENabuCoreException::ERROR_SESSION_NOT_FOUND); } $nb_response = $this->nb_application->getResponse(); if ($nb_response === null || !($nb_response instanceof CNabuHTTPResponse)) { throw new ENabuCoreException(ENabuCoreException::ERROR_RESPONSE_NOT_FOUND); } $nb_site = $this->nb_application->getHTTPServer()->getSite(); if ($nb_site === null || !($nb_site instanceof CNabuSite)) { throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND); } try { $lang = $this->nb_application->getRequest()->getLanguage()->getId(); } catch (Exception $e) { $lang = null; } if ($lang === null) { $lang = $nb_site->getDefaultLanguageId(); } $max_signin_retries = $nb_site->getMaxSignInRetries(); $signin_locked_delay = $nb_site->getSignInLockDelay(); $signin_retries = $nb_session->getVariable('signin_retries', 0); $signin_last_fail_timestamp = $nb_session->getVariable('signin_last_fail_timestamp', 0); $now = time() - $signin_last_fail_timestamp; if ($max_signin_retries > 0) { if ($this->isSignInLocked()) { } else { $nb_session->setVariable('signin_retries', $signin_retries < $max_signin_retries ? ++$signin_retries : $max_signin_retries); $nb_session->setVariable('signin_last_fail_timestamp', time()); } if ($this->isSignInLocked()) { if (is_string($link = $nb_site->getLoginMaxFailsTargetLink()->getBestQualifiedURL(array($lang => $lang)))) { $nb_response->redirect($nb_site->getLoginMaxFailsErrorCode(), $link); } else { $retval = true; } } } return $retval; }
php
{ "resource": "" }
q3772
CNabuHTTPSecurityManager.isUserLogged
train
public function isUserLogged() { return ($this->nb_user !== null && $this->nb_role !== null && $this->nb_site_user !== null); }
php
{ "resource": "" }
q3773
CNabuHTTPSecurityManager.revalidatePassword
train
public function revalidatePassword(CNabuSite $nb_site, CNabuUser $nb_user, string $passwd) : bool { if (!($nb_site instanceof CNabuSite)) { throw new ENabuCoreException(ENabuCoreException::ERROR_METHOD_PARAMETER_NOT_VALID, array('$nb_site')); } if (!($nb_user instanceof CNabuUser) || !$nb_user->isFetched()) { throw new ENabuCoreException(ENabuCoreException::ERROR_METHOD_PARAMETER_NOT_VALID, array('$nb_user')); } if (!is_string($passwd)) { throw new ENabuCoreException( ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE, array('$passwd', print_r($passwd, true)) ); } $nb_log_user = CNabuUser::findBySiteLogin($nb_site, $nb_user->getLogin(), $passwd); return $nb_user->getId() == $nb_log_user->getId(); }
php
{ "resource": "" }
q3774
CNabuHTTPSecurityManager.applyRoleMask
train
public function applyRoleMask(INabuRoleMask $object, array $params = null) : bool { return $object->applyRoleMask( $this->nb_role, array( self::ROLE_MASK_USER_SIGNED => $this->isUserLogged(), self::ROLE_MASK_WORK_CUSTOMER => $this->hasWorkCustomer() ) ); }
php
{ "resource": "" }
q3775
CNabuHTTPSecurityManager.acceptPolicies
train
public function acceptPolicies(bool $save = true) { $nb_site = $this->nb_application->getHTTPServer()->getSite(); if ($nb_site === null || !($nb_site instanceof CNabuSite)) { throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND); } if ($this->isUserLogged()) { $this->nb_user->setPoliciesAccepted('T'); $this->nb_user->setPoliciesDatetime(date('Y-m-d H:i:s', time())); if ($nb_site->getEnableSessionStrictPolicies() === 'T') { session_regenerate_id(true); } if ($save && $this->nb_user->save() && strlen($url = $nb_site->getLoginRedirectionTargetLink($this->nb_site_role)->getBestQualifiedURL()) > 0 ) { $after_login = $url . "?logged"; throw new ENabuRedirectionException(301, new CNabuHTTPRedirection(301, $url)); } } }
php
{ "resource": "" }
q3776
CustomClassService.getAll
train
public function getAll($appId, $scanId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->classes() ->getAll($appId, $scanId, $queryParams); return new CustomClassesResponse($response); }
php
{ "resource": "" }
q3777
CustomClassService.getById
train
public function getById($appId, $scanId, $classId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->classes() ->getById($appId, $scanId, $classId, $queryParams); return new CustomClassResponse($response); }
php
{ "resource": "" }
q3778
CustomClassService.create
train
public function create($appId, $scanId, $input, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->classes() ->create($appId, $scanId, $input->toArray(), $queryParams); return new CustomClassResponse($response); }
php
{ "resource": "" }
q3779
FileService.getAll
train
public function getAll($appId, $scanId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->files() ->getAll($appId, $scanId, $queryParams); return new FilesResponse($response); }
php
{ "resource": "" }
q3780
FileService.getById
train
public function getById($appId, $scanId, $fileId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->files() ->getById($appId, $scanId, $fileId, $queryParams); return new FileResponse($response); }
php
{ "resource": "" }
q3781
FileService.delete
train
public function delete($appId, $scanId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->files() ->delete($appId, $scanId, $queryParams); return new BaseResponse($response); }
php
{ "resource": "" }
q3782
CNabuIContactBase.getAlliContacts
train
public static function getAlliContacts(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_icontact_id', 'select * ' . 'from nb_icontact ' . 'where nb_customer_id=%cust_id$d', array( 'cust_id' => $nb_customer_id ), $nb_customer ); } else { $retval = new CNabuIContactList(); } return $retval; }
php
{ "resource": "" }
q3783
SocialLoginService.getProvidersConfig
train
private function getProvidersConfig() { $config = []; foreach (self::PROVIDERS as $provider) { $config[ucfirst($provider)] = [ 'enabled' => (bool)$this->scopeConfig->getValue( sprintf(self::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_ENABLED, $provider), ScopeInterface::SCOPE_STORE ), 'keys' => [ 'key' => $this->scopeConfig->getValue( sprintf(self::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_KEY, $provider), ScopeInterface::SCOPE_STORE ), 'secret' => $this->scopeConfig->getValue( sprintf(self::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_SECRET, $provider), ScopeInterface::SCOPE_STORE ), ] ]; } return $config; }
php
{ "resource": "" }
q3784
SocialLoginService.getCustomerData
train
private function getCustomerData(UserProfile $profile) { $customerData = []; foreach (['firstName', 'lastName', 'email'] as $field) { $data = $profile->{$field}; $customerData[strtolower($field)] = $data !== null ? $data : '-'; } return $customerData; }
php
{ "resource": "" }
q3785
SocialLoginService.handleProviderQuirks
train
private function handleProviderQuirks($provider, $customer) { switch ($provider) { case 'Twitter': if ($customer->getData('lastname') === '-') { $nameParts = explode(' ', $customer->getData('firstname')); if (count($nameParts) > 1) { $customer->setData('firstname', $nameParts[0]); $lastName = implode(' ', array_slice($nameParts, 1)); $customer->setData('lastname', $lastName); } } break; } }
php
{ "resource": "" }
q3786
SocialLoginService.getCustomerForProfile
train
private function getCustomerForProfile($provider, UserProfile $profile) { /** @var Customer $customer */ $customer = $this->customerFactory->create(); $customer->setWebsiteId($this->getCurrentWebsiteId()); $customer->loadByEmail($profile->emailVerified); if (!$customer->getId()) { $customer->setData('email', $profile->emailVerified); $customer->addData($this->getCustomerData($profile)); $this->handleProviderQuirks($provider, $customer); $this->customerResource->save($customer); } return $customer; }
php
{ "resource": "" }
q3787
CheckoutConfigProvider.isProviderEnabled
train
private function isProviderEnabled($provider) { return (bool)$this->scopeConfig->getValue( sprintf(SocialLoginService::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_ENABLED, $provider), ScopeInterface::SCOPE_STORE ); }
php
{ "resource": "" }
q3788
CNabuClusterUserGroupBase.setClusterGroupId
train
public function setClusterGroupId(int $nb_cluster_group_id) : CNabuDataObject { if ($nb_cluster_group_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$nb_cluster_group_id") ); } $this->setValue('nb_cluster_group_id', $nb_cluster_group_id); return $this; }
php
{ "resource": "" }
q3789
CNabuClusterUserGroupBase.setOSId
train
public function setOSId(int $os_id) : CNabuDataObject { if ($os_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$os_id") ); } $this->setValue('nb_cluster_user_group_os_id', $os_id); return $this; }
php
{ "resource": "" }
q3790
EntrypointHydrator.hydrateCollection
train
public static function hydrateCollection(array $entrypoints) { $hydrated = []; foreach ($entrypoints as $entrypoint) { $hydrated[] = self::hydrate($entrypoint); } return $hydrated; }
php
{ "resource": "" }
q3791
EntrypointHydrator.hydrate
train
public static function hydrate(stdClass $entrypoint) { $hydrated = new EntrypointEntity(); if (isset($entrypoint->id)) { $hydrated->setId($entrypoint->id); } if (isset($entrypoint->line)) { $hydrated->setLine($entrypoint->line); } if (isset($entrypoint->file)) { $hydrated->setFile(FileHydrator::hydrate($entrypoint->file)); } if (isset($entrypoint->function)) { $hydrated->setFunction(CustomFunctionHydrator::hydrate($entrypoint->function)); } if (isset($entrypoint->class)) { $hydrated->setClass(CustomClassHydrator::hydrate($entrypoint->class)); } return $hydrated; }
php
{ "resource": "" }
q3792
CustomClassHydrator.hydrateCollection
train
public static function hydrateCollection(array $customClasses) { $hydrated = []; foreach ($customClasses as $customClass) { $hydrated[] = self::hydrate($customClass); } return $hydrated; }
php
{ "resource": "" }
q3793
CustomClassHydrator.hydrate
train
public static function hydrate(stdClass $customClass) { $hydrated = new CustomClassEntity(); if (isset($customClass->id)) { $hydrated->setId($customClass->id); } if (isset($customClass->start_line)) { $hydrated->setStartLine($customClass->start_line); } if (isset($customClass->end_line)) { $hydrated->setEndLine($customClass->end_line); } if (isset($customClass->start_column)) { $hydrated->setStartColumn($customClass->start_column); } if (isset($customClass->end_column)) { $hydrated->setEndColumn($customClass->end_column); } if (isset($customClass->name)) { $hydrated->setName($customClass->name); } if (isset($customClass->file)) { $hydrated->setFile(FileHydrator::hydrate($customClass->file)); } if (isset($customClass->package)) { $hydrated->setPackage($customClass->package); } return $hydrated; }
php
{ "resource": "" }
q3794
Chunker.setEncoding
train
public function setEncoding($encoding) { if ( ! is_string($encoding) || ! in_array($encoding, mb_list_encodings())) { throw new \InvalidArgumentException( __METHOD__."() expects parameter one, encoding, to be a valid " . "character encoding name" ); } $this->encoding = $encoding; return $this; }
php
{ "resource": "" }
q3795
Chunker.setIndex
train
public function setIndex($index) { if ( ! is_numeric($index) || ! is_int(+$index) || $index < 0) { throw new \InvalidArgumentException( __METHOD__."() expects parameter one, index, to be a positive " ."integer or zero" ); } $this->index = $index; return $this; }
php
{ "resource": "" }
q3796
Chunker.setSize
train
public function setSize($size) { if ( ! is_numeric($size) || ! is_int(+$size) || $size < 1) { throw new \InvalidArgumentException( __METHOD__."() expects parameter one, size, to be a positive integer" ); } $this->size = $size; return $this; }
php
{ "resource": "" }
q3797
Chunker.getPreviousChunk
train
public function getPreviousChunk() { $offset = --$this->index * $this->size; if ($offset >= 0) { $chunk = $this->getChunk($offset); } else { $chunk = false; } return $chunk; }
php
{ "resource": "" }
q3798
PageLayoutCompiler.compile
train
public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, ScaffolderThemeExtensionInterface $themeExtension, array $extensions, $extra = null) { $this->stub = $stub; return $this->setPageTitle($scaffolderConfig) ->setAppName($scaffolderConfig) ->setLinks($extra['links'], $scaffolderConfig) ->replaceRoutePrefix($scaffolderConfig->routing->prefix) ->store($modelName, $scaffolderConfig, $themeExtension->runAfterPageLayoutIsCompiled($this->stub, $scaffolderConfig), new FileToCompile(null, null)); }
php
{ "resource": "" }
q3799
PageLayoutCompiler.setPageTitle
train
private function setPageTitle(stdClass $scaffolderConfig) { $this->stub = str_replace('{{page_title}}', $scaffolderConfig->userInterface->pageTitle, $this->stub); return $this; }
php
{ "resource": "" }