_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q3900
CNabuMedioteca.getMediotecasForCustomer
train
static public function getMediotecasForCustomer(CNabuCustomer $nb_customer) { $nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID); if (is_numeric($nb_customer_id)) { $retval = CNabuMedioteca::buildObjectListFromSQL( NABU_MEDIOTECA_FIELD_ID, 'select * ' . 'from ' . NABU_MEDIOTECA_TABLE . ' ' . 'where nb_customer_id=%cust_id$d',
php
{ "resource": "" }
q3901
CNabuMedioteca.refresh
train
public function refresh(bool $force = false, bool $cascade = false) : bool
php
{ "resource": "" }
q3902
CNabuDomainZoneHostBase.setDomainZoneId
train
public function setDomainZoneId(int $nb_domain_zone_id) : CNabuDataObject { if ($nb_domain_zone_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3903
PointerPlus.initial_pointers
train
function initial_pointers() { global $pagenow; $defaults = array( 'class' => '', 'width' => 300, //only fixed value 'align' => 'middle', 'edge' => 'left', 'post_type' => array(), 'pages' => array(), 'icon_class' => '' ); $screen = get_current_screen(); $current_post_type = isset( $screen->post_type ) ? $screen->post_type : false; $search_pt = false; $pointers = apply_filters( $this->prefix . '-pointerplus_list', array( // Pointers are added through the 'initial_pointerplus' filter ), $this->prefix ); foreach ( $pointers as $key => $pointer ) { $pointers[ $key ] = wp_parse_args( $pointer, $defaults ); $search_pt = false; // Clean from null ecc $pointers[ $key ][ 'post_type' ] = array_filter( $pointers[ $key ][ 'post_type' ] ); if ( !empty( $pointers[ $key ][ 'post_type' ] ) ) { if ( !empty( $current_post_type ) ) { if ( is_array( $pointers[ $key ][ 'post_type' ] ) ) { // Search the post_type foreach ( $pointers[ $key ][ 'post_type' ] as $value ) { if ( $value === $current_post_type ) { $search_pt = true; } } if ( $search_pt === false ) { unset( $pointers[ $key ] ); } } else { new WP_Error( 'broke', __( 'PointerPlus Error: post_type is not an array!' ) ); } // If not in CPT view remove all the pointers with post_type
php
{ "resource": "" }
q3904
PointerPlus.maybe_add_pointers
train
function maybe_add_pointers() { // Get default pointers that we want to create $default_keys = $this->initial_pointers(); // Get pointers dismissed by user $dismissed = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); // Check that our pointers haven't been dismissed already $diff = array_diff_key( $default_keys, array_combine( $dismissed, $dismissed ) ); // If we have some pointers to show, save them and start enqueuing assets to display them if ( !empty( $diff
php
{ "resource": "" }
q3905
PointerPlus.admin_enqueue_assets
train
function admin_enqueue_assets() { $base_url = plugins_url( '', __FILE__ ); wp_enqueue_style( $this->prefix, $base_url . '/pointerplus.css', array( 'wp-pointer' ) ); wp_enqueue_script( $this->prefix, $base_url . '/pointerplus.js?var=' . str_replace( '-', '_', $this->prefix ) . '_pointerplus', array( 'wp-pointer' ) );
php
{ "resource": "" }
q3906
PointerPlus._reset_pointer
train
function _reset_pointer( $id = 'me' ) { if ( $id === 'me' ) { $id = get_current_user_id(); } $pointers = explode( ',', get_user_meta( $id, 'dismissed_wp_pointers', true ) );
php
{ "resource": "" }
q3907
CNabuProjectVersionLanguageBase.setProjectVersionId
train
public function setProjectVersionId(int $nb_project_version_id) : CNabuDataObject { if ($nb_project_version_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3908
CNabuSiteRoleLanguageBase.getSelectRegister
train
public function getSelectRegister() { return ($this->isValueNumeric('nb_site_id') && $this->isValueNumeric('nb_role_id') && $this->isValueNumeric('nb_language_id')) ? $this->buildSentence( 'select * ' . 'from nb_site_role_lang ' . "where nb_site_id=%nb_site_id\$d "
php
{ "resource": "" }
q3909
File.setName
train
public function setName($name) { if ( ! is_string($name)) { throw new \InvalidArgumentException( __METHOD__."() expects parameter one, name, to be a
php
{ "resource": "" }
q3910
File.getMaxChunks
train
public function getMaxChunks() { return ceil(($this->name
php
{ "resource": "" }
q3911
File.getChunk
train
protected function getChunk($offset) { if ( ! is_numeric($offset) || ! is_int(+$offset) || $offset < 0) { throw new \InvalidArgumentException( __METHOD__."() expects parameter one, offset, to be a positive " . "integer or zero" ); } if ($this->name !== null) { // get the single-byte chunk... // keep in mind, if file_get_contents() encounters an invalid offset, it // will return false AND raise an E_WARNING; we don't want the // E_WARNING, only the false // also, make sure you floor the offset to 0; negative values will start // that many bytes from the end of the file // $sbChunk = @file_get_contents( $this->name, false,
php
{ "resource": "" }
q3912
CNabuDataObjectListIndex.extractNodes
train
protected function extractNodes(CNabuDataObject $item) { $main_index_name = $this->list->getIndexedFieldName(); if (($item->isValueNumeric($main_index_name) || $item->isValueGUID($main_index_name)) && ($item->isValueString($this->key_field) || $item->isValueNumeric($this->key_field)) ) { $key = $item->getValue($this->key_field); $retval = array( 'key' => $key, 'pointer' => $item->getValue($main_index_name) );
php
{ "resource": "" }
q3913
CNabuDataObjectListIndex.addItem
train
public function addItem(CNabuDataObject $item) { if (is_array($nodes = $this->extractNodes($item)) && count($nodes) > 0) { if ($this->index === null) { $this->index =
php
{ "resource": "" }
q3914
CNabuProject.getVersions
train
public function getVersions($force = false) { if ($this->nb_project_version_list === null) { $this->nb_project_version_list = new CNabuProjectVersionList(); } if ($this->nb_project_version_list->isEmpty() || $force) { $this->nb_project_version_list->clear();
php
{ "resource": "" }
q3915
CNabuIContactProspectDiaryBase.setIcontactProspectId
train
public function setIcontactProspectId(int $nb_icontact_prospect_id) : CNabuDataObject { if ($nb_icontact_prospect_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3916
LicenseService.getAll
train
public function getAll(array $queryParams = []) { $response = $this->api->licenses()->getAll($queryParams);
php
{ "resource": "" }
q3917
LicenseService.getById
train
public function getById($appId, array $queryParams = []) { $response = $this->api->licenses()->getById($appId,
php
{ "resource": "" }
q3918
StatementFactory.createStatement
train
public function createStatement(): Statement { if (null === $this->actor) { throw new InvalidStateException('A statement actor is missing.'); } if (null === $this->verb) { throw new InvalidStateException('A statement verb is missing.'); } if (null === $this->object) {
php
{ "resource": "" }
q3919
CNabuMessagingFactory.discoverServiceInterface
train
private function discoverServiceInterface(CNabuMessagingService $nb_service) : INabuMessagingServiceInterface { $retval = false; $nb_engine = CNabuEngine::getEngine(); if (is_string($interface_name = $nb_service->getInterface())) { if (is_array($this->nb_service_interface_list) && array_key_exists($interface_name, $this->nb_service_interface_list) ) { $retval = $this->nb_service_interface_list[$interface_name]; } elseif ( is_string($provider_key = $nb_service->getProvider()) && count(list($vendor_key, $module_key) = preg_split("/:/", $provider_key)) === 2 && ($nb_manager = $nb_engine->getProviderManager($vendor_key, $module_key)) instanceof INabuMessagingModule && ($retval = $nb_manager->createServiceInterface($interface_name)) instanceof INabuMessagingServiceInterface ) {
php
{ "resource": "" }
q3920
CNabuMessagingFactory.discoverTemplate
train
private function discoverTemplate($nb_template) : CNabuMessagingTemplate { if (!($nb_template instanceof CNabuMessagingTemplate)) { if (is_numeric($nb_template_id = nb_getMixedValue($nb_template, NABU_MESSAGING_TEMPLATE_FIELD_ID))) { $nb_template = $this->nb_messaging->getTemplate($nb_template_id); } elseif (is_string($nb_template_id)) { $nb_template = $this->nb_messaging->getTemplateByKey($nb_template_id); } } if (!($nb_template instanceof CNabuMessagingTemplate)) { throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_TEMPLATE);
php
{ "resource": "" }
q3921
CNabuMessagingFactory.discoverLanguage
train
private function discoverLanguage($nb_language) : CNabuLanguage { if (!($nb_language instanceof CNabuLanguage)) { $nb_language = new CNabuLanguage(nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID)); }
php
{ "resource": "" }
q3922
CNabuMessagingFactory.prepareMessageUsingTemplate
train
private function prepareMessageUsingTemplate( CNabuMessagingTemplate $nb_template, CNabuLanguage $nb_language, array $params = null ) : array { $nb_engine = CNabuEngine::getEngine(); if (is_string($interface_name = $nb_template->getRenderInterface()) && is_string($provider_key = $nb_template->getRenderProvider()) && count(list($vendor_key, $module_key) = preg_split("/:/", $provider_key)) === 2 && ($nb_manager = $nb_engine->getProviderManager($vendor_key, $module_key)) instanceof INabuMessagingModule
php
{ "resource": "" }
q3923
CNabuMessagingFactory.postTemplateMessage
train
public function postTemplateMessage( $nb_template, $nb_language, $to = null, $cc = null, $bcc = null, array $params = null, array $attachments = null ) : bool { $nb_template = $this->discoverTemplate($nb_template); $nb_language = $this->discoverLanguage($nb_language);
php
{ "resource": "" }
q3924
CNabuMessagingFactory.sendTemplateMessage
train
public function sendTemplateMessage( $nb_template, $to = null, $cc = null, $bcc = null, array $params = null, array $attachments = null ) : bool { $nb_template = $this->discoverTemplate($nb_template); $nb_language = $this->discoverLanguage($nb_language);
php
{ "resource": "" }
q3925
CNabuMessagingFactory.postMessage
train
public function postMessage(CNabuMessagingServiceList $nb_service_list, $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments) : bool { $retval = false; $nb_service_list->iterate( function($key, CNabuMessagingService $nb_service)
php
{ "resource": "" }
q3926
CNabuMessagingFactory.sendMessage
train
public function sendMessage(CNabuMessagingServiceList $nb_service_list, $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments) { $retval = false; $nb_service_list->iterate( function($key, CNabuMessagingService $nb_service) use (&$retval, $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments) {
php
{ "resource": "" }
q3927
LibraryService.getAll
train
public function getAll($appId, $scanId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->libraries()
php
{ "resource": "" }
q3928
LibraryService.getById
train
public function getById($appId, $scanId, $libraryId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->libraries()
php
{ "resource": "" }
q3929
LibraryService.update
train
public function update($appId, $scanId, $libraryId, $input, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->libraries()
php
{ "resource": "" }
q3930
ApiRouteCompiler.compile
train
public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, array $extensions, $extra = null) { $this->stub
php
{ "resource": "" }
q3931
ControllerCompiler.setValidations
train
protected function setValidations($modelData) { $fields = ''; $firstIteration = true; foreach ($modelData->fields as $field) { if ($firstIteration) { $fields .= sprintf("'%s' => '%s'," . PHP_EOL, $field->name, $field->validations); $firstIteration = false; } else {
php
{ "resource": "" }
q3932
ControllerHydrator.hydrateCollection
train
public static function hydrateCollection(array $controllers) { $hydrated = []; foreach ($controllers as $controller) {
php
{ "resource": "" }
q3933
ControllerHydrator.hydrate
train
public static function hydrate(stdClass $controller) { $hydrated = new ControllerEntity(); if (isset($controller->id)) { $hydrated->setId($controller->id); } if (isset($controller->class)) { $hydrated->setClass($controller->class); } if (isset($controller->method)) { $hydrated->setMethod($controller->method);
php
{ "resource": "" }
q3934
CNabuSiteMapBase.getAllSiteMaps
train
public static function getAllSiteMaps(CNabuSite $nb_site) { $nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id'); if (is_numeric($nb_site_id)) { $retval = forward_static_call( array(get_called_class(), 'buildObjectListFromSQL'), 'nb_site_map_id', 'select * ' . 'from nb_site_map ' . 'where
php
{ "resource": "" }
q3935
CNabuSiteMapBase.getFilteredSiteMapList
train
public static function getFilteredSiteMapList($nb_site, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0) { $nb_site_id = nb_getMixedValue($nb_customer, NABU_SITE_FIELD_ID); if (is_numeric($nb_site_id)) { $fields_part = nb_prefixFieldList(CNabuSiteMapBase::getStorageName(), $fields, false, true, '`'); $order_part = nb_prefixFieldList(CNabuSiteMapBase::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 . ' ' : '* ')
php
{ "resource": "" }
q3936
CNabuSiteMapBase.setCustomerRequired
train
public function setCustomerRequired(string $customer_required = "B") : CNabuDataObject { if ($customer_required === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3937
CNabuSiteMapBase.setLevel
train
public function setLevel(int $level = 1) : CNabuDataObject { if ($level === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$level")
php
{ "resource": "" }
q3938
CNabuSiteMapBase.setUseURI
train
public function setUseURI(string $use_uri = "N") : CNabuDataObject { if ($use_uri === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3939
CNabuSiteMapBase.setOpenPopup
train
public function setOpenPopup(string $open_popup = "F") : CNabuDataObject { if ($open_popup === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3940
CNabuSiteMapBase.setVisible
train
public function setVisible(string $visible = "T") : CNabuDataObject { if ($visible === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3941
CNabuSiteMapBase.setSeparator
train
public function setSeparator(string $separator = "F") : CNabuDataObject { if ($separator === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3942
CNabuSiteMap.addRole
train
public function addRole(CNabuSiteMapRole $nb_role) { if ($nb_role->isValueNumeric(NABU_ROLE_FIELD_ID) || $nb_role->isValueGUID(NABU_ROLE_FIELD_ID)) { $nb_role->setSiteMap($this);
php
{ "resource": "" }
q3943
Definition.equals
train
public function equals(Definition $definition): bool { if (get_class($this) !== get_class($definition)) { return false; } if (null !== $this->type xor null !== $definition->type) { return false; } if (null !== $this->type && null !== $definition->type && !$this->type->equals($definition->type)) { return false; } if (null !== $this->moreInfo xor null !== $definition->moreInfo) { return false; } if (null !== $this->moreInfo && null !== $definition->moreInfo && !$this->moreInfo->equals($definition->moreInfo)) { return false; } if (null !== $this->extensions xor null !== $definition->extensions) { return false; } if (null !== $this->name xor null !== $definition->name) { return false; } if (null !== $this->description xor null !== $definition->description) { return false; } if (null !== $this->name) { if (count($this->name) !== count($definition->name)) { return false; } foreach ($this->name as $language => $value) { if (!isset($definition->name[$language])) { return false; } if ($value !== $definition->name[$language]) { return false; } } } if (null !== $this->description) {
php
{ "resource": "" }
q3944
RouteCompiler.replaceResource
train
protected function replaceResource($modelName) { $this->stub = str_replace('{{resource_lw}}', strtolower($modelName), $this->stub);
php
{ "resource": "" }
q3945
View.getTemplateWebPath
train
public function getTemplateWebPath($file = '',$version = true) { $webPath = '/assets/'; if(!empty($file)
php
{ "resource": "" }
q3946
View.get
train
public function get($key){ return (isset($this->tpl['vars'][$key]))
php
{ "resource": "" }
q3947
View.yields
train
public function yields($yield = self::DEFAULT_YIELD){ if(!empty($this->content_for[$yield])) echo $this->content_for[$yield]; if(!empty($this->tpl['layout']['yields'][$yield])
php
{ "resource": "" }
q3948
View.isYieldable
train
public function isYieldable($yield = self::DEFAULT_YIELD) { return (!empty($this->tpl['layout']['yields'][$yield])
php
{ "resource": "" }
q3949
View.compute
train
public function compute(){ if(file_exists($this->getTemplatePath($this->tpl['layout']['path']))){
php
{ "resource": "" }
q3950
CNabuClusterGroupServiceBase.getFilteredClusterGroupServiceList
train
public static function getFilteredClusterGroupServiceList($q = null, $fields = null, $order = null, $offset = 0, $num_items = 0) { $fields_part = nb_prefixFieldList(CNabuClusterGroupServiceBase::getStorageName(), $fields, false, true, '`'); $order_part = nb_prefixFieldList(CNabuClusterGroupServiceBase::getStorageName(), $fields, false, false, '`'); if ($num_items !== 0) { $limit_part = ($offset > 0 ? $offset . ', ' : '') . $num_items; } else { $limit_part = false; }
php
{ "resource": "" }
q3951
CNabuClusterGroupServiceBase.setUseSSL
train
public function setUseSSL(string $use_ssl = "F") : CNabuDataObject { if ($use_ssl === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$use_ssl")
php
{ "resource": "" }
q3952
CNabuMessagingModuleManagerAdapter.registerServiceInterface
train
protected function registerServiceInterface(INabuMessagingServiceInterface $interface) : bool { $hash = $interface->getHash(); if (is_array($this->service_interface_list) && array_key_exists($hash, $this->service_interface_list)) { throw new ENabuMessagingException(
php
{ "resource": "" }
q3953
CNabuMessagingModuleManagerAdapter.createServiceInterface
train
public function createServiceInterface(string $class_name) : INabuMessagingServiceInterface { $nb_engine = CNabuEngine::getEngine(); $nb_descriptor = $nb_engine->getProviderInterfaceDescriptor( $this->getVendorKey(), $this->getModuleKey(), CNabuProviderFactory::INTERFACE_MESSAGING_SERVICE, $class_name ); if ($nb_descriptor instanceof CNabuProviderInterfaceDescriptor) { $fullname = $nb_descriptor->getNamespace() . "\\services\\$class_name"; if ($nb_engine->preloadClass($fullname)) { $interface = new $fullname($this); if ($this->registerServiceInterface($interface)) { return $interface; } else { throw new ENabuMessagingException( ENabuMessagingException::ERROR_SERVICE_CANNOT_BE_INSTANTIATED,
php
{ "resource": "" }
q3954
CNabuMessagingModuleManagerAdapter.registerTemplateRenderInterface
train
protected function registerTemplateRenderInterface(INabuMessagingTemplateRenderInterface $interface) : bool { $hash = $interface->getHash(); if (is_array($this->template_render_interface_list) && array_key_exists($hash, $this->template_render_interface_list) ) { throw
php
{ "resource": "" }
q3955
CNabuMessagingModuleManagerAdapter.createTemplateRenderInterface
train
public function createTemplateRenderInterface(string $class_name) : INabuMessagingTemplateRenderInterface { $nb_engine = CNabuEngine::getEngine(); $nb_descriptor = $nb_engine->getProviderInterfaceDescriptor( $this->getVendorKey(), $this->getModuleKey(), CNabuProviderFactory::INTERFACE_MESSAGING_TEMPLATE_RENDER, $class_name ); if ($nb_descriptor instanceof CNabuProviderInterfaceDescriptor) { $fullname = $nb_descriptor->getNamespace() . "\\templates\\renders\\$class_name"; if ($nb_engine->preloadClass($fullname)) { $interface = new $fullname($this); if ($this->registerTemplateRenderInterface($interface)) { return $interface; } else { throw new ENabuMessagingException( ENabuMessagingException::ERROR_TEMPLATE_RENDER_CANNOT_BE_INSTANTIATED,
php
{ "resource": "" }
q3956
CNabuHTTPServerPoolManager.getHTTPServerFactory
train
public function getHTTPServerFactory(CNabuHTTPServerInterfaceDescriptor $nb_descriptor) { if (!($retval = $this->nb_http_server_factory_list->getItem($nb_descriptor->getKey()))) {
php
{ "resource": "" }
q3957
SanitizerHydrator.hydrateCollection
train
public static function hydrateCollection(array $sanitizers) { $hydrated = []; foreach ($sanitizers as $sanitizer) {
php
{ "resource": "" }
q3958
SanitizerHydrator.hydrate
train
public static function hydrate(stdClass $sanitizer) { $hydrated = new SanitizerEntity(); if (isset($sanitizer->id)) { $hydrated->setId($sanitizer->id); } if (isset($sanitizer->class)) { $hydrated->setClass($sanitizer->class); } if (isset($sanitizer->method)) {
php
{ "resource": "" }
q3959
SinkService.getAll
train
public function getAll($appId, $profileId, array $queryParams) { $response = $this->api->applications()->profiles()->sinks()->getAll($appId,
php
{ "resource": "" }
q3960
SinkService.getById
train
public function getById($appId, $profileId, $sinkId, array $queryParams = []) { $response =
php
{ "resource": "" }
q3961
SinkService.create
train
public function create($appId, $profileId, SinkBuilder $input, array $queryParams = []) { $response
php
{ "resource": "" }
q3962
CNabuCommerceBase.getAllCommerces
train
public static function getAllCommerces(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_commerce_id', 'select * ' . 'from nb_commerce ' . 'where
php
{ "resource": "" }
q3963
CNabuXMLSiteTargetBase.setAttributes
train
protected function setAttributes(SimpleXMLElement $element) { $element->addAttribute('GUID', $this->nb_data_object->grantHash(true)); $this->putAttributesFromList($element, array( 'nb_site_target_key' => 'key', 'nb_site_target_order' => 'order', 'nb_site_target_begin_date' => 'beginDate',
php
{ "resource": "" }
q3964
CNabuXMLSiteTargetBase.getChilds
train
protected function getChilds(SimpleXMLElement $element) { parent::getChilds($element); $this->getChildsAsCDATAFromList($element,
php
{ "resource": "" }
q3965
CNabuXMLSiteTargetBase.setChilds
train
protected function setChilds(SimpleXMLElement $element) { parent::setChilds($element); $this->putChildsAsCDATAFromList($element,
php
{ "resource": "" }
q3966
IssueHydrator.hydrateCollection
train
public static function hydrateCollection(array $issues) { $hydrated = []; foreach ($issues as $issue) {
php
{ "resource": "" }
q3967
ClientEntity.setAllowedGrantTypes
train
public function setAllowedGrantTypes($allowedGrantTypes) { foreach ($allowedGrantTypes as $allowedGrantType) { if (!in_array($allowedGrantType, $this->availableGrantTypes)) {
php
{ "resource": "" }
q3968
CNabuModuleMorphList.acquireItem
train
protected function acquireItem($key, $index = false) { $retval = false; $nb_engine = CNabuEngine::getEngine(); if ($nb_engine->isMainDBAvailable()) {
php
{ "resource": "" }
q3969
LoginViewCompiler.compile
train
public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, ScaffolderThemeExtensionInterface $themeExtension, array $extensions, $extra = null) { $this->stub = $stub; $this->stub = $themeExtension->runAfterLoginViewIsCompiled($this->stub, $scaffolderConfig); foreach ($extensions as $extension) {
php
{ "resource": "" }
q3970
RoutesRequests.parseIncomingRequest
train
protected function parseIncomingRequest($request) { if (! $request) { $request = LumenRequest::capture(); }
php
{ "resource": "" }
q3971
RoutesRequests.callActionOnArrayBasedRoute
train
protected function callActionOnArrayBasedRoute($routeInfo) { $action = $routeInfo[1]; if (isset($action['uses'])) { return $this->prepareResponse($this->callControllerAction($routeInfo)); } foreach ($action as $value) { if ($value instanceof Closure) { $closure = $value->bindTo(new RoutingClosure()); break; }
php
{ "resource": "" }
q3972
RoutesRequests.prepareResponse
train
public function prepareResponse($response) { $request = \app(Request::class); if ($response instanceof Responsable) { $response = $response->toResponse($request); } if ($response instanceof PsrResponseInterface) { $response = (new HttpFoundationFactory())->createResponse($response); } elseif (! $response instanceof SymfonyResponse) {
php
{ "resource": "" }
q3973
EntityScanner.scan
train
public function scan($classes, $namespaceTablenames=true, $morphClassAbbreviations=true) { $this->namespaceTablenames = $namespaceTablenames; $this->morphClassAbbreviations = $morphClassAbbreviations; $metadata = []; foreach ($classes as $class) { $entityMetadata = $this->parseClass($class); if ($entityMetadata) { $metadata[$class] = $entityMetadata; }
php
{ "resource": "" }
q3974
EntityScanner.parseClass
train
public function parseClass($class) { $reflectionClass = new ReflectionClass($class); // check if class is entity
php
{ "resource": "" }
q3975
EntityScanner.parseEmbeddedClass
train
protected function parseEmbeddedClass($name, Annotation $annotation, EntityDefinition &$entityMetadata, $primaryKeyOnly = false) { // check if related class is valid $annotation->class = $this->getRealEntity($annotation->class, $entityMetadata['class']); $reflectionClass = new ReflectionClass($annotation->class); $classAnnotations = $this->reader->getClassAnnotations($reflectionClass); // check if class is embedded class $this->validator->validateEmbeddedClass($annotation->class, $classAnnotations); $embeddedColumnPrefix = ($annotation->columnPrefix || $annotation->columnPrefix === false) ? $annotation->columnPrefix : $name; $embeddedClassMetadata =
php
{ "resource": "" }
q3976
EntityScanner.setAdditionalColumnProperties
train
protected function setAdditionalColumnProperties($name, Annotation &$annotation, array $propertyAnnotations, $embedded=false, $columnPrefix=false) { // scan for primary and versioned property foreach ($propertyAnnotations as $subAnnotation) { // set primary key if ($subAnnotation instanceof \ProAI\Datamapper\Annotations\Id) { $annotation->primary = true; } // set auto increment if ($subAnnotation instanceof \ProAI\Datamapper\Annotations\AutoIncrement) { $annotation->autoIncrement = true; } // set auto increment
php
{ "resource": "" }
q3977
EntityScanner.parseColumn
train
protected function parseColumn($name, Annotation $annotation, EntityDefinition &$entityMetadata, $embedded=false, $primaryKeyOnly = false) { if ($annotation->primary == $primaryKeyOnly) { // set column data if (! empty($entityMetadata['versionTable']) && $annotation->versioned) { $entityMetadata['versionTable']['columns'][] = $this->generateColumn($name, $annotation); } else { $entityMetadata['table']['columns'][] = $this->generateColumn($name, $annotation); } // set up version feature
php
{ "resource": "" }
q3978
EntityScanner.generateColumn
train
protected function generateColumn($name, $annotation) { // check if column type is valid $this->validator->validateColumnType($annotation->type); // add column return new ColumnDefinition([ 'name' => $annotation->name, 'type' => $annotation->type, 'nullable' => $annotation->nullable,
php
{ "resource": "" }
q3979
EntityScanner.generateVersionTable
train
protected function generateVersionTable($name, Annotation $annotation, EntityDefinition &$entityMetadata) { $annotation = clone $annotation; $annotation->name ='ref_' . $annotation->name; $annotation->autoIncrement = false;
php
{ "resource": "" }
q3980
EntityScanner.generateAttributeOptionsArray
train
protected function generateAttributeOptionsArray(Annotation $annotation) { $options = []; // length option if ($annotation->type == 'string' || $annotation->type == 'char' || $annotation->type == 'binary') { $options['length'] = $annotation->length; } // fixed option if ($annotation->type == 'binary' && $annotation->length == 16) { $options['fixed'] = $annotation->fixed; $options['autoUuid'] = $annotation->autoUuid; } // unsigned and autoIncrement option if ($annotation->type == 'smallInteger' || $annotation->type == 'integer' || $annotation->type == 'bigInteger') {
php
{ "resource": "" }
q3981
EntityScanner.parseRelation
train
protected function parseRelation($name, Annotation $annotation, EntityDefinition &$entityMetadata) { // check if relation type is valid $this->validator->validateRelationType($annotation->type); // check if we need to add base namespace from configuration $annotation->relatedEntity = $annotation->relatedEntity ? $this->getRealEntity($annotation->relatedEntity, $entityMetadata['class']) : null; $annotation->throughEntity = $annotation->throughEntity ? $this->getRealEntity($annotation->throughEntity, $entityMetadata['class']) : null; // change morphedByMany to inverse morphToMany if ($annotation->type == 'morphedByMany') { $annotation->type = 'morphToMany'; $annotation->inverse = true; } // create extra columns for belongsTo if ($annotation->type == 'belongsTo') { $this->generateBelongsToColumns($name, $annotation, $entityMetadata); } // create extra columns for morphTo if ($annotation->type == 'morphTo') { $this->generateMorphToColumns($name, $annotation, $entityMetadata); } $pivotTable = null; // create
php
{ "resource": "" }
q3982
EntityScanner.generateBelongsToColumns
train
protected function generateBelongsToColumns($name, Annotation $annotation, EntityDefinition &$entityMetadata) { $relatedForeignKey = $annotation->relatedForeignKey ?: $this->generateKey($annotation->relatedEntity); $entityMetadata['table']['columns'][] = $this->getModifiedPrimaryKeyColumn($entityMetadata['table'], [
php
{ "resource": "" }
q3983
EntityScanner.generateMorphToColumns
train
protected function generateMorphToColumns($name, Annotation $annotation, EntityDefinition &$entityMetadata) { $morphName = (! empty($annotation->morphName)) ? $annotation->morphName : $name; $morphId = (! empty($annotation->morphId)) ? $annotation->morphId : $morphName.'_id'; $morphType = (! empty($annotation->morphType)) ? $annotation->morphType : $morphName.'_type'; $entityMetadata['table']['columns'][] = $this->getModifiedPrimaryKeyColumn($entityMetadata['table'], [ 'name' => $morphId, 'primary' => false, 'options' => [
php
{ "resource": "" }
q3984
EntityScanner.generateBelongsToManyPivotTable
train
protected function generateBelongsToManyPivotTable($name, Annotation $annotation, EntityDefinition &$entityMetadata) { $tableName = ($annotation->pivotTable) ? $annotation->pivotTable : $this->generatePivotTablename($entityMetadata['class'], $annotation->relatedEntity, $annotation->inverse); $localPivotKey = $annotation->localForeignKey ?: $this->generateKey($entityMetadata['class']); $relatedPivotKey = $annotation->relatedForeignKey ?: $this->generateKey($annotation->relatedEntity);
php
{ "resource": "" }
q3985
EntityScanner.generateMorphToManyPivotTable
train
protected function generateMorphToManyPivotTable($name, Annotation $annotation, EntityDefinition &$entityMetadata) { $morphName = $annotation->morphName; $tableName = ($annotation->pivotTable) ? $annotation->pivotTable : $this->generatePivotTablename($entityMetadata['class'], $annotation->relatedEntity, $annotation->inverse, $morphName); if ($annotation->inverse) { $pivotKey = $annotation->localPivotKey ?: $this->generateKey($entityMetadata['class']); } else { $pivotKey = $annotation->relatedPivotKey ?: $this->generateKey($annotation->relatedEntity); } $morphId = (! empty($annotation->localKey)) ? $annotation->localKey : $morphName.'_id'; $morphType = $morphName.'_type'; return new TableDefinition([ 'name' => $tableName, 'columns' => [ $this->getModifiedPrimaryKeyColumn($entityMetadata['table'], [ 'name' => $pivotKey, 'options' => [
php
{ "resource": "" }
q3986
EntityScanner.getModifiedPrimaryKeyColumn
train
protected function getModifiedPrimaryKeyColumn(TableDefinition $tableMetadata, array $data) { foreach($tableMetadata['columns'] as $columnMetadata) { if ($columnMetadata['primary']) { $modifiedColumnMetadata = clone $columnMetadata; foreach($data as $key => $value) { if ($key == 'options') { $modifiedColumnMetadata[$key] = array_merge($modifiedColumnMetadata[$key], $value);
php
{ "resource": "" }
q3987
EntityScanner.generateMorphableClasses
train
protected function generateMorphableClasses(array &$metadata) { foreach ($metadata as $key => $entityMetadata) { foreach ($entityMetadata['relations'] as $relationKey => $relationMetadata) { // get morphable classes for morphTo relations if ($relationMetadata['type'] == 'morphTo') { $metadata[$key]['relations'][$relationKey]['options']['morphableClasses'] = $this->getMorphableClasses($entityMetadata['class'], $relationMetadata['options']['morphName'], $metadata); } // get morphable classes for morphToMany relations
php
{ "resource": "" }
q3988
EntityScanner.getMorphableClasses
train
protected function getMorphableClasses($relatedEntity, $morphName, array $metadata, $many=false) { $morphableClasses = []; foreach ($metadata as $entityMetadata) { foreach ($entityMetadata['relations'] as $relationMetadata) { // check relation type if (! ((! $many && $relationMetadata['type'] == 'morphOne') || (! $many && $relationMetadata['type'] == 'morphMany') || ($many && $relationMetadata['type'] == 'morphToMany' && $relationMetadata['options']['inverse']))) { continue; }
php
{ "resource": "" }
q3989
EntityScanner.generatePivotTablename
train
protected function generatePivotTablename($class1, $class2, $inverse, $morph=null) { // datamapper namespace tables if ($this->namespaceTablenames) { $base = ($inverse) ? $this->generateTableName($class1, true) : $this->generateTableName($class2, true); $related = (! empty($morph)) ? $morph : (! empty($inverse) ? snake_case(class_basename($class2))
php
{ "resource": "" }
q3990
EntityScanner.generateTableName
train
protected function generateTableName($class) { // datamapper namespace tables if ($this->namespaceTablenames) { $className = array_slice(explode('/', str_replace('\\', '/', $class)), 2); // delete last entry if entry is equal to the next to last entry if (count($className) >= 2 && end($className) == prev($className)) { array_pop($className); } $classBasename = array_pop($className);
php
{ "resource": "" }
q3991
EntityScanner.getColumnName
train
protected function getColumnName($name, $prefix = false) { $name = snake_case($name); if ($prefix) {
php
{ "resource": "" }
q3992
CensusHydrator.hydrateCollection
train
public static function hydrateCollection(array $censuses) { $hydrated = []; foreach ($censuses as $census) {
php
{ "resource": "" }
q3993
CensusHydrator.hydrate
train
public static function hydrate(stdClass $census) { $hydrated = new CensusEntity(); if (isset($census->id)) { $hydrated->setId($census->id); } if (isset($census->scans)) { $hydrated->setScans($census->scans); } if (isset($census->issues)) {
php
{ "resource": "" }
q3994
CNabuSiteBase.getAllSites
train
public static function getAllSites(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_site_id', 'select * ' . 'from nb_site ' . 'where
php
{ "resource": "" }
q3995
CNabuSiteBase.setMountingOrder
train
public function setMountingOrder(int $mounting_order = 0) : CNabuDataObject { if ($mounting_order === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3996
CNabuSiteBase.setPublished
train
public function setPublished(string $published = "F") : CNabuDataObject { if ($published === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3997
CNabuSiteBase.setPublicBasePathEnabled
train
public function setPublicBasePathEnabled(string $public_base_path_enabled = "F") : CNabuDataObject { if ($public_base_path_enabled === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3998
CNabuSiteBase.setDefaultTargetUseURI
train
public function setDefaultTargetUseURI(string $default_target_use_uri = "N") : CNabuDataObject { if ($default_target_use_uri === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }
q3999
CNabuSiteBase.setDefaultErrorCode
train
public function setDefaultErrorCode(int $default_error_code = 301) : CNabuDataObject { if ($default_error_code === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
php
{ "resource": "" }