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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
rips/php-connector-bundle | Services/ActivityService.php | ActivityService.getById | public function getById($activityId, array $queryParams = [])
{
$response = $this->api->activities()->getById($activityId, $queryParams);
return new ActivityResponse($response);
} | php | public function getById($activityId, array $queryParams = [])
{
$response = $this->api->activities()->getById($activityId, $queryParams);
return new ActivityResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"activityId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"activities",
"(",
")",
"->",
"getById",
"(",
"$",
"activityId",
",",
"$",
"quer... | Get activity by id
@param int $activityId
@param array $queryParams
@return ActivityResponse | [
"Get",
"activity",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/ActivityService.php#L45-L50 | train |
orchestral/lumen | src/Concerns/RegistersExceptionHandlers.php | RegistersExceptionHandlers.handleShutdown | protected function handleShutdown()
{
if (! \is_null($error = \error_get_last()) && $this->isFatalError($error['type'])) {
$this->handleUncaughtException(new FatalErrorException(
$error['message'], $error['type'], 0, $error['file'], $error['line']
));
}
} | php | protected function handleShutdown()
{
if (! \is_null($error = \error_get_last()) && $this->isFatalError($error['type'])) {
$this->handleUncaughtException(new FatalErrorException(
$error['message'], $error['type'], 0, $error['file'], $error['line']
));
}
} | [
"protected",
"function",
"handleShutdown",
"(",
")",
"{",
"if",
"(",
"!",
"\\",
"is_null",
"(",
"$",
"error",
"=",
"\\",
"error_get_last",
"(",
")",
")",
"&&",
"$",
"this",
"->",
"isFatalError",
"(",
"$",
"error",
"[",
"'type'",
"]",
")",
")",
"{",
... | Handle the application shutdown routine.
@return void | [
"Handle",
"the",
"application",
"shutdown",
"routine",
"."
] | 85a004e7cde0517b527241154f5ad031b7215851 | https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/src/Concerns/RegistersExceptionHandlers.php#L64-L71 | train |
orchestral/lumen | src/Concerns/RegistersExceptionHandlers.php | RegistersExceptionHandlers.isFatalError | protected function isFatalError($type)
{
$errorCodes = [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE];
if (\defined('FATAL_ERROR')) {
$errorCodes[] = FATAL_ERROR;
}
return \in_array($type, $errorCodes);
} | php | protected function isFatalError($type)
{
$errorCodes = [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE];
if (\defined('FATAL_ERROR')) {
$errorCodes[] = FATAL_ERROR;
}
return \in_array($type, $errorCodes);
} | [
"protected",
"function",
"isFatalError",
"(",
"$",
"type",
")",
"{",
"$",
"errorCodes",
"=",
"[",
"E_ERROR",
",",
"E_CORE_ERROR",
",",
"E_COMPILE_ERROR",
",",
"E_PARSE",
"]",
";",
"if",
"(",
"\\",
"defined",
"(",
"'FATAL_ERROR'",
")",
")",
"{",
"$",
"err... | Determine if the error type is fatal.
@param int $type
@return bool | [
"Determine",
"if",
"the",
"error",
"type",
"is",
"fatal",
"."
] | 85a004e7cde0517b527241154f5ad031b7215851 | https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/src/Concerns/RegistersExceptionHandlers.php#L80-L89 | train |
brtriver/dbup | src/Dbup/Util/Compiler.php | Compiler.addDbup | protected function addDbup(\Phar $phar)
{
$content = file_get_contents(__DIR__ . '/../../../dbup');
$content = preg_replace('{^#!/usr/bin/env php\s*}', '', $content);
$phar->addFromString('dbup', $content);
} | php | protected function addDbup(\Phar $phar)
{
$content = file_get_contents(__DIR__ . '/../../../dbup');
$content = preg_replace('{^#!/usr/bin/env php\s*}', '', $content);
$phar->addFromString('dbup', $content);
} | [
"protected",
"function",
"addDbup",
"(",
"\\",
"Phar",
"$",
"phar",
")",
"{",
"$",
"content",
"=",
"file_get_contents",
"(",
"__DIR__",
".",
"'/../../../dbup'",
")",
";",
"$",
"content",
"=",
"preg_replace",
"(",
"'{^#!/usr/bin/env php\\s*}'",
",",
"''",
",",
... | Remove the shebang from the file before add it to the PHAR file.
@param \Phar $phar PHAR instance | [
"Remove",
"the",
"shebang",
"from",
"the",
"file",
"before",
"add",
"it",
"to",
"the",
"PHAR",
"file",
"."
] | 8663e5342a096c739d70236a49bb981634023534 | https://github.com/brtriver/dbup/blob/8663e5342a096c739d70236a49bb981634023534/src/Dbup/Util/Compiler.php#L39-L45 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetSectionLanguageBase.php | CNabuSiteTargetSectionLanguageBase.setSiteTargetSectionId | public function setSiteTargetSectionId(int $nb_site_target_section_id) : CNabuDataObject
{
if ($nb_site_target_section_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_site_target_section_id")
);
}
$this->setValue('nb_site_target_section_id', $nb_site_target_section_id);
return $this;
} | php | public function setSiteTargetSectionId(int $nb_site_target_section_id) : CNabuDataObject
{
if ($nb_site_target_section_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_site_target_section_id")
);
}
$this->setValue('nb_site_target_section_id', $nb_site_target_section_id);
return $this;
} | [
"public",
"function",
"setSiteTargetSectionId",
"(",
"int",
"$",
"nb_site_target_section_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_site_target_section_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",... | Sets the Site Target Section Id attribute value.
@param int $nb_site_target_section_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"Section",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetSectionLanguageBase.php#L182-L193 | train |
nabu-3/core | nabu/data/project/base/CNabuProjectBase.php | CNabuProjectBase.refresh | public function refresh(bool $force = false, bool $cascade = false) : bool
{
return parent::refresh($force, $cascade) && $this->appendTranslatedRefresh($force);
} | php | public function refresh(bool $force = false, bool $cascade = false) : bool
{
return parent::refresh($force, $cascade) && $this->appendTranslatedRefresh($force);
} | [
"public",
"function",
"refresh",
"(",
"bool",
"$",
"force",
"=",
"false",
",",
"bool",
"$",
"cascade",
"=",
"false",
")",
":",
"bool",
"{",
"return",
"parent",
"::",
"refresh",
"(",
"$",
"force",
",",
"$",
"cascade",
")",
"&&",
"$",
"this",
"->",
"... | Overrides refresh method to add translations branch to refresh.
@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",
"add",
"translations",
"branch",
"to",
"refresh",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/project/base/CNabuProjectBase.php#L83-L86 | train |
nabu-3/core | nabu/data/project/base/CNabuProjectBase.php | CNabuProjectBase.getAllProjects | public static function getAllProjects(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_project_id',
'select * '
. 'from nb_project '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuProjectList();
}
return $retval;
} | php | public static function getAllProjects(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_project_id',
'select * '
. 'from nb_project '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuProjectList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllProjects",
"(",
"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_project_id' is the index, and each
value is an instance of class CNabuProjectBase.
@param CNabuCustomer $nb_customer The CNabuCustomer instance of the Customer that owns the Project List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_project_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuProjectBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/project/base/CNabuProjectBase.php#L155-L175 | train |
nabu-3/core | nabu/data/project/base/CNabuProjectBase.php | CNabuProjectBase.setCustomerId | public function setCustomerId(int $nb_customer_id) : CNabuDataObject
{
if ($nb_customer_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_customer_id")
);
}
$this->setValue('nb_customer_id', $nb_customer_id);
return $this;
} | php | public function setCustomerId(int $nb_customer_id) : CNabuDataObject
{
if ($nb_customer_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_customer_id")
);
}
$this->setValue('nb_customer_id', $nb_customer_id);
return $this;
} | [
"public",
"function",
"setCustomerId",
"(",
"int",
"$",
"nb_customer_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_customer_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWE... | Sets the Customer Id attribute value.
@param int $nb_customer_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Customer",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/project/base/CNabuProjectBase.php#L362-L373 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/Patch/ModificationHydrator.php | ModificationHydrator.hydrateCollection | public static function hydrateCollection(array $modifications)
{
$hydrated = [];
foreach ($modifications as $modification) {
$hydrated[] = self::hydrate($modification);
}
return $hydrated;
} | php | public static function hydrateCollection(array $modifications)
{
$hydrated = [];
foreach ($modifications as $modification) {
$hydrated[] = self::hydrate($modification);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"modifications",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"modifications",
"as",
"$",
"modification",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::... | Hydrate a collection of modification objects into a collection of
ModificationEntity objects
@param stdClass[] $modifications
@return ModificationEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"modification",
"objects",
"into",
"a",
"collection",
"of",
"ModificationEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/Patch/ModificationHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/Patch/ModificationHydrator.php | ModificationHydrator.hydrate | public static function hydrate(stdClass $modification)
{
$hydrated = new ModificationEntity();
if (isset($modification->id)) {
$hydrated->setId($modification->id);
}
if (isset($modification->virtual_line)) {
$hydrated->setVirtualLine($modification->virtual_line);
}
if (isset($modification->original_line)) {
$hydrated->setOriginalLine($modification->original_line);
}
if (isset($modification->column_start)) {
$hydrated->setColumnStart($modification->column_start);
}
if (isset($modification->column_end)) {
$hydrated->setColumnEnd($modification->column_end);
}
if (isset($modification->content)) {
$hydrated->setContent($modification->content);
}
if (isset($modification->highlighted_content)) {
$hydrated->setHighlightedContent($modification->highlighted_content);
}
if (isset($modification->original_content)) {
$hydrated->setOriginalContent($modification->original_content);
}
if (isset($modification->file)) {
$hydrated->setFile(FileHydrator::hydrate($modification->file));
}
return $hydrated;
} | php | public static function hydrate(stdClass $modification)
{
$hydrated = new ModificationEntity();
if (isset($modification->id)) {
$hydrated->setId($modification->id);
}
if (isset($modification->virtual_line)) {
$hydrated->setVirtualLine($modification->virtual_line);
}
if (isset($modification->original_line)) {
$hydrated->setOriginalLine($modification->original_line);
}
if (isset($modification->column_start)) {
$hydrated->setColumnStart($modification->column_start);
}
if (isset($modification->column_end)) {
$hydrated->setColumnEnd($modification->column_end);
}
if (isset($modification->content)) {
$hydrated->setContent($modification->content);
}
if (isset($modification->highlighted_content)) {
$hydrated->setHighlightedContent($modification->highlighted_content);
}
if (isset($modification->original_content)) {
$hydrated->setOriginalContent($modification->original_content);
}
if (isset($modification->file)) {
$hydrated->setFile(FileHydrator::hydrate($modification->file));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"modification",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ModificationEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"modification",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
... | Hydrate a modification object into a ModificationEntity object
@param stdClass $modification
@return ModificationEntity | [
"Hydrate",
"a",
"modification",
"object",
"into",
"a",
"ModificationEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/Patch/ModificationHydrator.php#L35-L76 | train |
orchestral/lumen | src/Routing/Controller.php | Controller.getMiddlewareForMethod | public function getMiddlewareForMethod($method)
{
$middleware = [];
foreach ($this->middleware as $name => $options) {
if (isset($options['only']) && ! \in_array($method, (array) $options['only'])) {
continue;
}
if (isset($options['except']) && \in_array($method, (array) $options['except'])) {
continue;
}
$middleware[] = $name;
}
return $middleware;
} | php | public function getMiddlewareForMethod($method)
{
$middleware = [];
foreach ($this->middleware as $name => $options) {
if (isset($options['only']) && ! \in_array($method, (array) $options['only'])) {
continue;
}
if (isset($options['except']) && \in_array($method, (array) $options['except'])) {
continue;
}
$middleware[] = $name;
}
return $middleware;
} | [
"public",
"function",
"getMiddlewareForMethod",
"(",
"$",
"method",
")",
"{",
"$",
"middleware",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"middleware",
"as",
"$",
"name",
"=>",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"op... | Get the middleware for a given method.
@param string $method
@return array | [
"Get",
"the",
"middleware",
"for",
"a",
"given",
"method",
"."
] | 85a004e7cde0517b527241154f5ad031b7215851 | https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/src/Routing/Controller.php#L36-L53 | train |
rips/php-connector-bundle | Hydrators/TeamHydrator.php | TeamHydrator.hydrateCollection | public static function hydrateCollection(array $teams)
{
$hydrated = [];
foreach ($teams as $team) {
$hydrated[] = self::hydrate($team);
}
return $hydrated;
} | php | public static function hydrateCollection(array $teams)
{
$hydrated = [];
foreach ($teams as $team) {
$hydrated[] = self::hydrate($team);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"teams",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"teams",
"as",
"$",
"team",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"(",
... | Hydrate a collection of team objects into a collection of
TeamEntity objects
@param stdClass[] $teams
@return TeamEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"team",
"objects",
"into",
"a",
"collection",
"of",
"TeamEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/TeamHydrator.php#L20-L29 | train |
rips/php-connector-bundle | Hydrators/TeamHydrator.php | TeamHydrator.hydrate | public static function hydrate(stdClass $team)
{
$hydrated = new TeamEntity();
if (isset($team->id)) {
$hydrated->setId($team->id);
}
if (isset($team->name)) {
$hydrated->setName($team->name);
}
if (isset($team->organization)) {
$hydrated->setOrganization(OrgHydrator::hydrate($team->organization));
}
if (isset($team->users) && is_array($team->users)) {
$hydrated->setUsers(UserHydrator::hydrateCollection($team->users));
}
if (isset($team->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($team->created_by));
}
if (isset($team->created_at)) {
$hydrated->setCreatedAt(new DateTime($team->created_at));
}
return $hydrated;
} | php | public static function hydrate(stdClass $team)
{
$hydrated = new TeamEntity();
if (isset($team->id)) {
$hydrated->setId($team->id);
}
if (isset($team->name)) {
$hydrated->setName($team->name);
}
if (isset($team->organization)) {
$hydrated->setOrganization(OrgHydrator::hydrate($team->organization));
}
if (isset($team->users) && is_array($team->users)) {
$hydrated->setUsers(UserHydrator::hydrateCollection($team->users));
}
if (isset($team->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($team->created_by));
}
if (isset($team->created_at)) {
$hydrated->setCreatedAt(new DateTime($team->created_at));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"team",
")",
"{",
"$",
"hydrated",
"=",
"new",
"TeamEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"team",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
"$",
... | Hydrate a team object into a TeamEntity object
@param stdClass $team
@return TeamEntity | [
"Hydrate",
"a",
"team",
"object",
"into",
"a",
"TeamEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/TeamHydrator.php#L37-L66 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductLanguageBase.php | CNabuCommerceProductLanguageBase.setCommerceProductId | public function setCommerceProductId(int $nb_commerce_product_id) : CNabuDataObject
{
if ($nb_commerce_product_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_commerce_product_id")
);
}
$this->setValue('nb_commerce_product_id', $nb_commerce_product_id);
return $this;
} | php | public function setCommerceProductId(int $nb_commerce_product_id) : CNabuDataObject
{
if ($nb_commerce_product_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_commerce_product_id")
);
}
$this->setValue('nb_commerce_product_id', $nb_commerce_product_id);
return $this;
} | [
"public",
"function",
"setCommerceProductId",
"(",
"int",
"$",
"nb_commerce_product_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_commerce_product_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERRO... | Sets the Commerce Product Id attribute value.
@param int $nb_commerce_product_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Commerce",
"Product",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductLanguageBase.php#L182-L193 | train |
nabu-3/core | nabu/data/icontact/base/CNabuIContactProspectStatusTypeBase.php | CNabuIContactProspectStatusTypeBase.getLanguages | public function getLanguages($force = false)
{
if (!CNabuEngine::getEngine()->isOperationModeStandalone() &&
($this->languages_list->getSize() === 0 || $force)
) {
$this->languages_list = CNabuIContactProspectStatusTypeLanguage::getLanguagesForTranslatedObject($this);
}
return $this->languages_list;
} | php | public function getLanguages($force = false)
{
if (!CNabuEngine::getEngine()->isOperationModeStandalone() &&
($this->languages_list->getSize() === 0 || $force)
) {
$this->languages_list = CNabuIContactProspectStatusTypeLanguage::getLanguagesForTranslatedObject($this);
}
return $this->languages_list;
} | [
"public",
"function",
"getLanguages",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"CNabuEngine",
"::",
"getEngine",
"(",
")",
"->",
"isOperationModeStandalone",
"(",
")",
"&&",
"(",
"$",
"this",
"->",
"languages_list",
"->",
"getSize",
"(",
... | Get all language instances corresponding to available translations.
@param bool $force If true force to reload languages list from storage.
@return null|array Return an array of \nabu\data\lang\CNabuLanguage instances if they have translations or null
if not. | [
"Get",
"all",
"language",
"instances",
"corresponding",
"to",
"available",
"translations",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/base/CNabuIContactProspectStatusTypeBase.php#L229-L238 | train |
nabu-3/core | nabu/data/icontact/base/CNabuIContactProspectStatusTypeBase.php | CNabuIContactProspectStatusTypeBase.getTranslations | public function getTranslations($force = false)
{
if (!CNabuEngine::getEngine()->isOperationModeStandalone() &&
($this->translations_list->getSize() === 0 || $force)
) {
$this->translations_list = CNabuIContactProspectStatusTypeLanguage::getTranslationsForTranslatedObject($this);
}
return $this->translations_list;
} | php | public function getTranslations($force = false)
{
if (!CNabuEngine::getEngine()->isOperationModeStandalone() &&
($this->translations_list->getSize() === 0 || $force)
) {
$this->translations_list = CNabuIContactProspectStatusTypeLanguage::getTranslationsForTranslatedObject($this);
}
return $this->translations_list;
} | [
"public",
"function",
"getTranslations",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"CNabuEngine",
"::",
"getEngine",
"(",
")",
"->",
"isOperationModeStandalone",
"(",
")",
"&&",
"(",
"$",
"this",
"->",
"translations_list",
"->",
"getSize",
... | Gets available translation instances.
@param bool $force If true force to reload translations list from storage.
@return null|array Return an array of \nabu\data\icontact\CNabuIContactProspectStatusTypeLanguage instances if
they have translations or null if not. | [
"Gets",
"available",
"translation",
"instances",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/base/CNabuIContactProspectStatusTypeBase.php#L246-L255 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.refresh | public function refresh(bool $force = false, bool $cascade = false) : bool
{
if (($retval = parent::refresh($force, $cascade))===true && $cascade) {
$this->getMediotecas($force);
$this->getSites($force);
$this->getCommerces($force);
$this->getCatalogs($force);
$this->getMessagings($force);
$this->getProjects($force);
$this->getRoles($force);
}
return $retval;
} | php | public function refresh(bool $force = false, bool $cascade = false) : bool
{
if (($retval = parent::refresh($force, $cascade))===true && $cascade) {
$this->getMediotecas($force);
$this->getSites($force);
$this->getCommerces($force);
$this->getCatalogs($force);
$this->getMessagings($force);
$this->getProjects($force);
$this->getRoles($force);
}
return $retval;
} | [
"public",
"function",
"refresh",
"(",
"bool",
"$",
"force",
"=",
"false",
",",
"bool",
"$",
"cascade",
"=",
"false",
")",
":",
"bool",
"{",
"if",
"(",
"(",
"$",
"retval",
"=",
"parent",
"::",
"refresh",
"(",
"$",
"force",
",",
"$",
"cascade",
")",
... | Overrides refresh method to add Customer 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",
"add",
"Customer",
"subentities",
"to",
"be",
"refreshed",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L158-L171 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getMediotecas | public function getMediotecas($force = false)
{
if ($this->nb_medioteca_list->isEmpty() || $force) {
$this->nb_medioteca_list->clear();
$this->nb_medioteca_list->merge(CNabuMedioteca::getAllMediotecas($this));
}
return $this->nb_medioteca_list->getItems();
} | php | public function getMediotecas($force = false)
{
if ($this->nb_medioteca_list->isEmpty() || $force) {
$this->nb_medioteca_list->clear();
$this->nb_medioteca_list->merge(CNabuMedioteca::getAllMediotecas($this));
}
return $this->nb_medioteca_list->getItems();
} | [
"public",
"function",
"getMediotecas",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_medioteca_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_medioteca_list",
"->",
"clear",
"(",
")... | Gets available Medioteca instances in the list.
@param bool $force If true, forces to merge complete list form the storage.
@return array Returns an associative array where the index is the ID of each Medioteca and the value
is the instance. | [
"Gets",
"available",
"Medioteca",
"instances",
"in",
"the",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L219-L227 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getMedioteca | public function getMedioteca($nb_medioteca)
{
$retval = false;
if (is_object($nb_medioteca) && !($nb_medioteca instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_medioteca', get_class($nb_medioteca))
);
}
if ($nb_medioteca !== null) {
$nb_medioteca_id = nb_getMixedValue($nb_medioteca, NABU_MEDIOTECA_FIELD_ID);
if (is_numeric($nb_medioteca_id) || nb_isValidGUID($nb_medioteca_id)) {
$retval = $this->nb_medioteca_list->getItem($nb_medioteca_id);
} elseif ($nb_medioteca_id !== null && $nb_medioteca_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_medioteca', print_r($nb_medioteca, true))
);
}
}
return $retval;
} | php | public function getMedioteca($nb_medioteca)
{
$retval = false;
if (is_object($nb_medioteca) && !($nb_medioteca instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_medioteca', get_class($nb_medioteca))
);
}
if ($nb_medioteca !== null) {
$nb_medioteca_id = nb_getMixedValue($nb_medioteca, NABU_MEDIOTECA_FIELD_ID);
if (is_numeric($nb_medioteca_id) || nb_isValidGUID($nb_medioteca_id)) {
$retval = $this->nb_medioteca_list->getItem($nb_medioteca_id);
} elseif ($nb_medioteca_id !== null && $nb_medioteca_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_medioteca', print_r($nb_medioteca, true))
);
}
}
return $retval;
} | [
"public",
"function",
"getMedioteca",
"(",
"$",
"nb_medioteca",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_object",
"(",
"$",
"nb_medioteca",
")",
"&&",
"!",
"(",
"$",
"nb_medioteca",
"instanceof",
"CNabuDataObject",
")",
")",
"{",
"throw",... | Gets a Medioteca by their ID.
If the internal Medioteca List contains a instance with same ID returns this instance, else if not exists,
tries to locate it in the storage and, if exists, then load it, add into Medioteca List and returns their
instance as result.
@param mixed $nb_medioteca A CNabuDataObject instance containing a nb_medioteca_id field or an ID.
@return CNabuMedioteca Returns the Medioteca instance if exists or false if not.
@throws ENabuCoreException Raises an exception if $nb_medioteca has no valid value. | [
"Gets",
"a",
"Medioteca",
"by",
"their",
"ID",
".",
"If",
"the",
"internal",
"Medioteca",
"List",
"contains",
"a",
"instance",
"with",
"same",
"ID",
"returns",
"this",
"instance",
"else",
"if",
"not",
"exists",
"tries",
"to",
"locate",
"it",
"in",
"the",
... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L247-L271 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getMediotecaByKey | public function getMediotecaByKey(string $key)
{
if (strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
}
return $this->nb_medioteca_list->getItem($key, CNabuMediotecaList::INDEX_KEY);
} | php | public function getMediotecaByKey(string $key)
{
if (strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
}
return $this->nb_medioteca_list->getItem($key, CNabuMediotecaList::INDEX_KEY);
} | [
"public",
"function",
"getMediotecaByKey",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"key",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_UNEXPECTED_PARAM_VALUE",
",",
"array"... | Gets a Medioteca instance using their key.
@param string $key Key of the Medioteca to be retrieved.
@return CNabuMedioteca Returns a Medioteca instance if exists or false if not. | [
"Gets",
"a",
"Medioteca",
"instance",
"using",
"their",
"key",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L278-L288 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getSite | public function getSite($nb_site)
{
$retval = false;
if (is_object($nb_site) && !($nb_site instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_site', get_class($nb_site))
);
}
if ($nb_site !== null) {
$nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID);
if (is_numeric($nb_site_id) || nb_isValidGUID($nb_site_id)) {
$retval = $this->nb_site_list->getItem($nb_site_id);
if ($retval instanceof CNabuSite) {
if (!$retval->validateCustomer($this)) {
$this->nb_site_list->removeItem($retval);
$retval = false;
} else {
$retval->setCustomer($this);
}
}
} elseif ($nb_site_id !== null && $nb_site_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_site', print_r($nb_site, true))
);
}
}
return $retval;
} | php | public function getSite($nb_site)
{
$retval = false;
if (is_object($nb_site) && !($nb_site instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_site', get_class($nb_site))
);
}
if ($nb_site !== null) {
$nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID);
if (is_numeric($nb_site_id) || nb_isValidGUID($nb_site_id)) {
$retval = $this->nb_site_list->getItem($nb_site_id);
if ($retval instanceof CNabuSite) {
if (!$retval->validateCustomer($this)) {
$this->nb_site_list->removeItem($retval);
$retval = false;
} else {
$retval->setCustomer($this);
}
}
} elseif ($nb_site_id !== null && $nb_site_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_site', print_r($nb_site, true))
);
}
}
return $retval;
} | [
"public",
"function",
"getSite",
"(",
"$",
"nb_site",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_object",
"(",
"$",
"nb_site",
")",
"&&",
"!",
"(",
"$",
"nb_site",
"instanceof",
"CNabuDataObject",
")",
")",
"{",
"throw",
"new",
"ENabuCo... | Gets a Site by their ID.
If the internal Site List contains a instance with same ID returns this instance, else if not exists,
tries to locate it in the storage and, if exists, then load it, add into Site List and returns their
instance as result.
@param mixed $nb_site A CNabuDataObject instance containing a nb_site_id field or an ID.
@return CNabuSite Returns the Site instance if exists or false if not.
@throws ENabuCoreException Raises an exception if $nb_site has no valid value. | [
"Gets",
"a",
"Site",
"by",
"their",
"ID",
".",
"If",
"the",
"internal",
"Site",
"List",
"contains",
"a",
"instance",
"with",
"same",
"ID",
"returns",
"this",
"instance",
"else",
"if",
"not",
"exists",
"tries",
"to",
"locate",
"it",
"in",
"the",
"storage"... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L307-L339 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getSiteByKey | public function getSiteByKey(string $key)
{
$retval = false;
if (strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
}
$nb_site = $this->nb_site_list->getItem($key, CNabuSiteList::INDEX_KEY);
if ($nb_site instanceof CNabuSite) {
$nb_site->setCustomer($this);
$retval = $nb_site;
}
return $retval;
} | php | public function getSiteByKey(string $key)
{
$retval = false;
if (strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
}
$nb_site = $this->nb_site_list->getItem($key, CNabuSiteList::INDEX_KEY);
if ($nb_site instanceof CNabuSite) {
$nb_site->setCustomer($this);
$retval = $nb_site;
}
return $retval;
} | [
"public",
"function",
"getSiteByKey",
"(",
"string",
"$",
"key",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"strlen",
"(",
"$",
"key",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_UN... | Gets a Site instance using their key.
@param string $key Key of the Site to be retrieved.
@return CNabuSite|bool Returns a Site instance if exists or false if not. | [
"Gets",
"a",
"Site",
"instance",
"using",
"their",
"key",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L346-L365 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getSiteByAlias | public function getSiteByAlias(string $alias)
{
$retval = false;
if (!is_string($alias) || strlen($alias) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$alias', print_r($alias, true))
);
}
$nb_site = CNabuSite::findByAlias($alias);
if ($nb_site instanceof CNabuSite && $nb_site->validateCustomer($this)) {
if (!$this->nb_site_list->containsKey($nb_site->getId())) {
$this->nb_site_list->addItem($nb_site);
}
$retval = $nb_site;
}
return $retval;
} | php | public function getSiteByAlias(string $alias)
{
$retval = false;
if (!is_string($alias) || strlen($alias) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$alias', print_r($alias, true))
);
}
$nb_site = CNabuSite::findByAlias($alias);
if ($nb_site instanceof CNabuSite && $nb_site->validateCustomer($this)) {
if (!$this->nb_site_list->containsKey($nb_site->getId())) {
$this->nb_site_list->addItem($nb_site);
}
$retval = $nb_site;
}
return $retval;
} | [
"public",
"function",
"getSiteByAlias",
"(",
"string",
"$",
"alias",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"alias",
")",
"||",
"strlen",
"(",
"$",
"alias",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"ENa... | Gets a Site instance using a possible alias.
@param string $alias The full Alias host name to looking for.
@return CNabuSite|bool Returns a Site instance if exists or false if not. | [
"Gets",
"a",
"Site",
"instance",
"using",
"a",
"possible",
"alias",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L372-L392 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getSites | public function getSites($force = false)
{
if ($force) {
$this->nb_site_list->clear();
$this->nb_site_list->merge(CNabuSite::getAllSites($this));
}
return $this->nb_site_list->getItems();
} | php | public function getSites($force = false)
{
if ($force) {
$this->nb_site_list->clear();
$this->nb_site_list->merge(CNabuSite::getAllSites($this));
}
return $this->nb_site_list->getItems();
} | [
"public",
"function",
"getSites",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_site_list",
"->",
"clear",
"(",
")",
";",
"$",
"this",
"->",
"nb_site_list",
"->",
"merge",
"(",
"CNabuSite",
"::",... | Gets available Site instances in the list.
@param bool $force If true, forces to merge complete list from the storage.
@return array Returns an associative array where the index is the ID of each Site and the value is the instance. | [
"Gets",
"available",
"Site",
"instances",
"in",
"the",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L399-L407 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getCommerces | public function getCommerces($force = false)
{
if ($this->nb_commerce_list->isEmpty() || $force) {
$this->nb_commerce_list->clear();
$this->nb_commerce_list->merge(CNabuCommerce::getAllCommerces($this));
}
return $this->nb_commerce_list->getItems();
} | php | public function getCommerces($force = false)
{
if ($this->nb_commerce_list->isEmpty() || $force) {
$this->nb_commerce_list->clear();
$this->nb_commerce_list->merge(CNabuCommerce::getAllCommerces($this));
}
return $this->nb_commerce_list->getItems();
} | [
"public",
"function",
"getCommerces",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_commerce_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_commerce_list",
"->",
"clear",
"(",
")",
... | Gets available Commerce instances in the list.
@param bool $force If true, forces to merge complete list from the storage.
@return array Returns an associative array where the index is the ID of each Commerce and the value
is the instance. | [
"Gets",
"available",
"Commerce",
"instances",
"in",
"the",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L443-L451 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getCommerce | public function getCommerce($nb_commerce)
{
$retval = false;
if (is_object($nb_commerce) && !($nb_commerce instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_commerce', get_class($nb_commerce))
);
}
if ($nb_commerce !== null) {
$nb_commerce_id = nb_getMixedValue($nb_commerce, NABU_COMMERCE_FIELD_ID);
if (is_numeric($nb_commerce_id) || nb_isValidGUID($nb_commerce_id)) {
$retval = $this->nb_commerce_list->getItem($nb_commerce_id);
} elseif ($nb_commerce_id !== null && $nb_commerce_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_commerce', print_r($nb_commerce, true))
);
}
}
return $retval;
} | php | public function getCommerce($nb_commerce)
{
$retval = false;
if (is_object($nb_commerce) && !($nb_commerce instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_commerce', get_class($nb_commerce))
);
}
if ($nb_commerce !== null) {
$nb_commerce_id = nb_getMixedValue($nb_commerce, NABU_COMMERCE_FIELD_ID);
if (is_numeric($nb_commerce_id) || nb_isValidGUID($nb_commerce_id)) {
$retval = $this->nb_commerce_list->getItem($nb_commerce_id);
} elseif ($nb_commerce_id !== null && $nb_commerce_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_commerce', print_r($nb_commerce, true))
);
}
}
return $retval;
} | [
"public",
"function",
"getCommerce",
"(",
"$",
"nb_commerce",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_object",
"(",
"$",
"nb_commerce",
")",
"&&",
"!",
"(",
"$",
"nb_commerce",
"instanceof",
"CNabuDataObject",
")",
")",
"{",
"throw",
"... | Gets a Commerce by their ID.
If the internal Commerce List contains a instance with same ID returns this instance, else if not exists,
tries to locate it in the storage and, if exists, then load it, add into Commerce List and returns their
instance as result.
@param mixed $nb_commerce A CNabuDataObject instance containing a nb_commerce_id field or an ID.
@return CNabuCommerce Returns the Commerce instance if exists or false if not.
@throws ENabuCoreException Raises an exception if $nb_commerce has no valid value. | [
"Gets",
"a",
"Commerce",
"by",
"their",
"ID",
".",
"If",
"the",
"internal",
"Commerce",
"List",
"contains",
"a",
"instance",
"with",
"same",
"ID",
"returns",
"this",
"instance",
"else",
"if",
"not",
"exists",
"tries",
"to",
"locate",
"it",
"in",
"the",
"... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L471-L495 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getCatalog | public function getCatalog($nb_catalog)
{
$retval = false;
if (is_object($nb_catalog) && !($nb_catalog instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_catalog', get_class($nb_catalog))
);
}
if ($nb_catalog !== null) {
$nb_catalog_id = nb_getMixedValue($nb_catalog, NABU_CATALOG_FIELD_ID);
if (is_numeric($nb_catalog_id) || nb_isValidGUID($nb_catalog_id)) {
$retval = $this->nb_catalog_list->getItem($nb_catalog_id);
} elseif ($nb_catalog_id !== null && $nb_catalog_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_catalog', print_r($nb_catalog, true))
);
}
}
return $retval;
} | php | public function getCatalog($nb_catalog)
{
$retval = false;
if (is_object($nb_catalog) && !($nb_catalog instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_catalog', get_class($nb_catalog))
);
}
if ($nb_catalog !== null) {
$nb_catalog_id = nb_getMixedValue($nb_catalog, NABU_CATALOG_FIELD_ID);
if (is_numeric($nb_catalog_id) || nb_isValidGUID($nb_catalog_id)) {
$retval = $this->nb_catalog_list->getItem($nb_catalog_id);
} elseif ($nb_catalog_id !== null && $nb_catalog_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_catalog', print_r($nb_catalog, true))
);
}
}
return $retval;
} | [
"public",
"function",
"getCatalog",
"(",
"$",
"nb_catalog",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_object",
"(",
"$",
"nb_catalog",
")",
"&&",
"!",
"(",
"$",
"nb_catalog",
"instanceof",
"CNabuDataObject",
")",
")",
"{",
"throw",
"new"... | Gets a Catalog by their ID.
If the internal Catalog List contains a instance with same ID returns this instance, else if not exists,
tries to locate it in the storage and, if exits, the load it, add into Catalog List and returns their
instance as result.
@param mixed $nb_catalog A CNabuDataObject instance containing a nb_catalog_id field or an ID.
@return CNabuCatalog Returns the Catalog instance if exists or false if not.
@throws ENabuCoreException Raises an exception if $nb_catalog has no valid value. | [
"Gets",
"a",
"Catalog",
"by",
"their",
"ID",
".",
"If",
"the",
"internal",
"Catalog",
"List",
"contains",
"a",
"instance",
"with",
"same",
"ID",
"returns",
"this",
"instance",
"else",
"if",
"not",
"exists",
"tries",
"to",
"locate",
"it",
"in",
"the",
"st... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L515-L539 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getCatalogByKey | public function getCatalogByKey($key)
{
if (!is_string($key) || strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
}
return $this->nb_catalog_list->getItem($key, CNabuCatalogList::INDEX_KEY);
} | php | public function getCatalogByKey($key)
{
if (!is_string($key) || strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
}
return $this->nb_catalog_list->getItem($key, CNabuCatalogList::INDEX_KEY);
} | [
"public",
"function",
"getCatalogByKey",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"key",
")",
"||",
"strlen",
"(",
"$",
"key",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"E... | Gets a Catalog instance using their key.
@param string $key Key of the Catalog to be retrieved.
@return CNabuCatalog|false Returns a Catalog instance if exists or false if not. | [
"Gets",
"a",
"Catalog",
"instance",
"using",
"their",
"key",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L546-L556 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getCatalogBySlug | public function getCatalogBySlug($slug, $nb_language = null)
{
if (!is_string($slug) || strlen($slug) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$slug', print_r($slug, true))
);
}
$nb_final_catalog = null;
$nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);
$this->nb_catalog_list->iterate(
function ($key, CNabuCatalog $nb_catalog)
use ($slug, &$nb_final_catalog, $nb_language_id)
{
if (is_numeric($nb_language_id)) {
$nb_translation = $nb_catalog->getTranslation($nb_language_id);
if ($nb_translation instanceof CNabuCatalogLanguage &&
$nb_translation->getSlug() === $slug
) {
$nb_final_catalog = $nb_catalog;
}
} else {
$nb_catalog->getTranslations(true)->iterate(
function ($key, CNabuCatalogLanguage $nb_catalog_language)
use ($slug, $nb_catalog, &$nb_final_catalog)
{
if ($nb_catalog_language->getSlug() === $slug) {
$nb_final_catalog = $nb_catalog;
}
return ($nb_final_catalog === null);
}
);
}
return ($nb_final_catalog === null);
}
);
return ($nb_final_catalog === null ? false : $nb_final_catalog);
} | php | public function getCatalogBySlug($slug, $nb_language = null)
{
if (!is_string($slug) || strlen($slug) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$slug', print_r($slug, true))
);
}
$nb_final_catalog = null;
$nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);
$this->nb_catalog_list->iterate(
function ($key, CNabuCatalog $nb_catalog)
use ($slug, &$nb_final_catalog, $nb_language_id)
{
if (is_numeric($nb_language_id)) {
$nb_translation = $nb_catalog->getTranslation($nb_language_id);
if ($nb_translation instanceof CNabuCatalogLanguage &&
$nb_translation->getSlug() === $slug
) {
$nb_final_catalog = $nb_catalog;
}
} else {
$nb_catalog->getTranslations(true)->iterate(
function ($key, CNabuCatalogLanguage $nb_catalog_language)
use ($slug, $nb_catalog, &$nb_final_catalog)
{
if ($nb_catalog_language->getSlug() === $slug) {
$nb_final_catalog = $nb_catalog;
}
return ($nb_final_catalog === null);
}
);
}
return ($nb_final_catalog === null);
}
);
return ($nb_final_catalog === null ? false : $nb_final_catalog);
} | [
"public",
"function",
"getCatalogBySlug",
"(",
"$",
"slug",
",",
"$",
"nb_language",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"slug",
")",
"||",
"strlen",
"(",
"$",
"slug",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"ENabuCoreExc... | Gets a Catalog instance using their slug.
@param string $slug Slug of the Catalog to be retrieved.
@param mixed $nb_language A CNabuDataObject containing a field named nb_language_id or an ID.
@return CNabuCatalog|false Returns a Catalog instance if exists or false if not. | [
"Gets",
"a",
"Catalog",
"instance",
"using",
"their",
"slug",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L564-L604 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getCatalogs | public function getCatalogs($force = false)
{
if ($this->nb_catalog_list->isEmpty() || $force) {
$this->nb_catalog_list->clear();
$this->nb_catalog_list->merge(CNabuCatalog::getAllCatalogs($this));
}
return $this->nb_catalog_list->getItems();
} | php | public function getCatalogs($force = false)
{
if ($this->nb_catalog_list->isEmpty() || $force) {
$this->nb_catalog_list->clear();
$this->nb_catalog_list->merge(CNabuCatalog::getAllCatalogs($this));
}
return $this->nb_catalog_list->getItems();
} | [
"public",
"function",
"getCatalogs",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_catalog_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_catalog_list",
"->",
"clear",
"(",
")",
"... | Gets available Catalog instances in the list.
@param bool $force If true, fordes to merge complete list from the storage.
@return array Returns an associative array where the index is the ID of each Catalog and the value
is the instance. | [
"Gets",
"available",
"Catalog",
"instances",
"in",
"the",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L612-L620 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getMessagings | public function getMessagings($force = false)
{
if ($this->nb_messaging_list->isEmpty() || $force) {
$this->nb_messaging_list->clear();
$this->nb_messaging_list->merge(CNabuMessaging::getAllMessagings($this));
}
return $this->nb_messaging_list->getItems();
} | php | public function getMessagings($force = false)
{
if ($this->nb_messaging_list->isEmpty() || $force) {
$this->nb_messaging_list->clear();
$this->nb_messaging_list->merge(CNabuMessaging::getAllMessagings($this));
}
return $this->nb_messaging_list->getItems();
} | [
"public",
"function",
"getMessagings",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_messaging_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_messaging_list",
"->",
"clear",
"(",
")... | Gets available Messaging instances in the list.
@param bool $force If true, foces to merge complete list from the storage.
@return array Returns an associative array where the index is the ID of each Catalog and the value
is the instance. | [
"Gets",
"available",
"Messaging",
"instances",
"in",
"the",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L646-L654 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getMessaging | public function getMessaging($nb_messaging)
{
$retval = false;
if (is_object($nb_messaging) && !($nb_messaging instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_messaging', get_class($nb_messaging))
);
}
if ($nb_messaging !== null) {
$nb_messaging_id = nb_getMixedValue($nb_messaging, NABU_MESSAGING_FIELD_ID);
if (is_numeric($nb_messaging_id) || nb_isValidGUID($nb_messaging_id)) {
$retval = $this->nb_messaging_list->getItem($nb_messaging_id);
} elseif ($nb_messaging_id !== null && $nb_messaging_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_messaging', print_r($nb_messaging, true))
);
}
}
return $retval;
} | php | public function getMessaging($nb_messaging)
{
$retval = false;
if (is_object($nb_messaging) && !($nb_messaging instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_messaging', get_class($nb_messaging))
);
}
if ($nb_messaging !== null) {
$nb_messaging_id = nb_getMixedValue($nb_messaging, NABU_MESSAGING_FIELD_ID);
if (is_numeric($nb_messaging_id) || nb_isValidGUID($nb_messaging_id)) {
$retval = $this->nb_messaging_list->getItem($nb_messaging_id);
} elseif ($nb_messaging_id !== null && $nb_messaging_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_messaging', print_r($nb_messaging, true))
);
}
}
return $retval;
} | [
"public",
"function",
"getMessaging",
"(",
"$",
"nb_messaging",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_object",
"(",
"$",
"nb_messaging",
")",
"&&",
"!",
"(",
"$",
"nb_messaging",
"instanceof",
"CNabuDataObject",
")",
")",
"{",
"throw",... | Gets a Messaging by their ID.
If the internal Messaging List contains a instance with same ID returns this instance, else if not exists,
tries to locate it in the storage and, if exits, the load it, add into Messaging List and returns their
instance as result.
@param mixed $nb_messaging A CNabuDataObject instance containing a nb_messaging_id field or an ID.
@return CNabuMessaging Returns the Messaging instance if exists or false if not.
@throws ENabuCoreException Raises an exception if $nb_messaging has no valid value. | [
"Gets",
"a",
"Messaging",
"by",
"their",
"ID",
".",
"If",
"the",
"internal",
"Messaging",
"List",
"contains",
"a",
"instance",
"with",
"same",
"ID",
"returns",
"this",
"instance",
"else",
"if",
"not",
"exists",
"tries",
"to",
"locate",
"it",
"in",
"the",
... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L674-L698 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getProjects | public function getProjects($force = false)
{
if ($this->nb_project_list === null) {
$this->nb_project_list = new CNabuProjectList($this);
}
if ($force) {
$this->nb_role_list->clear();
$this->nb_project_list->merge(CNabuProject::getAllProjects($this));
}
return $this->nb_project_list->getItems();
} | php | public function getProjects($force = false)
{
if ($this->nb_project_list === null) {
$this->nb_project_list = new CNabuProjectList($this);
}
if ($force) {
$this->nb_role_list->clear();
$this->nb_project_list->merge(CNabuProject::getAllProjects($this));
}
return $this->nb_project_list->getItems();
} | [
"public",
"function",
"getProjects",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_project_list",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"nb_project_list",
"=",
"new",
"CNabuProjectList",
"(",
"$",
"this",
")",
";",
... | Gets available Project instances in the list.
@param bool $force If true, foces to merge complete list from the storage.
@return array Returns an associative array where the index is the ID of each Catalog and the value
is the instance. | [
"Gets",
"available",
"Project",
"instances",
"in",
"the",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L715-L727 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getProject | public function getProject($nb_project)
{
$retval = false;
if (is_object($nb_project) && !($nb_project instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_project', get_class($nb_project))
);
}
if ($nb_project !== null) {
$nb_project_id = nb_getMixedValue($nb_project, NABU_PROJECT_FIELD_ID);
if (is_numeric($nb_project_id) || nb_isValidGUID($nb_project_id)) {
$retval = $this->nb_project_list->getItem($nb_project_id);
} elseif ($nb_project_id !== null && $nb_project_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_project', print_r($nb_project, true))
);
}
}
return $retval;
} | php | public function getProject($nb_project)
{
$retval = false;
if (is_object($nb_project) && !($nb_project instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_project', get_class($nb_project))
);
}
if ($nb_project !== null) {
$nb_project_id = nb_getMixedValue($nb_project, NABU_PROJECT_FIELD_ID);
if (is_numeric($nb_project_id) || nb_isValidGUID($nb_project_id)) {
$retval = $this->nb_project_list->getItem($nb_project_id);
} elseif ($nb_project_id !== null && $nb_project_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$nb_project', print_r($nb_project, true))
);
}
}
return $retval;
} | [
"public",
"function",
"getProject",
"(",
"$",
"nb_project",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_object",
"(",
"$",
"nb_project",
")",
"&&",
"!",
"(",
"$",
"nb_project",
"instanceof",
"CNabuDataObject",
")",
")",
"{",
"throw",
"new"... | Gets a Project by their ID.
If the internal Project List contains a instance with same ID returns this instance, else if not exists,
tries to locate it in the storage and, if exits, the load it, add into Project List and returns their
instance as result.
@param mixed $nb_project A CNabuDataObject instance containing a nb_project_id field or an ID.
@return CNabuProject Returns the Project instance if exists or false if not.
@throws ENabuCoreException Raises an exception if $nb_project has no valid value. | [
"Gets",
"a",
"Project",
"by",
"their",
"ID",
".",
"If",
"the",
"internal",
"Project",
"List",
"contains",
"a",
"instance",
"with",
"same",
"ID",
"returns",
"this",
"instance",
"else",
"if",
"not",
"exists",
"tries",
"to",
"locate",
"it",
"in",
"the",
"st... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L747-L771 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getUser | public function getUser($nb_user)
{
$retval = null;
$nb_user_id = nb_getMixedValue($nb_user, NABU_USER_FIELD_ID);
if (is_numeric($nb_user_id)) {
$nb_new_user = new CNabuUser($nb_user_id);
if ($nb_new_user->isFetched() && $nb_new_user->validateCustomer($this)) {
$nb_new_user->setCustomer($this);
$retval = $nb_new_user;
}
}
return $retval;
} | php | public function getUser($nb_user)
{
$retval = null;
$nb_user_id = nb_getMixedValue($nb_user, NABU_USER_FIELD_ID);
if (is_numeric($nb_user_id)) {
$nb_new_user = new CNabuUser($nb_user_id);
if ($nb_new_user->isFetched() && $nb_new_user->validateCustomer($this)) {
$nb_new_user->setCustomer($this);
$retval = $nb_new_user;
}
}
return $retval;
} | [
"public",
"function",
"getUser",
"(",
"$",
"nb_user",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"$",
"nb_user_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_user",
",",
"NABU_USER_FIELD_ID",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_user_id",
")",
"... | Gets a User instance owned by this Customer.
@param mixed $nb_user A CNabuDataObject containing a nb_user_id field or an ID.
@return CNabuUser|null Returns the required User instance if exists or null if not. | [
"Gets",
"a",
"User",
"instance",
"owned",
"by",
"this",
"Customer",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L786-L800 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getUserByLogin | public function getUserByLogin(string $login)
{
$retval = null;
if (strlen($login) > 0) {
$nb_user = CNabuUser::findByLogin($this, $login);
if ($nb_user instanceof CNabuUser && $nb_user->validateCustomer($this)) {
$nb_user->setCustomer($this);
$retval = $nb_user;
}
}
return $retval;
} | php | public function getUserByLogin(string $login)
{
$retval = null;
if (strlen($login) > 0) {
$nb_user = CNabuUser::findByLogin($this, $login);
if ($nb_user instanceof CNabuUser && $nb_user->validateCustomer($this)) {
$nb_user->setCustomer($this);
$retval = $nb_user;
}
}
return $retval;
} | [
"public",
"function",
"getUserByLogin",
"(",
"string",
"$",
"login",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"if",
"(",
"strlen",
"(",
"$",
"login",
")",
">",
"0",
")",
"{",
"$",
"nb_user",
"=",
"CNabuUser",
"::",
"findByLogin",
"(",
"$",
"this",
... | Get a User instance owned by this Customer and identified by his login attribute.
@param string $login A login string to looking for.
@return CNabuUser|null Returns a User instance if found or null if not. | [
"Get",
"a",
"User",
"instance",
"owned",
"by",
"this",
"Customer",
"and",
"identified",
"by",
"his",
"login",
"attribute",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L807-L820 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getUserByEMail | public function getUserByEMail(string $email)
{
$retval = null;
if (strlen($email) > 0) {
$nb_user = CNabuUser::findByEMail($this, $email);
if ($nb_user instanceof CNabuUser && $nb_user->validateCustomer($this)) {
$nb_user->setCustomer($this);
$retval = $nb_user;
}
}
return $retval;
} | php | public function getUserByEMail(string $email)
{
$retval = null;
if (strlen($email) > 0) {
$nb_user = CNabuUser::findByEMail($this, $email);
if ($nb_user instanceof CNabuUser && $nb_user->validateCustomer($this)) {
$nb_user->setCustomer($this);
$retval = $nb_user;
}
}
return $retval;
} | [
"public",
"function",
"getUserByEMail",
"(",
"string",
"$",
"email",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"if",
"(",
"strlen",
"(",
"$",
"email",
")",
">",
"0",
")",
"{",
"$",
"nb_user",
"=",
"CNabuUser",
"::",
"findByEMail",
"(",
"$",
"this",
... | Get a User instance owned by this Customer and identified by his email attribute.
@param string $email A email string to looking for.
@return CNabuUser|null Returns a User instance if found or false if not. | [
"Get",
"a",
"User",
"instance",
"owned",
"by",
"this",
"Customer",
"and",
"identified",
"by",
"his",
"email",
"attribute",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L827-L840 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getRoles | public function getRoles(bool $force = false)
{
if ($this->nb_role_list->isEmpty() || $force) {
$this->nb_role_list->clear();
$this->nb_role_list->merge(CNabuRole::getAllRoles($this));
}
return $this->nb_role_list;
} | php | public function getRoles(bool $force = false)
{
if ($this->nb_role_list->isEmpty() || $force) {
$this->nb_role_list->clear();
$this->nb_role_list->merge(CNabuRole::getAllRoles($this));
}
return $this->nb_role_list;
} | [
"public",
"function",
"getRoles",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_role_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_role_list",
"->",
"clear",
"(",
")",
... | Gets a Role List of all roles owned by this Customer.
@param bool $force If true forces to reload Role list form the database storage.
@return CNabuRoleList Returns the list of roles. | [
"Gets",
"a",
"Role",
"List",
"of",
"all",
"roles",
"owned",
"by",
"this",
"Customer",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L864-L872 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getRole | public function getRole($nb_role)
{
$retval = false;
if (is_object($nb_role) && !($nb_role instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_role', get_class($nb_role))
);
}
if ($nb_role !== null) {
$nb_role_id = nb_getMixedValue($nb_role, NABU_ROLE_FIELD_ID);
if (is_numeric($nb_role_id) || nb_isValidGUID($nb_role_id)) {
$retval = $this->nb_role_list->getItem($nb_role_id);
if ($retval instanceof CNabuRole) {
if (!$retval->validateCustomer($this)) {
$this->nb_role_list->removeItem($retval);
$retval = false;
} else {
$retval->setCustomer($this);
}
}
} elseif ($nb_role_id !== null && $nb_role_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array(print_r($nb_role, true), '$nb_role')
);
}
}
return $retval;
} | php | public function getRole($nb_role)
{
$retval = false;
if (is_object($nb_role) && !($nb_role instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_role', get_class($nb_role))
);
}
if ($nb_role !== null) {
$nb_role_id = nb_getMixedValue($nb_role, NABU_ROLE_FIELD_ID);
if (is_numeric($nb_role_id) || nb_isValidGUID($nb_role_id)) {
$retval = $this->nb_role_list->getItem($nb_role_id);
if ($retval instanceof CNabuRole) {
if (!$retval->validateCustomer($this)) {
$this->nb_role_list->removeItem($retval);
$retval = false;
} else {
$retval->setCustomer($this);
}
}
} elseif ($nb_role_id !== null && $nb_role_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array(print_r($nb_role, true), '$nb_role')
);
}
}
return $retval;
} | [
"public",
"function",
"getRole",
"(",
"$",
"nb_role",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_object",
"(",
"$",
"nb_role",
")",
"&&",
"!",
"(",
"$",
"nb_role",
"instanceof",
"CNabuDataObject",
")",
")",
"{",
"throw",
"new",
"ENabuCo... | Gets a Role by their ID.
If the internal Role List contains a instance with same ID returns this instance, else if not exists,
tries to locate it in the storage and, if exists, then load it, add into Role List and returns their
instance as result.
@param mixed $nb_role A CNabuDataObject instance containing a nb_role_id field or an ID.
@return CNabuRole Returns the Role instance if exists or false if not.
@throws ENabuCoreException Raises an exception if $nb_role has no valid value. | [
"Gets",
"a",
"Role",
"by",
"their",
"ID",
".",
"If",
"the",
"internal",
"Role",
"List",
"contains",
"a",
"instance",
"with",
"same",
"ID",
"returns",
"this",
"instance",
"else",
"if",
"not",
"exists",
"tries",
"to",
"locate",
"it",
"in",
"the",
"storage"... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L892-L924 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getRoleByKey | public function getRoleByKey(string $key)
{
if (strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
}
return $this->nb_role_list->getItem($key, CNabuRoleList::INDEX_KEY);
} | php | public function getRoleByKey(string $key)
{
if (strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
}
return $this->nb_role_list->getItem($key, CNabuRoleList::INDEX_KEY);
} | [
"public",
"function",
"getRoleByKey",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"key",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_UNEXPECTED_PARAM_VALUE",
",",
"array",
"... | Gets a Role instance using their key.
@param string $key Key of the Role to be retrieved.
@return CNabuIContact Returns a Role instance if exists or false if not. | [
"Gets",
"a",
"Role",
"instance",
"using",
"their",
"key",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L931-L941 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getIContacts | public function getIContacts($force = false)
{
if ($this->nb_icontact_list->isEmpty() || $force) {
$this->nb_icontact_list->clear();
$this->nb_icontact_list->merge(CNabuIContact::getAlliContacts($this));
}
return $this->nb_icontact_list->getItems();
} | php | public function getIContacts($force = false)
{
if ($this->nb_icontact_list->isEmpty() || $force) {
$this->nb_icontact_list->clear();
$this->nb_icontact_list->merge(CNabuIContact::getAlliContacts($this));
}
return $this->nb_icontact_list->getItems();
} | [
"public",
"function",
"getIContacts",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_icontact_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_icontact_list",
"->",
"clear",
"(",
")",
... | Gets available i-Contact instances in the list.
@param bool $force If true, forces to merge complete list from the storage.
@return array Returns an associative array where the index is the ID of each i-Contact and the value
is the instance. | [
"Gets",
"available",
"i",
"-",
"Contact",
"instances",
"in",
"the",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L993-L1001 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getIContact | public function getIContact($nb_icontact)
{
$retval = false;
if (is_object($nb_icontact) && !($nb_icontact instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_icontact', get_class($nb_icontact))
);
}
if ($nb_icontact !== null) {
$nb_icontact_id = nb_getMixedValue($nb_icontact, NABU_ICONTACT_FIELD_ID);
if (is_numeric($nb_icontact_id) || nb_isValidGUID($nb_icontact_id)) {
$retval = $this->nb_icontact_list->getItem($nb_icontact_id);
} elseif ($nb_icontact_id !== null && $nb_icontact_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array(print_r($nb_icontact, true), '$nb_icontact')
);
}
}
return $retval;
} | php | public function getIContact($nb_icontact)
{
$retval = false;
if (is_object($nb_icontact) && !($nb_icontact instanceof CNabuDataObject)) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_CLASS_TYPE,
array('$nb_icontact', get_class($nb_icontact))
);
}
if ($nb_icontact !== null) {
$nb_icontact_id = nb_getMixedValue($nb_icontact, NABU_ICONTACT_FIELD_ID);
if (is_numeric($nb_icontact_id) || nb_isValidGUID($nb_icontact_id)) {
$retval = $this->nb_icontact_list->getItem($nb_icontact_id);
} elseif ($nb_icontact_id !== null && $nb_icontact_id !== false) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array(print_r($nb_icontact, true), '$nb_icontact')
);
}
}
return $retval;
} | [
"public",
"function",
"getIContact",
"(",
"$",
"nb_icontact",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"is_object",
"(",
"$",
"nb_icontact",
")",
"&&",
"!",
"(",
"$",
"nb_icontact",
"instanceof",
"CNabuDataObject",
")",
")",
"{",
"throw",
"... | Gets an i-Contact by their ID.
If the internal i-Contact List contains a instance with same ID returns this instance, else if not exists,
tries to locate it in the storage and, if exits, the load it, add into i-Contact List and returns their
instance as result.
@param mixed $nb_icontact A CNabuDataObject instance containing a nb_icontact_id field or an ID.
@return CNabuIContact Returns the i-Contact instance if exists or false if not.
@throws ENabuCoreException Raises an exception if $nb_icontact has no valid value. | [
"Gets",
"an",
"i",
"-",
"Contact",
"by",
"their",
"ID",
".",
"If",
"the",
"internal",
"i",
"-",
"Contact",
"List",
"contains",
"a",
"instance",
"with",
"same",
"ID",
"returns",
"this",
"instance",
"else",
"if",
"not",
"exists",
"tries",
"to",
"locate",
... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L1021-L1045 | train |
nabu-3/core | nabu/data/customer/CNabuCustomer.php | CNabuCustomer.getIContactByKey | public function getIContactByKey(string $key)
{
if (!is_string($key) || strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
}
return $this->nb_icontact_list->getItem($key, CNabuIContactList::INDEX_KEY);
} | php | public function getIContactByKey(string $key)
{
if (!is_string($key) || strlen($key) === 0) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE,
array('$key', print_r($key, true))
);
}
return $this->nb_icontact_list->getItem($key, CNabuIContactList::INDEX_KEY);
} | [
"public",
"function",
"getIContactByKey",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"key",
")",
"||",
"strlen",
"(",
"$",
"key",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",... | Gets an i-Contact instance using their key.
@param string $key Key of the i-Contact to be retrieved.
@return CNabuIContact Returns an i-Contact instance if exists or false if not. | [
"Gets",
"an",
"i",
"-",
"Contact",
"instance",
"using",
"their",
"key",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/CNabuCustomer.php#L1052-L1062 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/Origin/TypeService.php | TypeService.getAll | public function getAll(array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->origins()
->types()
->getAll($queryParams);
return new TypesResponse($response);
} | php | public function getAll(array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->origins()
->types()
->getAll($queryParams);
return new TypesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"issues",
"(",
")",
"->",
"origins",
"(",
")",... | Get all types for origin
@param array $queryParams
@return TypesResponse | [
"Get",
"all",
"types",
"for",
"origin"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/Origin/TypeService.php#L32-L43 | train |
rips/php-connector-bundle | Services/Application/Scan/Issue/Origin/TypeService.php | TypeService.getById | public function getById($typeId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->origins()
->types()
->getById($typeId, $queryParams);
return new TypeResponse($response);
} | php | public function getById($typeId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->origins()
->types()
->getById($typeId, $queryParams);
return new TypeResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"typeId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"issues",
"(",
")",
"->",... | Get type for origin by id
@param int $typeId
@param array $queryParams
@return TypeResponse | [
"Get",
"type",
"for",
"origin",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/Issue/Origin/TypeService.php#L52-L63 | train |
nabu-3/core | nabu/data/cluster/base/CNabuClusterUserBase.php | CNabuClusterUserBase.setGroupId | public function setGroupId(int $group_id) : CNabuDataObject
{
if ($group_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$group_id")
);
}
$this->setValue('nb_cluster_user_group_id', $group_id);
return $this;
} | php | public function setGroupId(int $group_id) : CNabuDataObject
{
if ($group_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$group_id")
);
}
$this->setValue('nb_cluster_user_group_id', $group_id);
return $this;
} | [
"public",
"function",
"setGroupId",
"(",
"int",
"$",
"group_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"group_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
... | Sets the Cluster User Group Id attribute value.
@param int $group_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Cluster",
"User",
"Group",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/cluster/base/CNabuClusterUserBase.php#L178-L189 | train |
nabu-3/core | nabu/data/cluster/base/CNabuClusterUserBase.php | CNabuClusterUserBase.setOSNick | public function setOSNick(string $os_nick) : CNabuDataObject
{
if ($os_nick === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$os_nick")
);
}
$this->setValue('nb_cluster_user_os_nick', $os_nick);
return $this;
} | php | public function setOSNick(string $os_nick) : CNabuDataObject
{
if ($os_nick === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$os_nick")
);
}
$this->setValue('nb_cluster_user_os_nick', $os_nick);
return $this;
} | [
"public",
"function",
"setOSNick",
"(",
"string",
"$",
"os_nick",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"os_nick",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
... | Sets the Cluster User OS Nick attribute value.
@param string $os_nick New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Cluster",
"User",
"OS",
"Nick",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/cluster/base/CNabuClusterUserBase.php#L226-L237 | train |
php-xapi/model | src/Result.php | Result.equals | public function equals(Result $result): bool
{
if (null !== $this->score xor null !== $result->score) {
return false;
}
if (null !== $this->score && !$this->score->equals($result->score)) {
return false;
}
if ($this->success !== $result->success) {
return false;
}
if ($this->completion !== $result->completion) {
return false;
}
if ($this->response !== $result->response) {
return false;
}
if ($this->duration !== $result->duration) {
return false;
}
if (null !== $this->extensions xor null !== $result->extensions) {
return false;
}
if (null !== $this->extensions && null !== $result->extensions && !$this->extensions->equals($result->extensions)) {
return false;
}
return true;
} | php | public function equals(Result $result): bool
{
if (null !== $this->score xor null !== $result->score) {
return false;
}
if (null !== $this->score && !$this->score->equals($result->score)) {
return false;
}
if ($this->success !== $result->success) {
return false;
}
if ($this->completion !== $result->completion) {
return false;
}
if ($this->response !== $result->response) {
return false;
}
if ($this->duration !== $result->duration) {
return false;
}
if (null !== $this->extensions xor null !== $result->extensions) {
return false;
}
if (null !== $this->extensions && null !== $result->extensions && !$this->extensions->equals($result->extensions)) {
return false;
}
return true;
} | [
"public",
"function",
"equals",
"(",
"Result",
"$",
"result",
")",
":",
"bool",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"score",
"xor",
"null",
"!==",
"$",
"result",
"->",
"score",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"null",... | Checks if another result is equal.
Two results are equal if and only if all of their properties are equal. | [
"Checks",
"if",
"another",
"result",
"is",
"equal",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/Result.php#L140-L175 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspectAttachment.php | CNabuIContactProspectAttachment.putFile | public function putFile(string $sourcefile)
{
if (file_exists($sourcefile)) {
if (($nb_icontact_prospect = $this->getIContactProspect()) instanceof CNabuIContactProspect &&
($nb_icontact = $nb_icontact_prospect->getIContact()) instanceof CNabuIContact
) {
$this->grantHash();
$nb_icontact->grantStorageFolder();
$base_path = $nb_icontact->getBasePath();
move_uploaded_file($sourcefile, $base_path . DIRECTORY_SEPARATOR . $this->getFilename());
} else {
throw new ENabuIContactException(ENabuIContactException::ERROR_ICONTACT_NOT_FOUND);
}
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_FILE_NOT_FOUND, array($sourcefile));
}
} | php | public function putFile(string $sourcefile)
{
if (file_exists($sourcefile)) {
if (($nb_icontact_prospect = $this->getIContactProspect()) instanceof CNabuIContactProspect &&
($nb_icontact = $nb_icontact_prospect->getIContact()) instanceof CNabuIContact
) {
$this->grantHash();
$nb_icontact->grantStorageFolder();
$base_path = $nb_icontact->getBasePath();
move_uploaded_file($sourcefile, $base_path . DIRECTORY_SEPARATOR . $this->getFilename());
} else {
throw new ENabuIContactException(ENabuIContactException::ERROR_ICONTACT_NOT_FOUND);
}
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_FILE_NOT_FOUND, array($sourcefile));
}
} | [
"public",
"function",
"putFile",
"(",
"string",
"$",
"sourcefile",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"sourcefile",
")",
")",
"{",
"if",
"(",
"(",
"$",
"nb_icontact_prospect",
"=",
"$",
"this",
"->",
"getIContactProspect",
"(",
")",
")",
"inst... | Put the file associated to this attachment in the iContact storage.
@param string $sourcefile Source path of the file to be attached.
@throws ENabuIContactException Raises an exception if source file does not exists or cannot be moved. | [
"Put",
"the",
"file",
"associated",
"to",
"this",
"attachment",
"in",
"the",
"iContact",
"storage",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspectAttachment.php#L69-L85 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspectAttachment.php | CNabuIContactProspectAttachment.deleteFile | public function deleteFile()
{
$retval = false;
if (($nb_icontact_prospect = $this->getIContactProspect()) instanceof CNabuIContactProspect &&
($nb_icontact = $nb_icontact_prospect->getIContact()) instanceof CNabuIContact
) {
$base_path = $nb_icontact->getBasePath();
$filename = $base_path . DIRECTORY_SEPARATOR . $this->getFilename();
if (file_exists($filename)) {
unlink($filename);
$retval = !file_exists($filename);
}
}
return $retval;
} | php | public function deleteFile()
{
$retval = false;
if (($nb_icontact_prospect = $this->getIContactProspect()) instanceof CNabuIContactProspect &&
($nb_icontact = $nb_icontact_prospect->getIContact()) instanceof CNabuIContact
) {
$base_path = $nb_icontact->getBasePath();
$filename = $base_path . DIRECTORY_SEPARATOR . $this->getFilename();
if (file_exists($filename)) {
unlink($filename);
$retval = !file_exists($filename);
}
}
return $retval;
} | [
"public",
"function",
"deleteFile",
"(",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"if",
"(",
"(",
"$",
"nb_icontact_prospect",
"=",
"$",
"this",
"->",
"getIContactProspect",
"(",
")",
")",
"instanceof",
"CNabuIContactProspect",
"&&",
"(",
"$",
"nb_icontac... | Delete the file of this attachment from the iContact storage.
@return bool Returns true if success. | [
"Delete",
"the",
"file",
"of",
"this",
"attachment",
"from",
"the",
"iContact",
"storage",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspectAttachment.php#L91-L108 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspectAttachment.php | CNabuIContactProspectAttachment.getAttachmentsForProspect | public static function getAttachmentsForProspect($nb_prospect)
{
if (is_numeric($nb_prospect_id = nb_getMixedValue($nb_prospect, NABU_ICONTACT_PROSPECT_FIELD_ID))) {
$retval = CNabuIContactProspectAttachment::buildObjectListFromSQL(
NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID,
'SELECT ipa.*
FROM nb_icontact_prospect_attachment ipa, nb_icontact_prospect ip
WHERE ipa.nb_icontact_prospect_id=ip.nb_icontact_prospect_id
AND ip.nb_icontact_prospect_id=%prospect_id$d
ORDER BY ipa.nb_icontact_prospect_attachment_id',
array(
'prospect_id' => $nb_prospect_id
),
($nb_prospect instanceof CNabuIContactProspect ? $nb_prospect : null)
);
if ($nb_prospect instanceof CNabuIContactProspect) {
$retval->iterate(
function($key, CNabuIContactProspectAttachment $nb_attachment) use ($nb_prospect)
{
$nb_attachment->setIContactProspect($nb_prospect);
return true;
}
);
}
} else {
$retval = new CNabuIContactProspectList(($nb_prospect instanceof CNabuIContactProspect ? $nb_prospect : null));
}
return $retval;
} | php | public static function getAttachmentsForProspect($nb_prospect)
{
if (is_numeric($nb_prospect_id = nb_getMixedValue($nb_prospect, NABU_ICONTACT_PROSPECT_FIELD_ID))) {
$retval = CNabuIContactProspectAttachment::buildObjectListFromSQL(
NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID,
'SELECT ipa.*
FROM nb_icontact_prospect_attachment ipa, nb_icontact_prospect ip
WHERE ipa.nb_icontact_prospect_id=ip.nb_icontact_prospect_id
AND ip.nb_icontact_prospect_id=%prospect_id$d
ORDER BY ipa.nb_icontact_prospect_attachment_id',
array(
'prospect_id' => $nb_prospect_id
),
($nb_prospect instanceof CNabuIContactProspect ? $nb_prospect : null)
);
if ($nb_prospect instanceof CNabuIContactProspect) {
$retval->iterate(
function($key, CNabuIContactProspectAttachment $nb_attachment) use ($nb_prospect)
{
$nb_attachment->setIContactProspect($nb_prospect);
return true;
}
);
}
} else {
$retval = new CNabuIContactProspectList(($nb_prospect instanceof CNabuIContactProspect ? $nb_prospect : null));
}
return $retval;
} | [
"public",
"static",
"function",
"getAttachmentsForProspect",
"(",
"$",
"nb_prospect",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_prospect_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_prospect",
",",
"NABU_ICONTACT_PROSPECT_FIELD_ID",
")",
")",
")",
"{",
"$",
... | Get a list of all attachments associated to an iContact Prospect instance.
@param mixed $nb_prospect A CNabuDataObject containing a field named nb_icontact_prospect_id or a valid Id.
@return CNabuIContactProspectAttachmentList Returns the list with found attachments. | [
"Get",
"a",
"list",
"of",
"all",
"attachments",
"associated",
"to",
"an",
"iContact",
"Prospect",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspectAttachment.php#L115-L145 | train |
nabu-3/core | nabu/http/adapters/CNabuHTTPSiteTargetPluginAdapter.php | CNabuHTTPSiteTargetPluginAdapter.trap | public function trap(CNabuHTTPRequest $nb_request, CNabuHTTPResponse $nb_response) : bool
{
if (($this->nb_request = $nb_request) === null ||
($this->nb_response = $nb_response) === null ||
($this->nb_engine = CNabuEngine::getEngine()) === null ||
($this->nb_application = $this->nb_engine->getApplication()) === null ||
($this->nb_session = CNabuHTTPSession::getSession()) === null ||
($this->nb_server = $this->nb_engine->getHTTPServer()->getServer()) === null ||
($this->nb_customer = $this->nb_engine->getCustomer()) === null ||
($this->nb_site = $this->nb_request->getSite()) === null ||
($this->nb_site_alias = $this->nb_request->getSiteAlias()) === null ||
($this->nb_site_target = $this->nb_request->getSiteTarget()) === null ||
($this->nb_language = $this->nb_request->getLanguage()) === null
) {
$retval = false;
} else {
$this->nb_work_customer = $this->nb_application->getSecurityManager()->getWorkCustomer();
$this->nb_user = $this->nb_application->getSecurityManager()->getUser();
$this->nb_role = $this->nb_application->getSecurityManager()->getRole();
$this->nb_site_role = $this->nb_application->getSecurityManager()->getSiteRole();
$this->nb_site_user = $this->nb_application->getSecurityManager()->getSiteUser();
$this->nb_site_alias_role = $this->nb_request->getSiteAliasRole();
$this->nb_commerce = $this->nb_request->getCommerce();
//$this->nb_apps_morphs = $this->nb_engine->getAppsMorphs();
$retval = true;
}
return $retval;
} | php | public function trap(CNabuHTTPRequest $nb_request, CNabuHTTPResponse $nb_response) : bool
{
if (($this->nb_request = $nb_request) === null ||
($this->nb_response = $nb_response) === null ||
($this->nb_engine = CNabuEngine::getEngine()) === null ||
($this->nb_application = $this->nb_engine->getApplication()) === null ||
($this->nb_session = CNabuHTTPSession::getSession()) === null ||
($this->nb_server = $this->nb_engine->getHTTPServer()->getServer()) === null ||
($this->nb_customer = $this->nb_engine->getCustomer()) === null ||
($this->nb_site = $this->nb_request->getSite()) === null ||
($this->nb_site_alias = $this->nb_request->getSiteAlias()) === null ||
($this->nb_site_target = $this->nb_request->getSiteTarget()) === null ||
($this->nb_language = $this->nb_request->getLanguage()) === null
) {
$retval = false;
} else {
$this->nb_work_customer = $this->nb_application->getSecurityManager()->getWorkCustomer();
$this->nb_user = $this->nb_application->getSecurityManager()->getUser();
$this->nb_role = $this->nb_application->getSecurityManager()->getRole();
$this->nb_site_role = $this->nb_application->getSecurityManager()->getSiteRole();
$this->nb_site_user = $this->nb_application->getSecurityManager()->getSiteUser();
$this->nb_site_alias_role = $this->nb_request->getSiteAliasRole();
$this->nb_commerce = $this->nb_request->getCommerce();
//$this->nb_apps_morphs = $this->nb_engine->getAppsMorphs();
$retval = true;
}
return $retval;
} | [
"public",
"function",
"trap",
"(",
"CNabuHTTPRequest",
"$",
"nb_request",
",",
"CNabuHTTPResponse",
"$",
"nb_response",
")",
":",
"bool",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"nb_request",
"=",
"$",
"nb_request",
")",
"===",
"null",
"||",
"(",
"$",
"t... | This method is called just after the instantiation of plugin to set request and response objects.
After called from the Engine, all protected properties of this class are setted with proper values.
@param CNabuHTTPRequest $nb_request Request instance.
@param CNabuHTTPResponse $nb_response Response instance.
@return bool Return true if trap successfully or false if not. | [
"This",
"method",
"is",
"called",
"just",
"after",
"the",
"instantiation",
"of",
"plugin",
"to",
"set",
"request",
"and",
"response",
"objects",
".",
"After",
"called",
"from",
"the",
"Engine",
"all",
"protected",
"properties",
"of",
"this",
"class",
"are",
... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/adapters/CNabuHTTPSiteTargetPluginAdapter.php#L97-L125 | train |
rips/php-connector-bundle | Services/Application/Scan/IssueService.php | IssueService.getAll | public function getAll($applicationID, $scanID, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->getAll($applicationID, $scanID, $queryParams);
return new IssuesResponse($response);
} | php | public function getAll($applicationID, $scanID, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->getAll($applicationID, $scanID, $queryParams);
return new IssuesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"applicationID",
",",
"$",
"scanID",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
... | Get all issue for a scan
@param int $applicationID
@param int $scanID
@param array $queryParams
@return IssuesResponse | [
"Get",
"all",
"issue",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/IssueService.php#L37-L46 | train |
rips/php-connector-bundle | Services/Application/Scan/IssueService.php | IssueService.getStats | public function getStats($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->getStats($appId, $scanId, $queryParams);
return new IssueStatsResponse($response);
} | php | public function getStats($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->getStats($appId, $scanId, $queryParams);
return new IssueStatsResponse($response);
} | [
"public",
"function",
"getStats",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"issu... | Get stats for all issues of scan
@param int $appId
@param int $scanId
@param array $queryParams
@return IssueStatsResponse | [
"Get",
"stats",
"for",
"all",
"issues",
"of",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/IssueService.php#L56-L65 | train |
rips/php-connector-bundle | Services/Application/Scan/IssueService.php | IssueService.getById | public function getById($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->getById($appId, $scanId, $issueId, $queryParams);
return new IssueResponse($response);
} | php | public function getById($appId, $scanId, $issueId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->issues()
->getById($appId, $scanId, $issueId, $queryParams);
return new IssueResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"issueId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"... | Get issue for scan by id
@param int $appId
@param int $scanId
@param int $issueId
@param array $queryParams
@return IssueResponse | [
"Get",
"issue",
"for",
"scan",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/IssueService.php#L76-L85 | train |
rips/php-connector-bundle | Services/Application/Scan/IssueService.php | IssueService.create | public function create($appId, $scanId, $input, array $queryParams = [])
{
if ($input instanceof IssueBuilder) {
$inputArray = $input->toArray();
$defaultInput = true;
} else {
$inputArray = [];
foreach ($input as $key => $value) {
if ($value instanceof BaseBuilder) {
$inputArray[$key] = $value->toArray();
} else if (is_array($value)) {
foreach ($value as $key2 => $value2) {
if ($value2 instanceof BaseBuilder) {
$inputArray[$key][$key2] = $value2->toArray();
} else if (is_string($value2)) {
$inputArray[$key][$key2] = $value2;
}
}
}
}
$defaultInput = false;
}
$response = $this->api
->applications()
->scans()
->issues()
->create($appId, $scanId, $inputArray, $queryParams, $defaultInput);
return new IssueResponse($response);
} | php | public function create($appId, $scanId, $input, array $queryParams = [])
{
if ($input instanceof IssueBuilder) {
$inputArray = $input->toArray();
$defaultInput = true;
} else {
$inputArray = [];
foreach ($input as $key => $value) {
if ($value instanceof BaseBuilder) {
$inputArray[$key] = $value->toArray();
} else if (is_array($value)) {
foreach ($value as $key2 => $value2) {
if ($value2 instanceof BaseBuilder) {
$inputArray[$key][$key2] = $value2->toArray();
} else if (is_string($value2)) {
$inputArray[$key][$key2] = $value2;
}
}
}
}
$defaultInput = false;
}
$response = $this->api
->applications()
->scans()
->issues()
->create($appId, $scanId, $inputArray, $queryParams, $defaultInput);
return new IssueResponse($response);
} | [
"public",
"function",
"create",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"input",
"instanceof",
"IssueBuilder",
")",
"{",
"$",
"inputArray",
"=",
"$",
"input"... | Create a new issue for a scan
@param int $appId
@param int $scanId
@param IssueBuilder|BaseBuilder[string] $input
@param array $queryParams
@return IssueResponse | [
"Create",
"a",
"new",
"issue",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/IssueService.php#L96-L126 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteRoleBase.php | CNabuSiteRoleBase.setSiteId | public function setSiteId(int $nb_site_id) : CNabuDataObject
{
if ($nb_site_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_site_id")
);
}
$this->setValue('nb_site_id', $nb_site_id);
return $this;
} | php | public function setSiteId(int $nb_site_id) : CNabuDataObject
{
if ($nb_site_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_site_id")
);
}
$this->setValue('nb_site_id', $nb_site_id);
return $this;
} | [
"public",
"function",
"setSiteId",
"(",
"int",
"$",
"nb_site_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_site_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
","... | Sets the Site Id attribute value.
@param int $nb_site_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteRoleBase.php#L253-L264 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteRoleBase.php | CNabuSiteRoleBase.setRoleId | public function setRoleId(int $nb_role_id) : CNabuDataObject
{
if ($nb_role_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_role_id")
);
}
$this->setValue('nb_role_id', $nb_role_id);
return $this;
} | php | public function setRoleId(int $nb_role_id) : CNabuDataObject
{
if ($nb_role_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_role_id")
);
}
$this->setValue('nb_role_id', $nb_role_id);
return $this;
} | [
"public",
"function",
"setRoleId",
"(",
"int",
"$",
"nb_role_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_role_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
","... | Sets the Role Id attribute value.
@param int $nb_role_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Role",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteRoleBase.php#L280-L291 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteRoleBase.php | CNabuSiteRoleBase.setLoginRedirectionTargetUseURI | public function setLoginRedirectionTargetUseURI($login_redirection_target_use_uri) : CNabuDataObject
{
if ($login_redirection_target_use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$login_redirection_target_use_uri")
);
}
$this->setValue('nb_site_role_login_redirection_target_use_uri', $login_redirection_target_use_uri);
return $this;
} | php | public function setLoginRedirectionTargetUseURI($login_redirection_target_use_uri) : CNabuDataObject
{
if ($login_redirection_target_use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$login_redirection_target_use_uri")
);
}
$this->setValue('nb_site_role_login_redirection_target_use_uri', $login_redirection_target_use_uri);
return $this;
} | [
"public",
"function",
"setLoginRedirectionTargetUseURI",
"(",
"$",
"login_redirection_target_use_uri",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"login_redirection_target_use_uri",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreExcep... | Sets the Site Role Login Redirection Target Use URI attribute value.
@param mixed $login_redirection_target_use_uri New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Role",
"Login",
"Redirection",
"Target",
"Use",
"URI",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteRoleBase.php#L307-L318 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteRoleBase.php | CNabuSiteRoleBase.setPoliciesTargetUseURI | public function setPoliciesTargetUseURI($policies_target_use_uri) : CNabuDataObject
{
if ($policies_target_use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$policies_target_use_uri")
);
}
$this->setValue('nb_site_role_policies_target_use_uri', $policies_target_use_uri);
return $this;
} | php | public function setPoliciesTargetUseURI($policies_target_use_uri) : CNabuDataObject
{
if ($policies_target_use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$policies_target_use_uri")
);
}
$this->setValue('nb_site_role_policies_target_use_uri', $policies_target_use_uri);
return $this;
} | [
"public",
"function",
"setPoliciesTargetUseURI",
"(",
"$",
"policies_target_use_uri",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"policies_target_use_uri",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NU... | Sets the Site Role Policies Target Use URI attribute value.
@param mixed $policies_target_use_uri New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Role",
"Policies",
"Target",
"Use",
"URI",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteRoleBase.php#L355-L366 | train |
nabu-3/core | nabu/data/security/base/CNabuUserGroupLanguageBase.php | CNabuUserGroupLanguageBase.setUserGroupId | public function setUserGroupId(int $nb_user_group_id) : CNabuDataObject
{
if ($nb_user_group_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_user_group_id")
);
}
$this->setValue('nb_user_group_id', $nb_user_group_id);
return $this;
} | php | public function setUserGroupId(int $nb_user_group_id) : CNabuDataObject
{
if ($nb_user_group_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_user_group_id")
);
}
$this->setValue('nb_user_group_id', $nb_user_group_id);
return $this;
} | [
"public",
"function",
"setUserGroupId",
"(",
"int",
"$",
"nb_user_group_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_user_group_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_A... | Sets the User Group Id attribute value.
@param int $nb_user_group_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Group",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserGroupLanguageBase.php#L182-L193 | train |
nabu-3/core | nabu/data/security/base/CNabuUserGroupLanguageBase.php | CNabuUserGroupLanguageBase.setTitle | public function setTitle(string $title) : CNabuDataObject
{
if ($title === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$title")
);
}
$this->setValue('nb_user_group_lang_title', $title);
return $this;
} | php | public function setTitle(string $title) : CNabuDataObject
{
if ($title === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$title")
);
}
$this->setValue('nb_user_group_lang_title', $title);
return $this;
} | [
"public",
"function",
"setTitle",
"(",
"string",
"$",
"title",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"title",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
"arr... | Sets the User Group Lang Title attribute value.
@param string $title New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"User",
"Group",
"Lang",
"Title",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/base/CNabuUserGroupLanguageBase.php#L236-L247 | train |
nabu-3/core | nabu/data/commerce/CNabuCommerceProduct.php | CNabuCommerceProduct.getProductsForCommerce | static public function getProductsForCommerce($nb_commerce)
{
$nb_commerce_id = nb_getMixedValue($nb_commerce, NABU_COMMERCE_FIELD_ID);
if (is_numeric($nb_commerce_id)) {
$retval = CNabuCommerceProduct::buildObjectListFromSQL(
'nb_commerce_product_id',
'SELECT *
FROM nb_commerce_product
WHERE nb_commerce_id=%commerce_id$d',
array(
'commerce_id' => $nb_commerce_id
)
);
if ($nb_commerce instanceof CNabuCommerce) {
$retval->setCommerce($nb_commerce);
}
} else {
$retval = new CNabuCommerceProductCategoryList($nb_commerce instanceof CNabuCommerce ? $nb_commerce : null);
}
return $retval;
} | php | static public function getProductsForCommerce($nb_commerce)
{
$nb_commerce_id = nb_getMixedValue($nb_commerce, NABU_COMMERCE_FIELD_ID);
if (is_numeric($nb_commerce_id)) {
$retval = CNabuCommerceProduct::buildObjectListFromSQL(
'nb_commerce_product_id',
'SELECT *
FROM nb_commerce_product
WHERE nb_commerce_id=%commerce_id$d',
array(
'commerce_id' => $nb_commerce_id
)
);
if ($nb_commerce instanceof CNabuCommerce) {
$retval->setCommerce($nb_commerce);
}
} else {
$retval = new CNabuCommerceProductCategoryList($nb_commerce instanceof CNabuCommerce ? $nb_commerce : null);
}
return $retval;
} | [
"static",
"public",
"function",
"getProductsForCommerce",
"(",
"$",
"nb_commerce",
")",
"{",
"$",
"nb_commerce_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_commerce",
",",
"NABU_COMMERCE_FIELD_ID",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_commerce_id",
")",... | Get all Products of a Commerce.
@param mixed $nb_commerce | [
"Get",
"all",
"Products",
"of",
"a",
"Commerce",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/CNabuCommerceProduct.php#L37-L58 | train |
nabu-3/core | nabu/data/commerce/CNabuCommerceProduct.php | CNabuCommerceProduct.findBySKU | static public function findBySKU($nb_commerce, string $sku)
{
$retval = false;
$nb_commerce_id = nb_getMixedValue($nb_commerce, NABU_COMMERCE_FIELD_ID);
if (is_numeric($nb_commerce_id)) {
$retval = CNabuCommerceProduct::buildObjectFromSQL(
'SELECT *
from nb_commerce_product
where nb_commerce_id=%commerce_id$d
and nb_commerce_product_sku=\'%sku$s\'
',
array(
'commerce_id' => $nb_commerce_id,
'sku' => $sku
)
);
}
return $retval;
} | php | static public function findBySKU($nb_commerce, string $sku)
{
$retval = false;
$nb_commerce_id = nb_getMixedValue($nb_commerce, NABU_COMMERCE_FIELD_ID);
if (is_numeric($nb_commerce_id)) {
$retval = CNabuCommerceProduct::buildObjectFromSQL(
'SELECT *
from nb_commerce_product
where nb_commerce_id=%commerce_id$d
and nb_commerce_product_sku=\'%sku$s\'
',
array(
'commerce_id' => $nb_commerce_id,
'sku' => $sku
)
);
}
return $retval;
} | [
"static",
"public",
"function",
"findBySKU",
"(",
"$",
"nb_commerce",
",",
"string",
"$",
"sku",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"$",
"nb_commerce_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_commerce",
",",
"NABU_COMMERCE_FIELD_ID",
")",
";",
"if... | Find a product in a Commerce by its SKU.
@param mixed $nb_commerce A CNabuDataObject instance containing a field named nb_commerce_id or a valid ID.
@param string $sku The SKU to be found.
@return CNabuCommerceProduct|false Returns a valid instance if found, or false if not found. | [
"Find",
"a",
"product",
"in",
"a",
"Commerce",
"by",
"its",
"SKU",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/CNabuCommerceProduct.php#L66-L85 | train |
nabu-3/core | nabu/data/security/CNabuUser.php | CNabuUser.setEmail | public function setEmail(string $email) : CNabuDataObject
{
$value = parent::setEmail(strtolower($email));
return $value;
} | php | public function setEmail(string $email) : CNabuDataObject
{
$value = parent::setEmail(strtolower($email));
return $value;
} | [
"public",
"function",
"setEmail",
"(",
"string",
"$",
"email",
")",
":",
"CNabuDataObject",
"{",
"$",
"value",
"=",
"parent",
"::",
"setEmail",
"(",
"strtolower",
"(",
"$",
"email",
")",
")",
";",
"return",
"$",
"value",
";",
"}"
] | Overrides the method to convert to lowercase emails before store them in the object.
@param string $email Email to be setted.
@return CNabuDataObject Returns the self instance to grant cascade setters. | [
"Overrides",
"the",
"method",
"to",
"convert",
"to",
"lowercase",
"emails",
"before",
"store",
"them",
"in",
"the",
"object",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuUser.php#L78-L83 | train |
nabu-3/core | nabu/data/security/CNabuUser.php | CNabuUser.activate | public function activate(bool $save = false) : bool
{
$retval = false;
$current = $this->getValidationStatus();
if ($current === self::USER_VALIDATION_PENDING || $current === self::USER_VALIDATION_PENDING_WITH_INVITATION) {
$this->setActivationDatetime(date('Y-m-d H:i:s', time()));
$this->setValidationStatus(CNabuUser::USER_ACTIVE);
$retval = ($save ? $this->save() : true);
}
return $retval;
} | php | public function activate(bool $save = false) : bool
{
$retval = false;
$current = $this->getValidationStatus();
if ($current === self::USER_VALIDATION_PENDING || $current === self::USER_VALIDATION_PENDING_WITH_INVITATION) {
$this->setActivationDatetime(date('Y-m-d H:i:s', time()));
$this->setValidationStatus(CNabuUser::USER_ACTIVE);
$retval = ($save ? $this->save() : true);
}
return $retval;
} | [
"public",
"function",
"activate",
"(",
"bool",
"$",
"save",
"=",
"false",
")",
":",
"bool",
"{",
"$",
"retval",
"=",
"false",
";",
"$",
"current",
"=",
"$",
"this",
"->",
"getValidationStatus",
"(",
")",
";",
"if",
"(",
"$",
"current",
"===",
"self",... | Activates the User account.
@param bool $save If true then saves the User record in the database storage before return.
@return bool Returns true if the user was successfully activated. | [
"Activates",
"the",
"User",
"account",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuUser.php#L110-L123 | train |
nabu-3/core | nabu/data/security/CNabuUser.php | CNabuUser.findByStaticEncodedId | public static function findByStaticEncodedId($nb_customer, string $key)
{
$retval = null;
if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID)) &&
strlen($key) > 0
) {
$retval = CNabuUser::buildObjectFromSQL(
'select * '
. 'from nb_user u, nb_customer c '
. 'where u.nb_customer_id=c.nb_customer_id '
. 'and c.nb_customer_id=%cust_id$d '
. "and md5(concat('%pref\$s', u.nb_user_id, '%suff\$s'))='%key\$s'",
array(
'pref' => NABU_ENC_ID_PREF,
'suff' => NABU_ENC_ID_SUFF,
'cust_id' => $nb_customer_id,
'key' => $key
)
);
if ($nb_customer instanceof CNabuCustomer && $retval !== null) {
$retval->setCustomer($nb_customer);
}
}
return $retval;
} | php | public static function findByStaticEncodedId($nb_customer, string $key)
{
$retval = null;
if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID)) &&
strlen($key) > 0
) {
$retval = CNabuUser::buildObjectFromSQL(
'select * '
. 'from nb_user u, nb_customer c '
. 'where u.nb_customer_id=c.nb_customer_id '
. 'and c.nb_customer_id=%cust_id$d '
. "and md5(concat('%pref\$s', u.nb_user_id, '%suff\$s'))='%key\$s'",
array(
'pref' => NABU_ENC_ID_PREF,
'suff' => NABU_ENC_ID_SUFF,
'cust_id' => $nb_customer_id,
'key' => $key
)
);
if ($nb_customer instanceof CNabuCustomer && $retval !== null) {
$retval->setCustomer($nb_customer);
}
}
return $retval;
} | [
"public",
"static",
"function",
"findByStaticEncodedId",
"(",
"$",
"nb_customer",
",",
"string",
"$",
"key",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_customer_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_customer",
","... | Find a User by an static encoded key.
@param mixed $nb_customer A Customer ID, a Data Object containing a field nb_customer_id or a Customer instance.
@param string $key Key encoded string value to find the User.
@return mixed Returns a User instance if $key matches or null if not. | [
"Find",
"a",
"User",
"by",
"an",
"static",
"encoded",
"key",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuUser.php#L131-L157 | train |
nabu-3/core | nabu/data/security/CNabuUser.php | CNabuUser.findByStaticEncodedLogin | public static function findByStaticEncodedLogin($nb_customer, string $key)
{
$retval = null;
if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID)) &&
strlen($key) > 0
) {
$retval = CNabuUser::buildObjectFromSQL(
'select * '
. 'from nb_user u, nb_customer c '
. 'where u.nb_customer_id=c.nb_customer_id '
. 'and c.nb_customer_id=%cust_id$d '
. "and md5(concat('%pref\$s', u.nb_user_login, '%suff\$s'))='%key\$s'",
array(
'pref' => self::PASS_PREF,
'suff' => self::PASS_SUFF,
'cust_id' => $nb_customer_id,
'key' => $key
)
);
if ($nb_customer instanceof CNabuCustomer && $retval !== null) {
$retval->setCustomer($nb_customer);
}
}
return $retval;
} | php | public static function findByStaticEncodedLogin($nb_customer, string $key)
{
$retval = null;
if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID)) &&
strlen($key) > 0
) {
$retval = CNabuUser::buildObjectFromSQL(
'select * '
. 'from nb_user u, nb_customer c '
. 'where u.nb_customer_id=c.nb_customer_id '
. 'and c.nb_customer_id=%cust_id$d '
. "and md5(concat('%pref\$s', u.nb_user_login, '%suff\$s'))='%key\$s'",
array(
'pref' => self::PASS_PREF,
'suff' => self::PASS_SUFF,
'cust_id' => $nb_customer_id,
'key' => $key
)
);
if ($nb_customer instanceof CNabuCustomer && $retval !== null) {
$retval->setCustomer($nb_customer);
}
}
return $retval;
} | [
"public",
"static",
"function",
"findByStaticEncodedLogin",
"(",
"$",
"nb_customer",
",",
"string",
"$",
"key",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_customer_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_customer",
... | Find a User by an static encoded login.
@param mixed $nb_customer A Customer ID, a Data Object containing a field nb_customer_id or a Customer instance.
@param string $key Key encoded string value to find the User.
@return mixed Returns a User instance if $key matches or null if not. | [
"Find",
"a",
"User",
"by",
"an",
"static",
"encoded",
"login",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuUser.php#L165-L191 | train |
nabu-3/core | nabu/data/security/CNabuUser.php | CNabuUser.findByTemporalEncodedId | public static function findByTemporalEncodedId($nb_customer, string $key, int $expires = NABU_TEMP_ENC_ID_EXPIRATION_TIME)
{
$retval = null;
if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID)) &&
strlen($key) > 0
) {
$hash_left = $hash_time = null;
sscanf($key, "%32s%x", $hash_left, $hash_time);
if ($hash_time >= time()) {
$retval = CNabuUser::buildObjectFromSQL(
'select * '
. 'from nb_user u, nb_customer c '
. 'where u.nb_customer_id=c.nb_customer_id '
. 'and c.nb_customer_id=%cust_id$d '
. "and md5(concat('%pref\$s', u.nb_user_id, '%suff\$s'))='%key\$s'",
array(
'pref' => NABU_ENC_ID_PREF,
'suff' => NABU_ENC_ID_SUFF,
'cust_id' => $nb_customer_id,
'key' => $hash_left
)
);
if ($nb_customer instanceof CNabuCustomer && $retval !== null) {
$retval->setCustomer($nb_customer);
}
}
}
return $retval;
} | php | public static function findByTemporalEncodedId($nb_customer, string $key, int $expires = NABU_TEMP_ENC_ID_EXPIRATION_TIME)
{
$retval = null;
if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID)) &&
strlen($key) > 0
) {
$hash_left = $hash_time = null;
sscanf($key, "%32s%x", $hash_left, $hash_time);
if ($hash_time >= time()) {
$retval = CNabuUser::buildObjectFromSQL(
'select * '
. 'from nb_user u, nb_customer c '
. 'where u.nb_customer_id=c.nb_customer_id '
. 'and c.nb_customer_id=%cust_id$d '
. "and md5(concat('%pref\$s', u.nb_user_id, '%suff\$s'))='%key\$s'",
array(
'pref' => NABU_ENC_ID_PREF,
'suff' => NABU_ENC_ID_SUFF,
'cust_id' => $nb_customer_id,
'key' => $hash_left
)
);
if ($nb_customer instanceof CNabuCustomer && $retval !== null) {
$retval->setCustomer($nb_customer);
}
}
}
return $retval;
} | [
"public",
"static",
"function",
"findByTemporalEncodedId",
"(",
"$",
"nb_customer",
",",
"string",
"$",
"key",
",",
"int",
"$",
"expires",
"=",
"NABU_TEMP_ENC_ID_EXPIRATION_TIME",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"if",
"(",
"is_numeric",
"(",
"$",
... | Find a User by a temporal encoded key.
@param mixed $nb_customer A Customer ID, a Data Object containing a field nb_customer_id or a Customer instance.
@param string $key Key encoded string value to find the User.
@param int $expires Time in seconds of the validity interval of encoded ID.
@return mixed Returns a User instance if $key matches and is in time, or null if not. | [
"Find",
"a",
"User",
"by",
"a",
"temporal",
"encoded",
"key",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuUser.php#L200-L230 | train |
nabu-3/core | nabu/data/security/CNabuUser.php | CNabuUser.findBySiteLogin | static public function findBySiteLogin($nb_site, $login, $passwd, $active = true)
{
$retval = null;
$nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
if (is_numeric($nb_site_id)) {
$retval = CNabuUser::buildObjectFromSQL(
"select u.*, su.nb_role_id "
. "from nb_user u, nb_site_user su "
. "where (u.nb_user_login='%login\$s' or lower(u.nb_user_email)=lower('%login\$s')) "
. "and u.nb_user_passwd='%passwd\$s' "
. ($active ? "and u.nb_user_validation_status='T' " : '')
. "and u.nb_user_id=su.nb_user_id "
. "and su.nb_site_id=%site_id\$d",
array(
'login' => $login,
'passwd' => CNabuUser::encodePassword($passwd),
'site_id' => $nb_site_id
)
);
}
return $retval;
} | php | static public function findBySiteLogin($nb_site, $login, $passwd, $active = true)
{
$retval = null;
$nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
if (is_numeric($nb_site_id)) {
$retval = CNabuUser::buildObjectFromSQL(
"select u.*, su.nb_role_id "
. "from nb_user u, nb_site_user su "
. "where (u.nb_user_login='%login\$s' or lower(u.nb_user_email)=lower('%login\$s')) "
. "and u.nb_user_passwd='%passwd\$s' "
. ($active ? "and u.nb_user_validation_status='T' " : '')
. "and u.nb_user_id=su.nb_user_id "
. "and su.nb_site_id=%site_id\$d",
array(
'login' => $login,
'passwd' => CNabuUser::encodePassword($passwd),
'site_id' => $nb_site_id
)
);
}
return $retval;
} | [
"static",
"public",
"function",
"findBySiteLogin",
"(",
"$",
"nb_site",
",",
"$",
"login",
",",
"$",
"passwd",
",",
"$",
"active",
"=",
"true",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"$",
"nb_site_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site",
... | Find a user by his login data in a site.
@param mixed $nb_site Site instance, object containing a Site Id field or an Id.
@param string $login Login name
@param string $passwd Password in clear format
@param bool $active If true only active users are found else if false then looks for all validation statuses.
@return \nabu\data\security\CNabuUser Returns the instance representing the User if found or null if not. | [
"Find",
"a",
"user",
"by",
"his",
"login",
"data",
"in",
"a",
"site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuUser.php#L274-L297 | train |
nabu-3/core | nabu/data/security/CNabuUser.php | CNabuUser.findByEMail | static public function findByEMail($nb_customer, string $email)
{
$retval = null;
if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID))) {
$retval = CNabuUser::buildObjectFromSQL(
'select u.* '
. 'from nb_user u, nb_customer c '
. 'where u.nb_customer_id=c.nb_customer_id '
. 'and c.nb_customer_id=%cust_id$d '
. 'and u.nb_user_email=\'%email$s\'',
array(
'cust_id' => $nb_customer_id,
'email' => $email
)
);
if ($retval instanceof CNabuUser && $nb_customer instanceof CNabuCustomer) {
$retval->setCustomer($nb_customer);
}
}
return $retval;
} | php | static public function findByEMail($nb_customer, string $email)
{
$retval = null;
if (is_numeric($nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID))) {
$retval = CNabuUser::buildObjectFromSQL(
'select u.* '
. 'from nb_user u, nb_customer c '
. 'where u.nb_customer_id=c.nb_customer_id '
. 'and c.nb_customer_id=%cust_id$d '
. 'and u.nb_user_email=\'%email$s\'',
array(
'cust_id' => $nb_customer_id,
'email' => $email
)
);
if ($retval instanceof CNabuUser && $nb_customer instanceof CNabuCustomer) {
$retval->setCustomer($nb_customer);
}
}
return $retval;
} | [
"static",
"public",
"function",
"findByEMail",
"(",
"$",
"nb_customer",
",",
"string",
"$",
"email",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_customer_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_customer",
",",
"NAB... | Find a user by email.
@param mixed $nb_customer Customer that owns the User.
@param string $email e-Mail to find.
@return CNabuUser|null Returns a User instance if the email exists or null if not. | [
"Find",
"a",
"user",
"by",
"email",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuUser.php#L305-L327 | train |
nabu-3/core | nabu/data/security/CNabuUser.php | CNabuUser.getPrescriber | public function getPrescriber(bool $force = false)
{
if ($this->nb_prescriber == NULL ||
$this->nb_prescriber->getId() != $this->getPrescriberId() ||
$force
) {
$nb_prescriber_id = $this->getPrescriberId();
if ($nb_prescriber_id === null || $this->getCustomer() === null) {
$this->nb_prescriber = null;
} else {
$this->nb_prescriber = $this->getCustomer()->getUser($nb_prescriber_id);
}
}
return $this->nb_prescriber;
} | php | public function getPrescriber(bool $force = false)
{
if ($this->nb_prescriber == NULL ||
$this->nb_prescriber->getId() != $this->getPrescriberId() ||
$force
) {
$nb_prescriber_id = $this->getPrescriberId();
if ($nb_prescriber_id === null || $this->getCustomer() === null) {
$this->nb_prescriber = null;
} else {
$this->nb_prescriber = $this->getCustomer()->getUser($nb_prescriber_id);
}
}
return $this->nb_prescriber;
} | [
"public",
"function",
"getPrescriber",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_prescriber",
"==",
"NULL",
"||",
"$",
"this",
"->",
"nb_prescriber",
"->",
"getId",
"(",
")",
"!=",
"$",
"this",
"->",
"getPresc... | Gets the Prescriber instance.
@param bool $force If true forces to reload object from the database.
@return CNabuUser|null Returns the Prescriber instance if exists or null if not. | [
"Gets",
"the",
"Prescriber",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuUser.php#L334-L349 | train |
rips/php-connector-bundle | Hydrators/CallbackHydrator.php | CallbackHydrator.hydrateCollection | public static function hydrateCollection(array $callbacks)
{
$hydrated = [];
foreach ($callbacks as $callback) {
$hydrated[] = self::hydrate($callback);
}
return $hydrated;
} | php | public static function hydrateCollection(array $callbacks)
{
$hydrated = [];
foreach ($callbacks as $callback) {
$hydrated[] = self::hydrate($callback);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"callbacks",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"callbacks",
"as",
"$",
"callback",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrat... | Hydrate a collection of callback objects into a collection of
CallbackEntity objects
@param stdClass[] $callbacks
@return CallbackEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"callback",
"objects",
"into",
"a",
"collection",
"of",
"CallbackEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/CallbackHydrator.php#L19-L28 | train |
rips/php-connector-bundle | Hydrators/CallbackHydrator.php | CallbackHydrator.hydrate | public static function hydrate(stdClass $callback)
{
$hydrated = new CallbackEntity();
if (isset($callback->id)) {
$hydrated->setId($callback->id);
}
if (isset($callback->internal)) {
$hydrated->setInternal($callback->internal);
}
if (isset($callback->observe_organization)) {
$hydrated->setObserveOrganization($callback->observe_organization);
}
if (isset($callback->url)) {
$hydrated->setUrl($callback->url);
}
if (isset($callback->reports) && is_array($callback->reports)) {
$hydrated->setReports($callback->reports);
}
if (isset($callback->created_at)) {
$hydrated->setCreatedAt(new DateTime($callback->created_at));
}
if (isset($callback->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($callback->created_by));
}
if (isset($callback->users) && is_array($callback->users)) {
$hydrated->setUsers(UserHydrator::hydrateCollection($callback->users));
}
if (isset($callback->applications) && is_array($callback->applications)) {
$hydrated->setApplications(ApplicationHydrator::hydrateCollection($callback->applications));
}
if (isset($callback->scans) && is_array($callback->scans)) {
$hydrated->setScans(ScanHydrator::hydrateCollection($callback->scans));
}
return $hydrated;
} | php | public static function hydrate(stdClass $callback)
{
$hydrated = new CallbackEntity();
if (isset($callback->id)) {
$hydrated->setId($callback->id);
}
if (isset($callback->internal)) {
$hydrated->setInternal($callback->internal);
}
if (isset($callback->observe_organization)) {
$hydrated->setObserveOrganization($callback->observe_organization);
}
if (isset($callback->url)) {
$hydrated->setUrl($callback->url);
}
if (isset($callback->reports) && is_array($callback->reports)) {
$hydrated->setReports($callback->reports);
}
if (isset($callback->created_at)) {
$hydrated->setCreatedAt(new DateTime($callback->created_at));
}
if (isset($callback->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($callback->created_by));
}
if (isset($callback->users) && is_array($callback->users)) {
$hydrated->setUsers(UserHydrator::hydrateCollection($callback->users));
}
if (isset($callback->applications) && is_array($callback->applications)) {
$hydrated->setApplications(ApplicationHydrator::hydrateCollection($callback->applications));
}
if (isset($callback->scans) && is_array($callback->scans)) {
$hydrated->setScans(ScanHydrator::hydrateCollection($callback->scans));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"callback",
")",
"{",
"$",
"hydrated",
"=",
"new",
"CallbackEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"callback",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
... | Hydrate a callback object into a CallbackEntity object
@param stdClass $callback
@return CallbackEntity | [
"Hydrate",
"a",
"callback",
"object",
"into",
"a",
"CallbackEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/CallbackHydrator.php#L36-L81 | train |
nabu-3/core | nabu/data/site/traits/TNabuSiteRoleMask.php | TNabuSiteRoleMask.isForPublicZone | public function isForPublicZone(bool $strict = false)
{
if (!method_exists($this, 'getZone')) {
throw new ENabuCoreException(ENabuCoreException::ERROR_FEATURE_NOT_IMPLEMENTED);
}
$zone = $this->getZone();
return ($zone === CNabuSite::ZONE_PUBLIC || (!$strict && $zone === CNabuSite::ZONE_BOTH));
} | php | public function isForPublicZone(bool $strict = false)
{
if (!method_exists($this, 'getZone')) {
throw new ENabuCoreException(ENabuCoreException::ERROR_FEATURE_NOT_IMPLEMENTED);
}
$zone = $this->getZone();
return ($zone === CNabuSite::ZONE_PUBLIC || (!$strict && $zone === CNabuSite::ZONE_BOTH));
} | [
"public",
"function",
"isForPublicZone",
"(",
"bool",
"$",
"strict",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
",",
"'getZone'",
")",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_FEA... | Check if the Role is applied to Public Zone.
@param bool $strict If true, only roles with nb_site_map_role_zone = 'O' are valid. If false, 'O' and 'B' values
are true.
@return bool Return true if the Role applies to Public Zone. | [
"Check",
"if",
"the",
"Role",
"is",
"applied",
"to",
"Public",
"Zone",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/traits/TNabuSiteRoleMask.php#L39-L48 | train |
nabu-3/core | nabu/data/site/traits/TNabuSiteRoleMask.php | TNabuSiteRoleMask.isForPrivateZone | public function isForPrivateZone(bool $strict = false)
{
if (!method_exists($this, 'getZone')) {
throw new ENabuCoreException(ENabuCoreException::ERROR_FEATURE_NOT_IMPLEMENTED);
}
$zone = $this->getZone();
return ($zone === CNabuSite::ZONE_PRIVATE || (!$strict && $zone === CNabuSite::ZONE_BOTH));
} | php | public function isForPrivateZone(bool $strict = false)
{
if (!method_exists($this, 'getZone')) {
throw new ENabuCoreException(ENabuCoreException::ERROR_FEATURE_NOT_IMPLEMENTED);
}
$zone = $this->getZone();
return ($zone === CNabuSite::ZONE_PRIVATE || (!$strict && $zone === CNabuSite::ZONE_BOTH));
} | [
"public",
"function",
"isForPrivateZone",
"(",
"bool",
"$",
"strict",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
",",
"'getZone'",
")",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_FE... | Check if the Role is applied to Private Zone.
@param bool $strict If true, only roles with nb_site_map_role_zone= 'P' are valid. If false, 'P' and 'B' values
are true.
@return bool Return true if the Role applies to Private Zone. | [
"Check",
"if",
"the",
"Role",
"is",
"applied",
"to",
"Private",
"Zone",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/traits/TNabuSiteRoleMask.php#L56-L65 | train |
nabu-3/core | nabu/data/site/traits/TNabuSiteRoleMask.php | TNabuSiteRoleMask.isForBothZones | public function isForBothZones()
{
if (!method_exists($this, 'getZone')) {
throw new ENabuCoreException(ENabuCoreException::ERROR_FEATURE_NOT_IMPLEMENTED);
}
return $this->getZone() === CNabuSite::ZONE_BOTH;
} | php | public function isForBothZones()
{
if (!method_exists($this, 'getZone')) {
throw new ENabuCoreException(ENabuCoreException::ERROR_FEATURE_NOT_IMPLEMENTED);
}
return $this->getZone() === CNabuSite::ZONE_BOTH;
} | [
"public",
"function",
"isForBothZones",
"(",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
",",
"'getZone'",
")",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_FEATURE_NOT_IMPLEMENTED",
")",
";",
"}",
"r... | Check if the Role is applied to both zones.
@return bool Return true if the Role applies to both zones. | [
"Check",
"if",
"the",
"Role",
"is",
"applied",
"to",
"both",
"zones",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/traits/TNabuSiteRoleMask.php#L71-L78 | train |
nabu-3/core | nabu/data/site/traits/TNabuSiteRoleMask.php | TNabuSiteRoleMask.isZoneHidden | public function isZoneHidden()
{
if (!method_exists($this, 'getZone')) {
throw new ENabuCoreException(ENabuCoreException::ERROR_FEATURE_NOT_IMPLEMENTED);
}
$zone = $this->getZone();
return $zone !== CNabuSite::ZONE_PUBLIC && $zone !== CNabuSite::ZONE_PRIVATE && $zone !== CNabuSite::ZONE_HIDDEN;
} | php | public function isZoneHidden()
{
if (!method_exists($this, 'getZone')) {
throw new ENabuCoreException(ENabuCoreException::ERROR_FEATURE_NOT_IMPLEMENTED);
}
$zone = $this->getZone();
return $zone !== CNabuSite::ZONE_PUBLIC && $zone !== CNabuSite::ZONE_PRIVATE && $zone !== CNabuSite::ZONE_HIDDEN;
} | [
"public",
"function",
"isZoneHidden",
"(",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
",",
"'getZone'",
")",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_FEATURE_NOT_IMPLEMENTED",
")",
";",
"}",
"$",... | Check it the Role is hidden.
@return bool Return true if the Role is hidden and does not to be applied. | [
"Check",
"it",
"the",
"Role",
"is",
"hidden",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/traits/TNabuSiteRoleMask.php#L84-L93 | train |
nabu-3/core | nabu/core/traits/TNabuHashed.php | TNabuHashed.grantHash | public function grantHash(bool $save = false) : string
{
if (!nb_isValidGUID($hash = $this->getHash())) {
$this->setHash($hash = nb_generateGUID());
if ($save && $this instanceof CNabuDBObject) {
$this->save();
}
}
return $hash;
} | php | public function grantHash(bool $save = false) : string
{
if (!nb_isValidGUID($hash = $this->getHash())) {
$this->setHash($hash = nb_generateGUID());
if ($save && $this instanceof CNabuDBObject) {
$this->save();
}
}
return $hash;
} | [
"public",
"function",
"grantHash",
"(",
"bool",
"$",
"save",
"=",
"false",
")",
":",
"string",
"{",
"if",
"(",
"!",
"nb_isValidGUID",
"(",
"$",
"hash",
"=",
"$",
"this",
"->",
"getHash",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"setHash",
"(",
... | Grants that this object have a valid hash. Optionally can save the hash in the database.
@param bool $save If true, the save() method is called after grant the hash and just before return.
@return string Returns a valid hash. | [
"Grants",
"that",
"this",
"object",
"have",
"a",
"valid",
"hash",
".",
"Optionally",
"can",
"save",
"the",
"hash",
"in",
"the",
"database",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/core/traits/TNabuHashed.php#L39-L49 | train |
rips/php-connector-bundle | Hydrators/UserHydrator.php | UserHydrator.hydrateCollection | public static function hydrateCollection(array $users)
{
$hydrated = [];
foreach ($users as $user) {
$hydrated[] = self::hydrate($user);
}
return $hydrated;
} | php | public static function hydrateCollection(array $users)
{
$hydrated = [];
foreach ($users as $user) {
$hydrated[] = self::hydrate($user);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"users",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"users",
"as",
"$",
"user",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"(",
... | Hydrate a collection of user objects into a collection of
UserEntity objects
@param stdClass[] $users
@return UserEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"user",
"objects",
"into",
"a",
"collection",
"of",
"UserEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/UserHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/UserHydrator.php | UserHydrator.hydrate | public static function hydrate(stdClass $user)
{
$hydrated = new UserEntity();
if (isset($user->id)) {
$hydrated->setId($user->id);
}
if (isset($user->email)) {
$hydrated->setEmail($user->email);
}
if (isset($user->firstname)) {
$hydrated->setFirstname($user->firstname);
}
if (isset($user->lastname)) {
$hydrated->setLastname($user->lastname);
}
if (isset($user->valid_until)) {
$hydrated->setValidUntil(new DateTime($user->valid_until));
}
if (isset($user->organization)) {
$hydrated->setOrganization(OrgHydrator::hydrate($user->organization));
}
if (isset($user->roles)) {
$hydrated->setRoles($user->roles);
}
if (isset($user->root)) {
$hydrated->setRoot($user->root);
}
if (isset($user->whitelisted_ips)) {
$hydrated->setWhitelistedIps($user->whitelisted_ips);
}
if (isset($user->last_login)) {
$hydrated->setLastLogin(new DateTime($user->last_login));
}
if (isset($user->confirmation_token)) {
$hydrated->setConfirmationToken($user->confirmation_token);
}
if (isset($user->reset_token)) {
$hydrated->setResetToken($user->reset_token);
}
return $hydrated;
} | php | public static function hydrate(stdClass $user)
{
$hydrated = new UserEntity();
if (isset($user->id)) {
$hydrated->setId($user->id);
}
if (isset($user->email)) {
$hydrated->setEmail($user->email);
}
if (isset($user->firstname)) {
$hydrated->setFirstname($user->firstname);
}
if (isset($user->lastname)) {
$hydrated->setLastname($user->lastname);
}
if (isset($user->valid_until)) {
$hydrated->setValidUntil(new DateTime($user->valid_until));
}
if (isset($user->organization)) {
$hydrated->setOrganization(OrgHydrator::hydrate($user->organization));
}
if (isset($user->roles)) {
$hydrated->setRoles($user->roles);
}
if (isset($user->root)) {
$hydrated->setRoot($user->root);
}
if (isset($user->whitelisted_ips)) {
$hydrated->setWhitelistedIps($user->whitelisted_ips);
}
if (isset($user->last_login)) {
$hydrated->setLastLogin(new DateTime($user->last_login));
}
if (isset($user->confirmation_token)) {
$hydrated->setConfirmationToken($user->confirmation_token);
}
if (isset($user->reset_token)) {
$hydrated->setResetToken($user->reset_token);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"user",
")",
"{",
"$",
"hydrated",
"=",
"new",
"UserEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"user",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
"$",
... | Hydrate a user object into a UserEntity object
@param stdClass $user
@return UserEntity | [
"Hydrate",
"a",
"user",
"object",
"into",
"a",
"UserEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/UserHydrator.php#L35-L88 | train |
orchestral/lumen | src/Routing/UrlGenerator.php | UrlGenerator.replaceRouteParameters | protected function replaceRouteParameters($route, &$parameters = [])
{
return \preg_replace_callback('/\{(.*?)(:.*?)?(\{[0-9,]+\})?\}/', function ($m) use (&$parameters) {
return isset($parameters[$m[1]]) ? Arr::pull($parameters, $m[1]) : $m[0];
}, $route);
} | php | protected function replaceRouteParameters($route, &$parameters = [])
{
return \preg_replace_callback('/\{(.*?)(:.*?)?(\{[0-9,]+\})?\}/', function ($m) use (&$parameters) {
return isset($parameters[$m[1]]) ? Arr::pull($parameters, $m[1]) : $m[0];
}, $route);
} | [
"protected",
"function",
"replaceRouteParameters",
"(",
"$",
"route",
",",
"&",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"return",
"\\",
"preg_replace_callback",
"(",
"'/\\{(.*?)(:.*?)?(\\{[0-9,]+\\})?\\}/'",
",",
"function",
"(",
"$",
"m",
")",
"use",
"(",
... | Replace the route parameters with their parameter.
@param string $route
@param array $parameters
@return string | [
"Replace",
"the",
"route",
"parameters",
"with",
"their",
"parameter",
"."
] | 85a004e7cde0517b527241154f5ad031b7215851 | https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/src/Routing/UrlGenerator.php#L329-L334 | train |
nabu-3/core | nabu/data/site/CNabuSiteMapRole.php | CNabuSiteMapRole.getMapRolesForSite | static public function getMapRolesForSite($nb_site)
{
$nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID);
if (is_numeric($nb_site_id)) {
$retval = CNabuEngine::getEngine()
->getMainDB()
->getQueryAsObjectArray(
'\nabu\data\site\CNabuSiteMapRole', null,
'select smr.* '
. 'from nb_site_map sm, nb_site_map_role smr '
. 'where sm.nb_site_map_id=smr.nb_site_map_id '
. 'and sm.nb_site_id=%site_id$d '
. 'order by sm.nb_site_map_order, smr.nb_role_id',
array(
'site_id' => $nb_site_id
), null, true
)
;
} else {
$retval = null;
}
return $retval;
} | php | static public function getMapRolesForSite($nb_site)
{
$nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID);
if (is_numeric($nb_site_id)) {
$retval = CNabuEngine::getEngine()
->getMainDB()
->getQueryAsObjectArray(
'\nabu\data\site\CNabuSiteMapRole', null,
'select smr.* '
. 'from nb_site_map sm, nb_site_map_role smr '
. 'where sm.nb_site_map_id=smr.nb_site_map_id '
. 'and sm.nb_site_id=%site_id$d '
. 'order by sm.nb_site_map_order, smr.nb_role_id',
array(
'site_id' => $nb_site_id
), null, true
)
;
} else {
$retval = null;
}
return $retval;
} | [
"static",
"public",
"function",
"getMapRolesForSite",
"(",
"$",
"nb_site",
")",
"{",
"$",
"nb_site_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site",
",",
"NABU_SITE_FIELD_ID",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_site_id",
")",
")",
"{",
"$",
... | Get all roles to be applied to all maps of a Site.
@param mixed $nb_site Site to retrieve Site Map Roles.
@return CNabuSiteMapRoleList Returns a Site Map Role List with roles. If no roles the list is empty. | [
"Get",
"all",
"roles",
"to",
"be",
"applied",
"to",
"all",
"maps",
"of",
"a",
"Site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteMapRole.php#L43-L66 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/CommentHydrator.php | CommentHydrator.hydrateCollection | public static function hydrateCollection(array $comments)
{
$hydrated = [];
foreach ($comments as $comment) {
$hydrated[] = self::hydrate($comment);
}
return $hydrated;
} | php | public static function hydrateCollection(array $comments)
{
$hydrated = [];
foreach ($comments as $comment) {
$hydrated[] = self::hydrate($comment);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"comments",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"comments",
"as",
"$",
"comment",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",... | Hydrate a collection of comment objects into a collection of
CommentEntity objects
@param stdClass[] $comments
@return CommentEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"comment",
"objects",
"into",
"a",
"collection",
"of",
"CommentEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/CommentHydrator.php#L20-L29 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/CommentHydrator.php | CommentHydrator.hydrate | public static function hydrate(stdClass $comment)
{
$hydrated = new CommentEntity();
if (isset($comment->id)) {
$hydrated->setId($comment->id);
}
if (isset($comment->comment)) {
$hydrated->setComment($comment->comment);
}
if (isset($comment->created_at)) {
$hydrated->setCreatedAt(new DateTime($comment->created_at));
}
if (isset($comment->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($comment->created_by));
}
if (isset($comment->source)) {
$hydrated->setSource($comment->source);
}
if (isset($comment->issue)) {
$hydrated->setIssue(IssueHydrator::hydrate($comment->issue));
}
return $hydrated;
} | php | public static function hydrate(stdClass $comment)
{
$hydrated = new CommentEntity();
if (isset($comment->id)) {
$hydrated->setId($comment->id);
}
if (isset($comment->comment)) {
$hydrated->setComment($comment->comment);
}
if (isset($comment->created_at)) {
$hydrated->setCreatedAt(new DateTime($comment->created_at));
}
if (isset($comment->created_by)) {
$hydrated->setCreatedBy(UserHydrator::hydrate($comment->created_by));
}
if (isset($comment->source)) {
$hydrated->setSource($comment->source);
}
if (isset($comment->issue)) {
$hydrated->setIssue(IssueHydrator::hydrate($comment->issue));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"comment",
")",
"{",
"$",
"hydrated",
"=",
"new",
"CommentEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"comment",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"("... | Hydrate a comment object into a CommentEntity object
@param stdClass $comment
@return CommentEntity | [
"Hydrate",
"a",
"comment",
"object",
"into",
"a",
"CommentEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/CommentHydrator.php#L37-L66 | train |
nabu-3/core | nabu/data/catalog/base/CNabuCatalogItemTagBase.php | CNabuCatalogItemTagBase.setCatalogItemId | public function setCatalogItemId(int $nb_catalog_item_id) : CNabuDataObject
{
if ($nb_catalog_item_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_catalog_item_id")
);
}
$this->setValue('nb_catalog_item_id', $nb_catalog_item_id);
return $this;
} | php | public function setCatalogItemId(int $nb_catalog_item_id) : CNabuDataObject
{
if ($nb_catalog_item_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_catalog_item_id")
);
}
$this->setValue('nb_catalog_item_id', $nb_catalog_item_id);
return $this;
} | [
"public",
"function",
"setCatalogItemId",
"(",
"int",
"$",
"nb_catalog_item_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_catalog_item_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE... | Sets the Catalog Item Id attribute value.
@param int $nb_catalog_item_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Catalog",
"Item",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/base/CNabuCatalogItemTagBase.php#L145-L156 | train |
rips/php-connector-bundle | Services/System/LdapService.php | LdapService.get | public function get(array $queryParams = [])
{
$response = $this->api->systems()->ldap()->get($queryParams);
return new LdapResponse($response);
} | php | public function get(array $queryParams = [])
{
$response = $this->api->systems()->ldap()->get($queryParams);
return new LdapResponse($response);
} | [
"public",
"function",
"get",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"systems",
"(",
")",
"->",
"ldap",
"(",
")",
"->",
"get",
"(",
"$",
"queryParams",
")",
";",
"return",
"... | Get LDAP settings
@param array $queryParams
@return LdapResponse | [
"Get",
"LDAP",
"settings"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/System/LdapService.php#L37-L42 | train |
rips/php-connector-bundle | Services/System/LdapService.php | LdapService.update | public function update(LdapBuilder $input, array $queryParams = [])
{
$response = $this->api->systems()->ldap()->update($input->toArray(), $queryParams);
return new LdapResponse($response);
} | php | public function update(LdapBuilder $input, array $queryParams = [])
{
$response = $this->api->systems()->ldap()->update($input->toArray(), $queryParams);
return new LdapResponse($response);
} | [
"public",
"function",
"update",
"(",
"LdapBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"systems",
"(",
")",
"->",
"ldap",
"(",
")",
"->",
"update",
"(",
"$"... | Update LDAP settings
@param LdapBuilder $input
@param array $queryParams
@return LdapResponse | [
"Update",
"LDAP",
"settings"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/System/LdapService.php#L51-L56 | train |
rips/php-connector-bundle | Services/System/LdapService.php | LdapService.sync | public function sync(array $queryParams = [])
{
$response = $this->api->systems()->ldap()->sync($queryParams);
return new BaseResponse($response);
} | php | public function sync(array $queryParams = [])
{
$response = $this->api->systems()->ldap()->sync($queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"sync",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"systems",
"(",
")",
"->",
"ldap",
"(",
")",
"->",
"sync",
"(",
"$",
"queryParams",
")",
";",
"return",
... | Synchronize users with LDAP directory
@param array $queryParams
@return BaseResponse | [
"Synchronize",
"users",
"with",
"LDAP",
"directory"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/System/LdapService.php#L64-L69 | train |
rips/php-connector-bundle | Services/SettingService.php | SettingService.getAll | public function getAll(array $queryParams = [])
{
$response = $this->api->settings()->getAll($queryParams);
return new SettingsResponse($response);
} | php | public function getAll(array $queryParams = [])
{
$response = $this->api->settings()->getAll($queryParams);
return new SettingsResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"settings",
"(",
")",
"->",
"getAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"SettingsResponse... | Get all settings
@param array $queryParams
@return SettingsResponse | [
"Get",
"all",
"settings"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/SettingService.php#L33-L38 | train |
rips/php-connector-bundle | Services/SettingService.php | SettingService.createOrUpdate | public function createOrUpdate($key, SettingBuilder $input, array $queryParams = [])
{
$response = $this->api->settings()->createOrUpdate($key, $input->toArray(), $queryParams);
return new SettingResponse($response);
} | php | public function createOrUpdate($key, SettingBuilder $input, array $queryParams = [])
{
$response = $this->api->settings()->createOrUpdate($key, $input->toArray(), $queryParams);
return new SettingResponse($response);
} | [
"public",
"function",
"createOrUpdate",
"(",
"$",
"key",
",",
"SettingBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"settings",
"(",
")",
"->",
"createOrUpdate",
... | Create or update a quota
@param string $key
@param SettingBuilder $input
@param array $queryParams
@return SettingResponse | [
"Create",
"or",
"update",
"a",
"quota"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/SettingService.php#L62-L67 | train |
rips/php-connector-bundle | Services/SettingService.php | SettingService.deleteAll | public function deleteAll(array $queryParams = [])
{
$response = $this->api->settings()->deleteAll($queryParams);
return new BaseResponse($response);
} | php | public function deleteAll(array $queryParams = [])
{
$response = $this->api->settings()->deleteAll($queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"deleteAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"settings",
"(",
")",
"->",
"deleteAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"BaseRespon... | Delete all settings
@param array $queryParams
@return BaseResponse | [
"Delete",
"all",
"settings"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/SettingService.php#L75-L80 | train |
nabu-3/core | nabu/core/CNabuErrorHandler.php | CNabuErrorHandler.errorHandler | public function errorHandler(int $errno, string $errstr, string $errfile, string $errline, array $errcontext)
{
$this->dumpStack($errstr, $errno, $errfile, $errline, $errcontext);
return true;
} | php | public function errorHandler(int $errno, string $errstr, string $errfile, string $errline, array $errcontext)
{
$this->dumpStack($errstr, $errno, $errfile, $errline, $errcontext);
return true;
} | [
"public",
"function",
"errorHandler",
"(",
"int",
"$",
"errno",
",",
"string",
"$",
"errstr",
",",
"string",
"$",
"errfile",
",",
"string",
"$",
"errline",
",",
"array",
"$",
"errcontext",
")",
"{",
"$",
"this",
"->",
"dumpStack",
"(",
"$",
"errstr",
"... | Error handler function. Dumps the error to errors log file and stores internally
to send at the end of the dispatch method, to a logs store.
@param int $errno Error level
@param string $errstr Error message
@param string $errfile File name where the error was generated
@param string $errline File line where the error was generated
@param array $errcontext Matrix as described in {@see http://php.net/manual/en/function.set-error-handler.php}
@return bool Returns true if the error is treated and the execution can continue,
or false if the execution needs to be finished now. | [
"Error",
"handler",
"function",
".",
"Dumps",
"the",
"error",
"to",
"errors",
"log",
"file",
"and",
"stores",
"internally",
"to",
"send",
"at",
"the",
"end",
"of",
"the",
"dispatch",
"method",
"to",
"a",
"logs",
"store",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/core/CNabuErrorHandler.php#L80-L84 | train |
nabu-3/core | nabu/core/CNabuErrorHandler.php | CNabuErrorHandler.dumpStack | public function dumpStack(
string $message = null,
string $type = null,
string $errfile = null,
int $errline = null,
$errcontext = null,
array $stack = null
) {
global $NABU_MESSAGE_TYPE_NAME;
if (($errtype = nb_getArrayValueByKey($type, $NABU_MESSAGE_TYPE_NAME)) === null) {
$this->nb_engine->errorLog("Unknow error type [$type]: $message in $errfile [line:$errline]");
} else {
$this->nb_engine->errorLog("$errtype: $message in $errfile [line:$errline]");
}
if ($stack === null) {
$stack = debug_backtrace(true);
}
$count = -1;
do {
foreach ($stack as $line) {
if ($count < 0 &&
(!array_key_exists('file', $line) ||
!array_key_exists('line', $line) ||
$line['file'] !== $errfile ||
$line['line'] !== $errline
)
) {
continue;
} elseif (array_key_exists('file', $line) &&
$line['file'] === $errfile && $line['line'] === $errline
) {
$count++;
continue;
}
$source = '';
if (array_key_exists(self::LINE_CLASS, $line)) {
$source .= $line[self::LINE_CLASS];
}
if (array_key_exists('type', $line)) {
$source .= $line['type'];
}
if (array_key_exists(self::LINE_FUNCTION, $line)) {
$source .= $line[self::LINE_FUNCTION];
}
if (array_key_exists(self::LINE_CLASS, $line) &&
array_key_exists('type', $line) &&
array_key_exists(self::LINE_FUNCTION, $line) &&
array_key_exists('args', $line) &&
is_array($line['args']) &&
count($line['args']) > 0 &&
$line[self::LINE_CLASS] == 'nabu\\core\\CNabuPluginManager' &&
$line[self::LINE_FUNCTION] == 'invoqueCommand'
) {
$source .= ' calling command ['.$line['args'][0].']';
}
if (array_key_exists('file', $line)) {
$source .= ' in '.$line['file'];
}
if (array_key_exists('line', $line)) {
$source .= " [line:$line[line]]";
}
$this->nb_engine->errorLog("#$count at $source");
$count++;
}
$count++;
} while ($count < 1);
} | php | public function dumpStack(
string $message = null,
string $type = null,
string $errfile = null,
int $errline = null,
$errcontext = null,
array $stack = null
) {
global $NABU_MESSAGE_TYPE_NAME;
if (($errtype = nb_getArrayValueByKey($type, $NABU_MESSAGE_TYPE_NAME)) === null) {
$this->nb_engine->errorLog("Unknow error type [$type]: $message in $errfile [line:$errline]");
} else {
$this->nb_engine->errorLog("$errtype: $message in $errfile [line:$errline]");
}
if ($stack === null) {
$stack = debug_backtrace(true);
}
$count = -1;
do {
foreach ($stack as $line) {
if ($count < 0 &&
(!array_key_exists('file', $line) ||
!array_key_exists('line', $line) ||
$line['file'] !== $errfile ||
$line['line'] !== $errline
)
) {
continue;
} elseif (array_key_exists('file', $line) &&
$line['file'] === $errfile && $line['line'] === $errline
) {
$count++;
continue;
}
$source = '';
if (array_key_exists(self::LINE_CLASS, $line)) {
$source .= $line[self::LINE_CLASS];
}
if (array_key_exists('type', $line)) {
$source .= $line['type'];
}
if (array_key_exists(self::LINE_FUNCTION, $line)) {
$source .= $line[self::LINE_FUNCTION];
}
if (array_key_exists(self::LINE_CLASS, $line) &&
array_key_exists('type', $line) &&
array_key_exists(self::LINE_FUNCTION, $line) &&
array_key_exists('args', $line) &&
is_array($line['args']) &&
count($line['args']) > 0 &&
$line[self::LINE_CLASS] == 'nabu\\core\\CNabuPluginManager' &&
$line[self::LINE_FUNCTION] == 'invoqueCommand'
) {
$source .= ' calling command ['.$line['args'][0].']';
}
if (array_key_exists('file', $line)) {
$source .= ' in '.$line['file'];
}
if (array_key_exists('line', $line)) {
$source .= " [line:$line[line]]";
}
$this->nb_engine->errorLog("#$count at $source");
$count++;
}
$count++;
} while ($count < 1);
} | [
"public",
"function",
"dumpStack",
"(",
"string",
"$",
"message",
"=",
"null",
",",
"string",
"$",
"type",
"=",
"null",
",",
"string",
"$",
"errfile",
"=",
"null",
",",
"int",
"$",
"errline",
"=",
"null",
",",
"$",
"errcontext",
"=",
"null",
",",
"ar... | Analizes and creates a Stack sequence of call from the beginning of the execution
until the point of error and log each step in the Engine Log store.
@global string $NABU_MESSAGE_TYPE_NAME
@param string|null $message Error message
@param string|null $type Error type/level
@param string|null $errfile File name where the error was generated
@param int|null $errline File line where the error was generated
@param mixed|null $errcontext Matrix as described in {@see http://php.net/manual/en/function.set-error-handler.php}
@param array|null $stack Complete list of stack calls from the beginning of the execution until the point of error | [
"Analizes",
"and",
"creates",
"a",
"Stack",
"sequence",
"of",
"call",
"from",
"the",
"beginning",
"of",
"the",
"execution",
"until",
"the",
"point",
"of",
"error",
"and",
"log",
"each",
"step",
"in",
"the",
"Engine",
"Log",
"store",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/core/CNabuErrorHandler.php#L97-L170 | train |
nabu-3/core | nabu/core/CNabuErrorHandler.php | CNabuErrorHandler.traceLog | public function traceLog(string $key = null, $message = null)
{
if ($this->trace_log_enabled) {
if (is_array($message) || is_object($message)) {
$text = print_r($message, true);
} elseif ($message === null) {
$text = "[null]";
} elseif ($message === false) {
$text = "[false]";
} elseif ($message === true) {
$text = "[true]";
} else {
$text = $message;
}
error_log("=== " . ($key !== null ? "$key: " : '') . $text);
}
if ($key === null) {
if ($this->trace_log_buffer === null) {
$this->trace_log_buffer = array();
}
if (array_key_exists(self::MESSAGES_STACK, $this->trace_log_buffer)) {
$this->trace_log_buffer[self::MESSAGES_STACK][] = $message;
} else {
$this->trace_log_buffer[self::MESSAGES_STACK] = array($message);
}
} else {
$this->trace_log_buffer[$key] = $message;
}
} | php | public function traceLog(string $key = null, $message = null)
{
if ($this->trace_log_enabled) {
if (is_array($message) || is_object($message)) {
$text = print_r($message, true);
} elseif ($message === null) {
$text = "[null]";
} elseif ($message === false) {
$text = "[false]";
} elseif ($message === true) {
$text = "[true]";
} else {
$text = $message;
}
error_log("=== " . ($key !== null ? "$key: " : '') . $text);
}
if ($key === null) {
if ($this->trace_log_buffer === null) {
$this->trace_log_buffer = array();
}
if (array_key_exists(self::MESSAGES_STACK, $this->trace_log_buffer)) {
$this->trace_log_buffer[self::MESSAGES_STACK][] = $message;
} else {
$this->trace_log_buffer[self::MESSAGES_STACK] = array($message);
}
} else {
$this->trace_log_buffer[$key] = $message;
}
} | [
"public",
"function",
"traceLog",
"(",
"string",
"$",
"key",
"=",
"null",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"trace_log_enabled",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"message",
")",
"||",
"is_object",
"("... | Traces a categorized data in the error log default system and stores it inside
the instance to be transmited after to a logs analyzer database.
@param string|null $key Categorized data key identifier
@param mixed|null $message Text message to log | [
"Traces",
"a",
"categorized",
"data",
"in",
"the",
"error",
"log",
"default",
"system",
"and",
"stores",
"it",
"inside",
"the",
"instance",
"to",
"be",
"transmited",
"after",
"to",
"a",
"logs",
"analyzer",
"database",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/core/CNabuErrorHandler.php#L190-L219 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/AutoUuid.php | AutoUuid.bootAutoUuid | protected static function bootAutoUuid()
{
static::creating(function ($model) {
foreach($model->getAutoUuids() as $autoUuid) {
if (empty($model->{$autoUuid})) {
$model->setAttribute($autoUuid, $model->generateUuid()->getBytes());
}
}
});
} | php | protected static function bootAutoUuid()
{
static::creating(function ($model) {
foreach($model->getAutoUuids() as $autoUuid) {
if (empty($model->{$autoUuid})) {
$model->setAttribute($autoUuid, $model->generateUuid()->getBytes());
}
}
});
} | [
"protected",
"static",
"function",
"bootAutoUuid",
"(",
")",
"{",
"static",
"::",
"creating",
"(",
"function",
"(",
"$",
"model",
")",
"{",
"foreach",
"(",
"$",
"model",
"->",
"getAutoUuids",
"(",
")",
"as",
"$",
"autoUuid",
")",
"{",
"if",
"(",
"empty... | Boot the uuid trait for a model.
@return void | [
"Boot",
"the",
"uuid",
"trait",
"for",
"a",
"model",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/AutoUuid.php#L14-L23 | train |
rips/php-connector-bundle | Services/ApplicationService.php | ApplicationService.getById | public function getById($appId, array $queryParams = [])
{
$response = $this->api->applications()->getById($appId, $queryParams);
return new ApplicationResponse($response);
} | php | public function getById($appId, array $queryParams = [])
{
$response = $this->api->applications()->getById($appId, $queryParams);
return new ApplicationResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"getById",
"(",
"$",
"appId",
",",
"$",
"queryParams"... | Get application by id
@param int $appId
@param array $queryParams
@return ApplicationResponse | [
"Get",
"application",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/ApplicationService.php#L47-L52 | train |
rips/php-connector-bundle | Services/ApplicationService.php | ApplicationService.update | public function update($appId, ApplicationBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->update($appId, $input->toArray(), $queryParams);
return new ApplicationResponse($response);
} | php | public function update($appId, ApplicationBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->update($appId, $input->toArray(), $queryParams);
return new ApplicationResponse($response);
} | [
"public",
"function",
"update",
"(",
"$",
"appId",
",",
"ApplicationBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"update",
"(",
... | Update an existing application
@param int $appId
@param ApplicationBuilder $input
@param array $queryParams
@return ApplicationResponse | [
"Update",
"an",
"existing",
"application"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/ApplicationService.php#L76-L81 | train |
rips/php-connector-bundle | Services/ApplicationService.php | ApplicationService.deleteAll | public function deleteAll(array $queryParams = [])
{
$response = $this->api->applications()->deleteAll($queryParams);
return new BaseResponse($response);
} | php | public function deleteAll(array $queryParams = [])
{
$response = $this->api->applications()->deleteAll($queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"deleteAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"deleteAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"BaseRe... | Delete all applications
@param array $queryParams
@return BaseResponse | [
"Delete",
"all",
"applications"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/ApplicationService.php#L89-L94 | train |
TypiCMS/History | src/Traits/Historable.php | Historable.writeHistory | public function writeHistory($action, $title = null, array $old = [], array $new = [])
{
$data['historable_id'] = $this->getKey();
$data['historable_type'] = get_class($this);
$data['user_id'] = auth()->id();
$data['title'] = $title;
$data['icon_class'] = $this->iconClass($action);
$data['historable_table'] = $this->getTable();
$data['action'] = $action;
$data['old'] = $old;
$data['new'] = $new;
(new EloquentHistory())->create($data);
} | php | public function writeHistory($action, $title = null, array $old = [], array $new = [])
{
$data['historable_id'] = $this->getKey();
$data['historable_type'] = get_class($this);
$data['user_id'] = auth()->id();
$data['title'] = $title;
$data['icon_class'] = $this->iconClass($action);
$data['historable_table'] = $this->getTable();
$data['action'] = $action;
$data['old'] = $old;
$data['new'] = $new;
(new EloquentHistory())->create($data);
} | [
"public",
"function",
"writeHistory",
"(",
"$",
"action",
",",
"$",
"title",
"=",
"null",
",",
"array",
"$",
"old",
"=",
"[",
"]",
",",
"array",
"$",
"new",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"[",
"'historable_id'",
"]",
"=",
"$",
"this",
"->"... | Write History row.
@param string $action
@param string $title
@param string $locale
@return null | [
"Write",
"History",
"row",
"."
] | 00fca293415440490a80b63d5fa7c9d1213bc4bb | https://github.com/TypiCMS/History/blob/00fca293415440490a80b63d5fa7c9d1213bc4bb/src/Traits/Historable.php#L64-L76 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.