repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
xtlsoft/NonDB
src/Components/ParentClass.php
ParentClass.setParent
public function setParent($parent){ $this->parent = $parent; if($this->parentCallback){ call_user_func($this->parentCallback); } return $this; }
php
public function setParent($parent){ $this->parent = $parent; if($this->parentCallback){ call_user_func($this->parentCallback); } return $this; }
[ "public", "function", "setParent", "(", "$", "parent", ")", "{", "$", "this", "->", "parent", "=", "$", "parent", ";", "if", "(", "$", "this", "->", "parentCallback", ")", "{", "call_user_func", "(", "$", "this", "->", "parentCallback", ")", ";", "}", ...
Set the parent @param mixed $parent @return self
[ "Set", "the", "parent" ]
6599c13bb5feabe77d91764fdf3c24b786c777b2
https://github.com/xtlsoft/NonDB/blob/6599c13bb5feabe77d91764fdf3c24b786c777b2/src/Components/ParentClass.php#L42-L52
train
xtlsoft/NonDB
src/Components/ParentClass.php
ParentClass.setCallback
public function setCallback(Callable $callback, bool $force = false){ if($force || !$this->parentCallback){ $this->parentCallback = $callback; } return $this; }
php
public function setCallback(Callable $callback, bool $force = false){ if($force || !$this->parentCallback){ $this->parentCallback = $callback; } return $this; }
[ "public", "function", "setCallback", "(", "Callable", "$", "callback", ",", "bool", "$", "force", "=", "false", ")", "{", "if", "(", "$", "force", "||", "!", "$", "this", "->", "parentCallback", ")", "{", "$", "this", "->", "parentCallback", "=", "$", ...
Set a callback @param Callable $callback @param bool $force @return self
[ "Set", "a", "callback" ]
6599c13bb5feabe77d91764fdf3c24b786c777b2
https://github.com/xtlsoft/NonDB/blob/6599c13bb5feabe77d91764fdf3c24b786c777b2/src/Components/ParentClass.php#L63-L71
train
orchestral/lumen
src/Concerns/FoundationSupports.php
FoundationSupports.withFoundation
public function withFoundation() { $this->make('events')->listen('orchestra.auth: roles', UserAccess::class); $this->registerMemoryBindings(); $this->registerAuthorizationBindings(); return $this; }
php
public function withFoundation() { $this->make('events')->listen('orchestra.auth: roles', UserAccess::class); $this->registerMemoryBindings(); $this->registerAuthorizationBindings(); return $this; }
[ "public", "function", "withFoundation", "(", ")", "{", "$", "this", "->", "make", "(", "'events'", ")", "->", "listen", "(", "'orchestra.auth: roles'", ",", "UserAccess", "::", "class", ")", ";", "$", "this", "->", "registerMemoryBindings", "(", ")", ";", ...
Bootstrap Orchestra Platform Foundation. @return $this
[ "Bootstrap", "Orchestra", "Platform", "Foundation", "." ]
85a004e7cde0517b527241154f5ad031b7215851
https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/src/Concerns/FoundationSupports.php#L14-L22
train
nabu-3/core
nabu/db/CNabuDBAbstractDescriptor.php
CNabuDBAbstractDescriptor.getPrimaryConstraint
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) && $constraint['primary'] === true ) { $this->primary_constraint = $constraint; break; } } } } return $this->primary_constraint; }
php
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) && $constraint['primary'] === true ) { $this->primary_constraint = $constraint; break; } } } } return $this->primary_constraint; }
[ "protected", "function", "getPrimaryConstraint", "(", "$", "force", "=", "false", ")", "{", "if", "(", "$", "this", "->", "primary_constraint", "===", "null", "||", "$", "force", ")", "{", "$", "this", "->", "primary_constraint", "=", "null", ";", "if", ...
Gets the Primary Constraint array fragment of the descriptor. This method is protected to prevent to expose the array to public accesses. @param bool $force If true, forces to update the Primary Constraint from the Storage main descriptor. @return array Returns the array fragment that describes the Primary Constraint.
[ "Gets", "the", "Primary", "Constraint", "array", "fragment", "of", "the", "descriptor", ".", "This", "method", "is", "protected", "to", "prevent", "to", "expose", "the", "array", "to", "public", "accesses", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/db/CNabuDBAbstractDescriptor.php#L304-L322
train
nabu-3/core
nabu/data/site/traits/TNabuSiteTargetCTAChild.php
TNabuSiteTargetCTAChild.setSiteTargetCTA
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) { $this->transferValue($nb_site_target_cta, NABU_SITE_TARGET_CTA_FIELD_ID, $field); } return $this; }
php
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) { $this->transferValue($nb_site_target_cta, NABU_SITE_TARGET_CTA_FIELD_ID, $field); } return $this; }
[ "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", ...
Sets the Site Target CTA instance that owns this object and sets the field containing the site id. @param CNabuSiteTargetCTA $nb_site_target_cta Site Target CTA instance to be setted. @param string $field Field name where the site id will be stored. @return mixed Returns $this to allow the cascade chain of setters.
[ "Sets", "the", "Site", "Target", "CTA", "instance", "that", "owns", "this", "object", "and", "sets", "the", "field", "containing", "the", "site", "id", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/traits/TNabuSiteTargetCTAChild.php#L56-L64
train
nabu-3/core
nabu/data/medioteca/traits/TNabuMediotecaChild.php
TNabuMediotecaChild.getMedioteca
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) { $this->nb_medioteca = $nb_final_cust->getMedioteca($this); } } return $this->nb_medioteca; }
php
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) { $this->nb_medioteca = $nb_final_cust->getMedioteca($this); } } return $this->nb_medioteca; }
[ "public", "function", "getMedioteca", "(", "$", "nb_customer", "=", "false", ",", "$", "force", "=", "false", ")", "{", "if", "(", "(", "$", "this", "->", "nb_medioteca", "===", "null", "||", "$", "force", ")", "&&", "!", "$", "this", "->", "isValueN...
Gets the Medioteca instance using the field value contained in parent class CNabuDataObject @param mixed $nb_customer An instance of CNabuDataObject which contains a field named nb_customer_id or an ID. When false, then uses as Customer the owner of the application. @param bool $force If true forces to reload the Medioteca instance from their repository. @return CNabuMedioteca|null Returns the Medioteca instance if setted or null if not.
[ "Gets", "the", "Medioteca", "instance", "using", "the", "field", "value", "contained", "in", "parent", "class", "CNabuDataObject" ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/traits/TNabuMediotecaChild.php#L48-L58
train
nabu-3/core
nabu/data/medioteca/traits/TNabuMediotecaChild.php
TNabuMediotecaChild.setMedioteca
public function setMedioteca(CNabuMedioteca $nb_medioteca, $field = NABU_MEDIOTECA_FIELD_ID) { $this->nb_medioteca = $nb_medioteca; if ($this instanceof CNabuDataObject) { $this->transferValue($nb_medioteca, NABU_MEDIOTECA_FIELD_ID, $field); } return $this; }
php
public function setMedioteca(CNabuMedioteca $nb_medioteca, $field = NABU_MEDIOTECA_FIELD_ID) { $this->nb_medioteca = $nb_medioteca; if ($this instanceof CNabuDataObject) { $this->transferValue($nb_medioteca, NABU_MEDIOTECA_FIELD_ID, $field); } return $this; }
[ "public", "function", "setMedioteca", "(", "CNabuMedioteca", "$", "nb_medioteca", ",", "$", "field", "=", "NABU_MEDIOTECA_FIELD_ID", ")", "{", "$", "this", "->", "nb_medioteca", "=", "$", "nb_medioteca", ";", "if", "(", "$", "this", "instanceof", "CNabuDataObjec...
Sets the Medioteca instance that owns this object and sets the field containing the Medioteca id. @param CNabuMedioteca $nb_medioteca Medioteca instance to be setted. @param string $field Field name where the Medioteca id will be stored. @return CNabuDataObject Returns $this to allow the cascade chain of setters.
[ "Sets", "the", "Medioteca", "instance", "that", "owns", "this", "object", "and", "sets", "the", "field", "containing", "the", "Medioteca", "id", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/traits/TNabuMediotecaChild.php#L66-L74
train
nabu-3/core
nabu/data/medioteca/base/CNabuMediotecaBase.php
CNabuMediotecaBase.getAllMediotecas
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 nb_customer_id=%cust_id$d', array( 'cust_id' => $nb_customer_id ), $nb_customer ); } else { $retval = new CNabuMediotecaList(); } return $retval; }
php
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 nb_customer_id=%cust_id$d', array( 'cust_id' => $nb_customer_id ), $nb_customer ); } else { $retval = new CNabuMediotecaList(); } return $retval; }
[ "public", "static", "function", "getAllMediotecas", "(", "CNabuCustomer", "$", "nb_customer", ")", "{", "$", "nb_customer_id", "=", "nb_getMixedValue", "(", "$", "nb_customer", ",", "'nb_customer_id'", ")", ";", "if", "(", "is_numeric", "(", "$", "nb_customer_id",...
Get all items in the storage as an associative array where the field 'nb_medioteca_id' is the index, and each value is an instance of class CNabuMediotecaBase. @param CNabuCustomer $nb_customer The CNabuCustomer instance of the Customer that owns the Medioteca List. @return mixed Returns and array with all items.
[ "Get", "all", "items", "in", "the", "storage", "as", "an", "associative", "array", "where", "the", "field", "nb_medioteca_id", "is", "the", "index", "and", "each", "value", "is", "an", "instance", "of", "class", "CNabuMediotecaBase", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/base/CNabuMediotecaBase.php#L180-L200
train
nabu-3/core
nabu/data/medioteca/base/CNabuMediotecaBase.php
CNabuMediotecaBase.getCustomerUsedLanguages
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 ' . 'where ca.nb_medioteca_id=cal.nb_medioteca_id ' . 'and ca.nb_customer_id=%cust_id$d) as lid ' . 'where l.nb_language_id=lid.nb_language_id', array('cust_id' => $nb_customer_id) ); } else { $nb_language_list = new CNabuLanguageList(); } return $nb_language_list; }
php
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 ' . 'where ca.nb_medioteca_id=cal.nb_medioteca_id ' . 'and ca.nb_customer_id=%cust_id$d) as lid ' . 'where l.nb_language_id=lid.nb_language_id', array('cust_id' => $nb_customer_id) ); } else { $nb_language_list = new CNabuLanguageList(); } return $nb_language_list; }
[ "public", "static", "function", "getCustomerUsedLanguages", "(", "$", "nb_customer", ")", "{", "$", "nb_customer_id", "=", "nb_getMixedValue", "(", "$", "nb_customer", ",", "NABU_CUSTOMER_FIELD_ID", ")", ";", "if", "(", "is_numeric", "(", "$", "nb_customer_id", ")...
Get all language instances used along of all Medioteca set of a Customer @param mixed $nb_customer A CNabuDataObject instance containing a field named nb_customer_id or a Customer ID @return CNabuLanguageList Returns the list of language instances used.
[ "Get", "all", "language", "instances", "used", "along", "of", "all", "Medioteca", "set", "of", "a", "Customer" ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/base/CNabuMediotecaBase.php#L323-L343
train
pragma-framework/core
Pragma/ORM/QueryBuilder.php
QueryBuilder.forge
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 { throw new \Exception("QueryBuilder can't be built without classname"); } $object->db_table_alias = $db_table_alias; $object->escape = $escape; return $object; }
php
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 { throw new \Exception("QueryBuilder can't be built without classname"); } $object->db_table_alias = $db_table_alias; $object->escape = $escape; return $object; }
[ "public", "static", "function", "forge", "(", "$", "classname", "=", "null", ",", "$", "db_table_alias", "=", "null", ",", "$", "escape", "=", "true", ")", "{", "if", "(", "!", "is_null", "(", "$", "classname", ")", ")", "{", "$", "object", "=", "n...
in order to get an instance on which execute the query
[ "in", "order", "to", "get", "an", "instance", "on", "which", "execute", "the", "query" ]
557f4b4857d36a8fd603483ec99782efdfd51c78
https://github.com/pragma-framework/core/blob/557f4b4857d36a8fd603483ec99782efdfd51c78/Pragma/ORM/QueryBuilder.php#L29-L43
train
mimmi20/WurflCache
src/Adapter/Helper/IdGenerator.php
IdGenerator.encode
public static function encode( $cacheVersion = WurflConstants::API_NAMESPACE, $namespace = AbstractAdapter::DEFAULT_NAMESPACE, $cacheId = '' ) { $cacheId = implode(':', array($cacheVersion, $namespace, $cacheId)); return hash('sha512', $cacheId); }
php
public static function encode( $cacheVersion = WurflConstants::API_NAMESPACE, $namespace = AbstractAdapter::DEFAULT_NAMESPACE, $cacheId = '' ) { $cacheId = implode(':', array($cacheVersion, $namespace, $cacheId)); return hash('sha512', $cacheId); }
[ "public", "static", "function", "encode", "(", "$", "cacheVersion", "=", "WurflConstants", "::", "API_NAMESPACE", ",", "$", "namespace", "=", "AbstractAdapter", "::", "DEFAULT_NAMESPACE", ",", "$", "cacheId", "=", "''", ")", "{", "$", "cacheId", "=", "implode"...
Encode the Object Id using the Persistence Identifier @param string $cacheVersion @param string $namespace @param string $cacheId @return string $input with the given $namespace as a prefix
[ "Encode", "the", "Object", "Id", "using", "the", "Persistence", "Identifier" ]
9fc307df74f782a879f4604ab99bf61ecfc165d4
https://github.com/mimmi20/WurflCache/blob/9fc307df74f782a879f4604ab99bf61ecfc165d4/src/Adapter/Helper/IdGenerator.php#L58-L66
train
nabu-3/core
nabu/data/messaging/CNabuMessagingService.php
CNabuMessagingService.getTemplateConnections
public function getTemplateConnections(bool $force = false) : CNabuMessagingServiceTemplateList { if ($this->nb_messaging_template_service_list->isEmpty() || $force) { $this->nb_messaging_template_service_list->clear(); $this->nb_messaging_template_service_list->merge( CNabuMessagingServiceTemplate::getTemplatesForService($this) ); } return $this->nb_messaging_template_service_list; }
php
public function getTemplateConnections(bool $force = false) : CNabuMessagingServiceTemplateList { if ($this->nb_messaging_template_service_list->isEmpty() || $force) { $this->nb_messaging_template_service_list->clear(); $this->nb_messaging_template_service_list->merge( CNabuMessagingServiceTemplate::getTemplatesForService($this) ); } return $this->nb_messaging_template_service_list; }
[ "public", "function", "getTemplateConnections", "(", "bool", "$", "force", "=", "false", ")", ":", "CNabuMessagingServiceTemplateList", "{", "if", "(", "$", "this", "->", "nb_messaging_template_service_list", "->", "isEmpty", "(", ")", "||", "$", "force", ")", "...
Gets all Template connections for this Service. @param bool $force If true forces to reload the list from the database storage. @return CNabuMessagingServiceTemplateList Returns the List of Template connections.
[ "Gets", "all", "Template", "connections", "for", "this", "Service", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/CNabuMessagingService.php#L50-L60
train
nabu-3/core
nabu/data/messaging/CNabuMessagingService.php
CNabuMessagingService.isTemplateConnected
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(); $retval = $this->nb_messaging_template_service_list->containsKey($nb_template_id); } return $retval; }
php
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(); $retval = $this->nb_messaging_template_service_list->containsKey($nb_template_id); } return $retval; }
[ "public", "function", "isTemplateConnected", "(", "$", "nb_template", ")", ":", "bool", "{", "$", "retval", "=", "false", ";", "if", "(", "is_numeric", "(", "$", "nb_template_id", "=", "nb_getMixedValue", "(", "$", "nb_template", ",", "NABU_MESSAGING_TEMPLATE_FI...
Checks if a Template is connected to this Service. @param mixed $nb_template A Messaging Template instance, a CNabuDataObject containing a field named nb_messaging_template_id, or a valid Id. @return bool Returns true if $nb_template is connected or false elsewhere.
[ "Checks", "if", "a", "Template", "is", "connected", "to", "this", "Service", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/CNabuMessagingService.php#L68-L78
train
nabu-3/core
nabu/data/messaging/CNabuMessagingService.php
CNabuMessagingService.getActiveMessagingServices
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 AND nb_messaging_service_status=\'E\'', array( 'messaging_id' => $nb_messaging_id ), $nb_messaging ); } else { $retval = new CNabuMessagingServiceList(); } return $retval; }
php
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 AND nb_messaging_service_status=\'E\'', array( 'messaging_id' => $nb_messaging_id ), $nb_messaging ); } else { $retval = new CNabuMessagingServiceList(); } return $retval; }
[ "public", "static", "function", "getActiveMessagingServices", "(", "CNabuMessaging", "$", "nb_messaging", ")", "{", "$", "nb_messaging_id", "=", "nb_getMixedValue", "(", "$", "nb_messaging", ",", "'nb_messaging_id'", ")", ";", "if", "(", "is_numeric", "(", "$", "n...
Get active items in the storage as an associative array where the field 'nb_messaging_service_id' is the index, and each value is an instance of class CNabuMessagingServiceBase. @param CNabuMessaging $nb_messaging The CNabuMessaging instance of the Messaging that owns the Messaging Service List @return mixed Returns and array with all items.
[ "Get", "active", "items", "in", "the", "storage", "as", "an", "associative", "array", "where", "the", "field", "nb_messaging_service_id", "is", "the", "index", "and", "each", "value", "is", "an", "instance", "of", "class", "CNabuMessagingServiceBase", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/CNabuMessagingService.php#L105-L126
train
nabu-3/core
nabu/data/security/traits/TNabuUserChild.php
TNabuUserChild.getUser
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) ) { $nb_user = new CNabuUser($this->getValue(NABU_USER_FIELD_ID)); if ($nb_user->isFetched()) { $this->nb_user = $nb_user; } } } return $this->nb_user; }
php
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) ) { $nb_user = new CNabuUser($this->getValue(NABU_USER_FIELD_ID)); if ($nb_user->isFetched()) { $this->nb_user = $nb_user; } } } return $this->nb_user; }
[ "public", "function", "getUser", "(", "$", "force", "=", "false", ")", "{", "if", "(", "$", "this", "->", "nb_user", "===", "null", "||", "$", "force", ")", "{", "$", "this", "->", "nb_user", "=", "null", ";", "if", "(", "$", "this", "instanceof", ...
Gets the User instance. @param bool $force If true, forces to load User from storage. @return CNabuUser|null Returns the User instance if setted or null if not.
[ "Gets", "the", "User", "instance", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/traits/TNabuUserChild.php#L44-L60
train
nabu-3/core
nabu/data/security/traits/TNabuUserChild.php
TNabuUserChild.setUser
public function setUser(CNabuUser $nb_user) { $this->nb_user = $nb_user; if ($this instanceof CNabuDataObject) { $this->transferValue($nb_user, NABU_USER_FIELD_ID); } return $this; }
php
public function setUser(CNabuUser $nb_user) { $this->nb_user = $nb_user; if ($this instanceof CNabuDataObject) { $this->transferValue($nb_user, NABU_USER_FIELD_ID); } return $this; }
[ "public", "function", "setUser", "(", "CNabuUser", "$", "nb_user", ")", "{", "$", "this", "->", "nb_user", "=", "$", "nb_user", ";", "if", "(", "$", "this", "instanceof", "CNabuDataObject", ")", "{", "$", "this", "->", "transferValue", "(", "$", "nb_user...
Sets the User instance that owns this object and sets the field containing the User id. @param CNabuUser $nb_user User instance to be setted. @param string $field Field name where the User id will be stored. @return mixed Returns $this to allow the cascade chain of setters.
[ "Sets", "the", "User", "instance", "that", "owns", "this", "object", "and", "sets", "the", "field", "containing", "the", "User", "id", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/traits/TNabuUserChild.php#L68-L76
train
nabu-3/core
nabu/data/site/traits/TNabuSiteTargetChild.php
TNabuSiteTargetChild.setSiteTarget
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) { if ($nb_site_target instanceof CNabuSiteTarget) { $this->transferValue($nb_site_target, NABU_SITE_TARGET_FIELD_ID, $field); } else { $this->setValue($field, null); } } return $this; }
php
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) { if ($nb_site_target instanceof CNabuSiteTarget) { $this->transferValue($nb_site_target, NABU_SITE_TARGET_FIELD_ID, $field); } else { $this->setValue($field, null); } } return $this; }
[ "public", "function", "setSiteTarget", "(", "CNabuSiteTarget", "$", "nb_site_target", "=", "null", ",", "$", "field", "=", "NABU_SITE_TARGET_FIELD_ID", ")", "{", "$", "this", "->", "nb_site_target", "=", "$", "nb_site_target", ";", "if", "(", "$", "this", "ins...
Sets the Site Target instance that owns this object and sets the field containing the site id. @param CNabuSiteTarget|null $nb_site_target Site instance to be setted or null to be unsetted. @param string $field Field name where the Site Target Id will be stored. @return mixed Returns $this to allow the cascade chain of setters.
[ "Sets", "the", "Site", "Target", "instance", "that", "owns", "this", "object", "and", "sets", "the", "field", "containing", "the", "site", "id", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/traits/TNabuSiteTargetChild.php#L58-L70
train
orchestral/lumen
skeleton/app/Providers/AuthServiceProvider.php
AuthServiceProvider.bindAuthForApiToken
protected function bindAuthForApiToken() { Auth::viaRequest('api', function ($request) { if ($request->input('api_token')) { return User::where('api_token', $request->input('api_token'))->first(); } }); }
php
protected function bindAuthForApiToken() { Auth::viaRequest('api', function ($request) { if ($request->input('api_token')) { return User::where('api_token', $request->input('api_token'))->first(); } }); }
[ "protected", "function", "bindAuthForApiToken", "(", ")", "{", "Auth", "::", "viaRequest", "(", "'api'", ",", "function", "(", "$", "request", ")", "{", "if", "(", "$", "request", "->", "input", "(", "'api_token'", ")", ")", "{", "return", "User", "::", ...
Bind authentication for API Token. @return void
[ "Bind", "authentication", "for", "API", "Token", "." ]
85a004e7cde0517b527241154f5ad031b7215851
https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/skeleton/app/Providers/AuthServiceProvider.php#L44-L51
train
orchestral/lumen
skeleton/app/Providers/AuthServiceProvider.php
AuthServiceProvider.bindAuthForJwtToken
protected function bindAuthForJwtToken() { Auth::viaRequest('jwt', function ($request) { try { if (! $user = JWTAuth::parseToken()->authenticate()) { return; } } catch (Exception $e) { return; } return $user; }); }
php
protected function bindAuthForJwtToken() { Auth::viaRequest('jwt', function ($request) { try { if (! $user = JWTAuth::parseToken()->authenticate()) { return; } } catch (Exception $e) { return; } return $user; }); }
[ "protected", "function", "bindAuthForJwtToken", "(", ")", "{", "Auth", "::", "viaRequest", "(", "'jwt'", ",", "function", "(", "$", "request", ")", "{", "try", "{", "if", "(", "!", "$", "user", "=", "JWTAuth", "::", "parseToken", "(", ")", "->", "authe...
Bind authentication for JWT Token. @return void
[ "Bind", "authentication", "for", "JWT", "Token", "." ]
85a004e7cde0517b527241154f5ad031b7215851
https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/skeleton/app/Providers/AuthServiceProvider.php#L58-L71
train
rips/php-connector-bundle
InputBuilders/BaseBuilder.php
BaseBuilder.toArray
public function toArray() { $out = []; foreach ($this->setFields as $key) { $property = $this->{$key}; if ($property instanceof DateTime) { $out[$key] = $property->format(DateTime::ISO8601); } else { $out[$key] = $property; } } return $out; }
php
public function toArray() { $out = []; foreach ($this->setFields as $key) { $property = $this->{$key}; if ($property instanceof DateTime) { $out[$key] = $property->format(DateTime::ISO8601); } else { $out[$key] = $property; } } return $out; }
[ "public", "function", "toArray", "(", ")", "{", "$", "out", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "setFields", "as", "$", "key", ")", "{", "$", "property", "=", "$", "this", "->", "{", "$", "key", "}", ";", "if", "(", "$", "p...
Get an array of class properties @return array
[ "Get", "an", "array", "of", "class", "properties" ]
34ac080a7988d4d91f8129419998e51291261f55
https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/InputBuilders/BaseBuilder.php#L35-L50
train
nabu-3/core
nabu/data/site/base/CNabuSiteMapRoleBase.php
CNabuSiteMapRoleBase.setSiteMapId
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, array("\$nb_site_map_id") ); } $this->setValue('nb_site_map_id', $nb_site_map_id); return $this; }
php
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, array("\$nb_site_map_id") ); } $this->setValue('nb_site_map_id', $nb_site_map_id); return $this; }
[ "public", "function", "setSiteMapId", "(", "int", "$", "nb_site_map_id", "=", "0", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "nb_site_map_id", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VAL...
Sets the Site Map Id attribute value. @param int $nb_site_map_id New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Site", "Map", "Id", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteMapRoleBase.php#L144-L155
train
nabu-3/core
nabu/data/site/base/CNabuSiteMapRoleBase.php
CNabuSiteMapRoleBase.setZone
public function setZone(string $zone = "B") : CNabuDataObject { if ($zone === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$zone") ); } $this->setValue('nb_site_map_role_zone', $zone); return $this; }
php
public function setZone(string $zone = "B") : CNabuDataObject { if ($zone === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$zone") ); } $this->setValue('nb_site_map_role_zone', $zone); return $this; }
[ "public", "function", "setZone", "(", "string", "$", "zone", "=", "\"B\"", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "zone", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_IN"...
Sets the Site Map Role Zone attribute value. @param string $zone New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Site", "Map", "Role", "Zone", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteMapRoleBase.php#L198-L209
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.getAllDomainZones
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 nb_customer_id=%cust_id$d', array( 'cust_id' => $nb_customer_id ), $nb_customer ); } else { $retval = new CNabuDomainZoneList(); } return $retval; }
php
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 nb_customer_id=%cust_id$d', array( 'cust_id' => $nb_customer_id ), $nb_customer ); } else { $retval = new CNabuDomainZoneList(); } return $retval; }
[ "public", "static", "function", "getAllDomainZones", "(", "CNabuCustomer", "$", "nb_customer", ")", "{", "$", "nb_customer_id", "=", "nb_getMixedValue", "(", "$", "nb_customer", ",", "'nb_customer_id'", ")", ";", "if", "(", "is_numeric", "(", "$", "nb_customer_id"...
Get all items in the storage as an associative array where the field 'nb_domain_zone_id' is the index, and each value is an instance of class CNabuDomainZoneBase. @param CNabuCustomer $nb_customer The CNabuCustomer instance of the Customer that owns the Domain Zone List. @return mixed Returns and array with all items.
[ "Get", "all", "items", "in", "the", "storage", "as", "an", "associative", "array", "where", "the", "field", "nb_domain_zone_id", "is", "the", "index", "and", "each", "value", "is", "an", "instance", "of", "class", "CNabuDomainZoneBase", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L99-L119
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setOrigin
public function setOrigin($origin) : CNabuDataObject { if ($origin === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$origin") ); } $this->setValue('nb_domain_zone_origin', $origin); return $this; }
php
public function setOrigin($origin) : CNabuDataObject { if ($origin === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$origin") ); } $this->setValue('nb_domain_zone_origin', $origin); return $this; }
[ "public", "function", "setOrigin", "(", "$", "origin", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "origin", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_IN", ",", "array", "(...
Sets the Domain Zone Origin attribute value. @param mixed $origin New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Origin", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L253-L264
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setTtl
public function setTtl(int $ttl = 86400) : CNabuDataObject { if ($ttl === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$ttl") ); } $this->setValue('nb_domain_zone_ttl', $ttl); return $this; }
php
public function setTtl(int $ttl = 86400) : CNabuDataObject { if ($ttl === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$ttl") ); } $this->setValue('nb_domain_zone_ttl', $ttl); return $this; }
[ "public", "function", "setTtl", "(", "int", "$", "ttl", "=", "86400", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "ttl", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_IN", ",...
Sets the Domain Zone Ttl attribute value. @param int $ttl New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Ttl", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L280-L291
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setAdminEmail
public function setAdminEmail(string $admin_email) : CNabuDataObject { if ($admin_email === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$admin_email") ); } $this->setValue('nb_domain_zone_admin_email', $admin_email); return $this; }
php
public function setAdminEmail(string $admin_email) : CNabuDataObject { if ($admin_email === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$admin_email") ); } $this->setValue('nb_domain_zone_admin_email', $admin_email); return $this; }
[ "public", "function", "setAdminEmail", "(", "string", "$", "admin_email", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "admin_email", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_I...
Sets the Domain Zone Admin Email attribute value. @param string $admin_email New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Admin", "Email", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L307-L318
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setSerial
public function setSerial(int $serial = 1) : CNabuDataObject { if ($serial === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$serial") ); } $this->setValue('nb_domain_zone_serial', $serial); return $this; }
php
public function setSerial(int $serial = 1) : CNabuDataObject { if ($serial === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$serial") ); } $this->setValue('nb_domain_zone_serial', $serial); return $this; }
[ "public", "function", "setSerial", "(", "int", "$", "serial", "=", "1", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "serial", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_IN",...
Sets the Domain Zone Serial attribute value. @param int $serial New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Serial", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L334-L345
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setRefresh
public function setRefresh(int $refresh = 10800) : CNabuDataObject { if ($refresh === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$refresh") ); } $this->setValue('nb_domain_zone_refresh', $refresh); return $this; }
php
public function setRefresh(int $refresh = 10800) : CNabuDataObject { if ($refresh === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$refresh") ); } $this->setValue('nb_domain_zone_refresh', $refresh); return $this; }
[ "public", "function", "setRefresh", "(", "int", "$", "refresh", "=", "10800", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "refresh", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOW...
Sets the Domain Zone Refresh attribute value. @param int $refresh New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Refresh", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L361-L372
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setRetry
public function setRetry(int $retry = 3600) : CNabuDataObject { if ($retry === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$retry") ); } $this->setValue('nb_domain_zone_retry', $retry); return $this; }
php
public function setRetry(int $retry = 3600) : CNabuDataObject { if ($retry === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$retry") ); } $this->setValue('nb_domain_zone_retry', $retry); return $this; }
[ "public", "function", "setRetry", "(", "int", "$", "retry", "=", "3600", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "retry", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_IN",...
Sets the Domain Zone Retry attribute value. @param int $retry New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Retry", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L388-L399
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setExpiry
public function setExpiry(int $expiry = 604800) : CNabuDataObject { if ($expiry === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$expiry") ); } $this->setValue('nb_domain_zone_expiry', $expiry); return $this; }
php
public function setExpiry(int $expiry = 604800) : CNabuDataObject { if ($expiry === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$expiry") ); } $this->setValue('nb_domain_zone_expiry', $expiry); return $this; }
[ "public", "function", "setExpiry", "(", "int", "$", "expiry", "=", "604800", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "expiry", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED...
Sets the Domain Zone Expiry attribute value. @param int $expiry New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Expiry", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L415-L426
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setMinimum
public function setMinimum(int $minimum = 10800) : CNabuDataObject { if ($minimum === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$minimum") ); } $this->setValue('nb_domain_zone_minimum', $minimum); return $this; }
php
public function setMinimum(int $minimum = 10800) : CNabuDataObject { if ($minimum === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$minimum") ); } $this->setValue('nb_domain_zone_minimum', $minimum); return $this; }
[ "public", "function", "setMinimum", "(", "int", "$", "minimum", "=", "10800", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "minimum", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOW...
Sets the Domain Zone Minimum attribute value. @param int $minimum New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Minimum", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L442-L453
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setDns01
public function setDns01(string $dns_01) : CNabuDataObject { if ($dns_01 === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$dns_01") ); } $this->setValue('nb_domain_zone_dns_01', $dns_01); return $this; }
php
public function setDns01(string $dns_01) : CNabuDataObject { if ($dns_01 === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$dns_01") ); } $this->setValue('nb_domain_zone_dns_01', $dns_01); return $this; }
[ "public", "function", "setDns01", "(", "string", "$", "dns_01", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "dns_01", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_IN", ",", "a...
Sets the Domain Zone Dns 01 attribute value. @param string $dns_01 New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Dns", "01", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L511-L522
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setDns02
public function setDns02(string $dns_02) : CNabuDataObject { if ($dns_02 === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$dns_02") ); } $this->setValue('nb_domain_zone_dns_02', $dns_02); return $this; }
php
public function setDns02(string $dns_02) : CNabuDataObject { if ($dns_02 === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$dns_02") ); } $this->setValue('nb_domain_zone_dns_02', $dns_02); return $this; }
[ "public", "function", "setDns02", "(", "string", "$", "dns_02", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "dns_02", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_IN", ",", "a...
Sets the Domain Zone Dns 02 attribute value. @param string $dns_02 New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Dns", "02", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L538-L549
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setDnsOrigin
public function setDnsOrigin($dns_origin) : CNabuDataObject { if ($dns_origin === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$dns_origin") ); } $this->setValue('nb_domain_zone_dns_origin', $dns_origin); return $this; }
php
public function setDnsOrigin($dns_origin) : CNabuDataObject { if ($dns_origin === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$dns_origin") ); } $this->setValue('nb_domain_zone_dns_origin', $dns_origin); return $this; }
[ "public", "function", "setDnsOrigin", "(", "$", "dns_origin", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "dns_origin", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_IN", ",", "a...
Sets the Domain Zone Dns Origin attribute value. @param mixed $dns_origin New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Dns", "Origin", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L649-L660
train
nabu-3/core
nabu/data/domain/base/CNabuDomainZoneBase.php
CNabuDomainZoneBase.setShareAll
public function setShareAll(string $share_all = "F") : CNabuDataObject { if ($share_all === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$share_all") ); } $this->setValue('nb_domain_zone_share_all', $share_all); return $this; }
php
public function setShareAll(string $share_all = "F") : CNabuDataObject { if ($share_all === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$share_all") ); } $this->setValue('nb_domain_zone_share_all', $share_all); return $this; }
[ "public", "function", "setShareAll", "(", "string", "$", "share_all", "=", "\"F\"", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "share_all", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_N...
Sets the Domain Zone Share All attribute value. @param string $share_all New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Domain", "Zone", "Share", "All", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneBase.php#L676-L687
train
rips/php-connector-bundle
Hydrators/SettingHydrator.php
SettingHydrator.hydrateCollection
public static function hydrateCollection(array $settings) { $hydrated = []; foreach ($settings as $setting) { $hydrated[] = self::hydrate($setting); } return $hydrated; }
php
public static function hydrateCollection(array $settings) { $hydrated = []; foreach ($settings as $setting) { $hydrated[] = self::hydrate($setting); } return $hydrated; }
[ "public", "static", "function", "hydrateCollection", "(", "array", "$", "settings", ")", "{", "$", "hydrated", "=", "[", "]", ";", "foreach", "(", "$", "settings", "as", "$", "setting", ")", "{", "$", "hydrated", "[", "]", "=", "self", "::", "hydrate",...
Hydrate a collection of settings objects into a SettingEntity collection @param array $settings @return SettingEntity[]
[ "Hydrate", "a", "collection", "of", "settings", "objects", "into", "a", "SettingEntity", "collection" ]
34ac080a7988d4d91f8129419998e51291261f55
https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/SettingHydrator.php#L18-L27
train
rips/php-connector-bundle
Hydrators/SettingHydrator.php
SettingHydrator.hydrate
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); } if (isset($setting->created_at)) { $hydrated->setCreatedAt(new DateTime($setting->created_at)); } return $hydrated; }
php
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); } if (isset($setting->created_at)) { $hydrated->setCreatedAt(new DateTime($setting->created_at)); } return $hydrated; }
[ "public", "static", "function", "hydrate", "(", "stdClass", "$", "setting", ")", "{", "$", "hydrated", "=", "new", "SettingEntity", "(", ")", ";", "if", "(", "isset", "(", "$", "setting", "->", "key", ")", ")", "{", "$", "hydrated", "->", "setKey", "...
Hydrate a setting object into a SettingEntity @param \stdClass $setting @return SettingEntity
[ "Hydrate", "a", "setting", "object", "into", "a", "SettingEntity" ]
34ac080a7988d4d91f8129419998e51291261f55
https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/SettingHydrator.php#L35-L52
train
nabu-3/core
nabu/data/messaging/base/CNabuMessagingTemplateBase.php
CNabuMessagingTemplateBase.getAllMessagingTemplates
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 nb_messaging_id=%messaging_id$d', array( 'messaging_id' => $nb_messaging_id ), $nb_messaging ); } else { $retval = new CNabuMessagingTemplateList(); } return $retval; }
php
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 nb_messaging_id=%messaging_id$d', array( 'messaging_id' => $nb_messaging_id ), $nb_messaging ); } else { $retval = new CNabuMessagingTemplateList(); } return $retval; }
[ "public", "static", "function", "getAllMessagingTemplates", "(", "CNabuMessaging", "$", "nb_messaging", ")", "{", "$", "nb_messaging_id", "=", "nb_getMixedValue", "(", "$", "nb_messaging", ",", "'nb_messaging_id'", ")", ";", "if", "(", "is_numeric", "(", "$", "nb_...
Get all items in the storage as an associative array where the field 'nb_messaging_template_id' is the index, and each value is an instance of class CNabuMessagingTemplateBase. @param CNabuMessaging $nb_messaging The CNabuMessaging instance of the Messaging that owns the Messaging Template List @return mixed Returns and array with all items.
[ "Get", "all", "items", "in", "the", "storage", "as", "an", "associative", "array", "where", "the", "field", "nb_messaging_template_id", "is", "the", "index", "and", "each", "value", "is", "an", "instance", "of", "class", "CNabuMessagingTemplateBase", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/base/CNabuMessagingTemplateBase.php#L179-L199
train
markusjwetzel/laravel-datamapper
src/Providers/CommandsServiceProvider.php
CommandsServiceProvider.registerEntityScanner
protected function registerEntityScanner() { $app = $this->app; $app->singleton('datamapper.entity.scanner', function ($app) { $reader = $app['datamapper.annotationreader']; $validator = new EntityValidator; return new EntityScanner($reader, $validator); }); }
php
protected function registerEntityScanner() { $app = $this->app; $app->singleton('datamapper.entity.scanner', function ($app) { $reader = $app['datamapper.annotationreader']; $validator = new EntityValidator; return new EntityScanner($reader, $validator); }); }
[ "protected", "function", "registerEntityScanner", "(", ")", "{", "$", "app", "=", "$", "this", "->", "app", ";", "$", "app", "->", "singleton", "(", "'datamapper.entity.scanner'", ",", "function", "(", "$", "app", ")", "{", "$", "reader", "=", "$", "app"...
Register the entity scanner implementation. @return void
[ "Register", "the", "entity", "scanner", "implementation", "." ]
8fac20e5bca8fb81eefa7dacc49269b4a6241cbf
https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Providers/CommandsServiceProvider.php#L46-L57
train
nabu-3/core
nabu/data/catalog/base/CNabuCatalogTagBase.php
CNabuCatalogTagBase.findByKey
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'", array( 'catalog_id' => $nb_catalog_id, 'key' => $key ) ); } else { $retval = null; } return $retval; }
php
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'", array( 'catalog_id' => $nb_catalog_id, 'key' => $key ) ); } else { $retval = null; } return $retval; }
[ "public", "static", "function", "findByKey", "(", "$", "nb_catalog", ",", "$", "key", ")", "{", "$", "nb_catalog_id", "=", "nb_getMixedValue", "(", "$", "nb_catalog", ",", "'nb_catalog_id'", ")", ";", "if", "(", "is_numeric", "(", "$", "nb_catalog_id", ")", ...
Find an instance identified by nb_catalog_tag_key field. @param mixed $nb_catalog Catalog that owns Catalog Tag @param string $key Key to search @return CNabuCatalogTag Returns a valid instance if exists or null if not.
[ "Find", "an", "instance", "identified", "by", "nb_catalog_tag_key", "field", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/base/CNabuCatalogTagBase.php#L151-L170
train
nabu-3/core
nabu/data/catalog/base/CNabuCatalogTagBase.php
CNabuCatalogTagBase.getAllCatalogTags
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 nb_catalog_id=%catalog_id$d', array( 'catalog_id' => $nb_catalog_id ), $nb_catalog ); } else { $retval = new CNabuCatalogTagList(); } return $retval; }
php
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 nb_catalog_id=%catalog_id$d', array( 'catalog_id' => $nb_catalog_id ), $nb_catalog ); } else { $retval = new CNabuCatalogTagList(); } return $retval; }
[ "public", "static", "function", "getAllCatalogTags", "(", "CNabuCatalog", "$", "nb_catalog", ")", "{", "$", "nb_catalog_id", "=", "nb_getMixedValue", "(", "$", "nb_catalog", ",", "'nb_catalog_id'", ")", ";", "if", "(", "is_numeric", "(", "$", "nb_catalog_id", ")...
Get all items in the storage as an associative array where the field 'nb_catalog_tag_id' is the index, and each value is an instance of class CNabuCatalogTagBase. @param CNabuCatalog $nb_catalog The CNabuCatalog instance of the Catalog that owns the Catalog Tag List. @return mixed Returns and array with all items.
[ "Get", "all", "items", "in", "the", "storage", "as", "an", "associative", "array", "where", "the", "field", "nb_catalog_tag_id", "is", "the", "index", "and", "each", "value", "is", "an", "instance", "of", "class", "CNabuCatalogTagBase", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/base/CNabuCatalogTagBase.php#L178-L198
train
nabu-3/core
nabu/data/catalog/base/CNabuCatalogTagBase.php
CNabuCatalogTagBase.getFilteredCatalogTagList
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 . ' ' : '* ') . 'from nb_catalog_tag ' . 'where ' . NABU_CATALOG_FIELD_ID . '=%catalog_id$d ' . ($order_part ? "order by $order_part " : '') . ($limit_part ? "limit $limit_part" : ''), array( 'catalog_id' => $nb_catalog_id ) ); } else { $nb_item_list = null; } return $nb_item_list; }
php
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 . ' ' : '* ') . 'from nb_catalog_tag ' . 'where ' . NABU_CATALOG_FIELD_ID . '=%catalog_id$d ' . ($order_part ? "order by $order_part " : '') . ($limit_part ? "limit $limit_part" : ''), array( 'catalog_id' => $nb_catalog_id ) ); } else { $nb_item_list = null; } return $nb_item_list; }
[ "public", "static", "function", "getFilteredCatalogTagList", "(", "$", "nb_catalog", ",", "$", "q", "=", "null", ",", "$", "fields", "=", "null", ",", "$", "order", "=", "null", ",", "$", "offset", "=", "0", ",", "$", "num_items", "=", "0", ")", "{",...
Gets a filtered list of Catalog Tag instances represented as an array. Params allows the capability of select a subset of fields, order by concrete fields, or truncate the list by a number of rows starting in an offset. @throws \nabu\core\exceptions\ENabuCoreException Raises an exception if $fields or $order have invalid values. @param mixed $nb_catalog Catalog instance, object containing a Catalog Id field or an Id. @param string $q Query string to filter results using a context index. @param string|array $fields List of fields to put in the results. @param string|array $order List of fields to order the results. Each field can be suffixed with "ASC" or "DESC" to determine the short order @param int $offset Offset of first row in the results having the first row at offset 0. @param int $num_items Number of continue rows to get as maximum in the results. @return array Returns an array with all rows found using the criteria.
[ "Gets", "a", "filtered", "list", "of", "Catalog", "Tag", "instances", "represented", "as", "an", "array", ".", "Params", "allows", "the", "capability", "of", "select", "a", "subset", "of", "fields", "order", "by", "concrete", "fields", "or", "truncate", "the...
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/base/CNabuCatalogTagBase.php#L213-L241
train
nabu-3/core
nabu/messaging/managers/CNabuMessagingPoolManager.php
CNabuMessagingPoolManager.getFactory
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))) { $retval = $this->nb_messaging_factory_list->getItem($nb_messaging_id); } if (!$retval) { $retval = $this->nb_messaging_factory_list->addItem(new CNabuMessagingFactory($nb_messaging)); } } else { throw new ENabuCoreException(ENabuCoreException::ERROR_CUSTOMERS_DOES_NOT_MATCH); } return $retval; }
php
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))) { $retval = $this->nb_messaging_factory_list->getItem($nb_messaging_id); } if (!$retval) { $retval = $this->nb_messaging_factory_list->addItem(new CNabuMessagingFactory($nb_messaging)); } } else { throw new ENabuCoreException(ENabuCoreException::ERROR_CUSTOMERS_DOES_NOT_MATCH); } return $retval; }
[ "public", "function", "getFactory", "(", "CNabuMessaging", "$", "nb_messaging", ")", "{", "$", "retval", "=", "false", ";", "$", "nb_customer", "=", "$", "this", "->", "getCustomer", "(", ")", ";", "if", "(", "$", "nb_messaging", "->", "validateCustomer", ...
Gets a Messaging Factory instance for a Messaging instance. If Factory instance already exists then returns it. @param CNabuMessaging $nb_messaging Messaging instance that owns the Factory required. @return CNabuMessagingFactory|false Returns the Factory if $nb_messaging is owned by the Customer passed in the constructor, or false if not.
[ "Gets", "a", "Messaging", "Factory", "instance", "for", "a", "Messaging", "instance", ".", "If", "Factory", "instance", "already", "exists", "then", "returns", "it", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/messaging/managers/CNabuMessagingPoolManager.php#L71-L88
train
rips/php-connector-bundle
Hydrators/Application/Scan/LibraryHydrator.php
LibraryHydrator.hydrateCollection
public static function hydrateCollection(array $libraries) { $hydrated = []; foreach ($libraries as $library) { $hydrated[] = self::hydrate($library); } return $hydrated; }
php
public static function hydrateCollection(array $libraries) { $hydrated = []; foreach ($libraries as $library) { $hydrated[] = self::hydrate($library); } return $hydrated; }
[ "public", "static", "function", "hydrateCollection", "(", "array", "$", "libraries", ")", "{", "$", "hydrated", "=", "[", "]", ";", "foreach", "(", "$", "libraries", "as", "$", "library", ")", "{", "$", "hydrated", "[", "]", "=", "self", "::", "hydrate...
Hydrate a collection of library objects into a collection of LibraryEntity objects @param stdClass[] $libraries @return LibraryEntity[]
[ "Hydrate", "a", "collection", "of", "library", "objects", "into", "a", "collection", "of", "LibraryEntity", "objects" ]
34ac080a7988d4d91f8129419998e51291261f55
https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/LibraryHydrator.php#L17-L26
train
rips/php-connector-bundle
Hydrators/Application/Scan/LibraryHydrator.php
LibraryHydrator.hydrate
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); } if (isset($library->version)) { $hydrated->setVersion($library->version); } if (isset($library->implementation)) { $hydrated->setImplementation($library->implementation); } if (isset($library->group)) { $hydrated->setGroup($library->group); } return $hydrated; }
php
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); } if (isset($library->version)) { $hydrated->setVersion($library->version); } if (isset($library->implementation)) { $hydrated->setImplementation($library->implementation); } if (isset($library->group)) { $hydrated->setGroup($library->group); } return $hydrated; }
[ "public", "static", "function", "hydrate", "(", "stdClass", "$", "library", ")", "{", "$", "hydrated", "=", "new", "LibraryEntity", "(", ")", ";", "if", "(", "isset", "(", "$", "library", "->", "id", ")", ")", "{", "$", "hydrated", "->", "setId", "("...
Hydrate a library object into a LibraryEntity object @param stdClass $library @return LibraryEntity
[ "Hydrate", "a", "library", "object", "into", "a", "LibraryEntity", "object" ]
34ac080a7988d4d91f8129419998e51291261f55
https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/LibraryHydrator.php#L34-L59
train
wikimedia/DeadlinkChecker
src/CheckIfDead.php
CheckIfDead.isLinkDead
public function isLinkDead( $url ) { $deadVal = $this->areLinksDead( [ $url ] ); $deadVal = $deadVal[$url]; return $deadVal; }
php
public function isLinkDead( $url ) { $deadVal = $this->areLinksDead( [ $url ] ); $deadVal = $deadVal[$url]; return $deadVal; }
[ "public", "function", "isLinkDead", "(", "$", "url", ")", "{", "$", "deadVal", "=", "$", "this", "->", "areLinksDead", "(", "[", "$", "url", "]", ")", ";", "$", "deadVal", "=", "$", "deadVal", "[", "$", "url", "]", ";", "return", "$", "deadVal", ...
Check if a single URL is dead by performing a curl request @param string $url URL to check @return bool|null Returns null if curl is unable to initialize. Otherwise returns true (dead) or false (alive).
[ "Check", "if", "a", "single", "URL", "is", "dead", "by", "performing", "a", "curl", "request" ]
ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4
https://github.com/wikimedia/DeadlinkChecker/blob/ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4/src/CheckIfDead.php#L121-L126
train
wikimedia/DeadlinkChecker
src/CheckIfDead.php
CheckIfDead.performFullRequest
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 ); } while ( $mrc == CURLM_CALL_MULTI_PERFORM ); } // Let's process our curl results and extract the useful information foreach ( $urls as $id => $url ) { $headers = curl_getinfo( $curl_instances[$id] ); $error = curl_errno( $curl_instances[$id] ); $errormsg = curl_error( $curl_instances[$id] ); $curlInfo = [ 'http_code' => $headers['http_code'], 'effective_url' => $headers['url'], 'curl_error' => $error, 'curl_error_msg' => $errormsg, 'url' => $this->sanitizeURL( $url, false, true ), 'rawurl' => $url ]; // Remove each of the individual handles curl_multi_remove_handle( $multicurl_resource, $curl_instances[$id] ); $deadlinks[$url] = $this->processCurlResults( $curlInfo, true ); } // Close resource curl_multi_close( $multicurl_resource ); return $deadlinks; }
php
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 ); } while ( $mrc == CURLM_CALL_MULTI_PERFORM ); } // Let's process our curl results and extract the useful information foreach ( $urls as $id => $url ) { $headers = curl_getinfo( $curl_instances[$id] ); $error = curl_errno( $curl_instances[$id] ); $errormsg = curl_error( $curl_instances[$id] ); $curlInfo = [ 'http_code' => $headers['http_code'], 'effective_url' => $headers['url'], 'curl_error' => $error, 'curl_error_msg' => $errormsg, 'url' => $this->sanitizeURL( $url, false, true ), 'rawurl' => $url ]; // Remove each of the individual handles curl_multi_remove_handle( $multicurl_resource, $curl_instances[$id] ); $deadlinks[$url] = $this->processCurlResults( $curlInfo, true ); } // Close resource curl_multi_close( $multicurl_resource ); return $deadlinks; }
[ "protected", "function", "performFullRequest", "(", "$", "urls", ")", "{", "// Create multiple curl handle", "$", "multicurl_resource", "=", "curl_multi_init", "(", ")", ";", "if", "(", "$", "multicurl_resource", "===", "false", ")", "{", "return", "false", ";", ...
Perform a complete text request, not just for headers @param array $urls URLs we are checking @return array with params 'error':curl error number and 'result':true(dead)/false(alive) for each element
[ "Perform", "a", "complete", "text", "request", "not", "just", "for", "headers" ]
ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4
https://github.com/wikimedia/DeadlinkChecker/blob/ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4/src/CheckIfDead.php#L261-L317
train
wikimedia/DeadlinkChecker
src/CheckIfDead.php
CheckIfDead.queueRequests
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] ) ) { $this->curlQueue[$queueIndex][$domain] = $url; $queuedUrl = true; } } if ( $queuedUrl === false ) { $this->curlQueue[++$queueIndex][$domain] = $url; } } }
php
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] ) ) { $this->curlQueue[$queueIndex][$domain] = $url; $queuedUrl = true; } } if ( $queuedUrl === false ) { $this->curlQueue[++$queueIndex][$domain] = $url; } } }
[ "protected", "function", "queueRequests", "(", "$", "urls", ")", "{", "$", "this", "->", "curlQueue", "=", "[", "]", ";", "if", "(", "$", "this", "->", "queuedTesting", "===", "false", ")", "{", "$", "this", "->", "curlQueue", "[", "]", "=", "$", "...
Queue up the URLs creating time-delays between URLs with the same domain. @param array $urls All the URLs being tested
[ "Queue", "up", "the", "URLs", "creating", "time", "-", "delays", "between", "URLs", "with", "the", "same", "domain", "." ]
ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4
https://github.com/wikimedia/DeadlinkChecker/blob/ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4/src/CheckIfDead.php#L324-L345
train
wikimedia/DeadlinkChecker
src/CheckIfDead.php
CheckIfDead.getCurlOptions
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; } else { $options[CURLOPT_USERAGENT] = $this->customUserAgent; } } if ( $requestType == 'FTP' ) { $options[CURLOPT_FTP_USE_EPRT] = 1; $options[CURLOPT_FTP_USE_EPSV] = 1; $options[CURLOPT_FTPSSLAUTH] = CURLFTPAUTH_DEFAULT; $options[CURLOPT_FTP_FILEMETHOD] = CURLFTPMETHOD_SINGLECWD; if ( $full ) { // Set CURLOPT_USERPWD for anonymous FTP login $options[CURLOPT_USERPWD] = "anonymous:anonymous@domain.com"; } } if ( $full ) { // Extend timeout since we are requesting the full body $options[CURLOPT_TIMEOUT] = $this->curlTimeoutFull; $options[CURLOPT_HTTPHEADER] = $header; if ( $requestType != "MMS" && $requestType != "RTSP" ) { $options[CURLOPT_ENCODING] = 'gzip,deflate'; } $options[CURLOPT_USERAGENT] = $this->userAgent; } else { $options[CURLOPT_NOBODY] = 1; } return $options; }
php
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; } else { $options[CURLOPT_USERAGENT] = $this->customUserAgent; } } if ( $requestType == 'FTP' ) { $options[CURLOPT_FTP_USE_EPRT] = 1; $options[CURLOPT_FTP_USE_EPSV] = 1; $options[CURLOPT_FTPSSLAUTH] = CURLFTPAUTH_DEFAULT; $options[CURLOPT_FTP_FILEMETHOD] = CURLFTPMETHOD_SINGLECWD; if ( $full ) { // Set CURLOPT_USERPWD for anonymous FTP login $options[CURLOPT_USERPWD] = "anonymous:anonymous@domain.com"; } } if ( $full ) { // Extend timeout since we are requesting the full body $options[CURLOPT_TIMEOUT] = $this->curlTimeoutFull; $options[CURLOPT_HTTPHEADER] = $header; if ( $requestType != "MMS" && $requestType != "RTSP" ) { $options[CURLOPT_ENCODING] = 'gzip,deflate'; } $options[CURLOPT_USERAGENT] = $this->userAgent; } else { $options[CURLOPT_NOBODY] = 1; } return $options; }
[ "protected", "function", "getCurlOptions", "(", "$", "url", ",", "$", "full", "=", "false", ")", "{", "$", "requestType", "=", "$", "this", "->", "getRequestType", "(", "$", "url", ")", ";", "if", "(", "$", "requestType", "==", "\"MMS\"", ")", "{", "...
Get CURL options @param $url String URL we are testing against @param bool $full Is this a request for the full page? @return array Options for curl
[ "Get", "CURL", "options" ]
ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4
https://github.com/wikimedia/DeadlinkChecker/blob/ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4/src/CheckIfDead.php#L354-L415
train
wikimedia/DeadlinkChecker
src/CheckIfDead.php
CheckIfDead.processCurlResults
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; } } } // If there was an error during the CURL process, check if the code // returned is a server side problem if ( in_array( $curlInfo['curl_error'], $this->curlErrorCodes ) ) { $this->errors[$curlInfo['rawurl']] = "Curl Error {$curlInfo['curl_error']}: {$curlInfo['curl_error_msg']}"; return true; } if ( $httpCode === 0 ) { if ( $full ) { $this->errors[$curlInfo['rawurl']] = "NO RESPONSE FROM SERVER"; 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 for valid non-error codes for HTTP or FTP if ( $requestType != "FTP" && !in_array( $httpCode, $this->goodHttpCodes ) ) { $this->errors[$curlInfo['rawurl']] = "HTTP RESPONSE CODE: $httpCode"; return true; // Check for valid non-error codes for FTP } elseif ( $requestType == "FTP" && !in_array( $httpCode, $this->goodFtpCodes ) ) { $this->errors[$curlInfo['rawurl']] = "FTP RESPONSE CODE: $httpCode"; return true; } // Yay, the checks passed, and the site is alive. return false; }
php
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; } } } // If there was an error during the CURL process, check if the code // returned is a server side problem if ( in_array( $curlInfo['curl_error'], $this->curlErrorCodes ) ) { $this->errors[$curlInfo['rawurl']] = "Curl Error {$curlInfo['curl_error']}: {$curlInfo['curl_error_msg']}"; return true; } if ( $httpCode === 0 ) { if ( $full ) { $this->errors[$curlInfo['rawurl']] = "NO RESPONSE FROM SERVER"; 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 for valid non-error codes for HTTP or FTP if ( $requestType != "FTP" && !in_array( $httpCode, $this->goodHttpCodes ) ) { $this->errors[$curlInfo['rawurl']] = "HTTP RESPONSE CODE: $httpCode"; return true; // Check for valid non-error codes for FTP } elseif ( $requestType == "FTP" && !in_array( $httpCode, $this->goodFtpCodes ) ) { $this->errors[$curlInfo['rawurl']] = "FTP RESPONSE CODE: $httpCode"; return true; } // Yay, the checks passed, and the site is alive. return false; }
[ "protected", "function", "processCurlResults", "(", "$", "curlInfo", ",", "$", "full", "=", "false", ")", "{", "// Determine if we are using FTP or HTTP", "$", "requestType", "=", "$", "this", "->", "getRequestType", "(", "$", "curlInfo", "[", "'url'", "]", ")",...
Process the returned headers @param array $curlInfo Array with values: returned headers, error number, URL checked for @param bool $full Was this a request for the full page? @return bool|null Returns true if dead, false if alive, null if uncertain
[ "Process", "the", "returned", "headers" ]
ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4
https://github.com/wikimedia/DeadlinkChecker/blob/ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4/src/CheckIfDead.php#L446-L528
train
wikimedia/DeadlinkChecker
src/CheckIfDead.php
CheckIfDead.getDomainRoots
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'] : ''; if ( preg_match( '/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs ) ) { $roots[] = $regs['domain']; $roots[] = $regs['domain'] . '/'; } $parts = explode( '.', $pieces['host'] ); if ( count( $parts ) >= 3 ) { $roots[] = implode( '.', array_slice( $parts, -2 ) ); $roots[] = implode( '.', array_slice( $parts, -2 ) ) . '/'; } return $roots; }
php
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'] : ''; if ( preg_match( '/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs ) ) { $roots[] = $regs['domain']; $roots[] = $regs['domain'] . '/'; } $parts = explode( '.', $pieces['host'] ); if ( count( $parts ) >= 3 ) { $roots[] = implode( '.', array_slice( $parts, -2 ) ); $roots[] = implode( '.', array_slice( $parts, -2 ) ) . '/'; } return $roots; }
[ "protected", "function", "getDomainRoots", "(", "$", "url", ")", "{", "$", "roots", "=", "[", "]", ";", "$", "pieces", "=", "parse_url", "(", "$", "url", ")", ";", "if", "(", "!", "isset", "(", "$", "pieces", "[", "'host'", "]", ",", "$", "pieces...
Compile an array of "possible" root URLs. With subdomain, without subdomain etc. @param string $url Initial url @return array Possible root domains (strings)
[ "Compile", "an", "array", "of", "possible", "root", "URLs", ".", "With", "subdomain", "without", "subdomain", "etc", "." ]
ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4
https://github.com/wikimedia/DeadlinkChecker/blob/ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4/src/CheckIfDead.php#L536-L556
train
wikimedia/DeadlinkChecker
src/CheckIfDead.php
CheckIfDead.parseURL
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 ) ) { $url .= "#$fragment"; } } // Sometimes the scheme is followed by a single slash instead of a double. // Web browsers and archives support this, so we should too. if ( preg_match( '/^([a-z0-9\+\-\.]*:)?\/([^\/].+)/i', $url, $match ) ) { $url = $match[1] . "//" . $match[2]; } // Sometimes protocol relative URLs are not formatted correctly // This checks to see if the URL starts with :/ or :// // We will assume http in these cases if ( preg_match( '/^:\/\/?([^\/].+)/i', $url, $match ) ) { $url = "http://" . $match[1]; } // If we're missing the scheme and double slashes entirely, assume http. // The parse_url function fails without this if ( !preg_match( '/(?:[a-z0-9\+\-\.]*:)?\/\//i', $url ) ) { $url = "http://" . $url; } $encodedUrl = preg_replace_callback( '%[^:/@?&=#;]+%sD', function ( $matches ) { return urlencode( $matches[0] ); }, $url ); $parts = parse_url( $encodedUrl ); // Check if the URL was actually parsed. if ( $parts !== false ) { foreach ( $parts as $name => $value ) { $parts[$name] = urldecode( $value ); } } return $parts; }
php
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 ) ) { $url .= "#$fragment"; } } // Sometimes the scheme is followed by a single slash instead of a double. // Web browsers and archives support this, so we should too. if ( preg_match( '/^([a-z0-9\+\-\.]*:)?\/([^\/].+)/i', $url, $match ) ) { $url = $match[1] . "//" . $match[2]; } // Sometimes protocol relative URLs are not formatted correctly // This checks to see if the URL starts with :/ or :// // We will assume http in these cases if ( preg_match( '/^:\/\/?([^\/].+)/i', $url, $match ) ) { $url = "http://" . $match[1]; } // If we're missing the scheme and double slashes entirely, assume http. // The parse_url function fails without this if ( !preg_match( '/(?:[a-z0-9\+\-\.]*:)?\/\//i', $url ) ) { $url = "http://" . $url; } $encodedUrl = preg_replace_callback( '%[^:/@?&=#;]+%sD', function ( $matches ) { return urlencode( $matches[0] ); }, $url ); $parts = parse_url( $encodedUrl ); // Check if the URL was actually parsed. if ( $parts !== false ) { foreach ( $parts as $name => $value ) { $parts[$name] = urldecode( $value ); } } return $parts; }
[ "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 dou...
Custom parse_url function to support UTF-8 URLs @param string $url The URL to parse @return mixed False on failure, array on success. For example: array( 'scheme' => 'https', 'host' => 'hello.com', 'path' => '/en/' ) )
[ "Custom", "parse_url", "function", "to", "support", "UTF", "-", "8", "URLs" ]
ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4
https://github.com/wikimedia/DeadlinkChecker/blob/ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4/src/CheckIfDead.php#L714-L766
train
wikimedia/DeadlinkChecker
src/CheckIfDead.php
CheckIfDead.cleanURL
public function cleanURL( $input ) { // scheme and www $url = preg_replace( '/^((https?:|ftp:)?(\/\/))?(www\.)?/', '', $input ); // fragment $url = preg_replace( '/#.*/', '', $url ); // trailing slash $url = preg_replace( '{/$}', '', $url ); return $url; }
php
public function cleanURL( $input ) { // scheme and www $url = preg_replace( '/^((https?:|ftp:)?(\/\/))?(www\.)?/', '', $input ); // fragment $url = preg_replace( '/#.*/', '', $url ); // trailing slash $url = preg_replace( '{/$}', '', $url ); return $url; }
[ "public", "function", "cleanURL", "(", "$", "input", ")", "{", "// scheme and www", "$", "url", "=", "preg_replace", "(", "'/^((https?:|ftp:)?(\\/\\/))?(www\\.)?/'", ",", "''", ",", "$", "input", ")", ";", "// fragment", "$", "url", "=", "preg_replace", "(", "...
Remove scheme, 'www', URL fragment, leading forward slashes and trailing slash @param string $input @return string Cleaned url string
[ "Remove", "scheme", "www", "URL", "fragment", "leading", "forward", "slashes", "and", "trailing", "slash" ]
ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4
https://github.com/wikimedia/DeadlinkChecker/blob/ef91c65c0b556d6ef0eb2cd3c7a55a3e4b31ace4/src/CheckIfDead.php#L774-L783
train
nabu-3/core
nabu/data/site/base/CNabuSiteAliasHostBase.php
CNabuSiteAliasHostBase.setSiteAliasId
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, array("\$nb_site_alias_id") ); } $this->setValue('nb_site_alias_id', $nb_site_alias_id); return $this; }
php
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, array("\$nb_site_alias_id") ); } $this->setValue('nb_site_alias_id', $nb_site_alias_id); return $this; }
[ "public", "function", "setSiteAliasId", "(", "int", "$", "nb_site_alias_id", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "nb_site_alias_id", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_A...
Sets the Site Alias Id attribute value. @param int $nb_site_alias_id New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Site", "Alias", "Id", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteAliasHostBase.php#L145-L156
train
nabu-3/core
nabu/data/site/base/CNabuSiteAliasHostBase.php
CNabuSiteAliasHostBase.setServerHostId
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, array("\$nb_server_host_id") ); } $this->setValue('nb_server_host_id', $nb_server_host_id); return $this; }
php
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, array("\$nb_server_host_id") ); } $this->setValue('nb_server_host_id', $nb_server_host_id); return $this; }
[ "public", "function", "setServerHostId", "(", "int", "$", "nb_server_host_id", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "nb_server_host_id", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NO...
Sets the Server Host Id attribute value. @param int $nb_server_host_id New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Server", "Host", "Id", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteAliasHostBase.php#L172-L183
train
nabu-3/core
nabu/data/site/base/CNabuSiteAliasHostBase.php
CNabuSiteAliasHostBase.setLastUpdateErrorCode
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, array("\$last_update_error_code") ); } $this->setValue('nb_site_alias_host_last_update_error_code', $last_update_error_code); return $this; }
php
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, array("\$last_update_error_code") ); } $this->setValue('nb_site_alias_host_last_update_error_code', $last_update_error_code); return $this; }
[ "public", "function", "setLastUpdateErrorCode", "(", "int", "$", "last_update_error_code", "=", "0", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "last_update_error_code", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException",...
Sets the Site Alias Host Last Update Error Code attribute value. @param int $last_update_error_code New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Site", "Alias", "Host", "Last", "Update", "Error", "Code", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteAliasHostBase.php#L247-L258
train
nabu-3/core
nabu/http/managers/CNabuHTTPRenderDescriptor.php
CNabuHTTPRenderDescriptor.setKey
public function setKey($key) { if ($key === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$key") ); } $this->setValue("nb_http_render_descriptor_key", $key); return $this; }
php
public function setKey($key) { if ($key === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$key") ); } $this->setValue("nb_http_render_descriptor_key", $key); return $this; }
[ "public", "function", "setKey", "(", "$", "key", ")", "{", "if", "(", "$", "key", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_IN", ",", "array", "(", "\"\\$key\"", ")", ")", ";...
Sets the Descriptor key attribute value @param int $key New value for attribute @return CNabuHTTPRenderDescriptor Returns $this
[ "Sets", "the", "Descriptor", "key", "attribute", "value" ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuHTTPRenderDescriptor.php#L49-L60
train
nabu-3/core
nabu/http/managers/CNabuHTTPRenderDescriptor.php
CNabuHTTPRenderDescriptor.setClassName
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) ) { $this->setValue("nb_http_render_descriptor_class_name", $class_name); } else { throw new ENabuCoreException(ENabuCoreException::ERROR_INVALID_RENDER_DESCRIPTOR_CLASS); } return $this; }
php
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) ) { $this->setValue("nb_http_render_descriptor_class_name", $class_name); } else { throw new ENabuCoreException(ENabuCoreException::ERROR_INVALID_RENDER_DESCRIPTOR_CLASS); } return $this; }
[ "public", "function", "setClassName", "(", "$", "class_name", ")", "{", "if", "(", "$", "class_name", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_IN", ",", "array", "(", "\"\\$class_...
Sets the Descriptor class name attribute value @param int $class_name New value for attribute @return CNabuHTTPRenderDescriptor Returns $this
[ "Sets", "the", "Descriptor", "class", "name", "attribute", "value" ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuHTTPRenderDescriptor.php#L76-L96
train
nabu-3/core
nabu/xml/site/base/CNabuXMLSiteTargetSectionLanguageBase.php
CNabuXMLSiteTargetSectionLanguageBase.setAttributes
protected function setAttributes(SimpleXMLElement $element) { $nb_parent = $this->nb_data_object->getTranslatedObject(); if ($nb_parent !== null) { $nb_language = $nb_parent->getLanguage($this->nb_data_object->getLanguageId()); $element->addAttribute('lang', $nb_language->grantHash(true)); $this->putAttributesFromList($element, array( 'nb_site_target_section_main_image' => 'image' ), false); } }
php
protected function setAttributes(SimpleXMLElement $element) { $nb_parent = $this->nb_data_object->getTranslatedObject(); if ($nb_parent !== null) { $nb_language = $nb_parent->getLanguage($this->nb_data_object->getLanguageId()); $element->addAttribute('lang', $nb_language->grantHash(true)); $this->putAttributesFromList($element, array( 'nb_site_target_section_main_image' => 'image' ), false); } }
[ "protected", "function", "setAttributes", "(", "SimpleXMLElement", "$", "element", ")", "{", "$", "nb_parent", "=", "$", "this", "->", "nb_data_object", "->", "getTranslatedObject", "(", ")", ";", "if", "(", "$", "nb_parent", "!==", "null", ")", "{", "$", ...
Set default attributes of Site Target Section Language XML Element. @param SimpleXMLElement $element XML Element to set attributes
[ "Set", "default", "attributes", "of", "Site", "Target", "Section", "Language", "XML", "Element", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/site/base/CNabuXMLSiteTargetSectionLanguageBase.php#L95-L105
train
nabu-3/core
nabu/data/traits/TNabuDataObjectTreeNode.php
TNabuDataObjectTreeNode.addChild
public function addChild(INabuDataObjectTreeNode $child) { $retval = $this->nb_tree_child_list->addItem($child); $child->setParent($this); return $retval; }
php
public function addChild(INabuDataObjectTreeNode $child) { $retval = $this->nb_tree_child_list->addItem($child); $child->setParent($this); return $retval; }
[ "public", "function", "addChild", "(", "INabuDataObjectTreeNode", "$", "child", ")", "{", "$", "retval", "=", "$", "this", "->", "nb_tree_child_list", "->", "addItem", "(", "$", "child", ")", ";", "$", "child", "->", "setParent", "(", "$", "this", ")", "...
Add a child if not exists. If child is in a deep level then looks for their parent level to connect both instances. @param CNabuDataObject $child The child to be added. @return CNabuDataObject If child is added then returns the added instance else returns null.
[ "Add", "a", "child", "if", "not", "exists", ".", "If", "child", "is", "in", "a", "deep", "level", "then", "looks", "for", "their", "parent", "level", "to", "connect", "both", "instances", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/traits/TNabuDataObjectTreeNode.php#L71-L77
train
nabu-3/core
nabu/data/traits/TNabuDataObjectTreeNode.php
TNabuDataObjectTreeNode.setChild
public function setChild(INabuDataObjectTreeNode $child) { $this->nb_tree_child_list->setItem($child); $child->setParent($this); return $this; }
php
public function setChild(INabuDataObjectTreeNode $child) { $this->nb_tree_child_list->setItem($child); $child->setParent($this); return $this; }
[ "public", "function", "setChild", "(", "INabuDataObjectTreeNode", "$", "child", ")", "{", "$", "this", "->", "nb_tree_child_list", "->", "setItem", "(", "$", "child", ")", ";", "$", "child", "->", "setParent", "(", "$", "this", ")", ";", "return", "$", "...
Add or replaces a child. If child is in a deep level then looks for their parent level to connect both instances. @param CNabuDataObject $child The child to be added or replaced. @return INabuDataObjectTreeNode Returns the parent instance where the child is added.
[ "Add", "or", "replaces", "a", "child", ".", "If", "child", "is", "in", "a", "deep", "level", "then", "looks", "for", "their", "parent", "level", "to", "connect", "both", "instances", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/traits/TNabuDataObjectTreeNode.php#L85-L91
train
nabu-3/core
nabu/data/traits/TNabuDataObjectTreeNode.php
TNabuDataObjectTreeNode.setParent
public function setParent(INabuDataObjectTreeNode $parent) { $this->nb_tree_parent = $parent; if ($parent instanceof CNabuDataObject && method_exists($parent, 'getId') && $this instanceof CNabuDataObject && method_exists($this, 'setParentId') ) { $this->setParentId($parent->getId()); } return $this; }
php
public function setParent(INabuDataObjectTreeNode $parent) { $this->nb_tree_parent = $parent; if ($parent instanceof CNabuDataObject && method_exists($parent, 'getId') && $this instanceof CNabuDataObject && method_exists($this, 'setParentId') ) { $this->setParentId($parent->getId()); } return $this; }
[ "public", "function", "setParent", "(", "INabuDataObjectTreeNode", "$", "parent", ")", "{", "$", "this", "->", "nb_tree_parent", "=", "$", "parent", ";", "if", "(", "$", "parent", "instanceof", "CNabuDataObject", "&&", "method_exists", "(", "$", "parent", ",",...
Sets the parent instance of this tree node. @param INabuDataObjectTreeNode $parent The parent instance. @return INabuDataObjectTreeNode Returns $this to grant chained setters.
[ "Sets", "the", "parent", "instance", "of", "this", "tree", "node", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/traits/TNabuDataObjectTreeNode.php#L107-L120
train
nabu-3/core
nabu/http/CNabuHTTPSession.php
CNabuHTTPSession.init
private function init() { $nb_engine = CNabuEngine::getEngine(); $session_name = session_name(); $nb_engine->traceLog("Session Name", $session_name); if (array_key_exists($session_name, $_GET)) { $sessid = filter_input(INPUT_GET, $session_name); if (preg_match('/^[a-zA-Z0-9]{26}$/', $sessid)) { session_id($sessid); $nb_engine->traceLog("Session source", "GET"); } else { $nb_engine->traceLog("Session source", "COOKIE"); } } else { $nb_engine->traceLog("Session source", "COOKIE"); } }
php
private function init() { $nb_engine = CNabuEngine::getEngine(); $session_name = session_name(); $nb_engine->traceLog("Session Name", $session_name); if (array_key_exists($session_name, $_GET)) { $sessid = filter_input(INPUT_GET, $session_name); if (preg_match('/^[a-zA-Z0-9]{26}$/', $sessid)) { session_id($sessid); $nb_engine->traceLog("Session source", "GET"); } else { $nb_engine->traceLog("Session source", "COOKIE"); } } else { $nb_engine->traceLog("Session source", "COOKIE"); } }
[ "private", "function", "init", "(", ")", "{", "$", "nb_engine", "=", "CNabuEngine", "::", "getEngine", "(", ")", ";", "$", "session_name", "=", "session_name", "(", ")", ";", "$", "nb_engine", "->", "traceLog", "(", "\"Session Name\"", ",", "$", "session_n...
This method initializes the instance. Init process consists in start the session and check all objects stored in session to relink the database connection of each one.
[ "This", "method", "initializes", "the", "instance", ".", "Init", "process", "consists", "in", "start", "the", "session", "and", "check", "all", "objects", "stored", "in", "session", "to", "relink", "the", "database", "connection", "of", "each", "one", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/CNabuHTTPSession.php#L90-L107
train
nabu-3/core
nabu/http/CNabuHTTPSession.php
CNabuHTTPSession.applySecurityRules
public function applySecurityRules(bool $secure = false, bool $httponly = false) { $nb_engine = CNabuEngine::getEngine(); $attrs = session_get_cookie_params(); session_set_cookie_params( $attrs['lifetime'], $attrs['path'], $attrs['domain'], $secure || $attrs['secure'], $httponly || (array_key_exists('httponly', $attrs) && $attrs['httponly']) ); session_start(); $nb_engine->traceLog("Session ID", session_id()); $this->purgeNonce(); if (isset($_SESSION) && count($_SESSION) > 0) { foreach ($_SESSION as $value) { if ($value instanceof INabuDBObject && !$value->isBuiltIn()) { $value->relinkDB(); } } } }
php
public function applySecurityRules(bool $secure = false, bool $httponly = false) { $nb_engine = CNabuEngine::getEngine(); $attrs = session_get_cookie_params(); session_set_cookie_params( $attrs['lifetime'], $attrs['path'], $attrs['domain'], $secure || $attrs['secure'], $httponly || (array_key_exists('httponly', $attrs) && $attrs['httponly']) ); session_start(); $nb_engine->traceLog("Session ID", session_id()); $this->purgeNonce(); if (isset($_SESSION) && count($_SESSION) > 0) { foreach ($_SESSION as $value) { if ($value instanceof INabuDBObject && !$value->isBuiltIn()) { $value->relinkDB(); } } } }
[ "public", "function", "applySecurityRules", "(", "bool", "$", "secure", "=", "false", ",", "bool", "$", "httponly", "=", "false", ")", "{", "$", "nb_engine", "=", "CNabuEngine", "::", "getEngine", "(", ")", ";", "$", "attrs", "=", "session_get_cookie_params"...
Apply requested security options to protect the session. @param bool $secure If true, forces to set the secure flag of session cookie @param bool $httponly If true, forces to set the httponly flag of session cookie
[ "Apply", "requested", "security", "options", "to", "protect", "the", "session", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/CNabuHTTPSession.php#L114-L139
train
nabu-3/core
nabu/http/CNabuHTTPSession.php
CNabuHTTPSession.purgeNonce
public function purgeNonce() { $nonce_list = $this->getVariable('nonce_list', array()); $new_nonce_list = array(); if (count($nonce_list) > 0) { $stop_nonce = time() - 1800; foreach ($nonce_list as $key => $word) { if (count($word) > 0) { $this->purgeNonceWord($key, $word, $stop_nonce, $new_nonce_list); } } } if (count($new_nonce_list) > 0) { $this->setVariable('nonce_list', $new_nonce_list); } else { $this->unsetVariable('nonce_list'); } }
php
public function purgeNonce() { $nonce_list = $this->getVariable('nonce_list', array()); $new_nonce_list = array(); if (count($nonce_list) > 0) { $stop_nonce = time() - 1800; foreach ($nonce_list as $key => $word) { if (count($word) > 0) { $this->purgeNonceWord($key, $word, $stop_nonce, $new_nonce_list); } } } if (count($new_nonce_list) > 0) { $this->setVariable('nonce_list', $new_nonce_list); } else { $this->unsetVariable('nonce_list'); } }
[ "public", "function", "purgeNonce", "(", ")", "{", "$", "nonce_list", "=", "$", "this", "->", "getVariable", "(", "'nonce_list'", ",", "array", "(", ")", ")", ";", "$", "new_nonce_list", "=", "array", "(", ")", ";", "if", "(", "count", "(", "$", "non...
Check Nonce storage and purge those Nonce keys that are expired.
[ "Check", "Nonce", "storage", "and", "purge", "those", "Nonce", "keys", "that", "are", "expired", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/CNabuHTTPSession.php#L144-L162
train
nabu-3/core
nabu/http/CNabuHTTPSession.php
CNabuHTTPSession.purgeNonceWord
private function purgeNonceWord(string $key, array $word, int $stop_nonce, array &$new_nonce_list) { foreach ($word as $nonce) { if ($nonce['time'] >= $stop_nonce) { if (!array_key_exists($key, $new_nonce_list)) { $new_nonce_list[$key] = array(); } $new_nonce_list[$key][] = $nonce; } } }
php
private function purgeNonceWord(string $key, array $word, int $stop_nonce, array &$new_nonce_list) { foreach ($word as $nonce) { if ($nonce['time'] >= $stop_nonce) { if (!array_key_exists($key, $new_nonce_list)) { $new_nonce_list[$key] = array(); } $new_nonce_list[$key][] = $nonce; } } }
[ "private", "function", "purgeNonceWord", "(", "string", "$", "key", ",", "array", "$", "word", ",", "int", "$", "stop_nonce", ",", "array", "&", "$", "new_nonce_list", ")", "{", "foreach", "(", "$", "word", "as", "$", "nonce", ")", "{", "if", "(", "$...
Purge a Nonce Word list. @param string $key Nonce key @param array $word Array of words created for $key @param int $stop_nonce Time limit of words to preserve each one @param array &$new_nonce_list New nonce list which is being built
[ "Purge", "a", "Nonce", "Word", "list", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/CNabuHTTPSession.php#L171-L181
train
nabu-3/core
nabu/http/CNabuHTTPSession.php
CNabuHTTPSession.unsetVariable
public function unsetVariable($name) { $retval = false; if (array_key_exists($name, $_SESSION)) { unset($_SESSION[$name]); $retval = true; } return $retval; }
php
public function unsetVariable($name) { $retval = false; if (array_key_exists($name, $_SESSION)) { unset($_SESSION[$name]); $retval = true; } return $retval; }
[ "public", "function", "unsetVariable", "(", "$", "name", ")", "{", "$", "retval", "=", "false", ";", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "_SESSION", ")", ")", "{", "unset", "(", "$", "_SESSION", "[", "$", "name", "]", ")", ";...
Remove a value from the Session storage. @param string $name Storage name to remove @return boolean Returns true if the value was removed.
[ "Remove", "a", "value", "from", "the", "Session", "storage", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/CNabuHTTPSession.php#L221-L231
train
nabu-3/core
nabu/http/CNabuHTTPSession.php
CNabuHTTPSession.setCookie
public function setCookie($name, $value, $expires = null, $path = null, $domain = null, $secure = false, $httponly = false) { if ($expires !== null) { setcookie($name, $value, time() + $expires, $path, $domain, $secure, $httponly); } else { setcookie($name, $value, 0, $path, $domain, $secure, $httponly); } }
php
public function setCookie($name, $value, $expires = null, $path = null, $domain = null, $secure = false, $httponly = false) { if ($expires !== null) { setcookie($name, $value, time() + $expires, $path, $domain, $secure, $httponly); } else { setcookie($name, $value, 0, $path, $domain, $secure, $httponly); } }
[ "public", "function", "setCookie", "(", "$", "name", ",", "$", "value", ",", "$", "expires", "=", "null", ",", "$", "path", "=", "null", ",", "$", "domain", "=", "null", ",", "$", "secure", "=", "false", ",", "$", "httponly", "=", "false", ")", "...
Sets or updates a Cookie @param string $name Cookie name to be setted @param string $value Content string of the Cookie. @param int $expires Timestamp of Cookie expiration time. @param string $path Path to apply the Cookie. @param string $domain Domain of the Cookie. @param boolean $secure True if the cookie is marked as secure. @param boolean $httponly True if the cookie is applied only in HTTP mode.
[ "Sets", "or", "updates", "a", "Cookie" ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/CNabuHTTPSession.php#L324-L331
train
markusjwetzel/laravel-datamapper
src/Metadata/EntityValidator.php
EntityValidator.validateEmbeddedClass
public function validateEmbeddedClass($class, $classAnnotations) { $check = false; foreach ($classAnnotations as $annotation) { if ($annotation instanceof \ProAI\Datamapper\Annotations\Embeddable) { $check = true; } } if (! $check) { throw new InvalidArgumentException('Embedded class '.$class.' has no @Embeddable annotation.'); } }
php
public function validateEmbeddedClass($class, $classAnnotations) { $check = false; foreach ($classAnnotations as $annotation) { if ($annotation instanceof \ProAI\Datamapper\Annotations\Embeddable) { $check = true; } } if (! $check) { throw new InvalidArgumentException('Embedded class '.$class.' has no @Embeddable annotation.'); } }
[ "public", "function", "validateEmbeddedClass", "(", "$", "class", ",", "$", "classAnnotations", ")", "{", "$", "check", "=", "false", ";", "foreach", "(", "$", "classAnnotations", "as", "$", "annotation", ")", "{", "if", "(", "$", "annotation", "instanceof",...
Check if class exists. @param string $class @param array $classAnnotations @return void
[ "Check", "if", "class", "exists", "." ]
8fac20e5bca8fb81eefa7dacc49269b4a6241cbf
https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Metadata/EntityValidator.php#L55-L68
train
markusjwetzel/laravel-datamapper
src/Metadata/EntityValidator.php
EntityValidator.validateName
public function validateName($name, $definedClass) { if ($name != camel_case($name)) { throw new Exception('Name "'.$name.'" (defined in class "'.$definedClass.'") is not a camel case name.'); } return true; }
php
public function validateName($name, $definedClass) { if ($name != camel_case($name)) { throw new Exception('Name "'.$name.'" (defined in class "'.$definedClass.'") is not a camel case name.'); } return true; }
[ "public", "function", "validateName", "(", "$", "name", ",", "$", "definedClass", ")", "{", "if", "(", "$", "name", "!=", "camel_case", "(", "$", "name", ")", ")", "{", "throw", "new", "Exception", "(", "'Name \"'", ".", "$", "name", ".", "'\" (defined...
Check if name is not snake case. @param string $name @param string $definedClass @return boolean
[ "Check", "if", "name", "is", "not", "snake", "case", "." ]
8fac20e5bca8fb81eefa7dacc49269b4a6241cbf
https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Metadata/EntityValidator.php#L95-L102
train
markusjwetzel/laravel-datamapper
src/Metadata/EntityValidator.php
EntityValidator.validatePrimaryKey
public function validatePrimaryKey(EntityDefinition $entityMetadata) { // check if all tables have exactly one primary key $countPrimaryKeys = 0; foreach ($entityMetadata['table']['columns'] as $column) { if (! empty($column['primary'])) { $countPrimaryKeys++; } } if ($countPrimaryKeys == 0) { throw new DomainException('No primary key defined in class ' . $entityMetadata['class'] . '.'); } elseif ($countPrimaryKeys > 1) { throw new DomainException('No composite primary keys allowed for class ' . $entityMetadata['class'] . '.'); } }
php
public function validatePrimaryKey(EntityDefinition $entityMetadata) { // check if all tables have exactly one primary key $countPrimaryKeys = 0; foreach ($entityMetadata['table']['columns'] as $column) { if (! empty($column['primary'])) { $countPrimaryKeys++; } } if ($countPrimaryKeys == 0) { throw new DomainException('No primary key defined in class ' . $entityMetadata['class'] . '.'); } elseif ($countPrimaryKeys > 1) { throw new DomainException('No composite primary keys allowed for class ' . $entityMetadata['class'] . '.'); } }
[ "public", "function", "validatePrimaryKey", "(", "EntityDefinition", "$", "entityMetadata", ")", "{", "// check if all tables have exactly one primary key", "$", "countPrimaryKeys", "=", "0", ";", "foreach", "(", "$", "entityMetadata", "[", "'table'", "]", "[", "'column...
Validate the number of primary keys. @param \ProAI\Datamapper\Metadata\Definitions\Entity $entityMetadata @return void
[ "Validate", "the", "number", "of", "primary", "keys", "." ]
8fac20e5bca8fb81eefa7dacc49269b4a6241cbf
https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Metadata/EntityValidator.php#L136-L152
train
markusjwetzel/laravel-datamapper
src/Metadata/EntityValidator.php
EntityValidator.validateTimestamps
public function validateTimestamps(EntityDefinition $entityMetadata) { $columnNames = []; // get column names foreach ($entityMetadata['table']['columns'] as $column) { $columnNames[] = $column['name']; } // get version column names if (! empty($entityMetadata['versionTable'])) { foreach ($entityMetadata['versionTable']['columns'] as $column) { $columnNames[] = $column['name']; } } if (! in_array('created_at', $columnNames) || ! in_array('updated_at', $columnNames)) { throw new DomainException('@Timestamps annotation defined in class ' . $entityMetadata['class'] . ' requires a $createdAt and an $updatedAt column property.'); } }
php
public function validateTimestamps(EntityDefinition $entityMetadata) { $columnNames = []; // get column names foreach ($entityMetadata['table']['columns'] as $column) { $columnNames[] = $column['name']; } // get version column names if (! empty($entityMetadata['versionTable'])) { foreach ($entityMetadata['versionTable']['columns'] as $column) { $columnNames[] = $column['name']; } } if (! in_array('created_at', $columnNames) || ! in_array('updated_at', $columnNames)) { throw new DomainException('@Timestamps annotation defined in class ' . $entityMetadata['class'] . ' requires a $createdAt and an $updatedAt column property.'); } }
[ "public", "function", "validateTimestamps", "(", "EntityDefinition", "$", "entityMetadata", ")", "{", "$", "columnNames", "=", "[", "]", ";", "// get column names", "foreach", "(", "$", "entityMetadata", "[", "'table'", "]", "[", "'columns'", "]", "as", "$", "...
Validate the timestamps columns. @param \ProAI\Datamapper\Metadata\Definitions\Entity $entityMetadata @return void
[ "Validate", "the", "timestamps", "columns", "." ]
8fac20e5bca8fb81eefa7dacc49269b4a6241cbf
https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Metadata/EntityValidator.php#L160-L179
train
markusjwetzel/laravel-datamapper
src/Metadata/EntityValidator.php
EntityValidator.validateVersionTable
public function validateVersionTable(EntityDefinition $entityMetadata) { $columnNames = []; $countPrimaryKeys = 0; $versionPrimaryKey = false; // get column names foreach ($entityMetadata['table']['columns'] as $column) { $columnNames[] = $column['name']; } if (! in_array('latest_version', $columnNames)) { throw new DomainException('@Versionable annotation defined in class ' . $entityMetadata['class'] . ' requires a $latestVersion column property.'); } $columnNames = []; // get version column names foreach ($entityMetadata['versionTable']['columns'] as $column) { $columnNames[] = $column['name']; if (! empty($column['primary'])) { $countPrimaryKeys++; } if (! empty($column['primary']) && $column['name'] == 'version') { $versionPrimaryKey = true; } } if (! in_array('version', $columnNames) || ! $versionPrimaryKey) { throw new DomainException('@Versionable annotation defined in class ' . $entityMetadata['class'] . ' requires a $version property column, which is a primary key.'); } if ($countPrimaryKeys > 2) { throw new DomainException('No more than 2 primary keys are allowed for version table in class ' . $entityMetadata['class'] . '.'); } }
php
public function validateVersionTable(EntityDefinition $entityMetadata) { $columnNames = []; $countPrimaryKeys = 0; $versionPrimaryKey = false; // get column names foreach ($entityMetadata['table']['columns'] as $column) { $columnNames[] = $column['name']; } if (! in_array('latest_version', $columnNames)) { throw new DomainException('@Versionable annotation defined in class ' . $entityMetadata['class'] . ' requires a $latestVersion column property.'); } $columnNames = []; // get version column names foreach ($entityMetadata['versionTable']['columns'] as $column) { $columnNames[] = $column['name']; if (! empty($column['primary'])) { $countPrimaryKeys++; } if (! empty($column['primary']) && $column['name'] == 'version') { $versionPrimaryKey = true; } } if (! in_array('version', $columnNames) || ! $versionPrimaryKey) { throw new DomainException('@Versionable annotation defined in class ' . $entityMetadata['class'] . ' requires a $version property column, which is a primary key.'); } if ($countPrimaryKeys > 2) { throw new DomainException('No more than 2 primary keys are allowed for version table in class ' . $entityMetadata['class'] . '.'); } }
[ "public", "function", "validateVersionTable", "(", "EntityDefinition", "$", "entityMetadata", ")", "{", "$", "columnNames", "=", "[", "]", ";", "$", "countPrimaryKeys", "=", "0", ";", "$", "versionPrimaryKey", "=", "false", ";", "// get column names", "foreach", ...
Validate the version table. @param \ProAI\Datamapper\Metadata\Definitions\Entity $entityMetadata @return void
[ "Validate", "the", "version", "table", "." ]
8fac20e5bca8fb81eefa7dacc49269b4a6241cbf
https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Metadata/EntityValidator.php#L214-L248
train
markusjwetzel/laravel-datamapper
src/Metadata/EntityValidator.php
EntityValidator.validatePivotTables
public function validatePivotTables($metadata) { $pivotTables = []; foreach ($metadata as $entityMetadata) { foreach ($entityMetadata['relations'] as $relationMetadata) { if (! empty($relationMetadata['pivotTable'])) { $pivotTables[$entityMetadata['class'].$relationMetadata['relatedEntity']] = $relationMetadata; if (isset($pivotTables[$relationMetadata['relatedEntity'].$entityMetadata['class']])) { $relation1 = $pivotTables[$relationMetadata['relatedEntity'].$entityMetadata['class']]; $relation2 = $relationMetadata; $error = null; // check name if ($relation1['pivotTable']['name'] != $relation2['pivotTable']['name']) { $error = 'Different table names (compared '.$relation1['pivotTable']['name'].' with '.$relation2['pivotTable']['name'].').'; } // check name if (! empty(array_diff_key($relation1['pivotTable']['columns'], $relation2['pivotTable']['columns']))) { $columns1 = implode(', ', array_keys($relation1['pivotTable']['columns'])); $columns2 = implode(', ', array_keys($relation2['pivotTable']['columns'])); $error = 'Different column names (compared '.$columns1.' with '.$columns2.').'; } if ($error) { throw new DomainException('Error syncing pivot tables for relations "'.$relation1['name'].'" in "'.$relation2['relatedEntity'].'" and "'.$relation2['name'].'" in "'.$relation1['relatedEntity'].'": '.$error); } } } } } }
php
public function validatePivotTables($metadata) { $pivotTables = []; foreach ($metadata as $entityMetadata) { foreach ($entityMetadata['relations'] as $relationMetadata) { if (! empty($relationMetadata['pivotTable'])) { $pivotTables[$entityMetadata['class'].$relationMetadata['relatedEntity']] = $relationMetadata; if (isset($pivotTables[$relationMetadata['relatedEntity'].$entityMetadata['class']])) { $relation1 = $pivotTables[$relationMetadata['relatedEntity'].$entityMetadata['class']]; $relation2 = $relationMetadata; $error = null; // check name if ($relation1['pivotTable']['name'] != $relation2['pivotTable']['name']) { $error = 'Different table names (compared '.$relation1['pivotTable']['name'].' with '.$relation2['pivotTable']['name'].').'; } // check name if (! empty(array_diff_key($relation1['pivotTable']['columns'], $relation2['pivotTable']['columns']))) { $columns1 = implode(', ', array_keys($relation1['pivotTable']['columns'])); $columns2 = implode(', ', array_keys($relation2['pivotTable']['columns'])); $error = 'Different column names (compared '.$columns1.' with '.$columns2.').'; } if ($error) { throw new DomainException('Error syncing pivot tables for relations "'.$relation1['name'].'" in "'.$relation2['relatedEntity'].'" and "'.$relation2['name'].'" in "'.$relation1['relatedEntity'].'": '.$error); } } } } } }
[ "public", "function", "validatePivotTables", "(", "$", "metadata", ")", "{", "$", "pivotTables", "=", "[", "]", ";", "foreach", "(", "$", "metadata", "as", "$", "entityMetadata", ")", "{", "foreach", "(", "$", "entityMetadata", "[", "'relations'", "]", "as...
Check if pivot tables of bi-directional relations are identically. @param array $metadata @return void
[ "Check", "if", "pivot", "tables", "of", "bi", "-", "directional", "relations", "are", "identically", "." ]
8fac20e5bca8fb81eefa7dacc49269b4a6241cbf
https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Metadata/EntityValidator.php#L256-L289
train
nabu-3/core
nabu/data/medioteca/base/CNabuMediotecaitemLanguageBase.php
CNabuMediotecaItemLanguageBase.setMediotecaItemId
public function setMediotecaItemId(int $nb_medioteca_item_id) : CNabuDataObject { if ($nb_medioteca_item_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$nb_medioteca_item_id") ); } $this->setValue('nb_medioteca_item_id', $nb_medioteca_item_id); return $this; }
php
public function setMediotecaItemId(int $nb_medioteca_item_id) : CNabuDataObject { if ($nb_medioteca_item_id === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$nb_medioteca_item_id") ); } $this->setValue('nb_medioteca_item_id', $nb_medioteca_item_id); return $this; }
[ "public", "function", "setMediotecaItemId", "(", "int", "$", "nb_medioteca_item_id", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "nb_medioteca_item_id", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL...
Sets the Medioteca Item Id attribute value. @param int $nb_medioteca_item_id New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Medioteca", "Item", "Id", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/base/CNabuMediotecaitemLanguageBase.php#L182-L193
train
nabu-3/core
nabu/data/medioteca/base/CNabuMediotecaitemLanguageBase.php
CNabuMediotecaItemLanguageBase.setHavePublic
public function setHavePublic($have_public) : CNabuDataObject { if ($have_public === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$have_public") ); } $this->setValue('nb_medioteca_item_lang_have_public', $have_public); return $this; }
php
public function setHavePublic($have_public) : CNabuDataObject { if ($have_public === null) { throw new ENabuCoreException( ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN, array("\$have_public") ); } $this->setValue('nb_medioteca_item_lang_have_public', $have_public); return $this; }
[ "public", "function", "setHavePublic", "(", "$", "have_public", ")", ":", "CNabuDataObject", "{", "if", "(", "$", "have_public", "===", "null", ")", "{", "throw", "new", "ENabuCoreException", "(", "ENabuCoreException", "::", "ERROR_NULL_VALUE_NOT_ALLOWED_IN", ",", ...
Sets the Medioteca Item Lang Have Public attribute value. @param mixed $have_public New value for attribute @return CNabuDataObject Returns self instance to grant chained setters call.
[ "Sets", "the", "Medioteca", "Item", "Lang", "Have", "Public", "attribute", "value", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/base/CNabuMediotecaitemLanguageBase.php#L284-L295
train
nabu-3/core
nabu/provider/adapters/CNabuProviderInterfaceFactoryAdapter.php
CNabuProviderInterfaceFactoryAdapter.discoverInterface
protected function discoverInterface() : bool { if (!($this->nb_interface instanceof INabuProviderInterface) && ($nb_manager = $this->nb_descriptor->getManager()) instanceof INabuProviderManager ) { $this->nb_interface = $this->createInterface($nb_manager, $this->nb_descriptor); } return ($this->nb_interface instanceof INabuProviderInterface); }
php
protected function discoverInterface() : bool { if (!($this->nb_interface instanceof INabuProviderInterface) && ($nb_manager = $this->nb_descriptor->getManager()) instanceof INabuProviderManager ) { $this->nb_interface = $this->createInterface($nb_manager, $this->nb_descriptor); } return ($this->nb_interface instanceof INabuProviderInterface); }
[ "protected", "function", "discoverInterface", "(", ")", ":", "bool", "{", "if", "(", "!", "(", "$", "this", "->", "nb_interface", "instanceof", "INabuProviderInterface", ")", "&&", "(", "$", "nb_manager", "=", "$", "this", "->", "nb_descriptor", "->", "getMa...
Discover the Render Transform Interface. @return bool If the Interface is discovered then returns true. @throws ENabuProviderException Raises an exception if the designated Render Transform is not valid or applicable.
[ "Discover", "the", "Render", "Transform", "Interface", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/provider/adapters/CNabuProviderInterfaceFactoryAdapter.php#L79-L88
train
nabu-3/core
nabu/provider/adapters/CNabuProviderInterfaceFactoryAdapter.php
CNabuProviderInterfaceFactoryAdapter.setRequest
public function setRequest(CNabuHTTPRequest $nb_request) : CNabuProviderInterfaceFactoryAdapter { if ($this->discoverInterface()) { $this->nb_interface->setRequest($nb_request); } else { throw new ENabuProviderException(ENabuProviderException::ERROR_INTERFACE_NOT_SETTED); } return $this; }
php
public function setRequest(CNabuHTTPRequest $nb_request) : CNabuProviderInterfaceFactoryAdapter { if ($this->discoverInterface()) { $this->nb_interface->setRequest($nb_request); } else { throw new ENabuProviderException(ENabuProviderException::ERROR_INTERFACE_NOT_SETTED); } return $this; }
[ "public", "function", "setRequest", "(", "CNabuHTTPRequest", "$", "nb_request", ")", ":", "CNabuProviderInterfaceFactoryAdapter", "{", "if", "(", "$", "this", "->", "discoverInterface", "(", ")", ")", "{", "$", "this", "->", "nb_interface", "->", "setRequest", "...
Pass Request instance to managed interface. @param CNabuHTTPRequest $nb_request Request instance to be passed. @return CNabuProviderInterfaceFactoryAdapter Returns self pointer to grant chained setters. @throws ENabuProviderException Raises an exception if the Interface is not setted.
[ "Pass", "Request", "instance", "to", "managed", "interface", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/provider/adapters/CNabuProviderInterfaceFactoryAdapter.php#L126-L135
train
nabu-3/core
nabu/provider/adapters/CNabuProviderInterfaceFactoryAdapter.php
CNabuProviderInterfaceFactoryAdapter.setResponse
public function setResponse(CNabuHTTPResponse $nb_response = null) : CNabuProviderInterfaceFactoryAdapter { if ($this->discoverInterface()) { $this->nb_interface->setResponse($nb_response); } else { throw new ENabuProviderException(ENabuProviderException::ERROR_INTERFACE_NOT_SETTED); } return $this; }
php
public function setResponse(CNabuHTTPResponse $nb_response = null) : CNabuProviderInterfaceFactoryAdapter { if ($this->discoverInterface()) { $this->nb_interface->setResponse($nb_response); } else { throw new ENabuProviderException(ENabuProviderException::ERROR_INTERFACE_NOT_SETTED); } return $this; }
[ "public", "function", "setResponse", "(", "CNabuHTTPResponse", "$", "nb_response", "=", "null", ")", ":", "CNabuProviderInterfaceFactoryAdapter", "{", "if", "(", "$", "this", "->", "discoverInterface", "(", ")", ")", "{", "$", "this", "->", "nb_interface", "->",...
Pass Response instance to managed interface. @param CNabuHTTPResponse|null $nb_response Response instance to be passed. @return CNabuProviderInterfaceFactoryAdapter Returns self pointer to grant chained setters. @throws ENabuProviderException Raises an exception if the Interface is not setted.
[ "Pass", "Response", "instance", "to", "managed", "interface", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/provider/adapters/CNabuProviderInterfaceFactoryAdapter.php#L143-L152
train
nabu-3/core
nabu/xml/CNabuXMLObject.php
CNabuXMLObject.collect
public function collect(SimpleXMLElement $element) { if ($element->getName() === get_called_class()::getTagName() && $this->locateDataObject($element)) { $this->getAttributes($element); $this->getChilds($element); } else { throw new ENabuXMLException(ENabuXMLException::ERROR_UNEXPECTED_ELEMENT, array($element->getName())); } }
php
public function collect(SimpleXMLElement $element) { if ($element->getName() === get_called_class()::getTagName() && $this->locateDataObject($element)) { $this->getAttributes($element); $this->getChilds($element); } else { throw new ENabuXMLException(ENabuXMLException::ERROR_UNEXPECTED_ELEMENT, array($element->getName())); } }
[ "public", "function", "collect", "(", "SimpleXMLElement", "$", "element", ")", "{", "if", "(", "$", "element", "->", "getName", "(", ")", "===", "get_called_class", "(", ")", "::", "getTagName", "(", ")", "&&", "$", "this", "->", "locateDataObject", "(", ...
Collects data from a XML branch. @param SimpleXMLElement $element Element of XML containing data to be collected. @throws ENabuXMLException Raises an exception if any error is detected collecting the content.
[ "Collects", "data", "from", "a", "XML", "branch", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/CNabuXMLObject.php#L105-L113
train
xtlsoft/NonDB
src/NonDB.php
NonDB.driver
public static function driver(string $name){ //Get the name. $name = explode(':', $name); //Get the classname. $class = "\\NonDB\\Drivers\\" . $name[0]; //Get the parameter. $param = $name[1]; //See if the driver exists. if(!class_exists($class) || !( \NonDB\Components\Tool::checkImplement($class, "NonDB\\Interfaces\\Driver") )){ throw new \NonDB\Exceptions\CoreException("Driver $class wasn't exists.", "0011"); return false; } //Get driver. $driver = eval("return new $class(urldecode(\$param));"); return $driver; }
php
public static function driver(string $name){ //Get the name. $name = explode(':', $name); //Get the classname. $class = "\\NonDB\\Drivers\\" . $name[0]; //Get the parameter. $param = $name[1]; //See if the driver exists. if(!class_exists($class) || !( \NonDB\Components\Tool::checkImplement($class, "NonDB\\Interfaces\\Driver") )){ throw new \NonDB\Exceptions\CoreException("Driver $class wasn't exists.", "0011"); return false; } //Get driver. $driver = eval("return new $class(urldecode(\$param));"); return $driver; }
[ "public", "static", "function", "driver", "(", "string", "$", "name", ")", "{", "//Get the name.", "$", "name", "=", "explode", "(", "':'", ",", "$", "name", ")", ";", "//Get the classname.", "$", "class", "=", "\"\\\\NonDB\\\\Drivers\\\\\"", ".", "$", "name...
Create a driver @static @param string $name Example: "Json:./data/" @throws \NonDB\Exceptions\CoreException @return \NonDB\Interfaces\Driver
[ "Create", "a", "driver" ]
6599c13bb5feabe77d91764fdf3c24b786c777b2
https://github.com/xtlsoft/NonDB/blob/6599c13bb5feabe77d91764fdf3c24b786c777b2/src/NonDB.php#L34-L54
train
nabu-3/core
nabu/xml/CNabuXMLDataObject.php
CNabuXMLDataObject.getAttributesFromList
protected function getAttributesFromList( SimpleXMLElement $element, array $attributes, bool $ignore_empty = false ) : int { $count = 0; if (count($attributes) > 0) { foreach ($attributes as $field => $attr) { if (isset($element[$attr])) { $value = (string)$element[$attr]; if ($ignore_empty || strlen($value) > 0) { $this->nb_data_object->setValue($field, $value); $count++; } } } } return $count; }
php
protected function getAttributesFromList( SimpleXMLElement $element, array $attributes, bool $ignore_empty = false ) : int { $count = 0; if (count($attributes) > 0) { foreach ($attributes as $field => $attr) { if (isset($element[$attr])) { $value = (string)$element[$attr]; if ($ignore_empty || strlen($value) > 0) { $this->nb_data_object->setValue($field, $value); $count++; } } } } return $count; }
[ "protected", "function", "getAttributesFromList", "(", "SimpleXMLElement", "$", "element", ",", "array", "$", "attributes", ",", "bool", "$", "ignore_empty", "=", "false", ")", ":", "int", "{", "$", "count", "=", "0", ";", "if", "(", "count", "(", "$", "...
Get a group of attributes listed in an array. @param SimpleXMLElement $element Element instance to get attributes. @param array $attributes Associative array with the list of data fields as keys and the attribute name as value. @param bool $ignore_empty If true, empty values are ignored (null, '') @return int Returns the number of attributes setted.
[ "Get", "a", "group", "of", "attributes", "listed", "in", "an", "array", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/CNabuXMLDataObject.php#L64-L84
train
nabu-3/core
nabu/xml/CNabuXMLDataObject.php
CNabuXMLDataObject.putAttributesFromList
protected function putAttributesFromList( SimpleXMLElement $element, array $attributes, bool $ignore_empty = false ) : int { $count = 0; if (count($attributes) > 0) { foreach ($attributes as $field => $attr) { if ($this->nb_data_object->contains($field) && (!$ignore_empty || !$this->nb_data_object->isValueNull($field) || !$this->nb_data_object->isValueEmptyString($field) ) ) { $element->addAttribute($attr, $this->nb_data_object->getValue($field)); $count++; } } } return $count; }
php
protected function putAttributesFromList( SimpleXMLElement $element, array $attributes, bool $ignore_empty = false ) : int { $count = 0; if (count($attributes) > 0) { foreach ($attributes as $field => $attr) { if ($this->nb_data_object->contains($field) && (!$ignore_empty || !$this->nb_data_object->isValueNull($field) || !$this->nb_data_object->isValueEmptyString($field) ) ) { $element->addAttribute($attr, $this->nb_data_object->getValue($field)); $count++; } } } return $count; }
[ "protected", "function", "putAttributesFromList", "(", "SimpleXMLElement", "$", "element", ",", "array", "$", "attributes", ",", "bool", "$", "ignore_empty", "=", "false", ")", ":", "int", "{", "$", "count", "=", "0", ";", "if", "(", "count", "(", "$", "...
Set a group of attributes listed in an array. @param SimpleXMLElement $element Element instance to set attributes. @param array $attributes Associative array with the list of data fields as keys and the attribute name as value. @param bool $ignore_empty If true, empty values are ignored (null, '') @return int Returns the number of attributes setted.
[ "Set", "a", "group", "of", "attributes", "listed", "in", "an", "array", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/CNabuXMLDataObject.php#L93-L115
train
nabu-3/core
nabu/xml/CNabuXMLDataObject.php
CNabuXMLDataObject.putChildsAsCDATAFromList
protected function putChildsAsCDATAFromList( SimpleXMLElement $element, array $childs, bool $ignore_empty = false ) : int { $count = 0; if (count($childs) > 0) { foreach ($childs as $field => $child) { if ($this->nb_data_object->contains($field) && (!$ignore_empty || !$this->nb_data_object->isValueNull($field) || !$this->nb_data_object->isValueEmptyString($field) ) ) { $element->addChild($child, $this->packCDATA($this->nb_data_object->getValue($field))); $count++; } } } return $count; }
php
protected function putChildsAsCDATAFromList( SimpleXMLElement $element, array $childs, bool $ignore_empty = false ) : int { $count = 0; if (count($childs) > 0) { foreach ($childs as $field => $child) { if ($this->nb_data_object->contains($field) && (!$ignore_empty || !$this->nb_data_object->isValueNull($field) || !$this->nb_data_object->isValueEmptyString($field) ) ) { $element->addChild($child, $this->packCDATA($this->nb_data_object->getValue($field))); $count++; } } } return $count; }
[ "protected", "function", "putChildsAsCDATAFromList", "(", "SimpleXMLElement", "$", "element", ",", "array", "$", "childs", ",", "bool", "$", "ignore_empty", "=", "false", ")", ":", "int", "{", "$", "count", "=", "0", ";", "if", "(", "count", "(", "$", "c...
Set a group of childs listed in an array as Element > CDATA structure. @param SimpleXMLElement $element Element instance to set childs. @param array $childs Associative array with the list of data fields as keys and the element name as value. @param bool $ignore_empty If true, empty values are ignored (null, '') @return int Returns the number of childs setted.
[ "Set", "a", "group", "of", "childs", "listed", "in", "an", "array", "as", "Element", ">", "CDATA", "structure", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/CNabuXMLDataObject.php#L139-L161
train
rips/php-connector-bundle
Services/Application/Scan/Issue/Type/PatchService.php
PatchService.getAll
public function getAll(array $queryParams = []) { $response = $this->api ->applications() ->scans() ->issues() ->types() ->patches() ->getAll($queryParams); return new PatchesResponse($response); }
php
public function getAll(array $queryParams = []) { $response = $this->api ->applications() ->scans() ->issues() ->types() ->patches() ->getAll($queryParams); return new PatchesResponse($response); }
[ "public", "function", "getAll", "(", "array", "$", "queryParams", "=", "[", "]", ")", "{", "$", "response", "=", "$", "this", "->", "api", "->", "applications", "(", ")", "->", "scans", "(", ")", "->", "issues", "(", ")", "->", "types", "(", ")", ...
Get all patches for issue types @param array $queryParams @return PatchesResponse
[ "Get", "all", "patches", "for", "issue", "types" ]
34ac080a7988d4d91f8129419998e51291261f55
https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/Type/PatchService.php#L32-L43
train
rips/php-connector-bundle
Services/Application/Scan/Issue/Type/PatchService.php
PatchService.getById
public function getById($patchId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->issues() ->types() ->patches() ->getById($patchId, $queryParams); return new PatchResponse($response); }
php
public function getById($patchId, array $queryParams = []) { $response = $this->api ->applications() ->scans() ->issues() ->types() ->patches() ->getById($patchId, $queryParams); return new PatchResponse($response); }
[ "public", "function", "getById", "(", "$", "patchId", ",", "array", "$", "queryParams", "=", "[", "]", ")", "{", "$", "response", "=", "$", "this", "->", "api", "->", "applications", "(", ")", "->", "scans", "(", ")", "->", "issues", "(", ")", "->"...
Get patch for issue types by id @param int $patchId @param array $queryParams @return PatchResponse
[ "Get", "patch", "for", "issue", "types", "by", "id" ]
34ac080a7988d4d91f8129419998e51291261f55
https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/Type/PatchService.php#L52-L63
train
rips/php-connector-bundle
Hydrators/LanguageHydrator.php
LanguageHydrator.hydrateCollection
public static function hydrateCollection(array $languages) { $hydrated = []; foreach ($languages as $language) { $hydrated[] = self::hydrate($language); } return $hydrated; }
php
public static function hydrateCollection(array $languages) { $hydrated = []; foreach ($languages as $language) { $hydrated[] = self::hydrate($language); } return $hydrated; }
[ "public", "static", "function", "hydrateCollection", "(", "array", "$", "languages", ")", "{", "$", "hydrated", "=", "[", "]", ";", "foreach", "(", "$", "languages", "as", "$", "language", ")", "{", "$", "hydrated", "[", "]", "=", "self", "::", "hydrat...
Hydrate a collection of language objects into a collection of LanguageEntity objects @param stdClass[] $languages @return LanguageEntity[]
[ "Hydrate", "a", "collection", "of", "language", "objects", "into", "a", "collection", "of", "LanguageEntity", "objects" ]
34ac080a7988d4d91f8129419998e51291261f55
https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/LanguageHydrator.php#L20-L29
train
rips/php-connector-bundle
Hydrators/LanguageHydrator.php
LanguageHydrator.hydrate
public static function hydrate(stdClass $language) { $hydrated = new LanguageEntity(); if (isset($language->id)) { $hydrated->setId($language->id); } if (isset($language->name)) { $hydrated->setName($language->name); } if (isset($language->file_extensions)) { $hydrated->setFileExtensions($language->file_extensions); } if (isset($language->config_file_extensions)) { $hydrated->setConfigFileExtensions($language->config_file_extensions); } return $hydrated; }
php
public static function hydrate(stdClass $language) { $hydrated = new LanguageEntity(); if (isset($language->id)) { $hydrated->setId($language->id); } if (isset($language->name)) { $hydrated->setName($language->name); } if (isset($language->file_extensions)) { $hydrated->setFileExtensions($language->file_extensions); } if (isset($language->config_file_extensions)) { $hydrated->setConfigFileExtensions($language->config_file_extensions); } return $hydrated; }
[ "public", "static", "function", "hydrate", "(", "stdClass", "$", "language", ")", "{", "$", "hydrated", "=", "new", "LanguageEntity", "(", ")", ";", "if", "(", "isset", "(", "$", "language", "->", "id", ")", ")", "{", "$", "hydrated", "->", "setId", ...
Hydrate a language object into a LanguageEntity object @param stdClass $language @return LanguageEntity
[ "Hydrate", "a", "language", "object", "into", "a", "LanguageEntity", "object" ]
34ac080a7988d4d91f8129419998e51291261f55
https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/LanguageHydrator.php#L37-L58
train
nabu-3/core
nabu/data/security/traits/TNabuRoleChild.php
TNabuRoleChild.getRole
public function getRole($force = false) { if ($this->nb_role === null || $force) { $this->nb_role = null; if ($this->isValueNumeric('nb_role_id')) { $nb_role = new CNabuRole($this); if ($nb_role->isFetched()) { $this->nb_role = $nb_role; } } } return $this->nb_role; }
php
public function getRole($force = false) { if ($this->nb_role === null || $force) { $this->nb_role = null; if ($this->isValueNumeric('nb_role_id')) { $nb_role = new CNabuRole($this); if ($nb_role->isFetched()) { $this->nb_role = $nb_role; } } } return $this->nb_role; }
[ "public", "function", "getRole", "(", "$", "force", "=", "false", ")", "{", "if", "(", "$", "this", "->", "nb_role", "===", "null", "||", "$", "force", ")", "{", "$", "this", "->", "nb_role", "=", "null", ";", "if", "(", "$", "this", "->", "isVal...
Gets the Role instance. @param bool $force If true, forces to load Role from storage. @return CNabuRole|null Returns the Role instance if setted or null if not.
[ "Gets", "the", "Role", "instance", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/traits/TNabuRoleChild.php#L47-L60
train
nabu-3/core
nabu/data/security/traits/TNabuRoleChild.php
TNabuRoleChild.setRole
public function setRole(CNabuRole $nb_role) { $this->nb_role = $nb_role; if ($this instanceof CNabuDataObject) { $this->transferValue($nb_role, NABU_ROLE_FIELD_ID); } return $this; }
php
public function setRole(CNabuRole $nb_role) { $this->nb_role = $nb_role; if ($this instanceof CNabuDataObject) { $this->transferValue($nb_role, NABU_ROLE_FIELD_ID); } return $this; }
[ "public", "function", "setRole", "(", "CNabuRole", "$", "nb_role", ")", "{", "$", "this", "->", "nb_role", "=", "$", "nb_role", ";", "if", "(", "$", "this", "instanceof", "CNabuDataObject", ")", "{", "$", "this", "->", "transferValue", "(", "$", "nb_role...
Sets the Role instance that owns this object and sets the field containing the Role id. @param CNabuRole $nb_role Role instance to be setted. @param string $field Field name where the Role id will be stored. @return mixed Returns $this to allow the cascade chain of setters.
[ "Sets", "the", "Role", "instance", "that", "owns", "this", "object", "and", "sets", "the", "field", "containing", "the", "Role", "id", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/traits/TNabuRoleChild.php#L68-L76
train
pragma-framework/core
Pragma/Helpers/Migrate.php
Migrate.postPackageInstall
public static function postPackageInstall(PackageEvent $event){ $installedPackage = $event->getOperation()->getPackage()->getName(); if (self::checkConfig($event, $installedPackage)) { self::phinxMigrateFromPackageName($event, $installedPackage, true); } else { die(); } }
php
public static function postPackageInstall(PackageEvent $event){ $installedPackage = $event->getOperation()->getPackage()->getName(); if (self::checkConfig($event, $installedPackage)) { self::phinxMigrateFromPackageName($event, $installedPackage, true); } else { die(); } }
[ "public", "static", "function", "postPackageInstall", "(", "PackageEvent", "$", "event", ")", "{", "$", "installedPackage", "=", "$", "event", "->", "getOperation", "(", ")", "->", "getPackage", "(", ")", "->", "getName", "(", ")", ";", "if", "(", "self", ...
post-package-install
[ "post", "-", "package", "-", "install" ]
557f4b4857d36a8fd603483ec99782efdfd51c78
https://github.com/pragma-framework/core/blob/557f4b4857d36a8fd603483ec99782efdfd51c78/Pragma/Helpers/Migrate.php#L9-L16
train
pragma-framework/core
Pragma/Helpers/Migrate.php
Migrate.postPackageUpdate
public static function postPackageUpdate(PackageEvent $event){ $installedPackage = $event->getOperation()->getTargetPackage()->getName(); if (self::checkConfig($event, $installedPackage)) { self::phinxMigrateFromPackageName($event, $installedPackage); } else { die(); } }
php
public static function postPackageUpdate(PackageEvent $event){ $installedPackage = $event->getOperation()->getTargetPackage()->getName(); if (self::checkConfig($event, $installedPackage)) { self::phinxMigrateFromPackageName($event, $installedPackage); } else { die(); } }
[ "public", "static", "function", "postPackageUpdate", "(", "PackageEvent", "$", "event", ")", "{", "$", "installedPackage", "=", "$", "event", "->", "getOperation", "(", ")", "->", "getTargetPackage", "(", ")", "->", "getName", "(", ")", ";", "if", "(", "se...
post-package-update
[ "post", "-", "package", "-", "update" ]
557f4b4857d36a8fd603483ec99782efdfd51c78
https://github.com/pragma-framework/core/blob/557f4b4857d36a8fd603483ec99782efdfd51c78/Pragma/Helpers/Migrate.php#L18-L25
train
pragma-framework/core
Pragma/Helpers/Migrate.php
Migrate.prePackageUninstall
public static function prePackageUninstall(PackageEvent $event){ $installedPackage = $event->getOperation()->getPackage()->getName(); if (self::checkConfig($event, $installedPackage)) { self::phinxRollbackFromPackageName($event, $installedPackage); } else { die(); } }
php
public static function prePackageUninstall(PackageEvent $event){ $installedPackage = $event->getOperation()->getPackage()->getName(); if (self::checkConfig($event, $installedPackage)) { self::phinxRollbackFromPackageName($event, $installedPackage); } else { die(); } }
[ "public", "static", "function", "prePackageUninstall", "(", "PackageEvent", "$", "event", ")", "{", "$", "installedPackage", "=", "$", "event", "->", "getOperation", "(", ")", "->", "getPackage", "(", ")", "->", "getName", "(", ")", ";", "if", "(", "self",...
pre-package-uninstall
[ "pre", "-", "package", "-", "uninstall" ]
557f4b4857d36a8fd603483ec99782efdfd51c78
https://github.com/pragma-framework/core/blob/557f4b4857d36a8fd603483ec99782efdfd51c78/Pragma/Helpers/Migrate.php#L27-L34
train
mpaleo/scaffolder
src/Scaffolder/Compilers/AbstractViewCompiler.php
AbstractViewCompiler.replaceBreadcrumb
protected function replaceBreadcrumb($modelName, $modelLabel) { $this->stub = str_replace('{{breadcrumb}}', ucfirst(strtolower($modelLabel)), $this->stub); $this->stub = str_replace('{{breadcrumb_lw}}', strtolower($modelName), $this->stub); return $this; }
php
protected function replaceBreadcrumb($modelName, $modelLabel) { $this->stub = str_replace('{{breadcrumb}}', ucfirst(strtolower($modelLabel)), $this->stub); $this->stub = str_replace('{{breadcrumb_lw}}', strtolower($modelName), $this->stub); return $this; }
[ "protected", "function", "replaceBreadcrumb", "(", "$", "modelName", ",", "$", "modelLabel", ")", "{", "$", "this", "->", "stub", "=", "str_replace", "(", "'{{breadcrumb}}'", ",", "ucfirst", "(", "strtolower", "(", "$", "modelLabel", ")", ")", ",", "$", "t...
Replace the breadcrumb. @param $modelName @param $modelLabel @return $this
[ "Replace", "the", "breadcrumb", "." ]
c68062dc1d71784b93e5ef77a8abd283b716633f
https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/AbstractViewCompiler.php#L34-L40
train
markusjwetzel/laravel-datamapper
src/Metadata/Definitions/Definition.php
Definition.offsetSet
public function offsetSet($key, $newval) { if ($def = in_array($key, array_keys($this->keys))) { parent::offsetSet($key, $newval); } else { throw new UnexpectedValueException($key.' is not defined in metadata definition '.get_class($this).'.'); } }
php
public function offsetSet($key, $newval) { if ($def = in_array($key, array_keys($this->keys))) { parent::offsetSet($key, $newval); } else { throw new UnexpectedValueException($key.' is not defined in metadata definition '.get_class($this).'.'); } }
[ "public", "function", "offsetSet", "(", "$", "key", ",", "$", "newval", ")", "{", "if", "(", "$", "def", "=", "in_array", "(", "$", "key", ",", "array_keys", "(", "$", "this", "->", "keys", ")", ")", ")", "{", "parent", "::", "offsetSet", "(", "$...
Do not allow to set more definitions. @param mixed $key @param mixed $newval @return void
[ "Do", "not", "allow", "to", "set", "more", "definitions", "." ]
8fac20e5bca8fb81eefa7dacc49269b4a6241cbf
https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Metadata/Definitions/Definition.php#L36-L43
train
orchestral/lumen
src/Auth/Providers/Guard.php
Guard.authenticate
public function authenticate(Request $request, Route $route) { if (! $user = $this->auth->user()) { throw new UnauthorizedHttpException( get_class($this), 'Unable to authenticate with invalid API key and token.' ); } return $user; }
php
public function authenticate(Request $request, Route $route) { if (! $user = $this->auth->user()) { throw new UnauthorizedHttpException( get_class($this), 'Unable to authenticate with invalid API key and token.' ); } return $user; }
[ "public", "function", "authenticate", "(", "Request", "$", "request", ",", "Route", "$", "route", ")", "{", "if", "(", "!", "$", "user", "=", "$", "this", "->", "auth", "->", "user", "(", ")", ")", "{", "throw", "new", "UnauthorizedHttpException", "(",...
Authenticate request with a Illuminate Guard. @param \Illuminate\Http\Request $request @param \Dingo\Api\Routing\Route $route @return mixed
[ "Authenticate", "request", "with", "a", "Illuminate", "Guard", "." ]
85a004e7cde0517b527241154f5ad031b7215851
https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/src/Auth/Providers/Guard.php#L45-L55
train
rips/php-connector-bundle
Hydrators/OrgHydrator.php
OrgHydrator.hydrateCollection
public static function hydrateCollection(array $organizations) { $hydrated = []; foreach ($organizations as $organization) { $hydrated[] = self::hydrate($organization); } return $hydrated; }
php
public static function hydrateCollection(array $organizations) { $hydrated = []; foreach ($organizations as $organization) { $hydrated[] = self::hydrate($organization); } return $hydrated; }
[ "public", "static", "function", "hydrateCollection", "(", "array", "$", "organizations", ")", "{", "$", "hydrated", "=", "[", "]", ";", "foreach", "(", "$", "organizations", "as", "$", "organization", ")", "{", "$", "hydrated", "[", "]", "=", "self", "::...
Hydrate a collection of organization objects into a collection of OrgEntity objects @param stdClass[] $organizations @return OrgEntity[]
[ "Hydrate", "a", "collection", "of", "organization", "objects", "into", "a", "collection", "of", "OrgEntity", "objects" ]
34ac080a7988d4d91f8129419998e51291261f55
https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/OrgHydrator.php#L19-L28
train
rips/php-connector-bundle
Hydrators/OrgHydrator.php
OrgHydrator.hydrate
public static function hydrate(stdClass $organization) { $hydrated = new OrgEntity(); if (isset($organization->id)) { $hydrated->setId($organization->id); } if (isset($organization->name)) { $hydrated->setName($organization->name); } if (isset($organization->valid_until)) { $hydrated->setValidUntil(new DateTime($organization->valid_until)); } if (isset($organization->quotas) && is_array($organization->quotas)) { $hydrated->setQuotas(QuotaHydrator::hydrateCollection($organization->quotas)); } if (isset($organization->trial_issue_types) && is_array($organization->trial_issue_types)) { $hydrated->setTrialIssueTypes(TypeHydrator::hydrateCollection($organization->trial_issue_types)); } if (isset($organization->disabled)) { $hydrated->setDisabled($organization->disabled); } return $hydrated; }
php
public static function hydrate(stdClass $organization) { $hydrated = new OrgEntity(); if (isset($organization->id)) { $hydrated->setId($organization->id); } if (isset($organization->name)) { $hydrated->setName($organization->name); } if (isset($organization->valid_until)) { $hydrated->setValidUntil(new DateTime($organization->valid_until)); } if (isset($organization->quotas) && is_array($organization->quotas)) { $hydrated->setQuotas(QuotaHydrator::hydrateCollection($organization->quotas)); } if (isset($organization->trial_issue_types) && is_array($organization->trial_issue_types)) { $hydrated->setTrialIssueTypes(TypeHydrator::hydrateCollection($organization->trial_issue_types)); } if (isset($organization->disabled)) { $hydrated->setDisabled($organization->disabled); } return $hydrated; }
[ "public", "static", "function", "hydrate", "(", "stdClass", "$", "organization", ")", "{", "$", "hydrated", "=", "new", "OrgEntity", "(", ")", ";", "if", "(", "isset", "(", "$", "organization", "->", "id", ")", ")", "{", "$", "hydrated", "->", "setId",...
Hydrate a organization object into a OrgEntity object @param stdClass $organization @return OrgEntity
[ "Hydrate", "a", "organization", "object", "into", "a", "OrgEntity", "object" ]
34ac080a7988d4d91f8129419998e51291261f55
https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/OrgHydrator.php#L36-L65
train
nabu-3/core
nabu/http/app/CNabuHTTPStandaloneApplication.php
CNabuHTTPStandaloneApplication.enableLanguage
public function enableLanguage($ISO639_1, $name, $default_country_code, $default_lang = false) { $nb_language = new CNabuBuiltInLanguage(); $nb_language->setISO6391($ISO639_1) ->setName($name) ->setDefaultCountryCode($default_country_code) ->setEnabled(CNabuLanguage::LANGUAGE_ENABLED) ; $nb_site = $this->nb_engine->getHTTPServer()->getSite(); $nb_site->setLanguage($nb_language); if ($default_lang) { $nb_site->setDefaultLanguage($nb_language); } return $nb_language; }
php
public function enableLanguage($ISO639_1, $name, $default_country_code, $default_lang = false) { $nb_language = new CNabuBuiltInLanguage(); $nb_language->setISO6391($ISO639_1) ->setName($name) ->setDefaultCountryCode($default_country_code) ->setEnabled(CNabuLanguage::LANGUAGE_ENABLED) ; $nb_site = $this->nb_engine->getHTTPServer()->getSite(); $nb_site->setLanguage($nb_language); if ($default_lang) { $nb_site->setDefaultLanguage($nb_language); } return $nb_language; }
[ "public", "function", "enableLanguage", "(", "$", "ISO639_1", ",", "$", "name", ",", "$", "default_country_code", ",", "$", "default_lang", "=", "false", ")", "{", "$", "nb_language", "=", "new", "CNabuBuiltInLanguage", "(", ")", ";", "$", "nb_language", "->...
Fast method to add a language to the Site. @param string $ISO639_1 ISO-639/1 code of language. @param string $name Common name of the language @param string $default_country_code Default country for this language @return CNabuLanguage Returns a CNabuLanguage instance
[ "Fast", "method", "to", "add", "a", "language", "to", "the", "Site", "." ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/app/CNabuHTTPStandaloneApplication.php#L133-L149
train
nabu-3/core
nabu/http/app/CNabuHTTPStandaloneApplication.php
CNabuHTTPStandaloneApplication.addSmartyTarget
public function addSmartyTarget($display, $content, $default = false) { $target = new CNabuBuiltInSiteTarget(); $target->setMIMETypeId('text/html') ->setOutputTypeHTML() ->setSmartyDisplayFile($display) ->setSmartyContentFile($content) ; return $this->addTarget($target, $default); }
php
public function addSmartyTarget($display, $content, $default = false) { $target = new CNabuBuiltInSiteTarget(); $target->setMIMETypeId('text/html') ->setOutputTypeHTML() ->setSmartyDisplayFile($display) ->setSmartyContentFile($content) ; return $this->addTarget($target, $default); }
[ "public", "function", "addSmartyTarget", "(", "$", "display", ",", "$", "content", ",", "$", "default", "=", "false", ")", "{", "$", "target", "=", "new", "CNabuBuiltInSiteTarget", "(", ")", ";", "$", "target", "->", "setMIMETypeId", "(", "'text/html'", ")...
Add a target using Smarty template files @param string $display Path to Smarty Display file. @param type $content Path to Smarty Content file. @return CNabuSiteTarget Returns the created target instance.
[ "Add", "a", "target", "using", "Smarty", "template", "files" ]
8a93a91ba146536d66f57821e6f23f9175d8bd11
https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/app/CNabuHTTPStandaloneApplication.php#L166-L176
train