_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q4100 | LdapHydrator.hydrateCollection | train | public static function hydrateCollection(array $ldaps)
{
$hydrated = [];
foreach ($ldaps as $ldap) {
| php | {
"resource": ""
} |
q4101 | LdapHydrator.hydrate | train | public static function hydrate(stdClass $ldap)
{
$hydrated = new LdapEntity();
if (isset($ldap->id)) {
$hydrated->setId($ldap->id);
}
if (isset($ldap->enabled)) {
$hydrated->setEnabled($ldap->enabled);
}
if (isset($ldap->search_dn)) {
$hydrated->setSearchDn($ldap->search_dn);
}
if (isset($ldap->search_password)) {
$hydrated->setSearchPassword($ldap->search_password);
}
if (isset($ldap->search_query)) {
$hydrated->setSearchQuery($ldap->search_query);
}
if (isset($ldap->base_dn)) {
$hydrated->setBaseDn($ldap->base_dn);
}
if (isset($ldap->email_key)) {
$hydrated->setEmailKey($ldap->email_key);
}
if (isset($ldap->user_dn)) {
$hydrated->setUserDn($ldap->user_dn);
}
if (isset($ldap->host)) {
$hydrated->setHost($ldap->host);
}
if (isset($ldap->port)) {
| php | {
"resource": ""
} |
q4102 | LocalDriver.getData | train | public function getData(string $table, $name = ""){
$file = $this->base . '/' . $table . '.json';
if(file_exists($file)){
return json_decode(file_get_contents($file), true);
}else{
| php | {
"resource": ""
} |
q4103 | LocalDriver.setData | train | public function setData(string $table, $data){
$file = $this->base . '/' . $table . '.json';
if(file_exists($file)){
if(file_put_contents($file, json_encode($data))){
$status = true;
}else{
$status = false;
| php | {
"resource": ""
} |
q4104 | LocalDriver.newTable | train | public function newTable(string $name){
$status = file_put_contents($file = $this->base . '/' . $name . '.json', "[]"); | php | {
"resource": ""
} |
q4105 | LocalDriver.removeTable | train | public function removeTable(string $name){
$status = unlink($file = $this->base . '/' . $name . '.json');
| php | {
"resource": ""
} |
q4106 | APIService.initialize | train | public function initialize($email, $password, $config)
| php | {
"resource": ""
} |
q4107 | ProcessHydrator.hydrateCollection | train | public static function hydrateCollection(array $processes)
{
$hydrated = [];
foreach ($processes as $process) {
| php | {
"resource": ""
} |
q4108 | ProcessHydrator.hydrate | train | public static function hydrate(stdClass $process)
{
$hydrated = new ProcessEntity();
if (isset($process->id)) {
$hydrated->setId($process->id);
}
if (isset($process->pid)) {
$hydrated->setPid($process->pid);
}
if (isset($process->version)) {
$hydrated->setVersion($process->version);
}
if (isset($process->name)) {
$hydrated->setName($process->name);
}
if (isset($process->started_at)) {
$hydrated->setStartedAt(new DateTime($process->started_at));
}
if (isset($process->finished_at)) {
$hydrated->setFinishedAt(new DateTime($process->finished_at));
}
if (isset($process->finished)) {
| php | {
"resource": ""
} |
q4109 | ExtensionHydrator.hydrateCollection | train | public static function hydrateCollection(array $extensions)
{
$hydrated = [];
foreach ($extensions as $extension) {
| php | {
"resource": ""
} |
q4110 | ExtensionHydrator.hydrate | train | public static function hydrate(stdClass $extension)
{
$hydrated = new ExtensionEntity();
if (isset($extension->id)) {
| php | {
"resource": ""
} |
q4111 | QuotaHydrator.hydrateCollection | train | public static function hydrateCollection(array $quotas)
{
$hydrated = [];
foreach ($quotas as $quota) {
| php | {
"resource": ""
} |
q4112 | CNabuSiteTargetSectionListBase.createSecondaryIndexes | train | protected function createSecondaryIndexes()
{
$this->addIndex(
new CNabuDataObjectListIndex($this, 'nb_site_target_section_key', 'nb_site_target_section_order', self::INDEX_KEY)
| php | {
"resource": ""
} |
q4113 | CNabuSiteTargetSectionListBase.acquireItem | train | public function acquireItem($key, $index = false)
{
$retval = false;
if ($index === false && CNabuEngine::getEngine()->isMainDBAvailable()) {
$item = new CNabuSiteTargetSection($key);
| php | {
"resource": ""
} |
q4114 | CNabuMessagingBase.getAllMessagings | train | public static function getAllMessagings(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_messaging_id',
'select * '
. 'from nb_messaging '
. 'where | php | {
"resource": ""
} |
q4115 | ProcessService.getAll | train | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->processes()
| php | {
"resource": ""
} |
q4116 | ProcessService.getById | train | public function getById($appId, $scanId, $processId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->processes()
| php | {
"resource": ""
} |
q4117 | ProcessService.create | train | public function create($appId, $scanId, $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->processes()
| php | {
"resource": ""
} |
q4118 | CNabuDataObjectList.clear | train | public function clear()
{
$this->list = null;
if (is_array($this->secondary_indexes)) { | php | {
"resource": ""
} |
q4119 | CNabuDataObjectList.addIndex | train | public function addIndex(CNabuDataObjectListIndex $index)
{
$name = $index->getName();
if (is_array($this->secondary_indexes)) {
| php | {
"resource": ""
} |
q4120 | CNabuDataObjectList.getIndex | train | public function getIndex($index)
{
if (is_string($index) &&
is_array($this->secondary_indexes) &&
array_key_exists($index, $this->secondary_indexes)
) {
return $this->secondary_indexes[$index];
} else { | php | {
"resource": ""
} |
q4121 | CNabuDataObjectList.getKeys | train | public function getKeys($index = false)
{
$retval = null;
if ($index === false) {
$retval = is_array($this->list) ? array_keys($this->list) : null;
} elseif (is_string($index) &&
is_array($this->secondary_indexes) &&
array_key_exists($index, $this->secondary_indexes)
) {
| php | {
"resource": ""
} |
q4122 | CNabuDataObjectList.addItem | train | public function addItem(CNabuDataObject $item)
{
$retval = false;
if ($this->index_field !== false) {
if ($item->contains($this->index_field)) {
if (is_array($this->list)) {
$this->list[$item->getValue($this->index_field)] = $item;
$retval = $item;
} else {
$this->list = array(
$item->getValue($this->index_field) => $item
);
$retval = $item;
}
}
} else {
| php | {
"resource": ""
} |
q4123 | CNabuDataObjectList.indexItem | train | protected function indexItem(CNabuDataObject $item)
{
if (is_array($this->secondary_indexes)) { | php | {
"resource": ""
} |
q4124 | CNabuDataObjectList.removeItemIndex | train | protected function removeItemIndex(CNabuDataObject $item)
{
if (is_array($this->secondary_indexes)) {
| php | {
"resource": ""
} |
q4125 | CNabuDataObjectList.removeItem | train | public function removeItem($item)
{
$nb_index_id = nb_getMixedValue($item, $this->index_field);
if ((is_numeric($nb_index_id) || nb_isValidGUID($nb_index_id)) && $this->containsKey($nb_index_id)) {
| php | {
"resource": ""
} |
q4126 | CNabuDataObjectList.mergeArray | train | public function mergeArray(array $array = null)
{
$count = 0;
if (is_array($array)) {
if (count($array) > 0) {
foreach ($array as $key => $item) {
if (!$this->containsKey($key)) {
$this->addItem($item);
$count++;
}
| php | {
"resource": ""
} |
q4127 | MigrationCompiler.compile | train | public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, array $extensions, $extra = null)
{
// Add time to migration
$this->date->addSeconds(5);
if (File::exists(base_path('scaffolder-config/cache/migration_' . $hash . self::CACHE_EXT)))
{
return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash));
}
else
{
$this->stub = $stub;
$this->replaceClassName($modelName)
| php | {
"resource": ""
} |
q4128 | MigrationCompiler.replaceTableName | train | private function replaceTableName(stdClass $scaffolderConfig, $modelName)
{
$tableName = isset($scaffolderConfig->tableName) && !empty($scaffolderConfig->tableName) | php | {
"resource": ""
} |
q4129 | MigrationCompiler.addFields | train | private function addFields($modelData)
{
// Default primary key
$fields = $this->tab(3) . "\$table->increments('id');" . PHP_EOL . PHP_EOL;
// Check primary key
foreach ($modelData->fields as $field)
{
if ($field->index == 'primary')
{
$fields = '';
break;
}
}
foreach ($modelData->fields as $field)
{
$parsedModifiers = '';
// Check modifiers
if (!empty($field->modifiers))
{
$modifiersArray = explode(':', $field->modifiers);
foreach ($modifiersArray as $modifier)
{
$modifierAndValue = explode(',', $modifier);
if (count($modifierAndValue) == 2)
{
$parsedModifiers .= '->' . $modifierAndValue[0] . '(' . $modifierAndValue[1] . ')';
}
else
{
$parsedModifiers .= '->' . $modifierAndValue[0] . '()';
}
}
}
// Check indexes
if ($field->index != 'none')
{
$fields .= sprintf($this->tab(3) . "\$table->%s('%s')%s->%s();" . PHP_EOL, $field->type->db, $field->name, $parsedModifiers, $field->index);
}
else
{
| php | {
"resource": ""
} |
q4130 | CNabuCatalog.getTaxonomies | train | public function getTaxonomies(bool $force = false)
{
if ($this->nb_catalog_taxonomy_list->isEmpty() || $force) {
$this->nb_catalog_taxonomy_list->clear();
$this->nb_catalog_taxonomy_list->merge(
| php | {
"resource": ""
} |
q4131 | CNabuCatalog.getTags | train | public function getTags(bool $force = false)
{
if ($this->nb_catalog_tag_list->isEmpty() || $force) {
$this->nb_catalog_tag_list->clear();
$this->nb_catalog_tag_list->merge(
| php | {
"resource": ""
} |
q4132 | CNabuXMLSiteMap.setTarget | train | private function setTarget(SimpleXMLElement $element)
{
$target = $element->addChild('target');
switch ($this->nb_data_object->getUseURI()) {
case 'T':
if (($nb_site = $this->nb_data_object->getSite()) instanceof CNabuSite &&
($nb_site_target = $nb_site->getTarget($this->nb_data_object->getSiteTargetId())) instanceof CNabuSiteTarget
) {
$target->addAttribute('useURI', 'T');
$target->addAttribute('target', $nb_site_target->getHash());
} else {
error_log("Target not exists");
}
break;
case 'U':
$translations = $this->nb_data_object->getTranslations();
$urls = array();
$translations->iterate(function ($lang, $nb_translation) use (&$urls) {
$urls[$lang] = array(
'url' => $nb_translation->getURL(),
'match' => $nb_translation->getMatchURLFragment()
);
| php | {
"resource": ""
} |
q4133 | CNabuXMLSiteMap.setSecurity | train | private function setSecurity(SimpleXMLElement $element)
{
$security = $element->addChild('security');
| php | {
"resource": ""
} |
q4134 | CNabuXMLSiteMap.setMapChilds | train | private function setMapChilds(SimpleXMLElement $element)
{
$nb_map_list = $this->nb_data_object->getChilds();
if ($nb_map_list->getSize() > 0) {
| php | {
"resource": ""
} |
q4135 | Tool.checkImplement | train | public static function checkImplement($class, string $interface){
$ref = new \ReflectionClass($class);
$names = $ref->getInterfaceNames();
if(in_array($interface, | php | {
"resource": ""
} |
q4136 | Dump.arrayToXML | train | protected static function arrayToXML($data, &$xml = null){
if($xml === null)
$xml = new \SimpleXMLElement("<?xml version=\"1.0\"?><nondb></nondb>");
foreach($data as $k=>$v){
if(is_array($v)){
$sub = $xml->addChild("$k");
self::arrayToXML($v, $sub);
| php | {
"resource": ""
} |
q4137 | ProfileHydrator.hydrateCollection | train | public static function hydrateCollection(array $profiles)
{
$hydrated = [];
foreach ($profiles as $profile) {
| php | {
"resource": ""
} |
q4138 | ProfileHydrator.hydrate | train | public static function hydrate(stdClass $profile)
{
$hydrated = new ProfileEntity();
if (isset($profile->id)) {
$hydrated->setId($profile->id);
}
if (isset($profile->name)) {
$hydrated->setName($profile->name);
}
if (isset($profile->setting)) {
$hydrated->setSetting(SettingHydrator::hydrate($profile->setting));
}
if (isset($profile->controllers) && is_array($profile->controllers)) {
$hydrated->setControllers(ControllerHydrator::hydrateCollection($profile->controllers));
}
if (isset($profile->sources) && is_array($profile->sources)) {
$hydrated->setSources(SourceHydrator::hydrateCollection($profile->sources));
}
if (isset($profile->sinks) && is_array($profile->sinks)) {
$hydrated->setSinks(SinkHydrator::hydrateCollection($profile->sinks));
}
| php | {
"resource": ""
} |
q4139 | Verb.equals | train | public function equals(Verb $verb): bool
{
if (!$this->id->equals($verb->id)) {
return false;
}
if (null === $this->display && null === $verb->display) {
return true;
}
if (null !== $this->display xor null !== $verb->display) {
return false;
}
if (count($this->display) !== count($verb->getDisplay())) {
return false;
}
foreach ($this->display as | php | {
"resource": ""
} |
q4140 | JavaHydrator.hydrateCollection | train | public static function hydrateCollection(array $javas)
{
$hydrated = [];
foreach ($javas as $java) {
| php | {
"resource": ""
} |
q4141 | JavaHydrator.hydrate | train | public static function hydrate(stdClass $java)
{
$hydrated = new JavaEntity();
if (isset($java->id)) {
$hydrated->setId($java->id);
}
if (isset($java->major_version)) {
$hydrated->setMajorVersion($java->major_version);
}
if (isset($java->minor_version)) {
| php | {
"resource": ""
} |
q4142 | ParentClass.setParent | train | public function setParent($parent){
$this->parent = $parent;
if($this->parentCallback){
| php | {
"resource": ""
} |
q4143 | ParentClass.setCallback | train | public function setCallback(Callable $callback, bool $force = false){
if($force || !$this->parentCallback){
$this->parentCallback | php | {
"resource": ""
} |
q4144 | FoundationSupports.withFoundation | train | public function withFoundation()
{
$this->make('events')->listen('orchestra.auth: roles', UserAccess::class); | php | {
"resource": ""
} |
q4145 | CNabuDBAbstractDescriptor.getPrimaryConstraint | train | protected function getPrimaryConstraint($force = false)
{
if ($this->primary_constraint === null || $force) {
$this->primary_constraint = null;
if (array_key_exists('constraints', $this->storage_descriptor)) {
foreach ($this->storage_descriptor['constraints'] as $constraint) {
if (is_array($constraint) &&
array_key_exists('primary', $constraint) &&
| php | {
"resource": ""
} |
q4146 | TNabuSiteTargetCTAChild.setSiteTargetCTA | train | public function setSiteTargetCTA(CNabuSiteTargetCTA $nb_site_target_cta, $field = NABU_SITE_TARGET_CTA_FIELD_ID)
{
$this->nb_site_target_cta = $nb_site_target_cta;
if ($this instanceof CNabuDataObject) {
| php | {
"resource": ""
} |
q4147 | TNabuMediotecaChild.getMedioteca | train | public function getMedioteca($nb_customer = false, $force = false)
{
if (($this->nb_medioteca === null || $force) && !$this->isValueNull(NABU_MEDIOTECA_FIELD_ID)) {
$this->nb_medioteca = null;
if (($nb_final_cust = nb_grantCustomer($nb_customer, $force)) !==false) {
| php | {
"resource": ""
} |
q4148 | TNabuMediotecaChild.setMedioteca | train | public function setMedioteca(CNabuMedioteca $nb_medioteca, $field = NABU_MEDIOTECA_FIELD_ID)
{
$this->nb_medioteca = $nb_medioteca;
if ($this instanceof CNabuDataObject) {
| php | {
"resource": ""
} |
q4149 | CNabuMediotecaBase.getAllMediotecas | train | public static function getAllMediotecas(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_medioteca_id',
'select * '
. 'from nb_medioteca '
. 'where | php | {
"resource": ""
} |
q4150 | CNabuMediotecaBase.getCustomerUsedLanguages | train | public static function getCustomerUsedLanguages($nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID);
if (is_numeric($nb_customer_id)) {
$nb_language_list = CNabuLanguage::buildObjectListFromSQL(
'nb_language_id',
'select l.* '
. 'from nb_language l, '
. '(select distinct nb_language_id '
. 'from nb_medioteca ca, nb_medioteca_lang cal '
| php | {
"resource": ""
} |
q4151 | QueryBuilder.forge | train | public static function forge($classname = null, $db_table_alias = null, $escape = true){
if (!is_null($classname)) {
$object = new $classname;
} else if(get_called_class() != "Pragma\ORM\QueryBuilder") {
$object = new static();
}
else {
| php | {
"resource": ""
} |
q4152 | IdGenerator.encode | train | public static function encode(
$cacheVersion = WurflConstants::API_NAMESPACE,
$namespace = AbstractAdapter::DEFAULT_NAMESPACE,
$cacheId = ''
) {
| php | {
"resource": ""
} |
q4153 | CNabuMessagingService.getTemplateConnections | train | public function getTemplateConnections(bool $force = false) : CNabuMessagingServiceTemplateList
{
if ($this->nb_messaging_template_service_list->isEmpty() || $force) {
| php | {
"resource": ""
} |
q4154 | CNabuMessagingService.isTemplateConnected | train | public function isTemplateConnected($nb_template) : bool
{
$retval = false;
if (is_numeric($nb_template_id = nb_getMixedValue($nb_template, NABU_MESSAGING_TEMPLATE_FIELD_ID))) {
$this->getTemplateConnections();
| php | {
"resource": ""
} |
q4155 | CNabuMessagingService.getActiveMessagingServices | train | public static function getActiveMessagingServices(CNabuMessaging $nb_messaging)
{
$nb_messaging_id = nb_getMixedValue($nb_messaging, 'nb_messaging_id');
if (is_numeric($nb_messaging_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_messaging_service_id',
'SELECT *
FROM nb_messaging_service
WHERE nb_messaging_id=%messaging_id$d
| php | {
"resource": ""
} |
q4156 | TNabuUserChild.getUser | train | public function getUser($force = false)
{
if ($this->nb_user === null || $force) {
$this->nb_user = null;
if ($this instanceof CNabuDataObject &&
$this->contains(NABU_USER_FIELD_ID) &&
$this->isValueNumeric(NABU_USER_FIELD_ID)
) {
| php | {
"resource": ""
} |
q4157 | TNabuUserChild.setUser | train | public function setUser(CNabuUser $nb_user)
{
$this->nb_user = $nb_user;
if ($this | php | {
"resource": ""
} |
q4158 | TNabuSiteTargetChild.setSiteTarget | train | public function setSiteTarget(CNabuSiteTarget $nb_site_target = null, $field = NABU_SITE_TARGET_FIELD_ID)
{
$this->nb_site_target = $nb_site_target;
if ($this instanceof CNabuDataObject) {
| php | {
"resource": ""
} |
q4159 | AuthServiceProvider.bindAuthForApiToken | train | protected function bindAuthForApiToken()
{
Auth::viaRequest('api', function ($request) {
if ($request->input('api_token')) {
| php | {
"resource": ""
} |
q4160 | AuthServiceProvider.bindAuthForJwtToken | train | protected function bindAuthForJwtToken()
{
Auth::viaRequest('jwt', function ($request) {
try {
if (! $user = JWTAuth::parseToken()->authenticate()) {
return;
| php | {
"resource": ""
} |
q4161 | BaseBuilder.toArray | train | public function toArray()
{
$out = [];
foreach ($this->setFields as $key) {
$property = $this->{$key};
if ($property instanceof DateTime) {
| php | {
"resource": ""
} |
q4162 | CNabuSiteMapRoleBase.setSiteMapId | train | public function setSiteMapId(int $nb_site_map_id = 0) : CNabuDataObject
{
if ($nb_site_map_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
| php | {
"resource": ""
} |
q4163 | CNabuSiteMapRoleBase.setZone | train | public function setZone(string $zone = "B") : CNabuDataObject
{
if ($zone === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$zone")
| php | {
"resource": ""
} |
q4164 | CNabuDomainZoneBase.getAllDomainZones | train | public static function getAllDomainZones(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_domain_zone_id',
'select * '
. 'from nb_domain_zone '
. 'where | php | {
"resource": ""
} |
q4165 | CNabuDomainZoneBase.setOrigin | train | public function setOrigin($origin) : CNabuDataObject
{
if ($origin === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$origin")
| php | {
"resource": ""
} |
q4166 | CNabuDomainZoneBase.setTtl | train | public function setTtl(int $ttl = 86400) : CNabuDataObject
{
if ($ttl === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$ttl")
| php | {
"resource": ""
} |
q4167 | CNabuDomainZoneBase.setAdminEmail | train | public function setAdminEmail(string $admin_email) : CNabuDataObject
{
if ($admin_email === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$admin_email")
| php | {
"resource": ""
} |
q4168 | CNabuDomainZoneBase.setSerial | train | public function setSerial(int $serial = 1) : CNabuDataObject
{
if ($serial === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$serial")
| php | {
"resource": ""
} |
q4169 | CNabuDomainZoneBase.setRefresh | train | public function setRefresh(int $refresh = 10800) : CNabuDataObject
{
if ($refresh === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
| php | {
"resource": ""
} |
q4170 | CNabuDomainZoneBase.setRetry | train | public function setRetry(int $retry = 3600) : CNabuDataObject
{
if ($retry === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$retry")
| php | {
"resource": ""
} |
q4171 | CNabuDomainZoneBase.setExpiry | train | public function setExpiry(int $expiry = 604800) : CNabuDataObject
{
if ($expiry === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
| php | {
"resource": ""
} |
q4172 | CNabuDomainZoneBase.setMinimum | train | public function setMinimum(int $minimum = 10800) : CNabuDataObject
{
if ($minimum === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
| php | {
"resource": ""
} |
q4173 | CNabuDomainZoneBase.setDns01 | train | public function setDns01(string $dns_01) : CNabuDataObject
{
if ($dns_01 === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$dns_01")
| php | {
"resource": ""
} |
q4174 | CNabuDomainZoneBase.setDns02 | train | public function setDns02(string $dns_02) : CNabuDataObject
{
if ($dns_02 === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$dns_02")
| php | {
"resource": ""
} |
q4175 | CNabuDomainZoneBase.setDnsOrigin | train | public function setDnsOrigin($dns_origin) : CNabuDataObject
{
if ($dns_origin === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$dns_origin")
| php | {
"resource": ""
} |
q4176 | CNabuDomainZoneBase.setShareAll | train | public function setShareAll(string $share_all = "F") : CNabuDataObject
{
if ($share_all === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
| php | {
"resource": ""
} |
q4177 | SettingHydrator.hydrateCollection | train | public static function hydrateCollection(array $settings)
{
$hydrated = [];
foreach ($settings as $setting) {
| php | {
"resource": ""
} |
q4178 | SettingHydrator.hydrate | train | public static function hydrate(stdClass $setting)
{
$hydrated = new SettingEntity();
if (isset($setting->key)) {
$hydrated->setKey($setting->key);
}
if (isset($setting->value)) {
$hydrated->setValue($setting->value);
| php | {
"resource": ""
} |
q4179 | CNabuMessagingTemplateBase.getAllMessagingTemplates | train | public static function getAllMessagingTemplates(CNabuMessaging $nb_messaging)
{
$nb_messaging_id = nb_getMixedValue($nb_messaging, 'nb_messaging_id');
if (is_numeric($nb_messaging_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_messaging_template_id',
'select * '
. 'from nb_messaging_template '
. 'where | php | {
"resource": ""
} |
q4180 | CommandsServiceProvider.registerEntityScanner | train | protected function registerEntityScanner()
{
$app = $this->app;
$app->singleton('datamapper.entity.scanner', function ($app) { | php | {
"resource": ""
} |
q4181 | CNabuCatalogTagBase.findByKey | train | public static function findByKey($nb_catalog, $key)
{
$nb_catalog_id = nb_getMixedValue($nb_catalog, 'nb_catalog_id');
if (is_numeric($nb_catalog_id)) {
$retval = CNabuCatalogTag::buildObjectFromSQL(
'select * '
. 'from nb_catalog_tag '
. 'where nb_catalog_id=%catalog_id$d '
. "and nb_catalog_tag_key='%key\$s'",
| php | {
"resource": ""
} |
q4182 | CNabuCatalogTagBase.getAllCatalogTags | train | public static function getAllCatalogTags(CNabuCatalog $nb_catalog)
{
$nb_catalog_id = nb_getMixedValue($nb_catalog, 'nb_catalog_id');
if (is_numeric($nb_catalog_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_catalog_tag_id',
'select * '
. 'from nb_catalog_tag '
. 'where | php | {
"resource": ""
} |
q4183 | CNabuCatalogTagBase.getFilteredCatalogTagList | train | public static function getFilteredCatalogTagList($nb_catalog, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_catalog_id = nb_getMixedValue($nbu_customer, NABU_CATALOG_FIELD_ID);
if (is_numeric($nb_catalog_id)) {
$fields_part = nb_prefixFieldList(CNabuCatalogTagBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuCatalogTagBase::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": ""
} |
q4184 | CNabuMessagingPoolManager.getFactory | train | public function getFactory(CNabuMessaging $nb_messaging)
{
$retval = false;
$nb_customer = $this->getCustomer();
if ($nb_messaging->validateCustomer($nb_customer)) {
if (is_numeric($nb_messaging_id = nb_getMixedValue($nb_messaging, NABU_MESSAGING_FIELD_ID))) {
| php | {
"resource": ""
} |
q4185 | LibraryHydrator.hydrateCollection | train | public static function hydrateCollection(array $libraries)
{
$hydrated = [];
foreach ($libraries as $library) {
| php | {
"resource": ""
} |
q4186 | LibraryHydrator.hydrate | train | public static function hydrate(stdClass $library)
{
$hydrated = new LibraryEntity();
if (isset($library->id)) {
$hydrated->setId($library->id);
}
if (isset($library->name)) {
$hydrated->setName($library->name);
| php | {
"resource": ""
} |
q4187 | CheckIfDead.isLinkDead | train | public function isLinkDead( $url ) {
$deadVal = $this->areLinksDead( | php | {
"resource": ""
} |
q4188 | CheckIfDead.performFullRequest | train | protected function performFullRequest( $urls ) {
// Create multiple curl handle
$multicurl_resource = curl_multi_init();
if ( $multicurl_resource === false ) {
return false;
}
$curl_instances = [];
$deadlinks = [];
foreach ( $urls as $id => $url ) {
$curl_instances[$id] = curl_init();
if ( $curl_instances[$id] === false ) {
return false;
}
// Get appropriate curl options
curl_setopt_array(
$curl_instances[$id],
$this->getCurlOptions( $this->sanitizeURL( $url, false, true ), true )
);
// Add the instance handle
curl_multi_add_handle( $multicurl_resource, $curl_instances[$id] );
}
// Let's do the CURL operations
$active = null;
do {
$mrc = curl_multi_exec( $multicurl_resource, $active );
} while ( $mrc == CURLM_CALL_MULTI_PERFORM );
while ( $active && $mrc == CURLM_OK ) {
if ( curl_multi_select( $multicurl_resource ) == -1 ) {
// To prevent CPU spike
usleep( 100 );
}
do {
$mrc = curl_multi_exec( $multicurl_resource, $active );
} | php | {
"resource": ""
} |
q4189 | CheckIfDead.queueRequests | train | protected function queueRequests( $urls ) {
$this->curlQueue = [];
if ( $this->queuedTesting === false ) {
$this->curlQueue[] = $urls;
return;
}
foreach ( $urls as $url ) {
$domain = $this->parseURL( $url )['host'];
$queuedUrl = false;
$queueIndex = -1;
foreach ( $this->curlQueue as $queueIndex => $urlList ) {
if ( $queuedUrl === false && !isset( $urlList[$domain] ) ) | php | {
"resource": ""
} |
q4190 | CheckIfDead.getCurlOptions | train | protected function getCurlOptions( $url, $full = false ) {
$requestType = $this->getRequestType( $url );
if ( $requestType == "MMS" ) {
$url = str_ireplace( "mms://", "rtsp://", $url );
}
$options = [
CURLOPT_URL => $url,
CURLOPT_HEADER => 1,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_AUTOREFERER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_TIMEOUT => $this->curlTimeoutNoBody,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_COOKIEJAR => sys_get_temp_dir() . "checkifdead.cookies.dat"
];
if ( $requestType == "RTSP" || $requestType == "MMS" ) {
$header = [];
$options[CURLOPT_USERAGENT] = $this->mediaAgent;
} else {
// Emulate a web browser request but make it accept more than a web browser
$header = [
// @codingStandardsIgnoreStart Line exceeds 100 characters
'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
// @codingStandardsIgnoreEnd
'Cache-Control: max-age=0',
'Connection: keep-alive',
'Keep-Alive: 300',
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Accept-Language: en-us,en;q=0.7,*;q=0.5',
'Accept-Encoding: *',
'Pragma: '
];
if ( $this->customUserAgent === false ) {
$options[CURLOPT_USERAGENT] = $this->userAgent;
} | php | {
"resource": ""
} |
q4191 | CheckIfDead.processCurlResults | train | protected function processCurlResults( $curlInfo, $full = false ) {
// Determine if we are using FTP or HTTP
$requestType = $this->getRequestType( $curlInfo['url'] );
// Get HTTP code returned
$httpCode = $curlInfo['http_code'];
// Get final URL
$effectiveUrl = $curlInfo['effective_url'];
// Clean final url, removing scheme, 'www', and trailing slash
$effectiveUrlClean = $this->cleanURL( $effectiveUrl );
// Get an array of possible root urls
$possibleRoots = $this->getDomainRoots( $curlInfo['url'] );
if ( $httpCode >= 400 && $httpCode < 600 ) {
if ( $full ) {
$this->errors[$curlInfo['rawurl']] = "RESPONSE CODE: $httpCode";
return true;
} else {
// Some servers don't support NOBODY requests, so if an HTTP error code
// is returned, we'll check the URL again with a full page request.
return null;
}
}
// Check for error messages in redirected URL string
if ( strpos( $effectiveUrlClean, '/404.htm' ) !== false ||
strpos( $effectiveUrlClean, '/404/' ) !== false ||
stripos( $effectiveUrlClean, 'notfound' ) !== false
) {
if ( $full ) {
$this->errors[$curlInfo['rawurl']] = "REDIRECT TO 404";
return true;
} else {
// Some servers don't support NOBODY requests, so if redirect to a 404 page
// is returned, we'll check the URL again with a full page request.
return null;
}
}
// Check if there was a redirect by comparing final URL with original URL
if ( $effectiveUrlClean != $this->cleanURL( $curlInfo['url'] ) ) {
// Check against possible roots
foreach ( $possibleRoots as $root ) {
// We found a match with final url and a possible root url
if ( $root == $effectiveUrlClean ) {
$this->errors[$curlInfo['rawurl']] = "REDIRECT TO ROOT";
return true; | php | {
"resource": ""
} |
q4192 | CheckIfDead.getDomainRoots | train | protected function getDomainRoots( $url ) {
$roots = [];
$pieces = parse_url( $url );
if ( !isset( $pieces['host'], $pieces['host'] ) ) {
return [];
}
$roots[] = $pieces['host'];
$roots[] = $pieces['host'] . '/';
$domain = isset( $pieces['host'] ) ? $pieces['host'] : ''; | php | {
"resource": ""
} |
q4193 | CheckIfDead.parseURL | train | public function parseURL( $url ) {
// Feeding fully encoded URLs will not work. So let's detect and decode if needed first.
// This is just idiot proofing.
// See if the URL is fully encoded by checking if the :// is encoded.
// This prevents URLs where double encoded values aren't mistakenly decoded breaking the URL.
if ( preg_match( '/^([a-z0-9\+\-\.]*)(?:%3A%2F%2F|%3A\/\/|:%2F%2F)/i', $url ) ) {
// First let's break the fragment out to prevent accidentally mistaking a decoded %23 as a #
$fragment = parse_url( $url, PHP_URL_FRAGMENT );
if ( !is_null( $fragment ) ) {
$url = strstr( $url, "#", true );
}
// Decode URL
$url = rawurldecode( $url );
// Re-encode the remaining #'s
$url = str_replace( "#", "%23", $url );
// Reattach the fragment
if ( !is_null( $fragment ) | php | {
"resource": ""
} |
q4194 | CheckIfDead.cleanURL | train | public function cleanURL( $input ) {
// scheme and www
$url = preg_replace( '/^((https?:|ftp:)?(\/\/))?(www\.)?/', '', | php | {
"resource": ""
} |
q4195 | CNabuSiteAliasHostBase.setSiteAliasId | train | public function setSiteAliasId(int $nb_site_alias_id) : CNabuDataObject
{
if ($nb_site_alias_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
| php | {
"resource": ""
} |
q4196 | CNabuSiteAliasHostBase.setServerHostId | train | public function setServerHostId(int $nb_server_host_id) : CNabuDataObject
{
if ($nb_server_host_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
| php | {
"resource": ""
} |
q4197 | CNabuSiteAliasHostBase.setLastUpdateErrorCode | train | public function setLastUpdateErrorCode(int $last_update_error_code = 0) : CNabuDataObject
{
if ($last_update_error_code === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
| php | {
"resource": ""
} |
q4198 | CNabuHTTPRenderDescriptor.setKey | train | public function setKey($key)
{
if ($key === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$key")
);
| php | {
"resource": ""
} |
q4199 | CNabuHTTPRenderDescriptor.setClassName | train | public function setClassName($class_name)
{
if ($class_name === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$class_name")
);
}
$implements_list = class_implements($class_name, true);
if (is_array($implements_list) &&
array_search('nabu\http\interfaces\INabuHTTPResponseRender', $implements_list)
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.