_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
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, ...
php
{ "resource": "" }
q3901
CNabuMedioteca.refresh
train
public function refresh(bool $force = false, bool $cascade = false) : bool { return parent::refresh($force, $cascade) && (!$cascade || $this->getItems($force)); }
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, array("\$nb_domain_zone_id") ); } ...
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...
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 di...
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-poin...
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 ) ); foreach ( $pointers as $key => $pointer ) { if ( strpos( $pointer, $this->prefix ) === 0 ) { unset( $pointers[ $key ] ); } ...
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, array("\$nb_project_version_id") ); ...
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...
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 string" ); } if ( ! is_readable($name)) { throw new \InvalidArgumentException( __METHOD__."() expects parameter one, name, to be a readable fil...
php
{ "resource": "" }
q3910
File.getMaxChunks
train
public function getMaxChunks() { return ceil(($this->name !== null ? filesize($this->name) : 0) / $this->size); }
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... ...
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)) ...
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 = $nodes; } else { $this->index = array_merge($this->index, $nodes); } ...
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, array("\$nb_icontact_prospect_id") ...
php
{ "resource": "" }
q3916
LicenseService.getAll
train
public function getAll(array $queryParams = []) { $response = $this->api->licenses()->getAll($queryParams); return new LicensesResponse($response); }
php
{ "resource": "" }
q3917
LicenseService.getById
train
public function getById($appId, array $queryParams = []) { $response = $this->api->licenses()->getById($appId, $queryParams); return new LicenseResponse($response); }
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 ==...
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) ...
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->getTemplat...
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)); } if (!($nb_language instanceof CNabuLanguage) || $nb_language->isNew()) { ...
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_st...
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->dis...
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_lang...
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) use (&$retval, $to, $cc, $bcc, $subj...
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, $b...
php
{ "resource": "" }
q3927
LibraryService.getAll
train
public function getAll($appId, $scanId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->libraries() ->getAll($appId, $scanId, $queryParams); return new LibrariesResponse($response); }
php
{ "resource": "" }
q3928
LibraryService.getById
train
public function getById($appId, $scanId, $libraryId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->libraries() ->getById($appId, $scanId, $libraryId, $queryParams); return new LibraryResponse($response); }
php
{ "resource": "" }
q3929
LibraryService.update
train
public function update($appId, $scanId, $libraryId, $input, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->libraries() ->update($appId, $scanId, $libraryId, $input->toArray(), $queryParams); return new LibraryResponse($...
php
{ "resource": "" }
q3930
ApiRouteCompiler.compile
train
public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, array $extensions, $extra = null) { $this->stub = $stub; $this->replaceResource($modelName); return $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); ...
php
{ "resource": "" }
q3932
ControllerHydrator.hydrateCollection
train
public static function hydrateCollection(array $controllers) { $hydrated = []; foreach ($controllers as $controller) { $hydrated[] = self::hydrate($controller); } return $hydrated; }
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 (iss...
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', ...
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::getStorage...
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, array("\$customer_required") ); ...
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") ); } $this->setValue('nb_site_map_level', $l...
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, array("\$use_uri") ); } $this->setValue('nb_site_ma...
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, array("\$open_popup") ); } $this->setValue...
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, array("\$visible") ); } $this->setValue('nb_site_m...
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, array("\$separator") ); } $this->setValue('n...
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); $this->nb_site_map_role_list->addItem($nb_role); } return $nb_role; }
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->typ...
php
{ "resource": "" }
q3944
RouteCompiler.replaceResource
train
protected function replaceResource($modelName) { $this->stub = str_replace('{{resource_lw}}', strtolower($modelName), $this->stub); $this->stub = str_replace('{{resource}}', $modelName, $this->stub); return $this; }
php
{ "resource": "" }
q3945
View.getTemplateWebPath
train
public function getTemplateWebPath($file = '',$version = true) { $webPath = '/assets/'; if(!empty($file) && $version) { $webPath .= $file.'?'.$this->get_static_version(); }else{ $webPath .= $file; } return $webPath; }
php
{ "resource": "" }
q3946
View.get
train
public function get($key){ return (isset($this->tpl['vars'][$key])) ? $this->tpl['vars'][$key] : null; }
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]) && file_exists($this->getTemplatePath($this->tpl['layout']['yields'][$yield]))) include $this->getTemplatePath($this->tpl['layout']['yiel...
php
{ "resource": "" }
q3948
View.isYieldable
train
public function isYieldable($yield = self::DEFAULT_YIELD) { return (!empty($this->tpl['layout']['yields'][$yield]) && file_exists($this->getTemplatePath($this->tpl['layout']['yields'][$yield]))); }
php
{ "resource": "" }
q3949
View.compute
train
public function compute(){ if(file_exists($this->getTemplatePath($this->tpl['layout']['path']))){ include $this->getTemplatePath($this->tpl['layout']['path']); }else echo "Layout does not exists ".$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(CNabuClusterGroupServiceBa...
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") ); } $this->setValue('nb_cluster...
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( ENabu...
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_MESS...
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::...
php
{ "resource": "" }
q3956
CNabuHTTPServerPoolManager.getHTTPServerFactory
train
public function getHTTPServerFactory(CNabuHTTPServerInterfaceDescriptor $nb_descriptor) { if (!($retval = $this->nb_http_server_factory_list->getItem($nb_descriptor->getKey()))) { $retval = $this->nb_http_server_factory_list->addItem(new CNabuHTTPServerFactory($nb_descriptor)); } ...
php
{ "resource": "" }
q3957
SanitizerHydrator.hydrateCollection
train
public static function hydrateCollection(array $sanitizers) { $hydrated = []; foreach ($sanitizers as $sanitizer) { $hydrated[] = self::hydrate($sanitizer); } return $hydrated; }
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($sa...
php
{ "resource": "" }
q3959
SinkService.getAll
train
public function getAll($appId, $profileId, array $queryParams) { $response = $this->api->applications()->profiles()->sinks()->getAll($appId, $profileId, $queryParams); return new SinksResponse($response); }
php
{ "resource": "" }
q3960
SinkService.getById
train
public function getById($appId, $profileId, $sinkId, array $queryParams = []) { $response = $this->api->applications()->profiles()->sinks()->getById($appId, $profileId, $sinkId, $queryParams); return new SinkResponse($response); }
php
{ "resource": "" }
q3961
SinkService.create
train
public function create($appId, $profileId, SinkBuilder $input, array $queryParams = []) { $response = $this->api->applications()->profiles()->sinks()->create($appId, $profileId, $input->toArray(), $queryParams); return new SinkResponse($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_...
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_be...
php
{ "resource": "" }
q3964
CNabuXMLSiteTargetBase.getChilds
train
protected function getChilds(SimpleXMLElement $element) { parent::getChilds($element); $this->getChildsAsCDATAFromList($element, array( 'nb_site_target_attributes' => 'attributes' ), false); }
php
{ "resource": "" }
q3965
CNabuXMLSiteTargetBase.setChilds
train
protected function setChilds(SimpleXMLElement $element) { parent::setChilds($element); $this->putChildsAsCDATAFromList($element, array( 'nb_site_target_attributes' => 'attributes' ), false); }
php
{ "resource": "" }
q3966
IssueHydrator.hydrateCollection
train
public static function hydrateCollection(array $issues) { $hydrated = []; foreach ($issues as $issue) { $hydrated[] = self::hydrate($issue); } return $hydrated; }
php
{ "resource": "" }
q3967
ClientEntity.setAllowedGrantTypes
train
public function setAllowedGrantTypes($allowedGrantTypes) { foreach ($allowedGrantTypes as $allowedGrantType) { if (!in_array($allowedGrantType, $this->availableGrantTypes)) { throw new \Exception('Unknown grant type ' . $allowedGrantType); } } $this->a...
php
{ "resource": "" }
q3968
CNabuModuleMorphList.acquireItem
train
protected function acquireItem($key, $index = false) { $retval = false; $nb_engine = CNabuEngine::getEngine(); if ($nb_engine->isMainDBAvailable()) { $item = new CNabuModuleMorph($key); if ($item->isFetched()) { $retval = $item; } ...
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); ...
php
{ "resource": "" }
q3970
RoutesRequests.parseIncomingRequest
train
protected function parseIncomingRequest($request) { if (! $request) { $request = LumenRequest::capture(); } $this->instance(Request::class, $this->prepareRequest($request)); return [$request->getMethod(), '/'.\trim($request->getPathInfo(), '/')]; }
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) { ...
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())->c...
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 = $thi...
php
{ "resource": "" }
q3974
EntityScanner.parseClass
train
public function parseClass($class) { $reflectionClass = new ReflectionClass($class); // check if class is entity if ($this->reader->getClassAnnotation($reflectionClass, '\ProAI\Datamapper\Annotations\Entity')) { return $this->parseEntity($class); } else { ret...
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 ReflectionCla...
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 ($subAnnota...
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) { ...
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, ...
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; // copy primary key to version table $entityMetadat...
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 o...
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 ...
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($entityMe...
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 ...
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->i...
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']...
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...
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['typ...
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 (! ...
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); ...
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($...
php
{ "resource": "" }
q3991
EntityScanner.getColumnName
train
protected function getColumnName($name, $prefix = false) { $name = snake_case($name); if ($prefix) { $name = $prefix.'_'.$name; } return $name; }
php
{ "resource": "" }
q3992
CensusHydrator.hydrateCollection
train
public static function hydrateCollection(array $censuses) { $hydrated = []; foreach ($censuses as $census) { $hydrated[] = self::hydrate($census); } return $hydrated; }
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...
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, array("\$mounting_order") ); } $thi...
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, array("\$published") ); } $this->setValue('n...
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, array("\$public_base_path_enab...
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, array("\$default_target_use_uri") ...
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, array("\$default_error_code") ); ...
php
{ "resource": "" }