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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.getTargets | public function getTargets($force = false) : CNabuSiteTargetList
{
if (!$this->isBuiltIn() &&
($this->nb_site_target_list->isEmpty() || $force)
) {
$this->nb_site_target_list->clear();
$this->nb_site_target_list->merge(CNabuSiteTarget::getAllSiteTargets($this));
$this->nb_site_target_list->iterate(function ($key, $nb_site_target) {
$nb_site_target->setSite($this);
return true;
});
}
return $this->nb_site_target_list;
} | php | public function getTargets($force = false) : CNabuSiteTargetList
{
if (!$this->isBuiltIn() &&
($this->nb_site_target_list->isEmpty() || $force)
) {
$this->nb_site_target_list->clear();
$this->nb_site_target_list->merge(CNabuSiteTarget::getAllSiteTargets($this));
$this->nb_site_target_list->iterate(function ($key, $nb_site_target) {
$nb_site_target->setSite($this);
return true;
});
}
return $this->nb_site_target_list;
} | [
"public",
"function",
"getTargets",
"(",
"$",
"force",
"=",
"false",
")",
":",
"CNabuSiteTargetList",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isBuiltIn",
"(",
")",
"&&",
"(",
"$",
"this",
"->",
"nb_site_target_list",
"->",
"isEmpty",
"(",
")",
"||",
"... | Gets the Target list associated with this instance.
@param bool $force If true forces to reload entire list from database.
@return CNabuSiteTargetList Returns the list instance containing all associated contents. | [
"Gets",
"the",
"Target",
"list",
"associated",
"with",
"this",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L231-L245 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.addStaticContent | public function addStaticContent(CNabuSiteStaticContent $nb_site_static_content)
{
$nb_site_static_content->setSite($this);
return $this->nb_site_static_content_list->addItem($nb_site_static_content);
} | php | public function addStaticContent(CNabuSiteStaticContent $nb_site_static_content)
{
$nb_site_static_content->setSite($this);
return $this->nb_site_static_content_list->addItem($nb_site_static_content);
} | [
"public",
"function",
"addStaticContent",
"(",
"CNabuSiteStaticContent",
"$",
"nb_site_static_content",
")",
"{",
"$",
"nb_site_static_content",
"->",
"setSite",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"nb_site_static_content_list",
"->",
"addItem",
... | Add a static content to a site.
@param CNabuSiteStaticContent $nb_site_static_content Static Content to add to site.
@return CNabuSiteStaticContent Returns the inserted static content. | [
"Add",
"a",
"static",
"content",
"to",
"a",
"site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L252-L257 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.getStaticContent | public function getStaticContent($nb_site_static_content)
{
$nb_site_static_content_id = nb_getMixedValue($nb_site_static_content, 'nb_site_static_content_id');
return (is_numeric($nb_site_static_content_id) || nb_isValidGUID($nb_site_static_content_id))
? $this->nb_site_static_content_list->getItem($nb_site_static_content_id)
: null
;
} | php | public function getStaticContent($nb_site_static_content)
{
$nb_site_static_content_id = nb_getMixedValue($nb_site_static_content, 'nb_site_static_content_id');
return (is_numeric($nb_site_static_content_id) || nb_isValidGUID($nb_site_static_content_id))
? $this->nb_site_static_content_list->getItem($nb_site_static_content_id)
: null
;
} | [
"public",
"function",
"getStaticContent",
"(",
"$",
"nb_site_static_content",
")",
"{",
"$",
"nb_site_static_content_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site_static_content",
",",
"'nb_site_static_content_id'",
")",
";",
"return",
"(",
"is_numeric",
"(",
"$",
... | Gets a Static Content item from the list of static contents loaded in the Site.
@param mixed $nb_site_static_content An instance that contains a field named 'nb_site_static_content_id'
or an Id.
@return CNabuSiteStaticContent Returns the requested static content if exists or null if not. | [
"Gets",
"a",
"Static",
"Content",
"item",
"from",
"the",
"list",
"of",
"static",
"contents",
"loaded",
"in",
"the",
"Site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L265-L273 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.getStaticContents | public function getStaticContents($force = false) : CNabuSiteStaticContentList
{
if (!$this->isBuiltIn() &&
($this->nb_site_static_content_list->isEmpty() || $force)
) {
$this->nb_site_static_content_list = CNabuSiteStaticContent::getStaticContentsForSite($this);
$this->nb_site_static_content_list->sort();
}
return $this->nb_site_static_content_list;
} | php | public function getStaticContents($force = false) : CNabuSiteStaticContentList
{
if (!$this->isBuiltIn() &&
($this->nb_site_static_content_list->isEmpty() || $force)
) {
$this->nb_site_static_content_list = CNabuSiteStaticContent::getStaticContentsForSite($this);
$this->nb_site_static_content_list->sort();
}
return $this->nb_site_static_content_list;
} | [
"public",
"function",
"getStaticContents",
"(",
"$",
"force",
"=",
"false",
")",
":",
"CNabuSiteStaticContentList",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isBuiltIn",
"(",
")",
"&&",
"(",
"$",
"this",
"->",
"nb_site_static_content_list",
"->",
"isEmpty",
"... | Gets the Static Content list associated with this instance.
@param bool $force If true forces to reload entire list from database.
@return CNabuSiteStaticContentList Returns the list instance containing all associated contents. | [
"Gets",
"the",
"Static",
"Content",
"list",
"associated",
"with",
"this",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L291-L301 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.isDefaultTargetUsingTarget | public function isDefaultTargetUsingTarget()
{
return $this->getDefaultTargetUseURI() === CNabuSiteTargetLink::USE_URI_TRANSLATED &&
$this->nb_site_target_list->containsKey($this->getDefaultTargetId());
} | php | public function isDefaultTargetUsingTarget()
{
return $this->getDefaultTargetUseURI() === CNabuSiteTargetLink::USE_URI_TRANSLATED &&
$this->nb_site_target_list->containsKey($this->getDefaultTargetId());
} | [
"public",
"function",
"isDefaultTargetUsingTarget",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"getDefaultTargetUseURI",
"(",
")",
"===",
"CNabuSiteTargetLink",
"::",
"USE_URI_TRANSLATED",
"&&",
"$",
"this",
"->",
"nb_site_target_list",
"->",
"containsKey",
"(",
"$... | Check if Default Target uses a Site Target object.
@return bool Returns true if the Default Site Target is a CNabuSiteTarget object. | [
"Check",
"if",
"Default",
"Target",
"uses",
"a",
"Site",
"Target",
"object",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L425-L429 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.setDefaultTarget | public function setDefaultTarget(CNabuDataObject $nb_site_target)
{
$this->setDefaultTargetUseURI(CNabuSiteTargetLink::USE_URI_TRANSLATED);
$this->transferValue($nb_site_target, 'nb_site_target_id', 'nb_site_default_target_id');
return $this;
} | php | public function setDefaultTarget(CNabuDataObject $nb_site_target)
{
$this->setDefaultTargetUseURI(CNabuSiteTargetLink::USE_URI_TRANSLATED);
$this->transferValue($nb_site_target, 'nb_site_target_id', 'nb_site_default_target_id');
return $this;
} | [
"public",
"function",
"setDefaultTarget",
"(",
"CNabuDataObject",
"$",
"nb_site_target",
")",
"{",
"$",
"this",
"->",
"setDefaultTargetUseURI",
"(",
"CNabuSiteTargetLink",
"::",
"USE_URI_TRANSLATED",
")",
";",
"$",
"this",
"->",
"transferValue",
"(",
"$",
"nb_site_t... | Sets the default Site Target.
@param CNabuDataObject $nb_site_target Target instance to be setted.
@return CNabuSite Returns the $this instance. | [
"Sets",
"the",
"default",
"Site",
"Target",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L436-L442 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.setLoginTarget | public function setLoginTarget(CNabuDataObject $nb_site_target)
{
$this->setLoginTargetUseURI(CNabuSiteTargetLink::USE_URI_TRANSLATED);
$this->transferValue($nb_site_target, 'nb_site_target_id', 'nb_site_login_target_id');
return $this;
} | php | public function setLoginTarget(CNabuDataObject $nb_site_target)
{
$this->setLoginTargetUseURI(CNabuSiteTargetLink::USE_URI_TRANSLATED);
$this->transferValue($nb_site_target, 'nb_site_target_id', 'nb_site_login_target_id');
return $this;
} | [
"public",
"function",
"setLoginTarget",
"(",
"CNabuDataObject",
"$",
"nb_site_target",
")",
"{",
"$",
"this",
"->",
"setLoginTargetUseURI",
"(",
"CNabuSiteTargetLink",
"::",
"USE_URI_TRANSLATED",
")",
";",
"$",
"this",
"->",
"transferValue",
"(",
"$",
"nb_site_targe... | Sets the login Site Target.
@param CNabuDataObject $nb_site_target Target instance to be setted.
@return CNabuSite Returns the $this instance. | [
"Sets",
"the",
"login",
"Site",
"Target",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L449-L455 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.getSiteMap | public function getSiteMap($nb_site_map, $cascade = false)
{
$retval = null;
$nb_site_map_id = nb_getMixedValue($nb_site_map, 'nb_site_map_id');
if (is_numeric($nb_site_map_id) || nb_isValidGUID($nb_site_map_id)) {
$retval = $this->nb_site_map_tree->getItem($nb_site_map_id);
}
return $retval;
} | php | public function getSiteMap($nb_site_map, $cascade = false)
{
$retval = null;
$nb_site_map_id = nb_getMixedValue($nb_site_map, 'nb_site_map_id');
if (is_numeric($nb_site_map_id) || nb_isValidGUID($nb_site_map_id)) {
$retval = $this->nb_site_map_tree->getItem($nb_site_map_id);
}
return $retval;
} | [
"public",
"function",
"getSiteMap",
"(",
"$",
"nb_site_map",
",",
"$",
"cascade",
"=",
"false",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"$",
"nb_site_map_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site_map",
",",
"'nb_site_map_id'",
")",
";",
"if",
"("... | Gets a Site Map instance, optionally looking for it in nested levels.
@param mixed $nb_site_map A CNabuDataObject inherited instance containing a field named nb_site_map_id
or an ID.
@param bool $cascade If true, the requested Site Map is searched exploring nested Site Maps.
@return null|CNabuSiteMap If a Site Map is found then returns the instance elsewhere returns null. | [
"Gets",
"a",
"Site",
"Map",
"instance",
"optionally",
"looking",
"for",
"it",
"in",
"nested",
"levels",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L464-L474 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.addSiteMap | public function addSiteMap(CNabuSiteMap $nb_site_map)
{
$nb_site_map->transferValue($this, 'nb_site_id');
return $this->nb_site_map_tree->addItem($nb_site_map);
} | php | public function addSiteMap(CNabuSiteMap $nb_site_map)
{
$nb_site_map->transferValue($this, 'nb_site_id');
return $this->nb_site_map_tree->addItem($nb_site_map);
} | [
"public",
"function",
"addSiteMap",
"(",
"CNabuSiteMap",
"$",
"nb_site_map",
")",
"{",
"$",
"nb_site_map",
"->",
"transferValue",
"(",
"$",
"this",
",",
"'nb_site_id'",
")",
";",
"return",
"$",
"this",
"->",
"nb_site_map_tree",
"->",
"addItem",
"(",
"$",
"nb... | Add a map to a site
@param CNabuSiteMap $nb_site_map Site Map to add to site
@return CNabuSiteMap Returns the inserted site map | [
"Add",
"a",
"map",
"to",
"a",
"site"
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L481-L486 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.getNaturalLanguages | public function getNaturalLanguages(bool $force = false) : CNabuLanguageList
{
$nb_natural = new CNabuLanguageList();
$this->getLanguages($force)->iterate(function ($key, CNabuLanguage $nb_language) use ($nb_natural) {
if ($nb_language->isNaturalLanguage()) {
$nb_natural->addItem($nb_language);
}
return true;
});
return $nb_natural;
} | php | public function getNaturalLanguages(bool $force = false) : CNabuLanguageList
{
$nb_natural = new CNabuLanguageList();
$this->getLanguages($force)->iterate(function ($key, CNabuLanguage $nb_language) use ($nb_natural) {
if ($nb_language->isNaturalLanguage()) {
$nb_natural->addItem($nb_language);
}
return true;
});
return $nb_natural;
} | [
"public",
"function",
"getNaturalLanguages",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"CNabuLanguageList",
"{",
"$",
"nb_natural",
"=",
"new",
"CNabuLanguageList",
"(",
")",
";",
"$",
"this",
"->",
"getLanguages",
"(",
"$",
"force",
")",
"->",
"i... | Get the list of all Natural Languages setted for this site.
@param bool $force When true, force to reload list from database.
@return CNabuLanguageList Returns the list of available languages. | [
"Get",
"the",
"list",
"of",
"all",
"Natural",
"Languages",
"setted",
"for",
"this",
"site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L555-L566 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.getAPILanguages | public function getAPILanguages(bool $force = false) : CNabuLanguageList
{
$nb_api = new CNabuLanguageList();
$this->getLanguages($force)->iterate(function ($key, CNabuLanguage $nb_language) use ($nb_api) {
if ($nb_language->isAPILanguage()) {
$nb_api->addItem($nb_language);
}
return true;
});
return $nb_api;
} | php | public function getAPILanguages(bool $force = false) : CNabuLanguageList
{
$nb_api = new CNabuLanguageList();
$this->getLanguages($force)->iterate(function ($key, CNabuLanguage $nb_language) use ($nb_api) {
if ($nb_language->isAPILanguage()) {
$nb_api->addItem($nb_language);
}
return true;
});
return $nb_api;
} | [
"public",
"function",
"getAPILanguages",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"CNabuLanguageList",
"{",
"$",
"nb_api",
"=",
"new",
"CNabuLanguageList",
"(",
")",
";",
"$",
"this",
"->",
"getLanguages",
"(",
"$",
"force",
")",
"->",
"iterate",... | Get the list of all API Languages setted for this site.
@param bool $force When true, force to reload list from database.
@return CNabuLanguageList Returns the list of available languages. | [
"Get",
"the",
"list",
"of",
"all",
"API",
"Languages",
"setted",
"for",
"this",
"site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L573-L584 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.getRoles | public function getRoles(bool $force = false) : CNabuRoleList
{
if ($this->nb_role_list->isEmpty() || $force) {
$this->nb_role_list->fillFromSite($this);
}
return $this->nb_role_list;
} | php | public function getRoles(bool $force = false) : CNabuRoleList
{
if ($this->nb_role_list->isEmpty() || $force) {
$this->nb_role_list->fillFromSite($this);
}
return $this->nb_role_list;
} | [
"public",
"function",
"getRoles",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"CNabuRoleList",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_role_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_role_list",
"->",
... | Gets a list of all Roles availables in this Site.
@param bool $force If true, the list is reloaded from the database storage.
@return CNabuRoleList Returns the list of roles if any, or an empty list if none. | [
"Gets",
"a",
"list",
"of",
"all",
"Roles",
"availables",
"in",
"this",
"Site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L972-L979 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.getSiteRoles | public function getSiteRoles(bool $force = false) : CNabuSiteRoleList
{
if ($this->nb_site_role_list->isEmpty() || $force) {
$this->nb_site_role_list->clear();
$this->nb_site_role_list->merge(CNabuSiteRole::getSiteRolesForSite($this));
}
return $this->nb_site_role_list;
} | php | public function getSiteRoles(bool $force = false) : CNabuSiteRoleList
{
if ($this->nb_site_role_list->isEmpty() || $force) {
$this->nb_site_role_list->clear();
$this->nb_site_role_list->merge(CNabuSiteRole::getSiteRolesForSite($this));
}
return $this->nb_site_role_list;
} | [
"public",
"function",
"getSiteRoles",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"CNabuSiteRoleList",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_site_role_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_site_rol... | Gets a list of all Site Roles availables in this Site.
@param bool $force If true, the list is reloaded from the database storage.
@return CNabuSiteRoleList Returns the list of Site Roles if any, or an empty list if none. | [
"Gets",
"a",
"list",
"of",
"all",
"Site",
"Roles",
"availables",
"in",
"this",
"Site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L986-L994 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.getSiteRole | public function getSiteRole($nb_site_role)
{
if (is_numeric($nb_role_id = nb_getMixedValue($nb_site_role, NABU_ROLE_FIELD_ID))) {
$retval = $this->getSiteRoles()->getItem($nb_role_id);
} else {
$retval = false;
}
return $retval;
} | php | public function getSiteRole($nb_site_role)
{
if (is_numeric($nb_role_id = nb_getMixedValue($nb_site_role, NABU_ROLE_FIELD_ID))) {
$retval = $this->getSiteRoles()->getItem($nb_role_id);
} else {
$retval = false;
}
return $retval;
} | [
"public",
"function",
"getSiteRole",
"(",
"$",
"nb_site_role",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_role_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site_role",
",",
"NABU_ROLE_FIELD_ID",
")",
")",
")",
"{",
"$",
"retval",
"=",
"$",
"this",
"->... | Gets a Site Role by his Id.
@param mixed $nb_site_role A CNabuDataObject containing a field named nb_role_id or a valid Id.
@return CNabuSiteRole|bool Returns the Site Role instance if exists or false if not. | [
"Gets",
"a",
"Site",
"Role",
"by",
"his",
"Id",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L1001-L1010 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.sendNewUserNotification | public function sendNewUserNotification(CNabuUser $nb_user, array $params = null) : bool
{
$retval = false;
$nb_engine = CNabuEngine::getEngine();
if (($nb_profile = $this->getUserProfile($nb_user)) instanceof CNabuSiteUser &&
($nb_language_id = $nb_profile->getLanguageId())
) {
if (count($params) === 0) {
$params = array();
}
foreach ($nb_user->getTreeData($nb_language_id, true) as $key => $item) {
if (is_scalar($item)) {
$params["target_user_$key"] = $item;
}
}
$nb_site_role = $this->getSiteRole($nb_profile);
$nb_template_id = $nb_site_role instanceof CNabuSiteRole &&
$nb_site_role->isValueNumeric('nb_messaging_template_new_user')
? $nb_template_id = $nb_site_role->getMessagingTemplateNewUser()
: $this->getMessagingTemplateNewUser()
;
return is_numeric($nb_template_id) &&
($nb_messaging = $this->getMessaging($this->getCustomer())) instanceof CNabuMessaging &&
($nb_messaging_factory = $nb_messaging->getFactory()) instanceof CNabuMessagingFactory &&
$nb_messaging_factory->postTemplateMessage($nb_template_id, $nb_language_id, $nb_user, null, null, $params)
;
} else {
throw new ENabuSecurityException(ENabuSecurityException::ERROR_USER_NOT_ALLOWED, array($nb_user->getId()));
}
} | php | public function sendNewUserNotification(CNabuUser $nb_user, array $params = null) : bool
{
$retval = false;
$nb_engine = CNabuEngine::getEngine();
if (($nb_profile = $this->getUserProfile($nb_user)) instanceof CNabuSiteUser &&
($nb_language_id = $nb_profile->getLanguageId())
) {
if (count($params) === 0) {
$params = array();
}
foreach ($nb_user->getTreeData($nb_language_id, true) as $key => $item) {
if (is_scalar($item)) {
$params["target_user_$key"] = $item;
}
}
$nb_site_role = $this->getSiteRole($nb_profile);
$nb_template_id = $nb_site_role instanceof CNabuSiteRole &&
$nb_site_role->isValueNumeric('nb_messaging_template_new_user')
? $nb_template_id = $nb_site_role->getMessagingTemplateNewUser()
: $this->getMessagingTemplateNewUser()
;
return is_numeric($nb_template_id) &&
($nb_messaging = $this->getMessaging($this->getCustomer())) instanceof CNabuMessaging &&
($nb_messaging_factory = $nb_messaging->getFactory()) instanceof CNabuMessagingFactory &&
$nb_messaging_factory->postTemplateMessage($nb_template_id, $nb_language_id, $nb_user, null, null, $params)
;
} else {
throw new ENabuSecurityException(ENabuSecurityException::ERROR_USER_NOT_ALLOWED, array($nb_user->getId()));
}
} | [
"public",
"function",
"sendNewUserNotification",
"(",
"CNabuUser",
"$",
"nb_user",
",",
"array",
"$",
"params",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"retval",
"=",
"false",
";",
"$",
"nb_engine",
"=",
"CNabuEngine",
"::",
"getEngine",
"(",
")",
";",
... | Send a New User double opt-in message to validate the account or communitate something to him.
@param CNabuUser $nb_user User instance to be notified.
@param array|null $params Array of additional parameters to be used. Depending on the Render used, this parameter
can be applied or ignored.
@return bool Returns true if the notification is sent or false if not. | [
"Send",
"a",
"New",
"User",
"double",
"opt",
"-",
"in",
"message",
"to",
"validate",
"the",
"account",
"or",
"communitate",
"something",
"to",
"him",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L1161-L1193 | train |
php-xapi/model | src/Statement.php | Statement.withAuthority | public function withAuthority(Actor $authority = null): self
{
$statement = clone $this;
$statement->authority = $authority;
return $statement;
} | php | public function withAuthority(Actor $authority = null): self
{
$statement = clone $this;
$statement->authority = $authority;
return $statement;
} | [
"public",
"function",
"withAuthority",
"(",
"Actor",
"$",
"authority",
"=",
"null",
")",
":",
"self",
"{",
"$",
"statement",
"=",
"clone",
"$",
"this",
";",
"$",
"statement",
"->",
"authority",
"=",
"$",
"authority",
";",
"return",
"$",
"statement",
";",... | Creates a new Statement based on the current one containing an Authority
that asserts the Statement true. | [
"Creates",
"a",
"new",
"Statement",
"based",
"on",
"the",
"current",
"one",
"containing",
"an",
"Authority",
"that",
"asserts",
"the",
"Statement",
"true",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/Statement.php#L95-L101 | train |
php-xapi/model | src/Statement.php | Statement.getVoidStatement | public function getVoidStatement(Actor $actor): self
{
return new Statement(
null,
$actor,
Verb::createVoidVerb(),
$this->getStatementReference()
);
} | php | public function getVoidStatement(Actor $actor): self
{
return new Statement(
null,
$actor,
Verb::createVoidVerb(),
$this->getStatementReference()
);
} | [
"public",
"function",
"getVoidStatement",
"(",
"Actor",
"$",
"actor",
")",
":",
"self",
"{",
"return",
"new",
"Statement",
"(",
"null",
",",
"$",
"actor",
",",
"Verb",
"::",
"createVoidVerb",
"(",
")",
",",
"$",
"this",
"->",
"getStatementReference",
"(",
... | Returns a Statement that voids the current Statement. | [
"Returns",
"a",
"Statement",
"that",
"voids",
"the",
"current",
"Statement",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/Statement.php#L252-L260 | train |
php-xapi/model | src/Statement.php | Statement.equals | public function equals(Statement $statement): bool
{
if (null !== $this->id xor null !== $statement->id) {
return false;
}
if (null !== $this->id && null !== $statement->id && !$this->id->equals($statement->id)) {
return false;
}
if (!$this->actor->equals($statement->actor)) {
return false;
}
if (!$this->verb->equals($statement->verb)) {
return false;
}
if (!$this->object->equals($statement->object)) {
return false;
}
if (null === $this->result && null !== $statement->result) {
return false;
}
if (null !== $this->result && null === $statement->result) {
return false;
}
if (null !== $this->result && !$this->result->equals($statement->result)) {
return false;
}
if (null === $this->authority && null !== $statement->authority) {
return false;
}
if (null !== $this->authority && null === $statement->authority) {
return false;
}
if (null !== $this->authority && !$this->authority->equals($statement->authority)) {
return false;
}
if ($this->created != $statement->created) {
return false;
}
if (null !== $this->context xor null !== $statement->context) {
return false;
}
if (null !== $this->context && null !== $statement->context && !$this->context->equals($statement->context)) {
return false;
}
if (null !== $this->attachments xor null !== $statement->attachments) {
return false;
}
if (null !== $this->attachments && null !== $statement->attachments) {
if (count($this->attachments) !== count($statement->attachments)) {
return false;
}
foreach ($this->attachments as $key => $attachment) {
if (!$attachment->equals($statement->attachments[$key])) {
return false;
}
}
}
return true;
} | php | public function equals(Statement $statement): bool
{
if (null !== $this->id xor null !== $statement->id) {
return false;
}
if (null !== $this->id && null !== $statement->id && !$this->id->equals($statement->id)) {
return false;
}
if (!$this->actor->equals($statement->actor)) {
return false;
}
if (!$this->verb->equals($statement->verb)) {
return false;
}
if (!$this->object->equals($statement->object)) {
return false;
}
if (null === $this->result && null !== $statement->result) {
return false;
}
if (null !== $this->result && null === $statement->result) {
return false;
}
if (null !== $this->result && !$this->result->equals($statement->result)) {
return false;
}
if (null === $this->authority && null !== $statement->authority) {
return false;
}
if (null !== $this->authority && null === $statement->authority) {
return false;
}
if (null !== $this->authority && !$this->authority->equals($statement->authority)) {
return false;
}
if ($this->created != $statement->created) {
return false;
}
if (null !== $this->context xor null !== $statement->context) {
return false;
}
if (null !== $this->context && null !== $statement->context && !$this->context->equals($statement->context)) {
return false;
}
if (null !== $this->attachments xor null !== $statement->attachments) {
return false;
}
if (null !== $this->attachments && null !== $statement->attachments) {
if (count($this->attachments) !== count($statement->attachments)) {
return false;
}
foreach ($this->attachments as $key => $attachment) {
if (!$attachment->equals($statement->attachments[$key])) {
return false;
}
}
}
return true;
} | [
"public",
"function",
"equals",
"(",
"Statement",
"$",
"statement",
")",
":",
"bool",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"id",
"xor",
"null",
"!==",
"$",
"statement",
"->",
"id",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"nul... | Checks if another statement is equal.
Two statements are equal if and only if all of their properties are equal. | [
"Checks",
"if",
"another",
"statement",
"is",
"equal",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/Statement.php#L267-L342 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Export/Pdf/QueueHydrator.php | QueueHydrator.hydrateCollection | public static function hydrateCollection(array $queues)
{
$hydrated = [];
foreach ($queues as $queue) {
$hydrated[] = self::hydrate($queue);
}
return $hydrated;
} | php | public static function hydrateCollection(array $queues)
{
$hydrated = [];
foreach ($queues as $queue) {
$hydrated[] = self::hydrate($queue);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"queues",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"queues",
"as",
"$",
"queue",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"("... | Hydrate a collection of queue objects into a collection of
QueueEntity objects
@param stdClass[] $queues
@return QueueEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"queue",
"objects",
"into",
"a",
"collection",
"of",
"QueueEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Export/Pdf/QueueHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Export/Pdf/QueueHydrator.php | QueueHydrator.hydrate | public static function hydrate(stdClass $queue)
{
$hydrated = new QueueEntity();
if (isset($queue->id)) {
$hydrated->setId($queue->id);
}
if (isset($queue->started_at)) {
$hydrated->setStartedAt(new DateTime($queue->started_at));
}
if (isset($queue->finished_at)) {
$hydrated->setFinishedAt(new DateTime($queue->finished_at));
}
return $hydrated;
} | php | public static function hydrate(stdClass $queue)
{
$hydrated = new QueueEntity();
if (isset($queue->id)) {
$hydrated->setId($queue->id);
}
if (isset($queue->started_at)) {
$hydrated->setStartedAt(new DateTime($queue->started_at));
}
if (isset($queue->finished_at)) {
$hydrated->setFinishedAt(new DateTime($queue->finished_at));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"queue",
")",
"{",
"$",
"hydrated",
"=",
"new",
"QueueEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"queue",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
"$... | Hydrate a java object into a QueueEntity object
@param \stdClass $queue
@return QueueEntity | [
"Hydrate",
"a",
"java",
"object",
"into",
"a",
"QueueEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Export/Pdf/QueueHydrator.php#L35-L52 | train |
nabu-3/core | nabu/data/icontact/traits/TNabuIContactChild.php | TNabuIContactChild.getIContact | public function getIContact($force = false)
{
if ($this->nb_icontact === null || $force) {
$this->nb_icontact = null;
if ($this instanceof CNabuDataObject &&
!$this->isBuiltIn()
&& $this->isValueNumeric(NABU_ICONTACT_FIELD_ID)
) {
$nb_icontact = new CNabuIContact($this->getValue(NABU_ICONTACT_FIELD_ID));
if ($nb_icontact->isFetched()) {
$this->nb_icontact = $nb_icontact;
}
}
}
return $this->nb_icontact;
} | php | public function getIContact($force = false)
{
if ($this->nb_icontact === null || $force) {
$this->nb_icontact = null;
if ($this instanceof CNabuDataObject &&
!$this->isBuiltIn()
&& $this->isValueNumeric(NABU_ICONTACT_FIELD_ID)
) {
$nb_icontact = new CNabuIContact($this->getValue(NABU_ICONTACT_FIELD_ID));
if ($nb_icontact->isFetched()) {
$this->nb_icontact = $nb_icontact;
}
}
}
return $this->nb_icontact;
} | [
"public",
"function",
"getIContact",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_icontact",
"===",
"null",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_icontact",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"i... | Gets the iContact instance that owns this object.
@param bool $force If true forces to reload IContact from the database.
@return CNabuIContact Returns the iContact instance if exists or null if not. | [
"Gets",
"the",
"iContact",
"instance",
"that",
"owns",
"this",
"object",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/traits/TNabuIContactChild.php#L49-L65 | train |
nabu-3/core | nabu/data/icontact/traits/TNabuIContactChild.php | TNabuIContactChild.setIContact | public function setIContact(CNabuIContact $nb_icontact)
{
$this->nb_icontact = $nb_icontact;
if ($this instanceof CNabuDataObject && $nb_icontact->contains(NABU_ICONTACT_FIELD_ID)) {
$this->transferValue($nb_icontact, NABU_ICONTACT_FIELD_ID);
}
return $this;
} | php | public function setIContact(CNabuIContact $nb_icontact)
{
$this->nb_icontact = $nb_icontact;
if ($this instanceof CNabuDataObject && $nb_icontact->contains(NABU_ICONTACT_FIELD_ID)) {
$this->transferValue($nb_icontact, NABU_ICONTACT_FIELD_ID);
}
return $this;
} | [
"public",
"function",
"setIContact",
"(",
"CNabuIContact",
"$",
"nb_icontact",
")",
"{",
"$",
"this",
"->",
"nb_icontact",
"=",
"$",
"nb_icontact",
";",
"if",
"(",
"$",
"this",
"instanceof",
"CNabuDataObject",
"&&",
"$",
"nb_icontact",
"->",
"contains",
"(",
... | Sets the iContact instance that onws this object.
@param CNabuIContact $nb_icontact The iContact instance to be setted.
@return mixed Return $this to grant cascade chain. | [
"Sets",
"the",
"iContact",
"instance",
"that",
"onws",
"this",
"object",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/traits/TNabuIContactChild.php#L72-L80 | train |
nabu-3/core | nabu/data/security/CNabuUserGroup.php | CNabuUserGroup.getMembers | public function getMembers($force = false)
{
if ($this->nb_user_group_member_list->isEmpty() || $force) {
$this->nb_user_group_member_list->clear();
if ($this->isValueNumeric('nb_user_group_id')) {
$this->nb_user_group_member_list->merge(CNabuUserGroupMember::getMembersOfGroup($this));
}
}
return $this->nb_user_group_member_list;
} | php | public function getMembers($force = false)
{
if ($this->nb_user_group_member_list->isEmpty() || $force) {
$this->nb_user_group_member_list->clear();
if ($this->isValueNumeric('nb_user_group_id')) {
$this->nb_user_group_member_list->merge(CNabuUserGroupMember::getMembersOfGroup($this));
}
}
return $this->nb_user_group_member_list;
} | [
"public",
"function",
"getMembers",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_user_group_member_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_user_group_member_list",
"->",
"clear"... | Returns the full list of members in the group.
@param bool $force If true, then force to reload from database the full list.
@return CNabuUserGroupMemberList Return a list with members found. | [
"Returns",
"the",
"full",
"list",
"of",
"members",
"in",
"the",
"group",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuUserGroup.php#L128-L138 | train |
nabu-3/core | nabu/data/security/CNabuUserGroup.php | CNabuUserGroup.getAdminMembers | public function getAdminMembers($force = false) : CNabuUserGroupMemberList
{
$this->getMembers($force);
$nb_admin_list = new CNabuUserGroupMemberList();
$this->nb_user_group_member_list->iterate(
function($key, CNabuUserGroupMember $nb_user_group_member) use ($nb_admin_list)
{
if ($nb_user_group_member->getAdmin() === 'T' && $nb_user_group_member->getStatus() === 'E') {
$nb_admin_list->addItem($nb_user_group_member);
}
return true;
}
);
return $nb_admin_list;
} | php | public function getAdminMembers($force = false) : CNabuUserGroupMemberList
{
$this->getMembers($force);
$nb_admin_list = new CNabuUserGroupMemberList();
$this->nb_user_group_member_list->iterate(
function($key, CNabuUserGroupMember $nb_user_group_member) use ($nb_admin_list)
{
if ($nb_user_group_member->getAdmin() === 'T' && $nb_user_group_member->getStatus() === 'E') {
$nb_admin_list->addItem($nb_user_group_member);
}
return true;
}
);
return $nb_admin_list;
} | [
"public",
"function",
"getAdminMembers",
"(",
"$",
"force",
"=",
"false",
")",
":",
"CNabuUserGroupMemberList",
"{",
"$",
"this",
"->",
"getMembers",
"(",
"$",
"force",
")",
";",
"$",
"nb_admin_list",
"=",
"new",
"CNabuUserGroupMemberList",
"(",
")",
";",
"$... | Returns the full list of admin members in the group.
@param bool $force If true, then force to reload from database the full list.
@return CNabuUserGroupMemberList Return an list with all members found. | [
"Returns",
"the",
"full",
"list",
"of",
"admin",
"members",
"in",
"the",
"group",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuUserGroup.php#L150-L166 | train |
rips/php-connector-bundle | Hydrators/ApplicationHydrator.php | ApplicationHydrator.hydrateCollection | public static function hydrateCollection(array $applications)
{
$hydrated = [];
foreach ($applications as $application) {
$hydrated[] = self::hydrate($application);
}
return $hydrated;
} | php | public static function hydrateCollection(array $applications)
{
$hydrated = [];
foreach ($applications as $application) {
$hydrated[] = self::hydrate($application);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"applications",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"applications",
"as",
"$",
"application",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
... | Hydrate a collection of application objects into a collection of
ApplicationEntity objects
@param stdClass[] $applications
@return ApplicationEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"application",
"objects",
"into",
"a",
"collection",
"of",
"ApplicationEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/ApplicationHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/ApplicationHydrator.php | ApplicationHydrator.hydrate | public static function hydrate(stdClass $application)
{
$hydrated = new ApplicationEntity();
if (isset($application->id)) {
$hydrated->setId($application->id);
}
if (isset($application->name)) {
$hydrated->setName($application->name);
}
if (isset($application->current_scan)) {
$hydrated->setCurrentScan($application->current_scan);
}
if (isset($application->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($application->created_by));
}
if (isset($application->charged_quota)) {
$hydrated->setChargedQuota(QuotaHydrator::hydrate($application->charged_quota));
}
if (isset($application->created_at)) {
$hydrated->setCreatedAt(new DateTime($application->created_at));
}
if (isset($application->organization)) {
$hydrated->setOrganization(OrgHydrator::hydrate($application->organization));
}
if (isset($application->auto_renew)) {
$hydrated->setAutoRenew($application->auto_renew);
}
return $hydrated;
} | php | public static function hydrate(stdClass $application)
{
$hydrated = new ApplicationEntity();
if (isset($application->id)) {
$hydrated->setId($application->id);
}
if (isset($application->name)) {
$hydrated->setName($application->name);
}
if (isset($application->current_scan)) {
$hydrated->setCurrentScan($application->current_scan);
}
if (isset($application->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($application->created_by));
}
if (isset($application->charged_quota)) {
$hydrated->setChargedQuota(QuotaHydrator::hydrate($application->charged_quota));
}
if (isset($application->created_at)) {
$hydrated->setCreatedAt(new DateTime($application->created_at));
}
if (isset($application->organization)) {
$hydrated->setOrganization(OrgHydrator::hydrate($application->organization));
}
if (isset($application->auto_renew)) {
$hydrated->setAutoRenew($application->auto_renew);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"application",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ApplicationEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"application",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"s... | Hydrate a application object into a ApplicationEntity object
@param stdClass $application
@return ApplicationEntity | [
"Hydrate",
"a",
"application",
"object",
"into",
"a",
"ApplicationEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/ApplicationHydrator.php#L35-L72 | train |
nabu-3/core | nabu/http/managers/CNabuHTTPSecurityManager.php | CNabuHTTPSecurityManager.validateZone | public function validateZone(CNabuSiteTarget $nb_site_target)
{
$nb_engine = CNabuEngine::getEngine();
if (!(($nb_site = $nb_site_target->getSite()) instanceof CNabuSite)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
}
$this->zone = ($this->nb_user !== null ? 'P' : 'O');
$nb_engine->traceLog("Request Zone", ($this->zone === 'P' ? 'Private' : 'Public'));
$site_target_zone = $nb_site_target->getZone();
$nb_engine->traceLog(
"Page Zone",
($site_target_zone === 'P' ? 'Private' : ($site_target_zone === 'O' ? 'Public' : 'Both'))
);
$retval = ($site_target_zone === 'B') ||
($site_target_zone !== null && $site_target_zone === $this->zone);
if ($retval && $this->zone === 'P' && $nb_site->getRequirePoliciesAfterLogin() === 'T') {
if ($this->nb_user->getPoliciesAccepted() === 'T') {
$nb_engine->traceLog('Policies', 'Accepted');
} else {
$nb_engine->traceLog('Policies', 'Not accepted');
if ($nb_site_target->getIgnorePolicies() === 'F' &&
($link = $nb_site->getPoliciesTargetLink())->isLinkable() &&
!($link->matchTarget($nb_site_target))
) {
throw new ENabuRedirectionException(428, new CNabuHTTPRedirection(428, $link->getBestQualifiedURL()));
}
}
}
return $retval;
} | php | public function validateZone(CNabuSiteTarget $nb_site_target)
{
$nb_engine = CNabuEngine::getEngine();
if (!(($nb_site = $nb_site_target->getSite()) instanceof CNabuSite)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
}
$this->zone = ($this->nb_user !== null ? 'P' : 'O');
$nb_engine->traceLog("Request Zone", ($this->zone === 'P' ? 'Private' : 'Public'));
$site_target_zone = $nb_site_target->getZone();
$nb_engine->traceLog(
"Page Zone",
($site_target_zone === 'P' ? 'Private' : ($site_target_zone === 'O' ? 'Public' : 'Both'))
);
$retval = ($site_target_zone === 'B') ||
($site_target_zone !== null && $site_target_zone === $this->zone);
if ($retval && $this->zone === 'P' && $nb_site->getRequirePoliciesAfterLogin() === 'T') {
if ($this->nb_user->getPoliciesAccepted() === 'T') {
$nb_engine->traceLog('Policies', 'Accepted');
} else {
$nb_engine->traceLog('Policies', 'Not accepted');
if ($nb_site_target->getIgnorePolicies() === 'F' &&
($link = $nb_site->getPoliciesTargetLink())->isLinkable() &&
!($link->matchTarget($nb_site_target))
) {
throw new ENabuRedirectionException(428, new CNabuHTTPRedirection(428, $link->getBestQualifiedURL()));
}
}
}
return $retval;
} | [
"public",
"function",
"validateZone",
"(",
"CNabuSiteTarget",
"$",
"nb_site_target",
")",
"{",
"$",
"nb_engine",
"=",
"CNabuEngine",
"::",
"getEngine",
"(",
")",
";",
"if",
"(",
"!",
"(",
"(",
"$",
"nb_site",
"=",
"$",
"nb_site_target",
"->",
"getSite",
"(... | Validates if the zone is allowed for current user.
@param CNabuSiteTarget $nb_site_target Site Target to grant zone access.
@return bool Return true if the zone is allowed for requested Site Target. | [
"Validates",
"if",
"the",
"zone",
"is",
"allowed",
"for",
"current",
"user",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuHTTPSecurityManager.php#L275-L310 | train |
nabu-3/core | nabu/http/managers/CNabuHTTPSecurityManager.php | CNabuHTTPSecurityManager.isSignInLocked | public function isSignInLocked()
{
$nb_session = $this->nb_application->getSession();
if ($nb_session === null || !($nb_session instanceof CNabuHTTPSession)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SESSION_NOT_FOUND);
}
$nb_site = $this->nb_application->getHTTPServer()->getSite();
if ($nb_site === null || !($nb_site instanceof CNabuSite)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
}
$max_signin_retries = $nb_site->getMaxSignInRetries();
$signin_locked_delay = $nb_site->getSignInLockDelay();
$signin_retries = $nb_session->getVariable('signin_retries', 0);
$signin_last_fail_timestamp = $nb_session->getVariable('signin_last_fail_timestamp', 0);
$now = time() - $signin_last_fail_timestamp;
if ($now > $signin_locked_delay) {
$this->resetSignInLock();
$retval = false;
} else {
$retval = $max_signin_retries > 0 && $signin_retries >= $max_signin_retries && $now < $signin_locked_delay;
}
return $retval;
} | php | public function isSignInLocked()
{
$nb_session = $this->nb_application->getSession();
if ($nb_session === null || !($nb_session instanceof CNabuHTTPSession)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SESSION_NOT_FOUND);
}
$nb_site = $this->nb_application->getHTTPServer()->getSite();
if ($nb_site === null || !($nb_site instanceof CNabuSite)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
}
$max_signin_retries = $nb_site->getMaxSignInRetries();
$signin_locked_delay = $nb_site->getSignInLockDelay();
$signin_retries = $nb_session->getVariable('signin_retries', 0);
$signin_last_fail_timestamp = $nb_session->getVariable('signin_last_fail_timestamp', 0);
$now = time() - $signin_last_fail_timestamp;
if ($now > $signin_locked_delay) {
$this->resetSignInLock();
$retval = false;
} else {
$retval = $max_signin_retries > 0 && $signin_retries >= $max_signin_retries && $now < $signin_locked_delay;
}
return $retval;
} | [
"public",
"function",
"isSignInLocked",
"(",
")",
"{",
"$",
"nb_session",
"=",
"$",
"this",
"->",
"nb_application",
"->",
"getSession",
"(",
")",
";",
"if",
"(",
"$",
"nb_session",
"===",
"null",
"||",
"!",
"(",
"$",
"nb_session",
"instanceof",
"CNabuHTTPS... | Check if the Sign-in is enabled or locked by an excess of retries.
@return bool Return true if Sign-in is locked.
@throws ENabuCoreException Raises an exception if Session or Site instances are not available. | [
"Check",
"if",
"the",
"Sign",
"-",
"in",
"is",
"enabled",
"or",
"locked",
"by",
"an",
"excess",
"of",
"retries",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuHTTPSecurityManager.php#L417-L443 | train |
nabu-3/core | nabu/http/managers/CNabuHTTPSecurityManager.php | CNabuHTTPSecurityManager.resetSignInLock | public function resetSignInLock()
{
$nb_session = $this->nb_application->getSession();
if ($nb_session === null || !($nb_session instanceof CNabuHTTPSession)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SESSION_NOT_FOUND);
}
$nb_session->unsetVariable('signin_retries');
$nb_session->unsetVariable('signin_last_fail_timestamp');
} | php | public function resetSignInLock()
{
$nb_session = $this->nb_application->getSession();
if ($nb_session === null || !($nb_session instanceof CNabuHTTPSession)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SESSION_NOT_FOUND);
}
$nb_session->unsetVariable('signin_retries');
$nb_session->unsetVariable('signin_last_fail_timestamp');
} | [
"public",
"function",
"resetSignInLock",
"(",
")",
"{",
"$",
"nb_session",
"=",
"$",
"this",
"->",
"nb_application",
"->",
"getSession",
"(",
")",
";",
"if",
"(",
"$",
"nb_session",
"===",
"null",
"||",
"!",
"(",
"$",
"nb_session",
"instanceof",
"CNabuHTTP... | Reset sign-in counters to 0 | [
"Reset",
"sign",
"-",
"in",
"counters",
"to",
"0"
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuHTTPSecurityManager.php#L448-L457 | train |
nabu-3/core | nabu/http/managers/CNabuHTTPSecurityManager.php | CNabuHTTPSecurityManager.lockSignIn | public function lockSignIn()
{
$retval = false;
$nb_session = $this->nb_application->getSession();
if ($nb_session === null || !($nb_session instanceof CNabuHTTPSession)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SESSION_NOT_FOUND);
}
$nb_response = $this->nb_application->getResponse();
if ($nb_response === null || !($nb_response instanceof CNabuHTTPResponse)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_RESPONSE_NOT_FOUND);
}
$nb_site = $this->nb_application->getHTTPServer()->getSite();
if ($nb_site === null || !($nb_site instanceof CNabuSite)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
}
try {
$lang = $this->nb_application->getRequest()->getLanguage()->getId();
} catch (Exception $e) {
$lang = null;
}
if ($lang === null) {
$lang = $nb_site->getDefaultLanguageId();
}
$max_signin_retries = $nb_site->getMaxSignInRetries();
$signin_locked_delay = $nb_site->getSignInLockDelay();
$signin_retries = $nb_session->getVariable('signin_retries', 0);
$signin_last_fail_timestamp = $nb_session->getVariable('signin_last_fail_timestamp', 0);
$now = time() - $signin_last_fail_timestamp;
if ($max_signin_retries > 0) {
if ($this->isSignInLocked()) {
} else {
$nb_session->setVariable('signin_retries', $signin_retries < $max_signin_retries ? ++$signin_retries : $max_signin_retries);
$nb_session->setVariable('signin_last_fail_timestamp', time());
}
if ($this->isSignInLocked()) {
if (is_string($link = $nb_site->getLoginMaxFailsTargetLink()->getBestQualifiedURL(array($lang => $lang)))) {
$nb_response->redirect($nb_site->getLoginMaxFailsErrorCode(), $link);
} else {
$retval = true;
}
}
}
return $retval;
} | php | public function lockSignIn()
{
$retval = false;
$nb_session = $this->nb_application->getSession();
if ($nb_session === null || !($nb_session instanceof CNabuHTTPSession)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SESSION_NOT_FOUND);
}
$nb_response = $this->nb_application->getResponse();
if ($nb_response === null || !($nb_response instanceof CNabuHTTPResponse)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_RESPONSE_NOT_FOUND);
}
$nb_site = $this->nb_application->getHTTPServer()->getSite();
if ($nb_site === null || !($nb_site instanceof CNabuSite)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
}
try {
$lang = $this->nb_application->getRequest()->getLanguage()->getId();
} catch (Exception $e) {
$lang = null;
}
if ($lang === null) {
$lang = $nb_site->getDefaultLanguageId();
}
$max_signin_retries = $nb_site->getMaxSignInRetries();
$signin_locked_delay = $nb_site->getSignInLockDelay();
$signin_retries = $nb_session->getVariable('signin_retries', 0);
$signin_last_fail_timestamp = $nb_session->getVariable('signin_last_fail_timestamp', 0);
$now = time() - $signin_last_fail_timestamp;
if ($max_signin_retries > 0) {
if ($this->isSignInLocked()) {
} else {
$nb_session->setVariable('signin_retries', $signin_retries < $max_signin_retries ? ++$signin_retries : $max_signin_retries);
$nb_session->setVariable('signin_last_fail_timestamp', time());
}
if ($this->isSignInLocked()) {
if (is_string($link = $nb_site->getLoginMaxFailsTargetLink()->getBestQualifiedURL(array($lang => $lang)))) {
$nb_response->redirect($nb_site->getLoginMaxFailsErrorCode(), $link);
} else {
$retval = true;
}
}
}
return $retval;
} | [
"public",
"function",
"lockSignIn",
"(",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"$",
"nb_session",
"=",
"$",
"this",
"->",
"nb_application",
"->",
"getSession",
"(",
")",
";",
"if",
"(",
"$",
"nb_session",
"===",
"null",
"||",
"!",
"(",
"$",
"nb... | Tries to lock the sign-in. If counter is less than the max, then increases the counter. If elapsed time between
now and last retry failed is great than the max lock delay, then resets the counter.
@return bool Returns true if sign-in is locked. | [
"Tries",
"to",
"lock",
"the",
"sign",
"-",
"in",
".",
"If",
"counter",
"is",
"less",
"than",
"the",
"max",
"then",
"increases",
"the",
"counter",
".",
"If",
"elapsed",
"time",
"between",
"now",
"and",
"last",
"retry",
"failed",
"is",
"great",
"than",
"... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuHTTPSecurityManager.php#L464-L514 | train |
nabu-3/core | nabu/http/managers/CNabuHTTPSecurityManager.php | CNabuHTTPSecurityManager.isUserLogged | public function isUserLogged()
{
return ($this->nb_user !== null && $this->nb_role !== null && $this->nb_site_user !== null);
} | php | public function isUserLogged()
{
return ($this->nb_user !== null && $this->nb_role !== null && $this->nb_site_user !== null);
} | [
"public",
"function",
"isUserLogged",
"(",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"nb_user",
"!==",
"null",
"&&",
"$",
"this",
"->",
"nb_role",
"!==",
"null",
"&&",
"$",
"this",
"->",
"nb_site_user",
"!==",
"null",
")",
";",
"}"
] | Check if the user is logged.
@return bool Returns true if the user is logged. | [
"Check",
"if",
"the",
"user",
"is",
"logged",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuHTTPSecurityManager.php#L558-L561 | train |
nabu-3/core | nabu/http/managers/CNabuHTTPSecurityManager.php | CNabuHTTPSecurityManager.revalidatePassword | public function revalidatePassword(CNabuSite $nb_site, CNabuUser $nb_user, string $passwd) : bool
{
if (!($nb_site instanceof CNabuSite)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_METHOD_PARAMETER_NOT_VALID, array('$nb_site'));
}
if (!($nb_user instanceof CNabuUser) || !$nb_user->isFetched()) {
throw new ENabuCoreException(ENabuCoreException::ERROR_METHOD_PARAMETER_NOT_VALID, array('$nb_user'));
}
if (!is_string($passwd)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$passwd', print_r($passwd, true))
);
}
$nb_log_user = CNabuUser::findBySiteLogin($nb_site, $nb_user->getLogin(), $passwd);
return $nb_user->getId() == $nb_log_user->getId();
} | php | public function revalidatePassword(CNabuSite $nb_site, CNabuUser $nb_user, string $passwd) : bool
{
if (!($nb_site instanceof CNabuSite)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_METHOD_PARAMETER_NOT_VALID, array('$nb_site'));
}
if (!($nb_user instanceof CNabuUser) || !$nb_user->isFetched()) {
throw new ENabuCoreException(ENabuCoreException::ERROR_METHOD_PARAMETER_NOT_VALID, array('$nb_user'));
}
if (!is_string($passwd)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$passwd', print_r($passwd, true))
);
}
$nb_log_user = CNabuUser::findBySiteLogin($nb_site, $nb_user->getLogin(), $passwd);
return $nb_user->getId() == $nb_log_user->getId();
} | [
"public",
"function",
"revalidatePassword",
"(",
"CNabuSite",
"$",
"nb_site",
",",
"CNabuUser",
"$",
"nb_user",
",",
"string",
"$",
"passwd",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"(",
"$",
"nb_site",
"instanceof",
"CNabuSite",
")",
")",
"{",
"throw",
"... | Revalidates a password to ensure that the user can continue in the private zone.
@param CNabuSite $nb_site Site to revalidate navigation.
@param CNabuUser $nb_user User to be revalidated.
@param string $passwd Password without encoding.
@return bool Returns true if revalidation success or false if not. | [
"Revalidates",
"a",
"password",
"to",
"ensure",
"that",
"the",
"user",
"can",
"continue",
"in",
"the",
"private",
"zone",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuHTTPSecurityManager.php#L661-L681 | train |
nabu-3/core | nabu/http/managers/CNabuHTTPSecurityManager.php | CNabuHTTPSecurityManager.applyRoleMask | public function applyRoleMask(INabuRoleMask $object, array $params = null) : bool
{
return $object->applyRoleMask(
$this->nb_role,
array(
self::ROLE_MASK_USER_SIGNED => $this->isUserLogged(),
self::ROLE_MASK_WORK_CUSTOMER => $this->hasWorkCustomer()
)
);
} | php | public function applyRoleMask(INabuRoleMask $object, array $params = null) : bool
{
return $object->applyRoleMask(
$this->nb_role,
array(
self::ROLE_MASK_USER_SIGNED => $this->isUserLogged(),
self::ROLE_MASK_WORK_CUSTOMER => $this->hasWorkCustomer()
)
);
} | [
"public",
"function",
"applyRoleMask",
"(",
"INabuRoleMask",
"$",
"object",
",",
"array",
"$",
"params",
"=",
"null",
")",
":",
"bool",
"{",
"return",
"$",
"object",
"->",
"applyRoleMask",
"(",
"$",
"this",
"->",
"nb_role",
",",
"array",
"(",
"self",
"::... | Applies a Role to an object, forcing to clean all related entities that does not share the same role.
@param INabuRoleMask $object Role Mask entity to be applied.
@param array|null $params Additional parameters to be applied when perform masking.
@return bool Returns true if the cleaning is performed. | [
"Applies",
"a",
"Role",
"to",
"an",
"object",
"forcing",
"to",
"clean",
"all",
"related",
"entities",
"that",
"does",
"not",
"share",
"the",
"same",
"role",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuHTTPSecurityManager.php#L754-L763 | train |
nabu-3/core | nabu/http/managers/CNabuHTTPSecurityManager.php | CNabuHTTPSecurityManager.acceptPolicies | public function acceptPolicies(bool $save = true)
{
$nb_site = $this->nb_application->getHTTPServer()->getSite();
if ($nb_site === null || !($nb_site instanceof CNabuSite)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
}
if ($this->isUserLogged()) {
$this->nb_user->setPoliciesAccepted('T');
$this->nb_user->setPoliciesDatetime(date('Y-m-d H:i:s', time()));
if ($nb_site->getEnableSessionStrictPolicies() === 'T') {
session_regenerate_id(true);
}
if ($save &&
$this->nb_user->save() &&
strlen($url = $nb_site->getLoginRedirectionTargetLink($this->nb_site_role)->getBestQualifiedURL()) > 0
) {
$after_login = $url . "?logged";
throw new ENabuRedirectionException(301, new CNabuHTTPRedirection(301, $url));
}
}
} | php | public function acceptPolicies(bool $save = true)
{
$nb_site = $this->nb_application->getHTTPServer()->getSite();
if ($nb_site === null || !($nb_site instanceof CNabuSite)) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
}
if ($this->isUserLogged()) {
$this->nb_user->setPoliciesAccepted('T');
$this->nb_user->setPoliciesDatetime(date('Y-m-d H:i:s', time()));
if ($nb_site->getEnableSessionStrictPolicies() === 'T') {
session_regenerate_id(true);
}
if ($save &&
$this->nb_user->save() &&
strlen($url = $nb_site->getLoginRedirectionTargetLink($this->nb_site_role)->getBestQualifiedURL()) > 0
) {
$after_login = $url . "?logged";
throw new ENabuRedirectionException(301, new CNabuHTTPRedirection(301, $url));
}
}
} | [
"public",
"function",
"acceptPolicies",
"(",
"bool",
"$",
"save",
"=",
"true",
")",
"{",
"$",
"nb_site",
"=",
"$",
"this",
"->",
"nb_application",
"->",
"getHTTPServer",
"(",
")",
"->",
"getSite",
"(",
")",
";",
"if",
"(",
"$",
"nb_site",
"===",
"null"... | Call this method when a User accept the Policies of the Site. In consequence the lock for policies
in all Targets is ignored.
@param bool $save If true, the instance is updated in the storage synchronously. If false, then the instance
is updated internally but changes will not be valid in other instances of the same object or in future requests.
To have changes applied permanently when $save if false, you need to call the save method after this call. | [
"Call",
"this",
"method",
"when",
"a",
"User",
"accept",
"the",
"Policies",
"of",
"the",
"Site",
".",
"In",
"consequence",
"the",
"lock",
"for",
"policies",
"in",
"all",
"Targets",
"is",
"ignored",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/managers/CNabuHTTPSecurityManager.php#L772-L796 | train |
rips/php-connector-bundle | Services/Application/Scan/CustomClassService.php | CustomClassService.getAll | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->classes()
->getAll($appId, $scanId, $queryParams);
return new CustomClassesResponse($response);
} | php | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->classes()
->getAll($appId, $scanId, $queryParams);
return new CustomClassesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"classe... | Get all custom classes for a scan
@param int $appId
@param int $scanId
@param array $queryParams
@return CustomClassesResponse | [
"Get",
"all",
"custom",
"classes",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/CustomClassService.php#L35-L44 | train |
rips/php-connector-bundle | Services/Application/Scan/CustomClassService.php | CustomClassService.getById | public function getById($appId, $scanId, $classId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->classes()
->getById($appId, $scanId, $classId, $queryParams);
return new CustomClassResponse($response);
} | php | public function getById($appId, $scanId, $classId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->classes()
->getById($appId, $scanId, $classId, $queryParams);
return new CustomClassResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"classId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"... | Get custom class for scan by id
@param int $appId
@param int $scanId
@param int $classId
@param array $queryParams
@return CustomClassResponse | [
"Get",
"custom",
"class",
"for",
"scan",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/CustomClassService.php#L55-L64 | train |
rips/php-connector-bundle | Services/Application/Scan/CustomClassService.php | CustomClassService.create | public function create($appId, $scanId, $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->classes()
->create($appId, $scanId, $input->toArray(), $queryParams);
return new CustomClassResponse($response);
} | php | public function create($appId, $scanId, $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->classes()
->create($appId, $scanId, $input->toArray(), $queryParams);
return new CustomClassResponse($response);
} | [
"public",
"function",
"create",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",... | Create custom class for a scan
@param int $appId
@param int $scanId
@param CustomClassBuilder $input
@param array $queryParams
@return CustomClassResponse | [
"Create",
"custom",
"class",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/CustomClassService.php#L75-L84 | train |
rips/php-connector-bundle | Services/Application/Scan/FileService.php | FileService.getAll | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->files()
->getAll($appId, $scanId, $queryParams);
return new FilesResponse($response);
} | php | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->files()
->getAll($appId, $scanId, $queryParams);
return new FilesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"files"... | Get all files for a scan
@param int $appId
@param int $scanId
@param array $queryParams
@return FilesResponse | [
"Get",
"all",
"files",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/FileService.php#L35-L44 | train |
rips/php-connector-bundle | Services/Application/Scan/FileService.php | FileService.getById | public function getById($appId, $scanId, $fileId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->files()
->getById($appId, $scanId, $fileId, $queryParams);
return new FileResponse($response);
} | php | public function getById($appId, $scanId, $fileId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->files()
->getById($appId, $scanId, $fileId, $queryParams);
return new FileResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"fileId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(... | Get file for scan by id
@param int $appId
@param int $scanId
@param int $fileId
@param array $queryParams
@return FileResponse | [
"Get",
"file",
"for",
"scan",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/FileService.php#L55-L64 | train |
rips/php-connector-bundle | Services/Application/Scan/FileService.php | FileService.delete | public function delete($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->files()
->delete($appId, $scanId, $queryParams);
return new BaseResponse($response);
} | php | public function delete($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->files()
->delete($appId, $scanId, $queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"delete",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"files"... | Delete the source code of a scan
@param int $appId
@param int $scanId
@param array $queryParams
@return BaseResponse | [
"Delete",
"the",
"source",
"code",
"of",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/FileService.php#L74-L83 | train |
nabu-3/core | nabu/data/icontact/base/CNabuIContactBase.php | CNabuIContactBase.getAlliContacts | public static function getAlliContacts(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_icontact_id',
'select * '
. 'from nb_icontact '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuIContactList();
}
return $retval;
} | php | public static function getAlliContacts(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_icontact_id',
'select * '
. 'from nb_icontact '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuIContactList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAlliContacts",
"(",
"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_icontact_id' is the index, and each
value is an instance of class CNabuIContactBase.
@param CNabuCustomer $nb_customer The CNabuCustomer instance of the Customer that owns the iContact List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_icontact_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuIContactBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/base/CNabuIContactBase.php#L180-L200 | train |
danslo/CleanCheckoutSocial | src/Service/SocialLoginService.php | SocialLoginService.getProvidersConfig | private function getProvidersConfig()
{
$config = [];
foreach (self::PROVIDERS as $provider) {
$config[ucfirst($provider)] = [
'enabled' => (bool)$this->scopeConfig->getValue(
sprintf(self::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_ENABLED, $provider),
ScopeInterface::SCOPE_STORE
),
'keys' => [
'key' => $this->scopeConfig->getValue(
sprintf(self::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_KEY, $provider),
ScopeInterface::SCOPE_STORE
),
'secret' => $this->scopeConfig->getValue(
sprintf(self::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_SECRET, $provider),
ScopeInterface::SCOPE_STORE
),
]
];
}
return $config;
} | php | private function getProvidersConfig()
{
$config = [];
foreach (self::PROVIDERS as $provider) {
$config[ucfirst($provider)] = [
'enabled' => (bool)$this->scopeConfig->getValue(
sprintf(self::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_ENABLED, $provider),
ScopeInterface::SCOPE_STORE
),
'keys' => [
'key' => $this->scopeConfig->getValue(
sprintf(self::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_KEY, $provider),
ScopeInterface::SCOPE_STORE
),
'secret' => $this->scopeConfig->getValue(
sprintf(self::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_SECRET, $provider),
ScopeInterface::SCOPE_STORE
),
]
];
}
return $config;
} | [
"private",
"function",
"getProvidersConfig",
"(",
")",
"{",
"$",
"config",
"=",
"[",
"]",
";",
"foreach",
"(",
"self",
"::",
"PROVIDERS",
"as",
"$",
"provider",
")",
"{",
"$",
"config",
"[",
"ucfirst",
"(",
"$",
"provider",
")",
"]",
"=",
"[",
"'enab... | Gets providers from Magento configuration.
@return array | [
"Gets",
"providers",
"from",
"Magento",
"configuration",
"."
] | 6db639b843430db021cebb79d3dbff420b3e5203 | https://github.com/danslo/CleanCheckoutSocial/blob/6db639b843430db021cebb79d3dbff420b3e5203/src/Service/SocialLoginService.php#L103-L125 | train |
danslo/CleanCheckoutSocial | src/Service/SocialLoginService.php | SocialLoginService.getCustomerData | private function getCustomerData(UserProfile $profile)
{
$customerData = [];
foreach (['firstName', 'lastName', 'email'] as $field) {
$data = $profile->{$field};
$customerData[strtolower($field)] = $data !== null ? $data : '-';
}
return $customerData;
} | php | private function getCustomerData(UserProfile $profile)
{
$customerData = [];
foreach (['firstName', 'lastName', 'email'] as $field) {
$data = $profile->{$field};
$customerData[strtolower($field)] = $data !== null ? $data : '-';
}
return $customerData;
} | [
"private",
"function",
"getCustomerData",
"(",
"UserProfile",
"$",
"profile",
")",
"{",
"$",
"customerData",
"=",
"[",
"]",
";",
"foreach",
"(",
"[",
"'firstName'",
",",
"'lastName'",
",",
"'email'",
"]",
"as",
"$",
"field",
")",
"{",
"$",
"data",
"=",
... | Gets customer data for a hybrid auth profile.
@param UserProfile $profile
@return array | [
"Gets",
"customer",
"data",
"for",
"a",
"hybrid",
"auth",
"profile",
"."
] | 6db639b843430db021cebb79d3dbff420b3e5203 | https://github.com/danslo/CleanCheckoutSocial/blob/6db639b843430db021cebb79d3dbff420b3e5203/src/Service/SocialLoginService.php#L155-L163 | train |
danslo/CleanCheckoutSocial | src/Service/SocialLoginService.php | SocialLoginService.handleProviderQuirks | private function handleProviderQuirks($provider, $customer)
{
switch ($provider) {
case 'Twitter':
if ($customer->getData('lastname') === '-') {
$nameParts = explode(' ', $customer->getData('firstname'));
if (count($nameParts) > 1) {
$customer->setData('firstname', $nameParts[0]);
$lastName = implode(' ', array_slice($nameParts, 1));
$customer->setData('lastname', $lastName);
}
}
break;
}
} | php | private function handleProviderQuirks($provider, $customer)
{
switch ($provider) {
case 'Twitter':
if ($customer->getData('lastname') === '-') {
$nameParts = explode(' ', $customer->getData('firstname'));
if (count($nameParts) > 1) {
$customer->setData('firstname', $nameParts[0]);
$lastName = implode(' ', array_slice($nameParts, 1));
$customer->setData('lastname', $lastName);
}
}
break;
}
} | [
"private",
"function",
"handleProviderQuirks",
"(",
"$",
"provider",
",",
"$",
"customer",
")",
"{",
"switch",
"(",
"$",
"provider",
")",
"{",
"case",
"'Twitter'",
":",
"if",
"(",
"$",
"customer",
"->",
"getData",
"(",
"'lastname'",
")",
"===",
"'-'",
")... | Some providers don't really put data in the right fields.
@param string $provider
@param Customer $customer | [
"Some",
"providers",
"don",
"t",
"really",
"put",
"data",
"in",
"the",
"right",
"fields",
"."
] | 6db639b843430db021cebb79d3dbff420b3e5203 | https://github.com/danslo/CleanCheckoutSocial/blob/6db639b843430db021cebb79d3dbff420b3e5203/src/Service/SocialLoginService.php#L171-L185 | train |
danslo/CleanCheckoutSocial | src/Service/SocialLoginService.php | SocialLoginService.getCustomerForProfile | private function getCustomerForProfile($provider, UserProfile $profile)
{
/** @var Customer $customer */
$customer = $this->customerFactory->create();
$customer->setWebsiteId($this->getCurrentWebsiteId());
$customer->loadByEmail($profile->emailVerified);
if (!$customer->getId()) {
$customer->setData('email', $profile->emailVerified);
$customer->addData($this->getCustomerData($profile));
$this->handleProviderQuirks($provider, $customer);
$this->customerResource->save($customer);
}
return $customer;
} | php | private function getCustomerForProfile($provider, UserProfile $profile)
{
/** @var Customer $customer */
$customer = $this->customerFactory->create();
$customer->setWebsiteId($this->getCurrentWebsiteId());
$customer->loadByEmail($profile->emailVerified);
if (!$customer->getId()) {
$customer->setData('email', $profile->emailVerified);
$customer->addData($this->getCustomerData($profile));
$this->handleProviderQuirks($provider, $customer);
$this->customerResource->save($customer);
}
return $customer;
} | [
"private",
"function",
"getCustomerForProfile",
"(",
"$",
"provider",
",",
"UserProfile",
"$",
"profile",
")",
"{",
"/** @var Customer $customer */",
"$",
"customer",
"=",
"$",
"this",
"->",
"customerFactory",
"->",
"create",
"(",
")",
";",
"$",
"customer",
"->"... | Loads or creates a customer for a hybridauth profile.
@param string $provider
@param UserProfile $profile
@return Customer
@throws LocalizedException
@throws \Exception | [
"Loads",
"or",
"creates",
"a",
"customer",
"for",
"a",
"hybridauth",
"profile",
"."
] | 6db639b843430db021cebb79d3dbff420b3e5203 | https://github.com/danslo/CleanCheckoutSocial/blob/6db639b843430db021cebb79d3dbff420b3e5203/src/Service/SocialLoginService.php#L196-L209 | train |
danslo/CleanCheckoutSocial | src/ConfigProvider/CheckoutConfigProvider.php | CheckoutConfigProvider.isProviderEnabled | private function isProviderEnabled($provider)
{
return (bool)$this->scopeConfig->getValue(
sprintf(SocialLoginService::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_ENABLED, $provider),
ScopeInterface::SCOPE_STORE
);
} | php | private function isProviderEnabled($provider)
{
return (bool)$this->scopeConfig->getValue(
sprintf(SocialLoginService::CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_ENABLED, $provider),
ScopeInterface::SCOPE_STORE
);
} | [
"private",
"function",
"isProviderEnabled",
"(",
"$",
"provider",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"scopeConfig",
"->",
"getValue",
"(",
"sprintf",
"(",
"SocialLoginService",
"::",
"CONFIG_PATH_SOCIAL_LOGIN_PROVIDER_ENABLED",
",",
"$",
"pro... | Checks if social login provider is enabled in config.
@param string $provider
@return bool | [
"Checks",
"if",
"social",
"login",
"provider",
"is",
"enabled",
"in",
"config",
"."
] | 6db639b843430db021cebb79d3dbff420b3e5203 | https://github.com/danslo/CleanCheckoutSocial/blob/6db639b843430db021cebb79d3dbff420b3e5203/src/ConfigProvider/CheckoutConfigProvider.php#L42-L48 | train |
nabu-3/core | nabu/data/cluster/base/CNabuClusterUserGroupBase.php | CNabuClusterUserGroupBase.setClusterGroupId | public function setClusterGroupId(int $nb_cluster_group_id) : CNabuDataObject
{
if ($nb_cluster_group_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_cluster_group_id")
);
}
$this->setValue('nb_cluster_group_id', $nb_cluster_group_id);
return $this;
} | php | public function setClusterGroupId(int $nb_cluster_group_id) : CNabuDataObject
{
if ($nb_cluster_group_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_cluster_group_id")
);
}
$this->setValue('nb_cluster_group_id', $nb_cluster_group_id);
return $this;
} | [
"public",
"function",
"setClusterGroupId",
"(",
"int",
"$",
"nb_cluster_group_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_cluster_group_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VA... | Sets the Cluster Group Id attribute value.
@param int $nb_cluster_group_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Cluster",
"Group",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/cluster/base/CNabuClusterUserGroupBase.php#L179-L190 | train |
nabu-3/core | nabu/data/cluster/base/CNabuClusterUserGroupBase.php | CNabuClusterUserGroupBase.setOSId | public function setOSId(int $os_id) : CNabuDataObject
{
if ($os_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$os_id")
);
}
$this->setValue('nb_cluster_user_group_os_id', $os_id);
return $this;
} | php | public function setOSId(int $os_id) : CNabuDataObject
{
if ($os_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$os_id")
);
}
$this->setValue('nb_cluster_user_group_os_id', $os_id);
return $this;
} | [
"public",
"function",
"setOSId",
"(",
"int",
"$",
"os_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"os_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
"array",... | Sets the Cluster User Group OS Id attribute value.
@param int $os_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Cluster",
"User",
"Group",
"OS",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/cluster/base/CNabuClusterUserGroupBase.php#L206-L217 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/EntrypointHydrator.php | EntrypointHydrator.hydrateCollection | public static function hydrateCollection(array $entrypoints)
{
$hydrated = [];
foreach ($entrypoints as $entrypoint) {
$hydrated[] = self::hydrate($entrypoint);
}
return $hydrated;
} | php | public static function hydrateCollection(array $entrypoints)
{
$hydrated = [];
foreach ($entrypoints as $entrypoint) {
$hydrated[] = self::hydrate($entrypoint);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"entrypoints",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"entrypoints",
"as",
"$",
"entrypoint",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"... | Hydrate a collection of entrypoint objects into a collection of
EntrypointEntity objects
@param stdClass[] $entrypoints
@return EntrypointEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"entrypoint",
"objects",
"into",
"a",
"collection",
"of",
"EntrypointEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/EntrypointHydrator.php#L17-L26 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/EntrypointHydrator.php | EntrypointHydrator.hydrate | public static function hydrate(stdClass $entrypoint)
{
$hydrated = new EntrypointEntity();
if (isset($entrypoint->id)) {
$hydrated->setId($entrypoint->id);
}
if (isset($entrypoint->line)) {
$hydrated->setLine($entrypoint->line);
}
if (isset($entrypoint->file)) {
$hydrated->setFile(FileHydrator::hydrate($entrypoint->file));
}
if (isset($entrypoint->function)) {
$hydrated->setFunction(CustomFunctionHydrator::hydrate($entrypoint->function));
}
if (isset($entrypoint->class)) {
$hydrated->setClass(CustomClassHydrator::hydrate($entrypoint->class));
}
return $hydrated;
} | php | public static function hydrate(stdClass $entrypoint)
{
$hydrated = new EntrypointEntity();
if (isset($entrypoint->id)) {
$hydrated->setId($entrypoint->id);
}
if (isset($entrypoint->line)) {
$hydrated->setLine($entrypoint->line);
}
if (isset($entrypoint->file)) {
$hydrated->setFile(FileHydrator::hydrate($entrypoint->file));
}
if (isset($entrypoint->function)) {
$hydrated->setFunction(CustomFunctionHydrator::hydrate($entrypoint->function));
}
if (isset($entrypoint->class)) {
$hydrated->setClass(CustomClassHydrator::hydrate($entrypoint->class));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"entrypoint",
")",
"{",
"$",
"hydrated",
"=",
"new",
"EntrypointEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"entrypoint",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setI... | Hydrate a entrypoint object into a EntrypointEntity object
@param stdClass $entrypoint
@return EntrypointEntity | [
"Hydrate",
"a",
"entrypoint",
"object",
"into",
"a",
"EntrypointEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/EntrypointHydrator.php#L34-L59 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/CustomClassHydrator.php | CustomClassHydrator.hydrateCollection | public static function hydrateCollection(array $customClasses)
{
$hydrated = [];
foreach ($customClasses as $customClass) {
$hydrated[] = self::hydrate($customClass);
}
return $hydrated;
} | php | public static function hydrateCollection(array $customClasses)
{
$hydrated = [];
foreach ($customClasses as $customClass) {
$hydrated[] = self::hydrate($customClass);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"customClasses",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"customClasses",
"as",
"$",
"customClass",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::"... | Hydrate a collection of customClass objects into a collection of
CustomClassEntity objects
@param stdClass[] $customClasses
@return CustomClassEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"customClass",
"objects",
"into",
"a",
"collection",
"of",
"CustomClassEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/CustomClassHydrator.php#L17-L26 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/CustomClassHydrator.php | CustomClassHydrator.hydrate | public static function hydrate(stdClass $customClass)
{
$hydrated = new CustomClassEntity();
if (isset($customClass->id)) {
$hydrated->setId($customClass->id);
}
if (isset($customClass->start_line)) {
$hydrated->setStartLine($customClass->start_line);
}
if (isset($customClass->end_line)) {
$hydrated->setEndLine($customClass->end_line);
}
if (isset($customClass->start_column)) {
$hydrated->setStartColumn($customClass->start_column);
}
if (isset($customClass->end_column)) {
$hydrated->setEndColumn($customClass->end_column);
}
if (isset($customClass->name)) {
$hydrated->setName($customClass->name);
}
if (isset($customClass->file)) {
$hydrated->setFile(FileHydrator::hydrate($customClass->file));
}
if (isset($customClass->package)) {
$hydrated->setPackage($customClass->package);
}
return $hydrated;
} | php | public static function hydrate(stdClass $customClass)
{
$hydrated = new CustomClassEntity();
if (isset($customClass->id)) {
$hydrated->setId($customClass->id);
}
if (isset($customClass->start_line)) {
$hydrated->setStartLine($customClass->start_line);
}
if (isset($customClass->end_line)) {
$hydrated->setEndLine($customClass->end_line);
}
if (isset($customClass->start_column)) {
$hydrated->setStartColumn($customClass->start_column);
}
if (isset($customClass->end_column)) {
$hydrated->setEndColumn($customClass->end_column);
}
if (isset($customClass->name)) {
$hydrated->setName($customClass->name);
}
if (isset($customClass->file)) {
$hydrated->setFile(FileHydrator::hydrate($customClass->file));
}
if (isset($customClass->package)) {
$hydrated->setPackage($customClass->package);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"customClass",
")",
"{",
"$",
"hydrated",
"=",
"new",
"CustomClassEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"customClass",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"s... | Hydrate a customClass object into a CustomClassEntity object
@param stdClass $customClass
@return CustomClassEntity | [
"Hydrate",
"a",
"customClass",
"object",
"into",
"a",
"CustomClassEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/CustomClassHydrator.php#L34-L71 | train |
jstewmc/chunker | src/Chunker.php | Chunker.setEncoding | public function setEncoding($encoding)
{
if ( ! is_string($encoding) || ! in_array($encoding, mb_list_encodings())) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, encoding, to be a valid "
. "character encoding name"
);
}
$this->encoding = $encoding;
return $this;
} | php | public function setEncoding($encoding)
{
if ( ! is_string($encoding) || ! in_array($encoding, mb_list_encodings())) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, encoding, to be a valid "
. "character encoding name"
);
}
$this->encoding = $encoding;
return $this;
} | [
"public",
"function",
"setEncoding",
"(",
"$",
"encoding",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"encoding",
")",
"||",
"!",
"in_array",
"(",
"$",
"encoding",
",",
"mb_list_encodings",
"(",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidA... | Sets the chunker's character encoding
@param string|null $encoding the chunker's character encoding
@throws InvalidArgumentException if $encoding is not an supported charset;
the special string 'auto'; or, null
@since 0.1.0 | [
"Sets",
"the",
"chunker",
"s",
"character",
"encoding"
] | 563b870bc73987b386728ff3d23fe41033fb143d | https://github.com/jstewmc/chunker/blob/563b870bc73987b386728ff3d23fe41033fb143d/src/Chunker.php#L89-L101 | train |
jstewmc/chunker | src/Chunker.php | Chunker.setIndex | public function setIndex($index)
{
if ( ! is_numeric($index) || ! is_int(+$index) || $index < 0) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, index, to be a positive "
."integer or zero"
);
}
$this->index = $index;
return $this;
} | php | public function setIndex($index)
{
if ( ! is_numeric($index) || ! is_int(+$index) || $index < 0) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, index, to be a positive "
."integer or zero"
);
}
$this->index = $index;
return $this;
} | [
"public",
"function",
"setIndex",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"index",
")",
"||",
"!",
"is_int",
"(",
"+",
"$",
"index",
")",
"||",
"$",
"index",
"<",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExc... | Sets the chunker's chunk index
@param int $index the chunker's chunk index
@return self
@throws InvalidArgumentException if $index is not a positive int or zero
@since 0.1.0 | [
"Sets",
"the",
"chunker",
"s",
"chunk",
"index"
] | 563b870bc73987b386728ff3d23fe41033fb143d | https://github.com/jstewmc/chunker/blob/563b870bc73987b386728ff3d23fe41033fb143d/src/Chunker.php#L111-L123 | train |
jstewmc/chunker | src/Chunker.php | Chunker.setSize | public function setSize($size)
{
if ( ! is_numeric($size) || ! is_int(+$size) || $size < 1) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, size, to be a positive integer"
);
}
$this->size = $size;
return $this;
} | php | public function setSize($size)
{
if ( ! is_numeric($size) || ! is_int(+$size) || $size < 1) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, size, to be a positive integer"
);
}
$this->size = $size;
return $this;
} | [
"public",
"function",
"setSize",
"(",
"$",
"size",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"size",
")",
"||",
"!",
"is_int",
"(",
"+",
"$",
"size",
")",
"||",
"$",
"size",
"<",
"1",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExceptio... | Sets the chunker's chunk size
Heads up! This property is a size in *bytes* for file chunks and a size in
*characters* for text chunks.
@param int $size the chunker's chunk size
@return self
@throws InvalidArgumentException if $size is not a positive integer
@since 0.1.0 | [
"Sets",
"the",
"chunker",
"s",
"chunk",
"size"
] | 563b870bc73987b386728ff3d23fe41033fb143d | https://github.com/jstewmc/chunker/blob/563b870bc73987b386728ff3d23fe41033fb143d/src/Chunker.php#L136-L147 | train |
jstewmc/chunker | src/Chunker.php | Chunker.getPreviousChunk | public function getPreviousChunk()
{
$offset = --$this->index * $this->size;
if ($offset >= 0) {
$chunk = $this->getChunk($offset);
} else {
$chunk = false;
}
return $chunk;
} | php | public function getPreviousChunk()
{
$offset = --$this->index * $this->size;
if ($offset >= 0) {
$chunk = $this->getChunk($offset);
} else {
$chunk = false;
}
return $chunk;
} | [
"public",
"function",
"getPreviousChunk",
"(",
")",
"{",
"$",
"offset",
"=",
"--",
"$",
"this",
"->",
"index",
"*",
"$",
"this",
"->",
"size",
";",
"if",
"(",
"$",
"offset",
">=",
"0",
")",
"{",
"$",
"chunk",
"=",
"$",
"this",
"->",
"getChunk",
"... | Returns the previous chunk and updates the chunker's internal pointer
@return int
@since 0.1.0 | [
"Returns",
"the",
"previous",
"chunk",
"and",
"updates",
"the",
"chunker",
"s",
"internal",
"pointer"
] | 563b870bc73987b386728ff3d23fe41033fb143d | https://github.com/jstewmc/chunker/blob/563b870bc73987b386728ff3d23fe41033fb143d/src/Chunker.php#L223-L234 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/Layout/PageLayoutCompiler.php | PageLayoutCompiler.compile | public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, ScaffolderThemeExtensionInterface $themeExtension, array $extensions, $extra = null)
{
$this->stub = $stub;
return $this->setPageTitle($scaffolderConfig)
->setAppName($scaffolderConfig)
->setLinks($extra['links'], $scaffolderConfig)
->replaceRoutePrefix($scaffolderConfig->routing->prefix)
->store($modelName, $scaffolderConfig, $themeExtension->runAfterPageLayoutIsCompiled($this->stub, $scaffolderConfig), new FileToCompile(null, null));
} | php | public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, ScaffolderThemeExtensionInterface $themeExtension, array $extensions, $extra = null)
{
$this->stub = $stub;
return $this->setPageTitle($scaffolderConfig)
->setAppName($scaffolderConfig)
->setLinks($extra['links'], $scaffolderConfig)
->replaceRoutePrefix($scaffolderConfig->routing->prefix)
->store($modelName, $scaffolderConfig, $themeExtension->runAfterPageLayoutIsCompiled($this->stub, $scaffolderConfig), new FileToCompile(null, null));
} | [
"public",
"function",
"compile",
"(",
"$",
"stub",
",",
"$",
"modelName",
",",
"$",
"modelData",
",",
"stdClass",
"$",
"scaffolderConfig",
",",
"$",
"hash",
",",
"ScaffolderThemeExtensionInterface",
"$",
"themeExtension",
",",
"array",
"$",
"extensions",
",",
... | Compiles the page layout.
@param $stub
@param $modelName
@param $modelData
@param \stdClass $scaffolderConfig
@param $hash
@param \Scaffolder\Support\Contracts\ScaffolderThemeExtensionInterface $themeExtension
@param \Scaffolder\Support\Contracts\ScaffolderExtensionInterface[] $extensions
@param null $extra
@return string | [
"Compiles",
"the",
"page",
"layout",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/Layout/PageLayoutCompiler.php#L28-L37 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/Layout/PageLayoutCompiler.php | PageLayoutCompiler.setPageTitle | private function setPageTitle(stdClass $scaffolderConfig)
{
$this->stub = str_replace('{{page_title}}', $scaffolderConfig->userInterface->pageTitle, $this->stub);
return $this;
} | php | private function setPageTitle(stdClass $scaffolderConfig)
{
$this->stub = str_replace('{{page_title}}', $scaffolderConfig->userInterface->pageTitle, $this->stub);
return $this;
} | [
"private",
"function",
"setPageTitle",
"(",
"stdClass",
"$",
"scaffolderConfig",
")",
"{",
"$",
"this",
"->",
"stub",
"=",
"str_replace",
"(",
"'{{page_title}}'",
",",
"$",
"scaffolderConfig",
"->",
"userInterface",
"->",
"pageTitle",
",",
"$",
"this",
"->",
"... | Replace the page title.
@param \stdClass $scaffolderConfig
@return $this | [
"Replace",
"the",
"page",
"title",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/Layout/PageLayoutCompiler.php#L65-L70 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/Layout/PageLayoutCompiler.php | PageLayoutCompiler.setAppName | private function setAppName(stdClass $scaffolderConfig)
{
$this->stub = str_replace('{{app_name}}', $scaffolderConfig->name, $this->stub);
return $this;
} | php | private function setAppName(stdClass $scaffolderConfig)
{
$this->stub = str_replace('{{app_name}}', $scaffolderConfig->name, $this->stub);
return $this;
} | [
"private",
"function",
"setAppName",
"(",
"stdClass",
"$",
"scaffolderConfig",
")",
"{",
"$",
"this",
"->",
"stub",
"=",
"str_replace",
"(",
"'{{app_name}}'",
",",
"$",
"scaffolderConfig",
"->",
"name",
",",
"$",
"this",
"->",
"stub",
")",
";",
"return",
"... | Replace the app name.
@param \stdClass $scaffolderConfig
@return $this | [
"Replace",
"the",
"app",
"name",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/Layout/PageLayoutCompiler.php#L79-L84 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/Layout/PageLayoutCompiler.php | PageLayoutCompiler.setLinks | private function setLinks($links, stdClass $scaffolderConfig)
{
$navLinks = '';
foreach ($links as $link)
{
$navLinks .= sprintf("
<li>
<a href='/%s' class='waves-effect'>
%s
</a>
</li>", $scaffolderConfig->routing->prefix . '/' . strtolower($link['modelName']), $link['modelLabel']);
}
$this->stub = str_replace('{{links}}', $navLinks, $this->stub);
return $this;
} | php | private function setLinks($links, stdClass $scaffolderConfig)
{
$navLinks = '';
foreach ($links as $link)
{
$navLinks .= sprintf("
<li>
<a href='/%s' class='waves-effect'>
%s
</a>
</li>", $scaffolderConfig->routing->prefix . '/' . strtolower($link['modelName']), $link['modelLabel']);
}
$this->stub = str_replace('{{links}}', $navLinks, $this->stub);
return $this;
} | [
"private",
"function",
"setLinks",
"(",
"$",
"links",
",",
"stdClass",
"$",
"scaffolderConfig",
")",
"{",
"$",
"navLinks",
"=",
"''",
";",
"foreach",
"(",
"$",
"links",
"as",
"$",
"link",
")",
"{",
"$",
"navLinks",
".=",
"sprintf",
"(",
"\"\n ... | Add links to the nav.
@param $links
@param \stdClass $scaffolderConfig
@return $this | [
"Add",
"links",
"to",
"the",
"nav",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/Layout/PageLayoutCompiler.php#L94-L111 | train |
rips/php-connector-bundle | Services/Application/Profile/SanitizerService.php | SanitizerService.getAll | public function getAll($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->sanitizers()->getAll($appId, $profileId, $queryParams);
return new SanitizersResponse($response);
} | php | public function getAll($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->sanitizers()->getAll($appId, $profileId, $queryParams);
return new SanitizersResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"array",
"$",
"queryParams",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"profiles",
"(",
")",
"->",
"sanitizers",
"(",
... | Get all sanitizers for a profile profile
@param int $appId
@param int $profileId
@param array $queryParams
@return SanitizersResponse | [
"Get",
"all",
"sanitizers",
"for",
"a",
"profile",
"profile"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Profile/SanitizerService.php#L36-L41 | train |
rips/php-connector-bundle | Services/Application/Profile/SanitizerService.php | SanitizerService.getById | public function getById($appId, $profileId, $sanitizerId, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->sanitizers()->getById($appId, $profileId, $sanitizerId, $queryParams);
return new SanitizerResponse($response);
} | php | public function getById($appId, $profileId, $sanitizerId, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->sanitizers()->getById($appId, $profileId, $sanitizerId, $queryParams);
return new SanitizerResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"$",
"sanitizerId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"prof... | Get sanitizer for profile profile by id
@param int $appId
@param int $profileId
@param int $sanitizerId
@param array $queryParams
@return SanitizerResponse | [
"Get",
"sanitizer",
"for",
"profile",
"profile",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Profile/SanitizerService.php#L52-L57 | train |
rips/php-connector-bundle | Services/Application/Profile/SanitizerService.php | SanitizerService.create | public function create($appId, $profileId, SanitizerBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->sanitizers()->create($appId, $profileId, $input->toArray(), $queryParams);
return new SanitizerResponse($response);
} | php | public function create($appId, $profileId, SanitizerBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->sanitizers()->create($appId, $profileId, $input->toArray(), $queryParams);
return new SanitizerResponse($response);
} | [
"public",
"function",
"create",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"SanitizerBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
... | Create sanitizer for profile profile
@param int $appId
@param int $profileId
@param SanitizerBuilder $input
@param array $queryParams
@return SanitizerResponse | [
"Create",
"sanitizer",
"for",
"profile",
"profile"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Profile/SanitizerService.php#L68-L73 | train |
rips/php-connector-bundle | Hydrators/Application/Profile/IgnoredLocationHydrator.php | IgnoredLocationHydrator.hydrateCollection | public static function hydrateCollection(array $ignores)
{
$hydrated = [];
foreach ($ignores as $ignore) {
$hydrated[] = self::hydrate($ignore);
}
return $hydrated;
} | php | public static function hydrateCollection(array $ignores)
{
$hydrated = [];
foreach ($ignores as $ignore) {
$hydrated[] = self::hydrate($ignore);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"ignores",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"ignores",
"as",
"$",
"ignore",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
... | Hydrate a collection of ignore objects into a collection of
IgnoredLocationEntity objects
@param stdClass[] $ignores
@return IgnoredLocationEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"ignore",
"objects",
"into",
"a",
"collection",
"of",
"IgnoredLocationEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Profile/IgnoredLocationHydrator.php#L17-L26 | train |
rips/php-connector-bundle | Hydrators/Application/Profile/IgnoredLocationHydrator.php | IgnoredLocationHydrator.hydrate | public static function hydrate(stdClass $ignore)
{
$hydrated = new IgnoredLocationEntity();
if (isset($ignore->id)) {
$hydrated->setId($ignore->id);
}
if (isset($ignore->path)) {
$hydrated->setPath($ignore->path);
}
if (isset($ignore->match)) {
$hydrated->setMatch($ignore->match);
}
if (isset($ignore->exclude)) {
$hydrated->setExclude($ignore->exclude);
}
return $hydrated;
} | php | public static function hydrate(stdClass $ignore)
{
$hydrated = new IgnoredLocationEntity();
if (isset($ignore->id)) {
$hydrated->setId($ignore->id);
}
if (isset($ignore->path)) {
$hydrated->setPath($ignore->path);
}
if (isset($ignore->match)) {
$hydrated->setMatch($ignore->match);
}
if (isset($ignore->exclude)) {
$hydrated->setExclude($ignore->exclude);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"ignore",
")",
"{",
"$",
"hydrated",
"=",
"new",
"IgnoredLocationEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"ignore",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",... | Hydrate a ignore object into a IgnoredLocationEntity object
@param stdClass $ignore
@return IgnoredLocationEntity | [
"Hydrate",
"a",
"ignore",
"object",
"into",
"a",
"IgnoredLocationEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Profile/IgnoredLocationHydrator.php#L34-L55 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/CustomFunctionHydrator.php | CustomFunctionHydrator.hydrateCollection | public static function hydrateCollection(array $customFunctions)
{
$hydrated = [];
foreach ($customFunctions as $customFunction) {
$hydrated[] = self::hydrate($customFunction);
}
return $hydrated;
} | php | public static function hydrateCollection(array $customFunctions)
{
$hydrated = [];
foreach ($customFunctions as $customFunction) {
$hydrated[] = self::hydrate($customFunction);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"customFunctions",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"customFunctions",
"as",
"$",
"customFunction",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",... | Hydrate a collection of custom-function objects into a collection of
CustomFunctionEntity objects
@param stdClass[] $customFunctions
@return CustomFunctionEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"custom",
"-",
"function",
"objects",
"into",
"a",
"collection",
"of",
"CustomFunctionEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/CustomFunctionHydrator.php#L17-L26 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/CustomFunctionHydrator.php | CustomFunctionHydrator.hydrate | public static function hydrate(stdClass $customFunction)
{
$hydrated = new CustomFunctionEntity();
if (isset($customFunction->id)) {
$hydrated->setId($customFunction->id);
}
if (isset($customFunction->start_line)) {
$hydrated->setStartLine($customFunction->start_line);
}
if (isset($customFunction->end_line)) {
$hydrated->setEndLine($customFunction->end_line);
}
if (isset($customFunction->start_column)) {
$hydrated->setStartColumn($customFunction->start_column);
}
if (isset($customFunction->end_column)) {
$hydrated->setEndColumn($customFunction->end_column);
}
if (isset($customFunction->name)) {
$hydrated->setName($customFunction->name);
}
if (isset($customFunction->file)) {
$hydrated->setFile(FileHydrator::hydrate($customFunction->file));
}
if (isset($customFunction->class)) {
$hydrated->setClass(CustomClassHydrator::hydrate($customFunction->class));
}
if (isset($customFunction->parameters)) {
$hydrated->setParameters($customFunction->parameters);
}
return $hydrated;
} | php | public static function hydrate(stdClass $customFunction)
{
$hydrated = new CustomFunctionEntity();
if (isset($customFunction->id)) {
$hydrated->setId($customFunction->id);
}
if (isset($customFunction->start_line)) {
$hydrated->setStartLine($customFunction->start_line);
}
if (isset($customFunction->end_line)) {
$hydrated->setEndLine($customFunction->end_line);
}
if (isset($customFunction->start_column)) {
$hydrated->setStartColumn($customFunction->start_column);
}
if (isset($customFunction->end_column)) {
$hydrated->setEndColumn($customFunction->end_column);
}
if (isset($customFunction->name)) {
$hydrated->setName($customFunction->name);
}
if (isset($customFunction->file)) {
$hydrated->setFile(FileHydrator::hydrate($customFunction->file));
}
if (isset($customFunction->class)) {
$hydrated->setClass(CustomClassHydrator::hydrate($customFunction->class));
}
if (isset($customFunction->parameters)) {
$hydrated->setParameters($customFunction->parameters);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"customFunction",
")",
"{",
"$",
"hydrated",
"=",
"new",
"CustomFunctionEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"customFunction",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"... | Hydrate a custom-function object into a CustomFunctionEntity object
@param stdClass $customFunction
@return CustomFunctionEntity | [
"Hydrate",
"a",
"custom",
"-",
"function",
"object",
"into",
"a",
"CustomFunctionEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/CustomFunctionHydrator.php#L34-L75 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/View/IndexViewCompiler.php | IndexViewCompiler.compile | public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, ScaffolderThemeExtensionInterface $themeExtension, array $extensions, $extra = null)
{
if (File::exists(base_path('scaffolder-config/cache/view_index_' . $hash . self::CACHE_EXT)))
{
return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash));
}
else
{
$this->stub = $stub;
$this->replaceClassName($modelName)
->replaceBreadcrumb($modelName, $modelData->modelLabel)
->addDatatableFields($modelName, $modelData)
->setTableHeaders($modelData)
->replaceRoutePrefix($scaffolderConfig->routing->prefix);
$this->stub = $themeExtension->runAfterIndexViewIsCompiled($this->stub, $modelData, $scaffolderConfig);
foreach ($extensions as $extension)
{
$this->stub = $extension->runAfterIndexViewIsCompiled($this->stub, $modelData, $scaffolderConfig);
}
return $this->store($modelName, $scaffolderConfig, $this->stub, new FileToCompile(false, $hash));
}
} | php | public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, ScaffolderThemeExtensionInterface $themeExtension, array $extensions, $extra = null)
{
if (File::exists(base_path('scaffolder-config/cache/view_index_' . $hash . self::CACHE_EXT)))
{
return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash));
}
else
{
$this->stub = $stub;
$this->replaceClassName($modelName)
->replaceBreadcrumb($modelName, $modelData->modelLabel)
->addDatatableFields($modelName, $modelData)
->setTableHeaders($modelData)
->replaceRoutePrefix($scaffolderConfig->routing->prefix);
$this->stub = $themeExtension->runAfterIndexViewIsCompiled($this->stub, $modelData, $scaffolderConfig);
foreach ($extensions as $extension)
{
$this->stub = $extension->runAfterIndexViewIsCompiled($this->stub, $modelData, $scaffolderConfig);
}
return $this->store($modelName, $scaffolderConfig, $this->stub, new FileToCompile(false, $hash));
}
} | [
"public",
"function",
"compile",
"(",
"$",
"stub",
",",
"$",
"modelName",
",",
"$",
"modelData",
",",
"stdClass",
"$",
"scaffolderConfig",
",",
"$",
"hash",
",",
"ScaffolderThemeExtensionInterface",
"$",
"themeExtension",
",",
"array",
"$",
"extensions",
",",
... | Compiles the index view.
@param $stub
@param $modelName
@param $modelData
@param \stdClass $scaffolderConfig
@param $hash
@param \Scaffolder\Support\Contracts\ScaffolderThemeExtensionInterface $themeExtension
@param \Scaffolder\Support\Contracts\ScaffolderExtensionInterface[] $extensions
@param null $extra
@return string | [
"Compiles",
"the",
"index",
"view",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/View/IndexViewCompiler.php#L28-L53 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/View/IndexViewCompiler.php | IndexViewCompiler.addDatatableFields | private function addDatatableFields($modelName, $modelData)
{
$fields = '';
$firstIteration = true;
foreach ($modelData->fields as $field)
{
if ($field->hideInListings === false)
{
if ($firstIteration)
{
$fields .= sprintf("{ data: '%s', name: '%s' }," . PHP_EOL, $field->name, $field->name);
$firstIteration = false;
}
else
{
$fields .= sprintf($this->tab(4) . "{ data: '%s', name: '%s' }," . PHP_EOL, $field->name, $field->name);
}
}
}
$this->stub = str_replace('{{datatable_fields}}', $fields, $this->stub);
$this->stub = str_replace('{{datatable_url}}', ucfirst($modelName), $this->stub);
return $this;
} | php | private function addDatatableFields($modelName, $modelData)
{
$fields = '';
$firstIteration = true;
foreach ($modelData->fields as $field)
{
if ($field->hideInListings === false)
{
if ($firstIteration)
{
$fields .= sprintf("{ data: '%s', name: '%s' }," . PHP_EOL, $field->name, $field->name);
$firstIteration = false;
}
else
{
$fields .= sprintf($this->tab(4) . "{ data: '%s', name: '%s' }," . PHP_EOL, $field->name, $field->name);
}
}
}
$this->stub = str_replace('{{datatable_fields}}', $fields, $this->stub);
$this->stub = str_replace('{{datatable_url}}', ucfirst($modelName), $this->stub);
return $this;
} | [
"private",
"function",
"addDatatableFields",
"(",
"$",
"modelName",
",",
"$",
"modelData",
")",
"{",
"$",
"fields",
"=",
"''",
";",
"$",
"firstIteration",
"=",
"true",
";",
"foreach",
"(",
"$",
"modelData",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
... | Datatable fields.
@param $modelName
@param $modelData
@return $this | [
"Datatable",
"fields",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/View/IndexViewCompiler.php#L91-L116 | train |
orchestral/lumen | src/Routing/Helpers.php | Helpers.getVersionedResourceClassName | protected function getVersionedResourceClassName($group, $name)
{
$class = \str_replace('.', '\\', $name);
$version = $this->getVersionNamespace();
return \sprintf('%s\%s\%s\%s', $this->namespace, $group, $version, $class);
} | php | protected function getVersionedResourceClassName($group, $name)
{
$class = \str_replace('.', '\\', $name);
$version = $this->getVersionNamespace();
return \sprintf('%s\%s\%s\%s', $this->namespace, $group, $version, $class);
} | [
"protected",
"function",
"getVersionedResourceClassName",
"(",
"$",
"group",
",",
"$",
"name",
")",
"{",
"$",
"class",
"=",
"\\",
"str_replace",
"(",
"'.'",
",",
"'\\\\'",
",",
"$",
"name",
")",
";",
"$",
"version",
"=",
"$",
"this",
"->",
"getVersionNam... | Get versioned resource class name.
@param string $group
@param string $name
@return string | [
"Get",
"versioned",
"resource",
"class",
"name",
"."
] | 85a004e7cde0517b527241154f5ad031b7215851 | https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/src/Routing/Helpers.php#L20-L26 | train |
orchestral/lumen | src/Routing/Helpers.php | Helpers.getVersionNamespace | protected function getVersionNamespace()
{
$version = $this->api()->getVersion();
$supported = $this->getSupportedVersionNamespace();
if (isset($supported[$version])) {
return $supported[$version];
}
return 'Base';
} | php | protected function getVersionNamespace()
{
$version = $this->api()->getVersion();
$supported = $this->getSupportedVersionNamespace();
if (isset($supported[$version])) {
return $supported[$version];
}
return 'Base';
} | [
"protected",
"function",
"getVersionNamespace",
"(",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"api",
"(",
")",
"->",
"getVersion",
"(",
")",
";",
"$",
"supported",
"=",
"$",
"this",
"->",
"getSupportedVersionNamespace",
"(",
")",
";",
"if",
"(",... | Get the version namespace.
@return string | [
"Get",
"the",
"version",
"namespace",
"."
] | 85a004e7cde0517b527241154f5ad031b7215851 | https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/src/Routing/Helpers.php#L33-L43 | train |
nabu-3/core | nabu/data/catalog/CNabuCatalogItem.php | CNabuCatalogItem.getItemsForCatalog | static public function getItemsForCatalog($nb_catalog, int $level)
{
$nb_catalog_id = nb_getMixedValue($nb_catalog, NABU_CATALOG_FIELD_ID);
if (is_numeric($nb_catalog_id)) {
$retval = CNabuCatalogItem::buildObjectListFromSQL(
NABU_CATALOG_ITEM_FIELD_ID,
'SELECT *
FROM nb_catalog_item
WHERE nb_catalog_id=%catalog_id$d '
. ($level > 0 ? 'AND nb_catalog_item_level<=%level$d ' : '')
. 'ORDER BY nb_catalog_item_order ASC',
array(
'catalog_id' => $nb_catalog_id,
'level' => $level
),
($nb_catalog instanceof CNabuCatalog ? $nb_catalog : null)
);
if ($nb_catalog instanceof CNabuCatalog) {
$retval->setCatalog($nb_catalog);
}
} else {
if ($nb_catalog instanceof CNabuCatalog) {
$retval = new CNabuCatalogItemList($nb_catalog);
$retval->setOwner($nb_catalog);
} else {
$retval = new CNabuCatalogItemList();
}
}
return $retval;
} | php | static public function getItemsForCatalog($nb_catalog, int $level)
{
$nb_catalog_id = nb_getMixedValue($nb_catalog, NABU_CATALOG_FIELD_ID);
if (is_numeric($nb_catalog_id)) {
$retval = CNabuCatalogItem::buildObjectListFromSQL(
NABU_CATALOG_ITEM_FIELD_ID,
'SELECT *
FROM nb_catalog_item
WHERE nb_catalog_id=%catalog_id$d '
. ($level > 0 ? 'AND nb_catalog_item_level<=%level$d ' : '')
. 'ORDER BY nb_catalog_item_order ASC',
array(
'catalog_id' => $nb_catalog_id,
'level' => $level
),
($nb_catalog instanceof CNabuCatalog ? $nb_catalog : null)
);
if ($nb_catalog instanceof CNabuCatalog) {
$retval->setCatalog($nb_catalog);
}
} else {
if ($nb_catalog instanceof CNabuCatalog) {
$retval = new CNabuCatalogItemList($nb_catalog);
$retval->setOwner($nb_catalog);
} else {
$retval = new CNabuCatalogItemList();
}
}
return $retval;
} | [
"static",
"public",
"function",
"getItemsForCatalog",
"(",
"$",
"nb_catalog",
",",
"int",
"$",
"level",
")",
"{",
"$",
"nb_catalog_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_catalog",
",",
"NABU_CATALOG_FIELD_ID",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
... | Gets the list of items of a catalog from the storage.
@param mixed $nb_catalog A CNabuDataObject instance containing a field name nb_catalog_id or a Catalog ID.
@param int $level Max deep level to retrieve items. If $level is 0 then retrieves all levels.
@return CNabuCatalogItemList Returns a CNabuCatalogItemList with all items found. If no items found, then
returns an empty instance. | [
"Gets",
"the",
"list",
"of",
"items",
"of",
"a",
"catalog",
"from",
"the",
"storage",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/CNabuCatalogItem.php#L61-L91 | train |
nabu-3/core | nabu/data/catalog/CNabuCatalogItem.php | CNabuCatalogItem.getItemTranslationsForCatalog | static public function getItemTranslationsForCatalog($nb_catalog, int $level)
{
$nb_catalog_id = nb_getMixedValue($nb_catalog, NABU_CATALOG_FIELD_ID);
if (is_numeric($nb_catalog_id)) {
$retval = CNabuCatalogItemLanguage::buildObjectListFromSQL(
null,
'SELECT cil.*
FROM nb_catalog_item ci, nb_catalog_item_lang cil
WHERE ci.nb_catalog_item_id=cil.nb_catalog_item_id
AND ci.nb_catalog_id=%catalog_id$d '
. ($level > 0 ? 'and ci.nb_catalog_item_level<=%level$d ' : '')
. 'ORDER BY ci.nb_catalog_item_order, cil.nb_language_id',
array(
'catalog_id' => $nb_catalog_id,
'level' => $level
)
);
} else {
$retval = new CNabuCatalogItemLanguageList();
}
return $retval;
} | php | static public function getItemTranslationsForCatalog($nb_catalog, int $level)
{
$nb_catalog_id = nb_getMixedValue($nb_catalog, NABU_CATALOG_FIELD_ID);
if (is_numeric($nb_catalog_id)) {
$retval = CNabuCatalogItemLanguage::buildObjectListFromSQL(
null,
'SELECT cil.*
FROM nb_catalog_item ci, nb_catalog_item_lang cil
WHERE ci.nb_catalog_item_id=cil.nb_catalog_item_id
AND ci.nb_catalog_id=%catalog_id$d '
. ($level > 0 ? 'and ci.nb_catalog_item_level<=%level$d ' : '')
. 'ORDER BY ci.nb_catalog_item_order, cil.nb_language_id',
array(
'catalog_id' => $nb_catalog_id,
'level' => $level
)
);
} else {
$retval = new CNabuCatalogItemLanguageList();
}
return $retval;
} | [
"static",
"public",
"function",
"getItemTranslationsForCatalog",
"(",
"$",
"nb_catalog",
",",
"int",
"$",
"level",
")",
"{",
"$",
"nb_catalog_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_catalog",
",",
"NABU_CATALOG_FIELD_ID",
")",
";",
"if",
"(",
"is_numeric",
"... | Gets the list of translations associated to all items of a catalog from the storage.
@param mixed $nb_catalog A CNabuDataObject instance containing a field name nb_catalog_id or a Catalog ID.
@param int $level Max deep level to retrieve items. If $level is 0 then retrieves all levels.
@return CNabuCatalogItemLanguageList Returns a CNabuCatalogItemLanguageList with all translations found.
If no translations found, then rturns an empty instance. | [
"Gets",
"the",
"list",
"of",
"translations",
"associated",
"to",
"all",
"items",
"of",
"a",
"catalog",
"from",
"the",
"storage",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/CNabuCatalogItem.php#L100-L122 | train |
nabu-3/core | nabu/data/catalog/CNabuCatalogItem.php | CNabuCatalogItem.getItems | public function getItems(bool $force = false) : CNabuCatalogItemList
{
if ($this->nb_tree_child_list->isEmpty() || $force) {
$this->nb_tree_child_list->merge(
CNabuCatalogItem::buildObjectListFromSQL(
'nb_catalog_item_id',
'SELECT *
FROM nb_catalog_item
WHERE nb_catalog_id=%catalog_id$d
AND nb_catalog_item_parent_id=%parent_id$d
ORDER BY nb_catalog_item_order ASC',
array(
'catalog_id' => $this->getCatalogId(),
'parent_id' => $this->getId()
),
$this->getCatalog()
)
);
}
return $this->nb_tree_child_list;
} | php | public function getItems(bool $force = false) : CNabuCatalogItemList
{
if ($this->nb_tree_child_list->isEmpty() || $force) {
$this->nb_tree_child_list->merge(
CNabuCatalogItem::buildObjectListFromSQL(
'nb_catalog_item_id',
'SELECT *
FROM nb_catalog_item
WHERE nb_catalog_id=%catalog_id$d
AND nb_catalog_item_parent_id=%parent_id$d
ORDER BY nb_catalog_item_order ASC',
array(
'catalog_id' => $this->getCatalogId(),
'parent_id' => $this->getId()
),
$this->getCatalog()
)
);
}
return $this->nb_tree_child_list;
} | [
"public",
"function",
"getItems",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"CNabuCatalogItemList",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_tree_child_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_tree_chi... | Get children items of this Item.
@param bool $force If true, then refresh the list from the database storage.
@return CNabuCatalogItemList Returns a Catalog Item List object with children items. | [
"Get",
"children",
"items",
"of",
"this",
"Item",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/CNabuCatalogItem.php#L129-L150 | train |
nabu-3/core | nabu/data/catalog/base/CNabuCatalogTaxonomyBase.php | CNabuCatalogTaxonomyBase.getAllCatalogTaxonomies | public static function getAllCatalogTaxonomies(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_taxonomy_id',
'select * '
. 'from nb_catalog_taxonomy '
. 'where nb_catalog_id=%catalog_id$d',
array(
'catalog_id' => $nb_catalog_id
),
$nb_catalog
);
} else {
$retval = new CNabuCatalogTaxonomyList();
}
return $retval;
} | php | public static function getAllCatalogTaxonomies(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_taxonomy_id',
'select * '
. 'from nb_catalog_taxonomy '
. 'where nb_catalog_id=%catalog_id$d',
array(
'catalog_id' => $nb_catalog_id
),
$nb_catalog
);
} else {
$retval = new CNabuCatalogTaxonomyList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllCatalogTaxonomies",
"(",
"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_taxonomy_id' is the index, and
each value is an instance of class CNabuCatalogTaxonomyBase.
@param CNabuCatalog $nb_catalog The CNabuCatalog instance of the Catalog that owns the Catalog Taxonomy List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_catalog_taxonomy_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuCatalogTaxonomyBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/base/CNabuCatalogTaxonomyBase.php#L178-L198 | train |
nabu-3/core | nabu/data/catalog/base/CNabuCatalogTaxonomyBase.php | CNabuCatalogTaxonomyBase.setScope | public function setScope(string $scope = "O") : CNabuDataObject
{
if ($scope === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$scope")
);
}
$this->setValue('nb_catalog_taxonomy_scope', $scope);
return $this;
} | php | public function setScope(string $scope = "O") : CNabuDataObject
{
if ($scope === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$scope")
);
}
$this->setValue('nb_catalog_taxonomy_scope', $scope);
return $this;
} | [
"public",
"function",
"setScope",
"(",
"string",
"$",
"scope",
"=",
"\"O\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"scope",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_... | Sets the Catalog Taxonomy Scope attribute value.
@param string $scope New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Catalog",
"Taxonomy",
"Scope",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/base/CNabuCatalogTaxonomyBase.php#L454-L465 | train |
nabu-3/core | nabu/data/security/base/CNabuUserGroupMemberBase.php | CNabuUserGroupMemberBase.setNew | public function setNew(string $new = "T") : CNabuDataObject
{
if ($new === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$new")
);
}
$this->setValue('nb_user_group_member_new', $new);
return $this;
} | php | public function setNew(string $new = "T") : CNabuDataObject
{
if ($new === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$new")
);
}
$this->setValue('nb_user_group_member_new', $new);
return $this;
} | [
"public",
"function",
"setNew",
"(",
"string",
"$",
"new",
"=",
"\"T\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"new",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
... | Sets the User Group Member New attribute value.
@param string $new New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Group",
"Member",
"New",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserGroupMemberBase.php#L289-L300 | train |
nabu-3/core | nabu/data/security/base/CNabuUserGroupMemberBase.php | CNabuUserGroupMemberBase.setAdmin | public function setAdmin(string $admin = "F") : CNabuDataObject
{
if ($admin === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$admin")
);
}
$this->setValue('nb_user_group_member_admin', $admin);
return $this;
} | php | public function setAdmin(string $admin = "F") : CNabuDataObject
{
if ($admin === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$admin")
);
}
$this->setValue('nb_user_group_member_admin', $admin);
return $this;
} | [
"public",
"function",
"setAdmin",
"(",
"string",
"$",
"admin",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"admin",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_... | Sets the User Group Member Admin attribute value.
@param string $admin New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Group",
"Member",
"Admin",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserGroupMemberBase.php#L316-L327 | train |
nabu-3/core | nabu/provider/base/CNabuProviderModuleManagerAdapter.php | CNabuProviderModuleManagerAdapter.setVendorKey | public function setVendorKey(string $vendor_key)
{
if (!nb_isValidKey($vendor_key)) {
throw new ENabuProviderException(ENabuProviderException::ERROR_VENDOR_KEY_NOT_VALID, array($vendor_key));
}
$this->setValue(self::VENDOR_KEY, $vendor_key);
try {
$this->getComplexKey();
} catch (ENabuProviderException $ex) {
}
return $this;
} | php | public function setVendorKey(string $vendor_key)
{
if (!nb_isValidKey($vendor_key)) {
throw new ENabuProviderException(ENabuProviderException::ERROR_VENDOR_KEY_NOT_VALID, array($vendor_key));
}
$this->setValue(self::VENDOR_KEY, $vendor_key);
try {
$this->getComplexKey();
} catch (ENabuProviderException $ex) {
}
return $this;
} | [
"public",
"function",
"setVendorKey",
"(",
"string",
"$",
"vendor_key",
")",
"{",
"if",
"(",
"!",
"nb_isValidKey",
"(",
"$",
"vendor_key",
")",
")",
"{",
"throw",
"new",
"ENabuProviderException",
"(",
"ENabuProviderException",
"::",
"ERROR_VENDOR_KEY_NOT_VALID",
"... | Sets the vendor key
@param string $vendor_key New vendor key.
@return INabuProviderManager Returns manager instance to grant cascade calls.
@throws ENabuProviderException Raises an exception if $vendor_key have an invalid value. | [
"Sets",
"the",
"vendor",
"key"
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/provider/base/CNabuProviderModuleManagerAdapter.php#L61-L75 | train |
nabu-3/core | nabu/provider/base/CNabuProviderModuleManagerAdapter.php | CNabuProviderModuleManagerAdapter.setModuleKey | public function setModuleKey(string $module_key)
{
if (!nb_isValidKey($module_key)) {
throw new ENabuProviderException(ENabuProviderException::ERROR_MODULE_KEY_NOT_VALID, array($module_key));
}
$this->setValue(self::MODULE_KEY, $module_key);
try {
$this->getComplexKey();
} catch (ENabuProviderException $ex) {
}
return $this;
} | php | public function setModuleKey(string $module_key)
{
if (!nb_isValidKey($module_key)) {
throw new ENabuProviderException(ENabuProviderException::ERROR_MODULE_KEY_NOT_VALID, array($module_key));
}
$this->setValue(self::MODULE_KEY, $module_key);
try {
$this->getComplexKey();
} catch (ENabuProviderException $ex) {
}
return $this;
} | [
"public",
"function",
"setModuleKey",
"(",
"string",
"$",
"module_key",
")",
"{",
"if",
"(",
"!",
"nb_isValidKey",
"(",
"$",
"module_key",
")",
")",
"{",
"throw",
"new",
"ENabuProviderException",
"(",
"ENabuProviderException",
"::",
"ERROR_MODULE_KEY_NOT_VALID",
"... | Sets the module key
@param string $module_key New module key.
@return INabuProviderManager Returns the manager instance to grant cascade calls.
@throws ENabuProviderException Raises an exception if $module_key have an invalid value. | [
"Sets",
"the",
"module",
"key"
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/provider/base/CNabuProviderModuleManagerAdapter.php#L88-L102 | train |
nabu-3/core | nabu/data/security/base/CNabuUserGroupTypeBase.php | CNabuUserGroupTypeBase.getAllUserGroupTypes | public static function getAllUserGroupTypes(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_user_group_type_id',
'select * '
. 'from nb_user_group_type '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuUserGroupTypeList();
}
return $retval;
} | php | public static function getAllUserGroupTypes(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_user_group_type_id',
'select * '
. 'from nb_user_group_type '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuUserGroupTypeList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllUserGroupTypes",
"(",
"CNabuCustomer",
"$",
"nb_customer",
")",
"{",
"$",
"nb_customer_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_customer",
",",
"'nb_customer_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_customer_... | Get all items in the storage as an associative array where the field 'nb_user_group_type_id' is the index, and
each value is an instance of class CNabuUserGroupTypeBase.
@param CNabuCustomer $nb_customer The CNabuCustomer instance of the Customer that owns the User Group Type List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_user_group_type_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuUserGroupTypeBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserGroupTypeBase.php#L160-L180 | train |
nabu-3/core | nabu/data/security/base/CNabuUserGroupTypeBase.php | CNabuUserGroupTypeBase.setExclusive | public function setExclusive(string $exclusive = "F") : CNabuDataObject
{
if ($exclusive === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$exclusive")
);
}
$this->setValue('nb_user_group_type_exclusive', $exclusive);
return $this;
} | php | public function setExclusive(string $exclusive = "F") : CNabuDataObject
{
if ($exclusive === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$exclusive")
);
}
$this->setValue('nb_user_group_type_exclusive', $exclusive);
return $this;
} | [
"public",
"function",
"setExclusive",
"(",
"string",
"$",
"exclusive",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"exclusive",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_... | Sets the User Group Type Exclusive attribute value.
@param string $exclusive New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Group",
"Type",
"Exclusive",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserGroupTypeBase.php#L436-L447 | train |
nabu-3/core | nabu/data/security/base/CNabuUserGroupTypeBase.php | CNabuUserGroupTypeBase.setCreatorOwner | public function setCreatorOwner(string $creator_owner = "T") : CNabuDataObject
{
if ($creator_owner === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$creator_owner")
);
}
$this->setValue('nb_user_group_type_creator_owner', $creator_owner);
return $this;
} | php | public function setCreatorOwner(string $creator_owner = "T") : CNabuDataObject
{
if ($creator_owner === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$creator_owner")
);
}
$this->setValue('nb_user_group_type_creator_owner', $creator_owner);
return $this;
} | [
"public",
"function",
"setCreatorOwner",
"(",
"string",
"$",
"creator_owner",
"=",
"\"T\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"creator_owner",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_... | Sets the User Group Type Creator Owner attribute value.
@param string $creator_owner New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Group",
"Type",
"Creator",
"Owner",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserGroupTypeBase.php#L463-L474 | train |
mmikkel/ChildMe-Craft | src/ChildMe.php | ChildMe.addElementTableAttributes | protected function addElementTableAttributes()
{
$segments = Craft::$app->getRequest()->getSegments();
$actionSegment = $segments[count($segments) - 1] ?? null;
$classes = [Entry::class, Category::class];
foreach ($classes as $class) {
// Register "Add child" attribute
Event::on($class, Element::EVENT_REGISTER_TABLE_ATTRIBUTES, function (RegisterElementTableAttributesEvent $event) use ($actionSegment) {
$event->tableAttributes['_childme_addChild'] = $actionSegment !== 'get-elements' ? Craft::t('child-me', 'Add child') : '';
});
// Get the HTML for that attribute
Event::on($class, Element::EVENT_SET_TABLE_ATTRIBUTE_HTML, function (SetElementTableAttributeHtmlEvent $event) use ($class) {
if ($event->attribute === '_childme_addChild') {
$html = '';
switch ($class) {
case 'craft\elements\Entry':
$entry = $event->sender;
if ($entry->section->type !== 'structure') {
break;
}
$maxLevels = $entry->section->maxLevels;
$visible = !$maxLevels || $entry->level < $maxLevels;
$newUrl = UrlHelper::cpUrl(implode('/', ['entries', $entry->section->handle, 'new']), [
'typeId' => $entry->type->id,
'parentId' => $entry->id,
]);
$html = $this->getElementTableAttributeHtml($newUrl, $visible, [
'data-section="' . $entry->section->handle . '"',
'data-id="' . $entry->id . '"'
]);
break;
case 'craft\elements\Category':
$category = $event->sender;
$maxLevels = $category->group->maxLevels;
$visible = !$maxLevels || $category->level < $maxLevels;
$newUrl = UrlHelper::cpUrl(implode('/', ['categories', $category->group->handle, 'new']), [
'parentId' => $category->id,
]);
$html = $this->getElementTableAttributeHtml($newUrl, $visible);
break;
}
$event->html = $html;
$event->handled = true;
}
});
}
} | php | protected function addElementTableAttributes()
{
$segments = Craft::$app->getRequest()->getSegments();
$actionSegment = $segments[count($segments) - 1] ?? null;
$classes = [Entry::class, Category::class];
foreach ($classes as $class) {
// Register "Add child" attribute
Event::on($class, Element::EVENT_REGISTER_TABLE_ATTRIBUTES, function (RegisterElementTableAttributesEvent $event) use ($actionSegment) {
$event->tableAttributes['_childme_addChild'] = $actionSegment !== 'get-elements' ? Craft::t('child-me', 'Add child') : '';
});
// Get the HTML for that attribute
Event::on($class, Element::EVENT_SET_TABLE_ATTRIBUTE_HTML, function (SetElementTableAttributeHtmlEvent $event) use ($class) {
if ($event->attribute === '_childme_addChild') {
$html = '';
switch ($class) {
case 'craft\elements\Entry':
$entry = $event->sender;
if ($entry->section->type !== 'structure') {
break;
}
$maxLevels = $entry->section->maxLevels;
$visible = !$maxLevels || $entry->level < $maxLevels;
$newUrl = UrlHelper::cpUrl(implode('/', ['entries', $entry->section->handle, 'new']), [
'typeId' => $entry->type->id,
'parentId' => $entry->id,
]);
$html = $this->getElementTableAttributeHtml($newUrl, $visible, [
'data-section="' . $entry->section->handle . '"',
'data-id="' . $entry->id . '"'
]);
break;
case 'craft\elements\Category':
$category = $event->sender;
$maxLevels = $category->group->maxLevels;
$visible = !$maxLevels || $category->level < $maxLevels;
$newUrl = UrlHelper::cpUrl(implode('/', ['categories', $category->group->handle, 'new']), [
'parentId' => $category->id,
]);
$html = $this->getElementTableAttributeHtml($newUrl, $visible);
break;
}
$event->html = $html;
$event->handled = true;
}
});
}
} | [
"protected",
"function",
"addElementTableAttributes",
"(",
")",
"{",
"$",
"segments",
"=",
"Craft",
"::",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getSegments",
"(",
")",
";",
"$",
"actionSegment",
"=",
"$",
"segments",
"[",
"count",
"(",
"$",
"s... | Add element table attributes | [
"Add",
"element",
"table",
"attributes"
] | d198e514b34e523c41df527930885c374b1580af | https://github.com/mmikkel/ChildMe-Craft/blob/d198e514b34e523c41df527930885c374b1580af/src/ChildMe.php#L131-L199 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductCategoryLanguageBase.php | CNabuCommerceProductCategoryLanguageBase.setCommerceProductCategoryId | public function setCommerceProductCategoryId(int $nb_commerce_product_category_id) : CNabuDataObject
{
if ($nb_commerce_product_category_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_commerce_product_category_id")
);
}
$this->setValue('nb_commerce_product_category_id', $nb_commerce_product_category_id);
return $this;
} | php | public function setCommerceProductCategoryId(int $nb_commerce_product_category_id) : CNabuDataObject
{
if ($nb_commerce_product_category_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_commerce_product_category_id")
);
}
$this->setValue('nb_commerce_product_category_id', $nb_commerce_product_category_id);
return $this;
} | [
"public",
"function",
"setCommerceProductCategoryId",
"(",
"int",
"$",
"nb_commerce_product_category_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_commerce_product_category_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreE... | Sets the Commerce Product Category Id attribute value.
@param int $nb_commerce_product_category_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Commerce",
"Product",
"Category",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductCategoryLanguageBase.php#L184-L195 | train |
nabu-3/core | nabu/data/security/base/CNabuUserGroupBase.php | CNabuUserGroupBase.getAllUserGroups | public static function getAllUserGroups(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_user_group_id',
'select * '
. 'from nb_user_group '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuUserGroupList();
}
return $retval;
} | php | public static function getAllUserGroups(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_user_group_id',
'select * '
. 'from nb_user_group '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuUserGroupList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllUserGroups",
"(",
"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_user_group_id' is the index, and each
value is an instance of class CNabuUserGroupBase.
@param CNabuCustomer $nb_customer The CNabuCustomer instance of the Customer that owns the User Group List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_user_group_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuUserGroupBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserGroupBase.php#L134-L154 | train |
nabu-3/core | nabu/data/security/base/CNabuUserGroupBase.php | CNabuUserGroupBase.setStatus | public function setStatus(string $status = "E") : CNabuDataObject
{
if ($status === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$status")
);
}
$this->setValue('nb_user_group_status', $status);
return $this;
} | php | public function setStatus(string $status = "E") : CNabuDataObject
{
if ($status === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$status")
);
}
$this->setValue('nb_user_group_status', $status);
return $this;
} | [
"public",
"function",
"setStatus",
"(",
"string",
"$",
"status",
"=",
"\"E\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"status",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOW... | Sets the User Group Status attribute value.
@param string $status New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Group",
"Status",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserGroupBase.php#L506-L517 | train |
nabu-3/core | nabu/data/commerce/CNabuCommerce.php | CNabuCommerce.newProductCategory | public function newProductCategory(string $key = null, int $order = 1) : CNabuCommerceProductCategory
{
$nb_commerce_product_category = $this->isBuiltIn()
? new CNabuBuiltInCommerceProductCategory()
: new CNabuCommerceProductCategory()
;
$nb_commerce_product_category->setKey($key);
$nb_commerce_product_category->setOrder($order);
return $this->addProductCategoryObject($nb_commerce_product_category);
} | php | public function newProductCategory(string $key = null, int $order = 1) : CNabuCommerceProductCategory
{
$nb_commerce_product_category = $this->isBuiltIn()
? new CNabuBuiltInCommerceProductCategory()
: new CNabuCommerceProductCategory()
;
$nb_commerce_product_category->setKey($key);
$nb_commerce_product_category->setOrder($order);
return $this->addProductCategoryObject($nb_commerce_product_category);
} | [
"public",
"function",
"newProductCategory",
"(",
"string",
"$",
"key",
"=",
"null",
",",
"int",
"$",
"order",
"=",
"1",
")",
":",
"CNabuCommerceProductCategory",
"{",
"$",
"nb_commerce_product_category",
"=",
"$",
"this",
"->",
"isBuiltIn",
"(",
")",
"?",
"n... | Creates a new Product Category instance.
@param string|null $key Key to identify the Category.
@param int $order Order of the Category.
@return CNabuCommerceProductCategory Returns a valid instance. | [
"Creates",
"a",
"new",
"Product",
"Category",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/CNabuCommerce.php#L66-L77 | train |
nabu-3/core | nabu/data/commerce/CNabuCommerce.php | CNabuCommerce.addProductCategoryObject | public function addProductCategoryObject(CNabuCommerceProductCategory $nb_commerce_product_category)
{
$nb_commerce_product_category->setCommerce($this);
return $this->nb_commerce_product_category_list->addItem($nb_commerce_product_category);
} | php | public function addProductCategoryObject(CNabuCommerceProductCategory $nb_commerce_product_category)
{
$nb_commerce_product_category->setCommerce($this);
return $this->nb_commerce_product_category_list->addItem($nb_commerce_product_category);
} | [
"public",
"function",
"addProductCategoryObject",
"(",
"CNabuCommerceProductCategory",
"$",
"nb_commerce_product_category",
")",
"{",
"$",
"nb_commerce_product_category",
"->",
"setCommerce",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"nb_commerce_product_ca... | Adds a Product Category object to this Commerce.
@param CNabuCommerceProductCategory $nb_commerce_product_category A Product Category object to be added.
@return CNabuCommerceProductCategory|false Returns the inserted object nor false if is not inserted. | [
"Adds",
"a",
"Product",
"Category",
"object",
"to",
"this",
"Commerce",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/CNabuCommerce.php#L84-L89 | train |
nabu-3/core | nabu/data/commerce/CNabuCommerce.php | CNabuCommerce.getProductCategory | public function getProductCategory($nb_commerce_product_category)
{
$nb_category = false;
$nb_category_id = nb_getMixedValue($nb_commerce_product_category, NABU_COMMERCE_PRODUCT_CATEGORY_FIELD_ID);
if (is_numeric($nb_category_id)) {
$nb_category = $this->nb_commerce_product_category_list->getItem($nb_category_id);
}
return $nb_category;
} | php | public function getProductCategory($nb_commerce_product_category)
{
$nb_category = false;
$nb_category_id = nb_getMixedValue($nb_commerce_product_category, NABU_COMMERCE_PRODUCT_CATEGORY_FIELD_ID);
if (is_numeric($nb_category_id)) {
$nb_category = $this->nb_commerce_product_category_list->getItem($nb_category_id);
}
return $nb_category;
} | [
"public",
"function",
"getProductCategory",
"(",
"$",
"nb_commerce_product_category",
")",
"{",
"$",
"nb_category",
"=",
"false",
";",
"$",
"nb_category_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_commerce_product_category",
",",
"NABU_COMMERCE_PRODUCT_CATEGORY_FIELD_ID",
... | Gets a Product Category by Id.
@param mixed $nb_commerce_product_category A CNabuDataObject containing a field named nb_commerce_product_category_id
or a valid ID.
@return CNabuCommerceProductCategory|false Returns a valid instance if exists or false if not. | [
"Gets",
"a",
"Product",
"Category",
"by",
"Id",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/CNabuCommerce.php#L97-L106 | train |
nabu-3/core | nabu/data/commerce/CNabuCommerce.php | CNabuCommerce.getProductCategories | public function getProductCategories(bool $force = false) : CNabuCommerceProductCategoryList
{
if ($this->nb_commerce_product_category_list->isEmpty() || $force) {
$this->nb_commerce_product_category_list->clear();
$this->nb_commerce_product_category_list->merge(
CNabuCommerceProductCategory::getCategoriesForCommerce($this)
);
}
return $this->nb_commerce_product_category_list;
} | php | public function getProductCategories(bool $force = false) : CNabuCommerceProductCategoryList
{
if ($this->nb_commerce_product_category_list->isEmpty() || $force) {
$this->nb_commerce_product_category_list->clear();
$this->nb_commerce_product_category_list->merge(
CNabuCommerceProductCategory::getCategoriesForCommerce($this)
);
}
return $this->nb_commerce_product_category_list;
} | [
"public",
"function",
"getProductCategories",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"CNabuCommerceProductCategoryList",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_commerce_product_category_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
... | Gets the full list of all Product Categories in this Commerce instance.
@param bool $force If true, forces to reload list form the database storage.
@return CNabuCommerceProductCategoryList Returns a Product Category List with all Categories. | [
"Gets",
"the",
"full",
"list",
"of",
"all",
"Product",
"Categories",
"in",
"this",
"Commerce",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/CNabuCommerce.php#L113-L123 | train |
nabu-3/core | nabu/data/commerce/CNabuCommerce.php | CNabuCommerce.getProducts | public function getProducts(bool $force = false) : CNabuCommerceProductList
{
if ($this->nb_commerce_product_list->isEmpty() || $force) {
$this->nb_commerce_product_list->clear();
$this->nb_commerce_product_list->merge(
CNabuCommerceProduct::getProductsForCommerce($this)
);
}
return $this->nb_commerce_product_list;
} | php | public function getProducts(bool $force = false) : CNabuCommerceProductList
{
if ($this->nb_commerce_product_list->isEmpty() || $force) {
$this->nb_commerce_product_list->clear();
$this->nb_commerce_product_list->merge(
CNabuCommerceProduct::getProductsForCommerce($this)
);
}
return $this->nb_commerce_product_list;
} | [
"public",
"function",
"getProducts",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"CNabuCommerceProductList",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_commerce_product_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
... | Gets the full list of all Products in this Commerce instance.
@param bool $force If true, forces to reload list from the database storage.
@return CNabuCommerceProductList Returns a Product List with all Categories. | [
"Gets",
"the",
"full",
"list",
"of",
"all",
"Products",
"in",
"this",
"Commerce",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/CNabuCommerce.php#L154-L164 | train |
nabu-3/core | nabu/data/commerce/CNabuCommerce.php | CNabuCommerce.getProduct | public function getProduct($nb_commerce_product)
{
$nb_product = false;
$nb_product_id = nb_getMixedValue($nb_commerce_product, NABU_COMMERCE_PRODUCT_FIELD_ID);
if (is_numeric($nb_product_id)) {
$nb_product = $this->nb_commerce_product_list->getItem($nb_product_id);
}
return $nb_product;
} | php | public function getProduct($nb_commerce_product)
{
$nb_product = false;
$nb_product_id = nb_getMixedValue($nb_commerce_product, NABU_COMMERCE_PRODUCT_FIELD_ID);
if (is_numeric($nb_product_id)) {
$nb_product = $this->nb_commerce_product_list->getItem($nb_product_id);
}
return $nb_product;
} | [
"public",
"function",
"getProduct",
"(",
"$",
"nb_commerce_product",
")",
"{",
"$",
"nb_product",
"=",
"false",
";",
"$",
"nb_product_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_commerce_product",
",",
"NABU_COMMERCE_PRODUCT_FIELD_ID",
")",
";",
"if",
"(",
"is_num... | Gets a Product by Id.
@param mixed $nb_commerce_product A CNabuDataObject containing a field named nb_commerce_product_id or a valid ID.
@return CNabuCommerceProduct|false Returns a valid instance if exists or false if not. | [
"Gets",
"a",
"Product",
"by",
"Id",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/CNabuCommerce.php#L171-L180 | train |
nabu-3/core | nabu/data/commerce/CNabuCommerce.php | CNabuCommerce.findProductBySlug | public function findProductBySlug(string $slug, $nb_language = null)
{
$retval = false;
$nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);
$this->getProducts()->iterate(
function ($key, CNabuCommerceProduct $nb_product)
use (&$retval, $slug, $nb_language_id)
{
if (is_numeric($nb_language_id) &&
($nb_translation = $nb_product->getTranslation($nb_language_id)) instanceof CNabuCommerceProductLanguage &&
$nb_translation->getSlug() === $slug
) {
$retval = $nb_product;
} else {
$nb_product->getTranslations()->iterate(
function ($key, CNabuCommerceProductLanguage $nb_translation)
use (&$retval, $nb_product, $slug)
{
if ($nb_translation->getSlug() === $slug) {
$retval = $nb_product;
}
return !$retval;
}
);
}
return !$retval;
}
);
return $retval;
} | php | public function findProductBySlug(string $slug, $nb_language = null)
{
$retval = false;
$nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);
$this->getProducts()->iterate(
function ($key, CNabuCommerceProduct $nb_product)
use (&$retval, $slug, $nb_language_id)
{
if (is_numeric($nb_language_id) &&
($nb_translation = $nb_product->getTranslation($nb_language_id)) instanceof CNabuCommerceProductLanguage &&
$nb_translation->getSlug() === $slug
) {
$retval = $nb_product;
} else {
$nb_product->getTranslations()->iterate(
function ($key, CNabuCommerceProductLanguage $nb_translation)
use (&$retval, $nb_product, $slug)
{
if ($nb_translation->getSlug() === $slug) {
$retval = $nb_product;
}
return !$retval;
}
);
}
return !$retval;
}
);
return $retval;
} | [
"public",
"function",
"findProductBySlug",
"(",
"string",
"$",
"slug",
",",
"$",
"nb_language",
"=",
"null",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"$",
"nb_language_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_language",
",",
"NABU_LANG_FIELD_ID",
")",
... | Find a Product using their slug.
@param string $slug Slug of Product to find.
@param mixed|null $nb_language Language to search the Slug.
@return CNabuCommerceProduct|false Returns the Product instance if exists or false if not. | [
"Find",
"a",
"Product",
"using",
"their",
"slug",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/CNabuCommerce.php#L188-L219 | train |
nabu-3/core | nabu/data/commerce/CNabuCommerce.php | CNabuCommerce.refresh | public function refresh(bool $force = false, bool $cascade = false) : bool
{
return parent::refresh($force, $cascade) &&
(!$cascade || (
$this->getProductCategories($force) &&
$this->getProducts($force)
))
;
} | php | public function refresh(bool $force = false, bool $cascade = false) : bool
{
return parent::refresh($force, $cascade) &&
(!$cascade || (
$this->getProductCategories($force) &&
$this->getProducts($force)
))
;
} | [
"public",
"function",
"refresh",
"(",
"bool",
"$",
"force",
"=",
"false",
",",
"bool",
"$",
"cascade",
"=",
"false",
")",
":",
"bool",
"{",
"return",
"parent",
"::",
"refresh",
"(",
"$",
"force",
",",
"$",
"cascade",
")",
"&&",
"(",
"!",
"$",
"casc... | Overrides refresh method to allow commerce subentities to be refreshed.
@param bool $force Forces to reload entities from the database storage.
@param bool $cascade Forces to reload child entities from the database storage.
@return bool Returns true if transations are empty or refreshed. | [
"Overrides",
"refresh",
"method",
"to",
"allow",
"commerce",
"subentities",
"to",
"be",
"refreshed",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/CNabuCommerce.php#L256-L264 | train |
nabu-3/core | nabu/http/adapters/CNabuHTTPServerAdapter.php | CNabuHTTPServerAdapter.isServerValid | public function isServerValid()
{
return ($this->nb_server !== null &&
($this->nb_server->isBuiltIn() || $this->nb_server->isFetched()));
} | php | public function isServerValid()
{
return ($this->nb_server !== null &&
($this->nb_server->isBuiltIn() || $this->nb_server->isFetched()));
} | [
"public",
"function",
"isServerValid",
"(",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"nb_server",
"!==",
"null",
"&&",
"(",
"$",
"this",
"->",
"nb_server",
"->",
"isBuiltIn",
"(",
")",
"||",
"$",
"this",
"->",
"nb_server",
"->",
"isFetched",
"(",
")... | Checks if a server is valid.
Valid servers are Built-in instances or fetched servers.
@return bool Returns true if the server is valid. | [
"Checks",
"if",
"a",
"server",
"is",
"valid",
".",
"Valid",
"servers",
"are",
"Built",
"-",
"in",
"instances",
"or",
"fetched",
"servers",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/adapters/CNabuHTTPServerAdapter.php#L461-L465 | train |
nabu-3/core | nabu/data/messaging/base/CNabuMessagingServiceStackAttachmentBase.php | CNabuMessagingServiceStackAttachmentBase.setMessagingServiceStackId | public function setMessagingServiceStackId(int $nb_messaging_service_stack_id) : CNabuDataObject
{
if ($nb_messaging_service_stack_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_messaging_service_stack_id")
);
}
$this->setValue('nb_messaging_service_stack_id', $nb_messaging_service_stack_id);
return $this;
} | php | public function setMessagingServiceStackId(int $nb_messaging_service_stack_id) : CNabuDataObject
{
if ($nb_messaging_service_stack_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_messaging_service_stack_id")
);
}
$this->setValue('nb_messaging_service_stack_id', $nb_messaging_service_stack_id);
return $this;
} | [
"public",
"function",
"setMessagingServiceStackId",
"(",
"int",
"$",
"nb_messaging_service_stack_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_messaging_service_stack_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreExcepti... | Sets the Messaging Service Stack Id attribute value.
@param int $nb_messaging_service_stack_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Messaging",
"Service",
"Stack",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/base/CNabuMessagingServiceStackAttachmentBase.php#L181-L192 | train |
nabu-3/core | nabu/render/CNabuRenderTransformFactory.php | CNabuRenderTransformFactory.transform | public function transform($source)
{
if ($this->discoverInterface()) {
$this->nb_interface->transform($source);
} else {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_TRANSFORM_NOT_FOUND,
array($this->nb_descriptor->getKey())
);
}
} | php | public function transform($source)
{
if ($this->discoverInterface()) {
$this->nb_interface->transform($source);
} else {
throw new ENabuRenderException(
ENabuRenderException::ERROR_RENDER_TRANSFORM_NOT_FOUND,
array($this->nb_descriptor->getKey())
);
}
} | [
"public",
"function",
"transform",
"(",
"$",
"source",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"discoverInterface",
"(",
")",
")",
"{",
"$",
"this",
"->",
"nb_interface",
"->",
"transform",
"(",
"$",
"source",
")",
";",
"}",
"else",
"{",
"throw",
"ne... | This method transform the content passed as parameter and exposes the result in the default output stream.
@param mixed $source Source content to be transformed. | [
"This",
"method",
"transform",
"the",
"content",
"passed",
"as",
"parameter",
"and",
"exposes",
"the",
"result",
"in",
"the",
"default",
"output",
"stream",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/render/CNabuRenderTransformFactory.php#L54-L64 | train |
nabu-3/core | nabu/data/site/traits/TNabuSiteChild.php | TNabuSiteChild.getSite | public function getSite(CNabuCustomer $nb_customer = null, $force = false)
{
if ($nb_customer !== null && ($this->nb_site === null || $force)) {
$this->nb_site = null;
if ($this instanceof CNabuDataObject && $this->contains(NABU_SITE_FIELD_ID)) {
$this->nb_site = $nb_customer->getSite($this);
}
}
return $this->nb_site;
} | php | public function getSite(CNabuCustomer $nb_customer = null, $force = false)
{
if ($nb_customer !== null && ($this->nb_site === null || $force)) {
$this->nb_site = null;
if ($this instanceof CNabuDataObject && $this->contains(NABU_SITE_FIELD_ID)) {
$this->nb_site = $nb_customer->getSite($this);
}
}
return $this->nb_site;
} | [
"public",
"function",
"getSite",
"(",
"CNabuCustomer",
"$",
"nb_customer",
"=",
"null",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"nb_customer",
"!==",
"null",
"&&",
"(",
"$",
"this",
"->",
"nb_site",
"===",
"null",
"||",
"$",
"force",... | Gets the Site instance.
@param CNabuCustomer|null $nb_customer If you want to get the Site in safe mode, you need to pass this parameter
to grant the Customer that owns the Site where the Site Map is placed. In any other case, the Site could not be
retrieved.
@param bool $force If true, then tries to reload Site instance from their storage.
@return CNabuSite|null Returns the Site instance if setted or null if not. | [
"Gets",
"the",
"Site",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/traits/TNabuSiteChild.php#L52-L62 | train |
nabu-3/core | nabu/data/site/traits/TNabuSiteChild.php | TNabuSiteChild.setSite | public function setSite(CNabuSite $nb_site = null, $field = NABU_SITE_FIELD_ID)
{
$this->nb_site = $nb_site;
if ($this instanceof CNabuDataObject) {
$this->transferValue($nb_site, $field);
}
return $this;
} | php | public function setSite(CNabuSite $nb_site = null, $field = NABU_SITE_FIELD_ID)
{
$this->nb_site = $nb_site;
if ($this instanceof CNabuDataObject) {
$this->transferValue($nb_site, $field);
}
return $this;
} | [
"public",
"function",
"setSite",
"(",
"CNabuSite",
"$",
"nb_site",
"=",
"null",
",",
"$",
"field",
"=",
"NABU_SITE_FIELD_ID",
")",
"{",
"$",
"this",
"->",
"nb_site",
"=",
"$",
"nb_site",
";",
"if",
"(",
"$",
"this",
"instanceof",
"CNabuDataObject",
")",
... | Sets the Site instance that owns this object and sets the field containing the site id.
@param CNabuSite|null $nb_site Site instance to be setted.
@param string $field Field name where the site id will be stored.
@return CNabuDataObject Returns $this to allow the cascade chain of setters. | [
"Sets",
"the",
"Site",
"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/TNabuSiteChild.php#L70-L78 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.