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/Application/Scan/EntrypointService.php | EntrypointService.getAll | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->entrypoints()
->getAll($appId, $scanId, $queryParams);
return new EntrypointsResponse($response);
} | php | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->entrypoints()
->getAll($appId, $scanId, $queryParams);
return new EntrypointsResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"entryp... | Get all entrypoints for a scan
@param int $appId
@param int $scanId
@param array $queryParams
@return EntrypointsResponse | [
"Get",
"all",
"entrypoints",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/EntrypointService.php#L34-L43 | train |
rips/php-connector-bundle | Services/Application/Scan/EntrypointService.php | EntrypointService.getById | public function getById($appId, $scanId, $entrypointId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->entrypoints()
->getById($appId, $scanId, $entrypointId, $queryParams);
return new EntrypointResponse($response);
} | php | public function getById($appId, $scanId, $entrypointId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->entrypoints()
->getById($appId, $scanId, $entrypointId, $queryParams);
return new EntrypointResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"entrypointId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans"... | Get entrypoint for scan by id
@param int $appId
@param int $scanId
@param int $entrypointId
@param array $queryParams
@return EntrypointResponse | [
"Get",
"entrypoint",
"for",
"scan",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/EntrypointService.php#L54-L63 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/TaintHydrator.php | TaintHydrator.hydrateCollection | public static function hydrateCollection(array $taints)
{
$hydrated = [];
foreach ($taints as $taint) {
$hydrated[] = self::hydrate($taint);
}
return $hydrated;
} | php | public static function hydrateCollection(array $taints)
{
$hydrated = [];
foreach ($taints as $taint) {
$hydrated[] = self::hydrate($taint);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"taints",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"taints",
"as",
"$",
"taint",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"("... | Hydrate a collection of taint objects into a collection of
TaintEntity objects
@param stdClass[] $taints
@return TaintEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"taint",
"objects",
"into",
"a",
"collection",
"of",
"TaintEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/TaintHydrator.php#L17-L26 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/TaintHydrator.php | TaintHydrator.hydrate | public static function hydrate(stdClass $taint)
{
$hydrated = new TaintEntity();
if (isset($taint->id)) {
$hydrated->setId($taint->id);
}
if (isset($taint->start_line)) {
$hydrated->setStartLine($taint->start_line);
}
if (isset($taint->end_line)) {
$hydrated->setEndLine($taint->end_line);
}
if (isset($taint->start_column)) {
$hydrated->setStartColumn($taint->start_column);
}
if (isset($taint->end_column)) {
$hydrated->setEndColumn($taint->end_column);
}
return $hydrated;
} | php | public static function hydrate(stdClass $taint)
{
$hydrated = new TaintEntity();
if (isset($taint->id)) {
$hydrated->setId($taint->id);
}
if (isset($taint->start_line)) {
$hydrated->setStartLine($taint->start_line);
}
if (isset($taint->end_line)) {
$hydrated->setEndLine($taint->end_line);
}
if (isset($taint->start_column)) {
$hydrated->setStartColumn($taint->start_column);
}
if (isset($taint->end_column)) {
$hydrated->setEndColumn($taint->end_column);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"taint",
")",
"{",
"$",
"hydrated",
"=",
"new",
"TaintEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"taint",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
"$... | Hydrate a taint object into a TaintEntity object
@param stdClass $taint
@return TaintEntity | [
"Hydrate",
"a",
"taint",
"object",
"into",
"a",
"TaintEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/TaintHydrator.php#L34-L59 | train |
nabu-3/core | nabu/data/catalog/base/CNabuCatalogLanguageBase.php | CNabuCatalogLanguageBase.setCatalogId | public function setCatalogId(int $nb_catalog_id) : CNabuDataObject
{
if ($nb_catalog_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_catalog_id")
);
}
$this->setValue('nb_catalog_id', $nb_catalog_id);
return $this;
} | php | public function setCatalogId(int $nb_catalog_id) : CNabuDataObject
{
if ($nb_catalog_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_catalog_id")
);
}
$this->setValue('nb_catalog_id', $nb_catalog_id);
return $this;
} | [
"public",
"function",
"setCatalogId",
"(",
"int",
"$",
"nb_catalog_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_catalog_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_I... | Sets the Catalog Id attribute value.
@param int $nb_catalog_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Catalog",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/catalog/base/CNabuCatalogLanguageBase.php#L184-L195 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/ConcatHydrator.php | ConcatHydrator.hydrateCollection | public static function hydrateCollection(array $concats)
{
$hydrated = [];
foreach ($concats as $concat) {
$hydrated[] = self::hydrate($concat);
}
return $hydrated;
} | php | public static function hydrateCollection(array $concats)
{
$hydrated = [];
foreach ($concats as $concat) {
$hydrated[] = self::hydrate($concat);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"concats",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"concats",
"as",
"$",
"concat",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
... | Hydrate a collection of concat objects into a collection of
ConcatEntity objects
@param stdClass[] $concats
@return ConcatEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"concat",
"objects",
"into",
"a",
"collection",
"of",
"ConcatEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/ConcatHydrator.php#L17-L26 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/ConcatHydrator.php | ConcatHydrator.hydrate | public static function hydrate(stdClass $concat)
{
$hydrated = new ConcatEntity();
if (isset($concat->id)) {
$hydrated->setId($concat->id);
}
if (isset($concat->line)) {
$hydrated->setLine($concat->line);
}
if (isset($concat->start_line)) {
$hydrated->setStartLine($concat->start_line);
}
if (isset($concat->end_line)) {
$hydrated->setEndLine($concat->end_line);
}
if (isset($concat->file)) {
$hydrated->setFile(FileHydrator::hydrate($concat->file));
}
if (isset($concat->function)) {
$hydrated->setFunction(CustomFunctionHydrator::hydrate($concat->function));
}
if (isset($concat->class)) {
$hydrated->setClass(CustomClassHydrator::hydrate($concat->class));
}
if (isset($concat->start_column)) {
$hydrated->setStartColumn($concat->start_column);
}
if (isset($concat->end_column)) {
$hydrated->setEndColumn($concat->end_column);
}
if (isset($concat->taint)) {
$hydrated->setTaint(TaintHydrator::hydrate($concat->taint));
}
return $hydrated;
} | php | public static function hydrate(stdClass $concat)
{
$hydrated = new ConcatEntity();
if (isset($concat->id)) {
$hydrated->setId($concat->id);
}
if (isset($concat->line)) {
$hydrated->setLine($concat->line);
}
if (isset($concat->start_line)) {
$hydrated->setStartLine($concat->start_line);
}
if (isset($concat->end_line)) {
$hydrated->setEndLine($concat->end_line);
}
if (isset($concat->file)) {
$hydrated->setFile(FileHydrator::hydrate($concat->file));
}
if (isset($concat->function)) {
$hydrated->setFunction(CustomFunctionHydrator::hydrate($concat->function));
}
if (isset($concat->class)) {
$hydrated->setClass(CustomClassHydrator::hydrate($concat->class));
}
if (isset($concat->start_column)) {
$hydrated->setStartColumn($concat->start_column);
}
if (isset($concat->end_column)) {
$hydrated->setEndColumn($concat->end_column);
}
if (isset($concat->taint)) {
$hydrated->setTaint(TaintHydrator::hydrate($concat->taint));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"concat",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ConcatEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"concat",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
... | Hydrate a concat object into a ConcatEntity object
@param stdClass $concat
@return ConcatEntity | [
"Hydrate",
"a",
"concat",
"object",
"into",
"a",
"ConcatEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/ConcatHydrator.php#L34-L79 | train |
rips/php-connector-bundle | Services/OAuth2/ClientService.php | ClientService.getAll | public function getAll(array $queryParams = [])
{
$response = $this->api->oauth2()->clients()->getAll($queryParams);
return new ClientsResponse($response);
} | php | public function getAll(array $queryParams = [])
{
$response = $this->api->oauth2()->clients()->getAll($queryParams);
return new ClientsResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"oauth2",
"(",
")",
"->",
"clients",
"(",
")",
"->",
"getAll",
"(",
"$",
"queryParams",
")",
";",
"retu... | Get all clients
@param array $queryParams
@return ClientsResponse | [
"Get",
"all",
"clients"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/OAuth2/ClientService.php#L33-L38 | train |
rips/php-connector-bundle | Services/OAuth2/ClientService.php | ClientService.getById | public function getById($clientId, array $queryParams = [])
{
$response = $this->api->oauth2()->clients()->getById($clientId, $queryParams);
return new ClientResponse($response);
} | php | public function getById($clientId, array $queryParams = [])
{
$response = $this->api->oauth2()->clients()->getById($clientId, $queryParams);
return new ClientResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"clientId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"oauth2",
"(",
")",
"->",
"clients",
"(",
")",
"->",
"getById",
"(",
"$",
"clien... | Get a client by id
@param int $clientId
@param array $queryParams
@return ClientResponse | [
"Get",
"a",
"client",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/OAuth2/ClientService.php#L47-L52 | train |
rips/php-connector-bundle | Services/OAuth2/ClientService.php | ClientService.create | public function create(ClientBuilder $input, array $queryParams = [])
{
$response = $this->api->oauth2()->clients()->create($input->toArray(), $queryParams);
return new ClientResponse($response);
} | php | public function create(ClientBuilder $input, array $queryParams = [])
{
$response = $this->api->oauth2()->clients()->create($input->toArray(), $queryParams);
return new ClientResponse($response);
} | [
"public",
"function",
"create",
"(",
"ClientBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"oauth2",
"(",
")",
"->",
"clients",
"(",
")",
"->",
"create",
"(",
... | Create a new client
@param ClientBuilder $input
@param array $queryParams
@return ClientResponse | [
"Create",
"a",
"new",
"client"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/OAuth2/ClientService.php#L61-L66 | train |
rips/php-connector-bundle | Services/OAuth2/ClientService.php | ClientService.delete | public function delete($clientId, array $queryParams)
{
$response = $this->api->oauth2()->clients()->delete($clientId, $queryParams);
return new BaseResponse($response);
} | php | public function delete($clientId, array $queryParams)
{
$response = $this->api->oauth2()->clients()->delete($clientId, $queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"delete",
"(",
"$",
"clientId",
",",
"array",
"$",
"queryParams",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"oauth2",
"(",
")",
"->",
"clients",
"(",
")",
"->",
"delete",
"(",
"$",
"clientId",
",",
"$",
"... | Delete a client
@param int $clientId
@param array $queryParams
@return BaseResponse | [
"Delete",
"a",
"client"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/OAuth2/ClientService.php#L90-L95 | train |
php-xapi/model | src/Account.php | Account.equals | public function equals(Account $account): bool
{
if ($this->name !== $account->name) {
return false;
}
if (!$this->homePage->equals($account->homePage)) {
return false;
}
return true;
} | php | public function equals(Account $account): bool
{
if ($this->name !== $account->name) {
return false;
}
if (!$this->homePage->equals($account->homePage)) {
return false;
}
return true;
} | [
"public",
"function",
"equals",
"(",
"Account",
"$",
"account",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"name",
"!==",
"$",
"account",
"->",
"name",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"homePage",
... | Checks if another account is equal.
Two accounts are equal if and only if all of their properties are equal. | [
"Checks",
"if",
"another",
"account",
"is",
"equal",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/Account.php#L51-L62 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/View/EditViewCompiler.php | EditViewCompiler.addFields | private function addFields($modelData)
{
$fields = '';
$firstIteration = true;
foreach ($modelData->fields as $field)
{
if ($firstIteration)
{
$fields .= self::getInputFor($field) . PHP_EOL;
$firstIteration = false;
}
else
{
$fields .= $this->tab(2) . self::getInputFor($field) . PHP_EOL;
}
}
$this->stub = str_replace('{{fields}}', $fields, $this->stub);
return $this;
} | php | private function addFields($modelData)
{
$fields = '';
$firstIteration = true;
foreach ($modelData->fields as $field)
{
if ($firstIteration)
{
$fields .= self::getInputFor($field) . PHP_EOL;
$firstIteration = false;
}
else
{
$fields .= $this->tab(2) . self::getInputFor($field) . PHP_EOL;
}
}
$this->stub = str_replace('{{fields}}', $fields, $this->stub);
return $this;
} | [
"private",
"function",
"addFields",
"(",
"$",
"modelData",
")",
"{",
"$",
"fields",
"=",
"''",
";",
"$",
"firstIteration",
"=",
"true",
";",
"foreach",
"(",
"$",
"modelData",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"firstIteration... | Add fields to the edit view.
@param $modelData
@return $this | [
"Add",
"fields",
"to",
"the",
"edit",
"view",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/View/EditViewCompiler.php#L93-L114 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/View/EditViewCompiler.php | EditViewCompiler.replacePrimaryKey | private function replacePrimaryKey($modelData)
{
$primaryKey = 'id';
foreach ($modelData->fields as $field)
{
if ($field->index == 'primary')
{
$primaryKey = $field->name;
break;
}
}
$this->stub = str_replace('{{primaryKey}}', $primaryKey, $this->stub);
return $this;
} | php | private function replacePrimaryKey($modelData)
{
$primaryKey = 'id';
foreach ($modelData->fields as $field)
{
if ($field->index == 'primary')
{
$primaryKey = $field->name;
break;
}
}
$this->stub = str_replace('{{primaryKey}}', $primaryKey, $this->stub);
return $this;
} | [
"private",
"function",
"replacePrimaryKey",
"(",
"$",
"modelData",
")",
"{",
"$",
"primaryKey",
"=",
"'id'",
";",
"foreach",
"(",
"$",
"modelData",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"->",
"index",
"==",
"'primary'",
... | Replace the primary key.
@param $modelData
@return $this | [
"Replace",
"the",
"primary",
"key",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/View/EditViewCompiler.php#L137-L153 | train |
nabu-3/core | nabu/http/adapters/CNabuHTTPModuleManagerAdapter.php | CNabuHTTPModuleManagerAdapter.registerHTTPServerInterface | protected function registerHTTPServerInterface(INabuHTTPServerInterface $interface) : bool
{
$hash = $interface->getHash();
if (is_array($this->http_server_interface_list) && array_key_exists($hash, $this->http_server_interface_list)) {
throw new ENabuHTTPException(
ENabuHTTPException::ERROR_HTTP_SERVER_INSTANCE_ALREADY_REGISTERED,
array(get_class($interface))
);
}
if ($this->http_server_interface_list === null) {
$this->http_server_interface_list = array($hash => $interface);
} else {
$this->http_server_interface_list[$hash] = $interface;
}
return $interface->init();
} | php | protected function registerHTTPServerInterface(INabuHTTPServerInterface $interface) : bool
{
$hash = $interface->getHash();
if (is_array($this->http_server_interface_list) && array_key_exists($hash, $this->http_server_interface_list)) {
throw new ENabuHTTPException(
ENabuHTTPException::ERROR_HTTP_SERVER_INSTANCE_ALREADY_REGISTERED,
array(get_class($interface))
);
}
if ($this->http_server_interface_list === null) {
$this->http_server_interface_list = array($hash => $interface);
} else {
$this->http_server_interface_list[$hash] = $interface;
}
return $interface->init();
} | [
"protected",
"function",
"registerHTTPServerInterface",
"(",
"INabuHTTPServerInterface",
"$",
"interface",
")",
":",
"bool",
"{",
"$",
"hash",
"=",
"$",
"interface",
"->",
"getHash",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"http_server_in... | Register a new HTTP Server Interface instance.
@param INabuHTTPServerInterface $interface Interface instance to be registered.
@return bool Returns true if the instance is registered and initiated.
@throws ENabuHTTPException Raises an exception if $interface is already registered. | [
"Register",
"a",
"new",
"HTTP",
"Server",
"Interface",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/adapters/CNabuHTTPModuleManagerAdapter.php#L56-L73 | train |
markusjwetzel/laravel-datamapper | src/Metadata/ClassFinder.php | ClassFinder.getClassesFromNamespace | public function getClassesFromNamespace($namespace = null)
{
$namespace = $namespace ?: $this->getAppNamespace();
$path = $this->convertNamespaceToPath($namespace);
return $this->finder->findClasses($path);
} | php | public function getClassesFromNamespace($namespace = null)
{
$namespace = $namespace ?: $this->getAppNamespace();
$path = $this->convertNamespaceToPath($namespace);
return $this->finder->findClasses($path);
} | [
"public",
"function",
"getClassesFromNamespace",
"(",
"$",
"namespace",
"=",
"null",
")",
"{",
"$",
"namespace",
"=",
"$",
"namespace",
"?",
":",
"$",
"this",
"->",
"getAppNamespace",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"convertNamespaceToP... | Get all classes for a given namespace.
@param string $namespace
@return array | [
"Get",
"all",
"classes",
"for",
"a",
"given",
"namespace",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Metadata/ClassFinder.php#L41-L48 | train |
markusjwetzel/laravel-datamapper | src/Metadata/ClassFinder.php | ClassFinder.convertNamespaceToPath | protected function convertNamespaceToPath($namespace)
{
// strip app namespace
$appNamespace = $this->getAppNamespace();
if (substr($namespace, 0, strlen($appNamespace)) != $appNamespace) {
return null;
}
$subNamespace = substr($namespace, strlen($appNamespace));
// replace \ with / to get the correct file path
$subPath = str_replace('\\', '/', $subNamespace);
// create path
return app('path') . '/' . $subPath;
} | php | protected function convertNamespaceToPath($namespace)
{
// strip app namespace
$appNamespace = $this->getAppNamespace();
if (substr($namespace, 0, strlen($appNamespace)) != $appNamespace) {
return null;
}
$subNamespace = substr($namespace, strlen($appNamespace));
// replace \ with / to get the correct file path
$subPath = str_replace('\\', '/', $subNamespace);
// create path
return app('path') . '/' . $subPath;
} | [
"protected",
"function",
"convertNamespaceToPath",
"(",
"$",
"namespace",
")",
"{",
"// strip app namespace",
"$",
"appNamespace",
"=",
"$",
"this",
"->",
"getAppNamespace",
"(",
")",
";",
"if",
"(",
"substr",
"(",
"$",
"namespace",
",",
"0",
",",
"strlen",
... | Convert given namespace to file path.
@param string $namespace
@return string|null | [
"Convert",
"given",
"namespace",
"to",
"file",
"path",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Metadata/ClassFinder.php#L56-L72 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Generator.php | Generator.clean | public function clean()
{
if ($this->files->exists($this->path)) {
$this->files->cleanDirectory($this->path);
}
} | php | public function clean()
{
if ($this->files->exists($this->path)) {
$this->files->cleanDirectory($this->path);
}
} | [
"public",
"function",
"clean",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"this",
"->",
"path",
")",
")",
"{",
"$",
"this",
"->",
"files",
"->",
"cleanDirectory",
"(",
"$",
"this",
"->",
"path",
")",
";",
"}",... | Clean model directory.
@return void | [
"Clean",
"model",
"directory",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Generator.php#L84-L89 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Generator.php | Generator.getPrimaryKeyColumn | protected function getPrimaryKeyColumn($entityMetadata)
{
$primaryKey = 'id';
$incrementing = true;
foreach ($entityMetadata['table']['columns'] as $column) {
if ($column['primary']) {
return $column;
}
}
} | php | protected function getPrimaryKeyColumn($entityMetadata)
{
$primaryKey = 'id';
$incrementing = true;
foreach ($entityMetadata['table']['columns'] as $column) {
if ($column['primary']) {
return $column;
}
}
} | [
"protected",
"function",
"getPrimaryKeyColumn",
"(",
"$",
"entityMetadata",
")",
"{",
"$",
"primaryKey",
"=",
"'id'",
";",
"$",
"incrementing",
"=",
"true",
";",
"foreach",
"(",
"$",
"entityMetadata",
"[",
"'table'",
"]",
"[",
"'columns'",
"]",
"as",
"$",
... | Get primary key and auto increment value.
@param \ProAI\Datamapper\Metadata\Definitions\Entity $entityMetadata
@return \ProAI\Datamapper\Metadata\Definitions\Column | [
"Get",
"primary",
"key",
"and",
"auto",
"increment",
"value",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Generator.php#L143-L153 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Generator.php | Generator.replaceTraits | protected function replaceTraits($entityMetadata, &$stub)
{
$traits = [];
// versionable
if (! empty($entityMetadata['versionTable'])) {
$traits['versionable'] = 'use \ProAI\Versioning\Versionable;';
}
// softDeletes
if ($entityMetadata['softDeletes']) {
$traits['softDeletes'] = 'use \ProAI\Versioning\SoftDeletes;';
}
// autoUuid
if ($this->hasAutoUuidColumn($entityMetadata)) {
$traits['autoUuid'] = 'use \ProAI\Datamapper\Eloquent\AutoUuid;';
}
$separator = PHP_EOL . PHP_EOL . ' ';
$stub = str_replace('{{traits}}', implode($separator, $traits) . $separator, $stub);
} | php | protected function replaceTraits($entityMetadata, &$stub)
{
$traits = [];
// versionable
if (! empty($entityMetadata['versionTable'])) {
$traits['versionable'] = 'use \ProAI\Versioning\Versionable;';
}
// softDeletes
if ($entityMetadata['softDeletes']) {
$traits['softDeletes'] = 'use \ProAI\Versioning\SoftDeletes;';
}
// autoUuid
if ($this->hasAutoUuidColumn($entityMetadata)) {
$traits['autoUuid'] = 'use \ProAI\Datamapper\Eloquent\AutoUuid;';
}
$separator = PHP_EOL . PHP_EOL . ' ';
$stub = str_replace('{{traits}}', implode($separator, $traits) . $separator, $stub);
} | [
"protected",
"function",
"replaceTraits",
"(",
"$",
"entityMetadata",
",",
"&",
"$",
"stub",
")",
"{",
"$",
"traits",
"=",
"[",
"]",
";",
"// versionable",
"if",
"(",
"!",
"empty",
"(",
"$",
"entityMetadata",
"[",
"'versionTable'",
"]",
")",
")",
"{",
... | Replace traits.
@param \ProAI\Datamapper\Metadata\Definitions\Entity $entityMetadata
@param string $stub
@return void | [
"Replace",
"traits",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Generator.php#L198-L219 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Generator.php | Generator.replaceVersionable | protected function replaceVersionable($versionTable, &$stub)
{
$option = (! empty($versionTable)) ? true : false;
$stub = str_replace('{{versionable}}', (! empty($versionTable)) ? 'use \ProAI\Versioning\Versionable;' . PHP_EOL . PHP_EOL . ' ' : '', $stub);
} | php | protected function replaceVersionable($versionTable, &$stub)
{
$option = (! empty($versionTable)) ? true : false;
$stub = str_replace('{{versionable}}', (! empty($versionTable)) ? 'use \ProAI\Versioning\Versionable;' . PHP_EOL . PHP_EOL . ' ' : '', $stub);
} | [
"protected",
"function",
"replaceVersionable",
"(",
"$",
"versionTable",
",",
"&",
"$",
"stub",
")",
"{",
"$",
"option",
"=",
"(",
"!",
"empty",
"(",
"$",
"versionTable",
")",
")",
"?",
"true",
":",
"false",
";",
"$",
"stub",
"=",
"str_replace",
"(",
... | Replace versionable.
@param boolean $option
@param string $stub
@return void | [
"Replace",
"versionable",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Generator.php#L257-L261 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Generator.php | Generator.replaceAutoUuids | protected function replaceAutoUuids($entityMetadata, &$stub)
{
$autoUuids = [];
foreach ($entityMetadata['table']['columns'] as $column) {
if (! empty($column['options']['autoUuid'])) {
$autoUuids[] = $column['name'];
}
}
$stub = str_replace('{{autoUuids}}', $this->getArrayAsText($autoUuids), $stub);
} | php | protected function replaceAutoUuids($entityMetadata, &$stub)
{
$autoUuids = [];
foreach ($entityMetadata['table']['columns'] as $column) {
if (! empty($column['options']['autoUuid'])) {
$autoUuids[] = $column['name'];
}
}
$stub = str_replace('{{autoUuids}}', $this->getArrayAsText($autoUuids), $stub);
} | [
"protected",
"function",
"replaceAutoUuids",
"(",
"$",
"entityMetadata",
",",
"&",
"$",
"stub",
")",
"{",
"$",
"autoUuids",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"entityMetadata",
"[",
"'table'",
"]",
"[",
"'columns'",
"]",
"as",
"$",
"column",
")",
... | Replace autoUuids.
@param \ProAI\Datamapper\Metadata\Definitions\Entity $entityMetadata
@param string $stub
@return void | [
"Replace",
"autoUuids",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Generator.php#L306-L317 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Generator.php | Generator.replaceVersioned | protected function replaceVersioned($versionTable, &$stub)
{
if (! $versionTable) {
$stub = str_replace('{{versioned}}', $this->getArrayAsText([]), $stub);
return;
}
$versioned = [];
foreach ($versionTable['columns'] as $column) {
if (! $column['primary'] || $column['name'] == 'version') {
$versioned[] = $column['name'];
}
}
$stub = str_replace('{{versioned}}', $this->getArrayAsText($versioned), $stub);
} | php | protected function replaceVersioned($versionTable, &$stub)
{
if (! $versionTable) {
$stub = str_replace('{{versioned}}', $this->getArrayAsText([]), $stub);
return;
}
$versioned = [];
foreach ($versionTable['columns'] as $column) {
if (! $column['primary'] || $column['name'] == 'version') {
$versioned[] = $column['name'];
}
}
$stub = str_replace('{{versioned}}', $this->getArrayAsText($versioned), $stub);
} | [
"protected",
"function",
"replaceVersioned",
"(",
"$",
"versionTable",
",",
"&",
"$",
"stub",
")",
"{",
"if",
"(",
"!",
"$",
"versionTable",
")",
"{",
"$",
"stub",
"=",
"str_replace",
"(",
"'{{versioned}}'",
",",
"$",
"this",
"->",
"getArrayAsText",
"(",
... | Replace versioned.
@param mixed $versionTable
@param string $stub
@return void | [
"Replace",
"versioned",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Generator.php#L362-L376 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Generator.php | Generator.replaceMapping | protected function replaceMapping($entityMetadata, &$stub)
{
$attributes = [];
foreach ($entityMetadata['attributes'] as $attributeMetadata) {
$attributes[$attributeMetadata['name']] = $attributeMetadata['columnName'];
}
$embeddeds = [];
foreach ($entityMetadata['embeddeds'] as $embeddedMetadata) {
$embedded = [];
$embedded['class'] = $embeddedMetadata['class'];
$embedded['columnPrefix'] = $embeddedMetadata['columnPrefix'];
$embeddedAttributes = [];
foreach ($embeddedMetadata['attributes'] as $attributeMetadata) {
$embeddedAttributes[$attributeMetadata['name']] = $attributeMetadata['columnName'];
}
$embedded['attributes'] = $embeddedAttributes;
$embeddeds[$embeddedMetadata['name']] = $embedded;
}
$relations = [];
foreach ($entityMetadata['relations'] as $relationMetadata) {
$relation = [];
$relation['type'] = $relationMetadata['type'];
if ($relation['type'] == 'belongsToMany' || $relation['type'] == 'morphToMany') {
$relation['inverse'] = (! empty($relationMetadata['options']['inverse']));
}
$relations[$relationMetadata['name']] = $relation;
}
$mapping = [
'attributes' => $attributes,
'embeddeds' => $embeddeds,
'relations' => $relations,
];
$stub = str_replace('{{mapping}}', $this->getArrayAsText($mapping), $stub);
} | php | protected function replaceMapping($entityMetadata, &$stub)
{
$attributes = [];
foreach ($entityMetadata['attributes'] as $attributeMetadata) {
$attributes[$attributeMetadata['name']] = $attributeMetadata['columnName'];
}
$embeddeds = [];
foreach ($entityMetadata['embeddeds'] as $embeddedMetadata) {
$embedded = [];
$embedded['class'] = $embeddedMetadata['class'];
$embedded['columnPrefix'] = $embeddedMetadata['columnPrefix'];
$embeddedAttributes = [];
foreach ($embeddedMetadata['attributes'] as $attributeMetadata) {
$embeddedAttributes[$attributeMetadata['name']] = $attributeMetadata['columnName'];
}
$embedded['attributes'] = $embeddedAttributes;
$embeddeds[$embeddedMetadata['name']] = $embedded;
}
$relations = [];
foreach ($entityMetadata['relations'] as $relationMetadata) {
$relation = [];
$relation['type'] = $relationMetadata['type'];
if ($relation['type'] == 'belongsToMany' || $relation['type'] == 'morphToMany') {
$relation['inverse'] = (! empty($relationMetadata['options']['inverse']));
}
$relations[$relationMetadata['name']] = $relation;
}
$mapping = [
'attributes' => $attributes,
'embeddeds' => $embeddeds,
'relations' => $relations,
];
$stub = str_replace('{{mapping}}', $this->getArrayAsText($mapping), $stub);
} | [
"protected",
"function",
"replaceMapping",
"(",
"$",
"entityMetadata",
",",
"&",
"$",
"stub",
")",
"{",
"$",
"attributes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"entityMetadata",
"[",
"'attributes'",
"]",
"as",
"$",
"attributeMetadata",
")",
"{",
"$",
... | Replace mapping.
@param \ProAI\Datamapper\Metadata\Definitions\Entity $entityMetadata
@param string $stub
@return void | [
"Replace",
"mapping",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Generator.php#L397-L436 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Generator.php | Generator.replaceRelations | protected function replaceRelations($relations, &$stub)
{
$textRelations = [];
foreach ($relations as $key => $relation) {
$relationStub = $this->stubs['relation'];
// generate options array
$options = [];
if ($relation['type'] != 'morphTo') {
$options[] = "'" . get_mapped_model($relation['relatedEntity'], false)."'";
}
foreach ($relation['options'] as $name => $option) {
if ($option === null) {
$options[] = 'null';
} elseif ($option === true) {
$options[] = 'true';
} elseif ($option === false) {
$options[] = 'false';
} else {
if ($name == 'throughEntity') {
$options[] = "'".get_mapped_model($option, false)."'";
} elseif ($name != 'morphableClasses') {
$options[] = "'".$option."'";
}
}
}
$options = implode(", ", $options);
$relationStub = str_replace('{{name}}', $relation['name'], $relationStub);
$relationStub = str_replace('{{options}}', $options, $relationStub);
$relationStub = str_replace('{{ucfirst_type}}', ucfirst($relation['type']), $relationStub);
$relationStub = str_replace('{{type}}', $relation['type'], $relationStub);
$textRelations[] = $relationStub;
if ($relation['type'] == 'morphTo'
|| ($relation['type'] == 'morphToMany' && ! $relation['options']['inverse'])) {
$morphStub = $this->stubs['morph_extension'];
$morphableClasses = [];
foreach ($relation['options']['morphableClasses'] as $key => $name) {
$morphableClasses[$key] = get_mapped_model($name, false);
}
$morphStub = str_replace('{{name}}', $relation['name'], $morphStub);
$morphStub = str_replace('{{morphName}}', ucfirst($relation['options']['morphName']), $morphStub);
$morphStub = str_replace('{{types}}', $this->getArrayAsText($morphableClasses, 2), $morphStub);
$textRelations[] = $morphStub;
}
}
$stub = str_replace('{{relations}}', implode(PHP_EOL . PHP_EOL, $textRelations), $stub);
} | php | protected function replaceRelations($relations, &$stub)
{
$textRelations = [];
foreach ($relations as $key => $relation) {
$relationStub = $this->stubs['relation'];
// generate options array
$options = [];
if ($relation['type'] != 'morphTo') {
$options[] = "'" . get_mapped_model($relation['relatedEntity'], false)."'";
}
foreach ($relation['options'] as $name => $option) {
if ($option === null) {
$options[] = 'null';
} elseif ($option === true) {
$options[] = 'true';
} elseif ($option === false) {
$options[] = 'false';
} else {
if ($name == 'throughEntity') {
$options[] = "'".get_mapped_model($option, false)."'";
} elseif ($name != 'morphableClasses') {
$options[] = "'".$option."'";
}
}
}
$options = implode(", ", $options);
$relationStub = str_replace('{{name}}', $relation['name'], $relationStub);
$relationStub = str_replace('{{options}}', $options, $relationStub);
$relationStub = str_replace('{{ucfirst_type}}', ucfirst($relation['type']), $relationStub);
$relationStub = str_replace('{{type}}', $relation['type'], $relationStub);
$textRelations[] = $relationStub;
if ($relation['type'] == 'morphTo'
|| ($relation['type'] == 'morphToMany' && ! $relation['options']['inverse'])) {
$morphStub = $this->stubs['morph_extension'];
$morphableClasses = [];
foreach ($relation['options']['morphableClasses'] as $key => $name) {
$morphableClasses[$key] = get_mapped_model($name, false);
}
$morphStub = str_replace('{{name}}', $relation['name'], $morphStub);
$morphStub = str_replace('{{morphName}}', ucfirst($relation['options']['morphName']), $morphStub);
$morphStub = str_replace('{{types}}', $this->getArrayAsText($morphableClasses, 2), $morphStub);
$textRelations[] = $morphStub;
}
}
$stub = str_replace('{{relations}}', implode(PHP_EOL . PHP_EOL, $textRelations), $stub);
} | [
"protected",
"function",
"replaceRelations",
"(",
"$",
"relations",
",",
"&",
"$",
"stub",
")",
"{",
"$",
"textRelations",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"relations",
"as",
"$",
"key",
"=>",
"$",
"relation",
")",
"{",
"$",
"relationStub",
"="... | Replace relations.
@param array $relations
@param string $stub
@return void | [
"Replace",
"relations",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Generator.php#L445-L502 | train |
markusjwetzel/laravel-datamapper | src/Eloquent/Generator.php | Generator.getArrayAsText | protected function getArrayAsText($array, $intendBy=1)
{
$intention = '';
for ($i=0; $i<$intendBy; $i++) {
$intention .= ' ';
}
$text = var_export($array, true);
$text = preg_replace('/[ ]{2}/', ' ', $text);
$text = preg_replace("/\=\>[ \n ]+array[ ]+\(/", '=> array(', $text);
return $text = preg_replace("/\n/", "\n".$intention, $text);
} | php | protected function getArrayAsText($array, $intendBy=1)
{
$intention = '';
for ($i=0; $i<$intendBy; $i++) {
$intention .= ' ';
}
$text = var_export($array, true);
$text = preg_replace('/[ ]{2}/', ' ', $text);
$text = preg_replace("/\=\>[ \n ]+array[ ]+\(/", '=> array(', $text);
return $text = preg_replace("/\n/", "\n".$intention, $text);
} | [
"protected",
"function",
"getArrayAsText",
"(",
"$",
"array",
",",
"$",
"intendBy",
"=",
"1",
")",
"{",
"$",
"intention",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"intendBy",
";",
"$",
"i",
"++",
")",
"{",
"$",
... | Get an array in text format.
@param array $array
@return string | [
"Get",
"an",
"array",
"in",
"text",
"format",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Eloquent/Generator.php#L510-L522 | train |
nabu-3/core | nabu/data/project/traits/TNabuProjectChild.php | TNabuProjectChild.getProject | public function getProject(CNabuCustomer $nb_customer = null, $force = false)
{
if ($nb_customer !== null && ($this->nb_project === null || $force)) {
$this->nb_project = null;
if ($this instanceof CNabuDataObject && $this->contains(NABU_PROJECT_FIELD_ID)) {
$this->nb_project = $nb_customer->getProject($this);
}
}
return $this->nb_project;
} | php | public function getProject(CNabuCustomer $nb_customer = null, $force = false)
{
if ($nb_customer !== null && ($this->nb_project === null || $force)) {
$this->nb_project = null;
if ($this instanceof CNabuDataObject && $this->contains(NABU_PROJECT_FIELD_ID)) {
$this->nb_project = $nb_customer->getProject($this);
}
}
return $this->nb_project;
} | [
"public",
"function",
"getProject",
"(",
"CNabuCustomer",
"$",
"nb_customer",
"=",
"null",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"nb_customer",
"!==",
"null",
"&&",
"(",
"$",
"this",
"->",
"nb_project",
"===",
"null",
"||",
"$",
"f... | Gets the Project instance.
@param null|CNabuCustomer If you want to get the Project in safe mode, you need to pass this parameter
to grant the Customer that owns the Project where the Project is placed. In any other case,
the Project could not be retrieved.
@param bool $force If true, then tries to reload Project instance from their storage.
@return CNabuProject|null Returns the Project instance if setted or null if not. | [
"Gets",
"the",
"Project",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/project/traits/TNabuProjectChild.php#L52-L62 | train |
nabu-3/core | nabu/data/project/traits/TNabuProjectChild.php | TNabuProjectChild.setProject | public function setProject(CNabuProject $nb_project, $field = NABU_PROJECT_FIELD_ID)
{
$this->nb_project = $nb_project;
if ($this instanceof CNabuDataObject) {
$this->transferValue($nb_project, NABU_PROJECT_FIELD_ID, $field);
}
return $this;
} | php | public function setProject(CNabuProject $nb_project, $field = NABU_PROJECT_FIELD_ID)
{
$this->nb_project = $nb_project;
if ($this instanceof CNabuDataObject) {
$this->transferValue($nb_project, NABU_PROJECT_FIELD_ID, $field);
}
return $this;
} | [
"public",
"function",
"setProject",
"(",
"CNabuProject",
"$",
"nb_project",
",",
"$",
"field",
"=",
"NABU_PROJECT_FIELD_ID",
")",
"{",
"$",
"this",
"->",
"nb_project",
"=",
"$",
"nb_project",
";",
"if",
"(",
"$",
"this",
"instanceof",
"CNabuDataObject",
")",
... | Sets the Project instance that owns this object and sets the field containing the project id.
@param CNabuProject $nb_project Project instance to be setted.
@param string $field Field name where the site id will be stored.
@return CNabuDataObject Returns $this to allow the cascade chain of setters. | [
"Sets",
"the",
"Project",
"instance",
"that",
"owns",
"this",
"object",
"and",
"sets",
"the",
"field",
"containing",
"the",
"project",
"id",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/project/traits/TNabuProjectChild.php#L70-L78 | train |
rips/php-connector-bundle | Services/Application/Profile/SourceService.php | SourceService.getAll | public function getAll($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->sources()->getAll($appId, $profileId, $queryParams);
return new SourcesResponse($response);
} | php | public function getAll($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->sources()->getAll($appId, $profileId, $queryParams);
return new SourcesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"array",
"$",
"queryParams",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"profiles",
"(",
")",
"->",
"sources",
"(",
")... | Get all sources for a profile profile
@param int $appId
@param int $profileId
@param array $queryParams
@return SourcesResponse | [
"Get",
"all",
"sources",
"for",
"a",
"profile",
"profile"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Profile/SourceService.php#L36-L41 | train |
rips/php-connector-bundle | Services/Application/Profile/SourceService.php | SourceService.getById | public function getById($appId, $profileId, $sourceId, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->sources()->getById($appId, $profileId, $sourceId, $queryParams);
return new SourceResponse($response);
} | php | public function getById($appId, $profileId, $sourceId, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->sources()->getById($appId, $profileId, $sourceId, $queryParams);
return new SourceResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"$",
"sourceId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"profile... | Get source for profile profile by id
@param int $appId
@param int $profileId
@param int $sourceId
@param array $queryParams
@return SourceResponse | [
"Get",
"source",
"for",
"profile",
"profile",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Profile/SourceService.php#L52-L57 | train |
rips/php-connector-bundle | Services/Application/Profile/SourceService.php | SourceService.create | public function create($appId, $profileId, SourceBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->sources()->create($appId, $profileId, $input->toArray(), $queryParams);
return new SourceResponse($response);
} | php | public function create($appId, $profileId, SourceBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->sources()->create($appId, $profileId, $input->toArray(), $queryParams);
return new SourceResponse($response);
} | [
"public",
"function",
"create",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"SourceBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"... | Create source for profile profile
@param int $appId
@param int $profileId
@param SourceBuilder $input
@param array $queryParams
@return SourceResponse | [
"Create",
"source",
"for",
"profile",
"profile"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Profile/SourceService.php#L68-L73 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteModuleBase.php | CNabuSiteModuleBase.setErrorReporting | public function setErrorReporting(int $error_reporting = 0) : CNabuDataObject
{
if ($error_reporting === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$error_reporting")
);
}
$this->setValue('nb_site_module_error_reporting', $error_reporting);
return $this;
} | php | public function setErrorReporting(int $error_reporting = 0) : CNabuDataObject
{
if ($error_reporting === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$error_reporting")
);
}
$this->setValue('nb_site_module_error_reporting', $error_reporting);
return $this;
} | [
"public",
"function",
"setErrorReporting",
"(",
"int",
"$",
"error_reporting",
"=",
"0",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"error_reporting",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_N... | Sets the Site Module Error Reporting attribute value.
@param int $error_reporting New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Module",
"Error",
"Reporting",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteModuleBase.php#L228-L239 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteModuleBase.php | CNabuSiteModuleBase.setDebugging | public function setDebugging(string $debugging = "F") : CNabuDataObject
{
if ($debugging === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$debugging")
);
}
$this->setValue('nb_site_module_debugging', $debugging);
return $this;
} | php | public function setDebugging(string $debugging = "F") : CNabuDataObject
{
if ($debugging === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$debugging")
);
}
$this->setValue('nb_site_module_debugging', $debugging);
return $this;
} | [
"public",
"function",
"setDebugging",
"(",
"string",
"$",
"debugging",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"debugging",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_... | Sets the Site Module Debugging attribute value.
@param string $debugging New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Module",
"Debugging",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteModuleBase.php#L255-L266 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/AbstractCompiler.php | AbstractCompiler.replaceClassName | protected function replaceClassName($modelName)
{
$this->stub = str_replace('{{class_name}}', $modelName, $this->stub);
$this->stub = str_replace('{{class_name_lw}}', strtolower($modelName), $this->stub);
return $this;
} | php | protected function replaceClassName($modelName)
{
$this->stub = str_replace('{{class_name}}', $modelName, $this->stub);
$this->stub = str_replace('{{class_name_lw}}', strtolower($modelName), $this->stub);
return $this;
} | [
"protected",
"function",
"replaceClassName",
"(",
"$",
"modelName",
")",
"{",
"$",
"this",
"->",
"stub",
"=",
"str_replace",
"(",
"'{{class_name}}'",
",",
"$",
"modelName",
",",
"$",
"this",
"->",
"stub",
")",
";",
"$",
"this",
"->",
"stub",
"=",
"str_re... | Replace the class name.
@param $modelName
@return $this | [
"Replace",
"the",
"class",
"name",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/AbstractCompiler.php#L41-L47 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/AbstractCompiler.php | AbstractCompiler.replaceNamespace | protected function replaceNamespace(stdClass $scaffolderConfig)
{
$this->stub = str_replace('{{namespace}}', $scaffolderConfig->namespaces->models, $this->stub);
return $this;
} | php | protected function replaceNamespace(stdClass $scaffolderConfig)
{
$this->stub = str_replace('{{namespace}}', $scaffolderConfig->namespaces->models, $this->stub);
return $this;
} | [
"protected",
"function",
"replaceNamespace",
"(",
"stdClass",
"$",
"scaffolderConfig",
")",
"{",
"$",
"this",
"->",
"stub",
"=",
"str_replace",
"(",
"'{{namespace}}'",
",",
"$",
"scaffolderConfig",
"->",
"namespaces",
"->",
"models",
",",
"$",
"this",
"->",
"s... | Replace the namespace.
@param \stdClass $scaffolderConfig
@return $this | [
"Replace",
"the",
"namespace",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/AbstractCompiler.php#L56-L61 | train |
nabu-3/core | nabu/data/security/CNabuRole.php | CNabuRole.getRolesForSite | static public function getRolesForSite($nb_site) : CNabuRoleList
{
$nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID);
if (is_numeric($nb_site_id)) {
$retval = self::buildObjectListFromSQL(
'nb_role_id',
'select r.* '
. 'from nb_role r, nb_site_role sr, nb_site s '
. 'where r.nb_role_id=sr.nb_role_id '
. 'and sr.nb_site_id=s.nb_site_id '
. 'and s.nb_site_id=%site_id$d',
array(
'site_id' => $nb_site_id
),
($nb_site instanceof CNabuSite ? $nb_site : null)
);
} else {
$retval = new CNabuRoleList();
}
return $retval;
} | php | static public function getRolesForSite($nb_site) : CNabuRoleList
{
$nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID);
if (is_numeric($nb_site_id)) {
$retval = self::buildObjectListFromSQL(
'nb_role_id',
'select r.* '
. 'from nb_role r, nb_site_role sr, nb_site s '
. 'where r.nb_role_id=sr.nb_role_id '
. 'and sr.nb_site_id=s.nb_site_id '
. 'and s.nb_site_id=%site_id$d',
array(
'site_id' => $nb_site_id
),
($nb_site instanceof CNabuSite ? $nb_site : null)
);
} else {
$retval = new CNabuRoleList();
}
return $retval;
} | [
"static",
"public",
"function",
"getRolesForSite",
"(",
"$",
"nb_site",
")",
":",
"CNabuRoleList",
"{",
"$",
"nb_site_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site",
",",
"NABU_SITE_FIELD_ID",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_site_id",
")",
... | Get the Role List of Roles assigned to a Site.
@param mixed $nb_site A Site instance, an object containing a field name nb_site_id or a Site Id.
@return CNabuRoleList Returns the list of roles found or an empty list if none. | [
"Get",
"the",
"Role",
"List",
"of",
"Roles",
"assigned",
"to",
"a",
"Site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/security/CNabuRole.php#L48-L70 | train |
jstewmc/chunker | src/Text.php | Text.setText | public function setText($text)
{
if ( ! is_string($text)) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, text, to be a string"
);
}
$this->text = $text;
return $this;
} | php | public function setText($text)
{
if ( ! is_string($text)) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, text, to be a string"
);
}
$this->text = $text;
return $this;
} | [
"public",
"function",
"setText",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"text",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"__METHOD__",
".",
"\"() expects parameter one, text, to be a string\"",
")",
";",
... | Sets the chunker's text
@param string $text the chunker's text
@return self
@since 0.1.0 | [
"Sets",
"the",
"chunker",
"s",
"text"
] | 563b870bc73987b386728ff3d23fe41033fb143d | https://github.com/jstewmc/chunker/blob/563b870bc73987b386728ff3d23fe41033fb143d/src/Text.php#L57-L68 | train |
jstewmc/chunker | src/Text.php | Text.getMaxChunks | public function getMaxChunks()
{
return ceil(mb_strlen((string) $this->text, $this->encoding) / $this->size);
} | php | public function getMaxChunks()
{
return ceil(mb_strlen((string) $this->text, $this->encoding) / $this->size);
} | [
"public",
"function",
"getMaxChunks",
"(",
")",
"{",
"return",
"ceil",
"(",
"mb_strlen",
"(",
"(",
"string",
")",
"$",
"this",
"->",
"text",
",",
"$",
"this",
"->",
"encoding",
")",
"/",
"$",
"this",
"->",
"size",
")",
";",
"}"
] | Returns the maximum number of chunks in the text
@return int
@since 0.1.0 | [
"Returns",
"the",
"maximum",
"number",
"of",
"chunks",
"in",
"the",
"text"
] | 563b870bc73987b386728ff3d23fe41033fb143d | https://github.com/jstewmc/chunker/blob/563b870bc73987b386728ff3d23fe41033fb143d/src/Text.php#L106-L109 | train |
jstewmc/chunker | src/Text.php | Text.getChunk | protected function getChunk($offset)
{
if ( ! is_numeric($offset) || ! is_int(+$offset) || $offset < 0) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, offset, to be a positive "
. "integer or zero"
);
}
$chunk = false;
$text = (string) $this->text;
if ($offset < mb_strlen($text)) {
$chunk = mb_substr($text, $offset, $this->size, $this->encoding);
}
return $chunk;
} | php | protected function getChunk($offset)
{
if ( ! is_numeric($offset) || ! is_int(+$offset) || $offset < 0) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, offset, to be a positive "
. "integer or zero"
);
}
$chunk = false;
$text = (string) $this->text;
if ($offset < mb_strlen($text)) {
$chunk = mb_substr($text, $offset, $this->size, $this->encoding);
}
return $chunk;
} | [
"protected",
"function",
"getChunk",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"offset",
")",
"||",
"!",
"is_int",
"(",
"+",
"$",
"offset",
")",
"||",
"$",
"offset",
"<",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgu... | Returns a string chunk or false if chunk does not exist
@param int $offset the chunk's offset
@return string|false
@throws InvalidArgumentException if $offset is not a positive int or zero
@since 0.1.0 | [
"Returns",
"a",
"string",
"chunk",
"or",
"false",
"if",
"chunk",
"does",
"not",
"exist"
] | 563b870bc73987b386728ff3d23fe41033fb143d | https://github.com/jstewmc/chunker/blob/563b870bc73987b386728ff3d23fe41033fb143d/src/Text.php#L122-L140 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/Core/ModelCompiler.php | ModelCompiler.replaceNamespaceModelExtend | private function replaceNamespaceModelExtend(stdClass $scaffolderConfig)
{
$this->stub = str_replace('{{namespace_model_extend}}', $scaffolderConfig->inheritance->model, $this->stub);
return $this;
} | php | private function replaceNamespaceModelExtend(stdClass $scaffolderConfig)
{
$this->stub = str_replace('{{namespace_model_extend}}', $scaffolderConfig->inheritance->model, $this->stub);
return $this;
} | [
"private",
"function",
"replaceNamespaceModelExtend",
"(",
"stdClass",
"$",
"scaffolderConfig",
")",
"{",
"$",
"this",
"->",
"stub",
"=",
"str_replace",
"(",
"'{{namespace_model_extend}}'",
",",
"$",
"scaffolderConfig",
"->",
"inheritance",
"->",
"model",
",",
"$",
... | Replace the namespace which the model extends
@param \stdClass $scaffolderConfig
@return $this | [
"Replace",
"the",
"namespace",
"which",
"the",
"model",
"extends"
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/Core/ModelCompiler.php#L87-L92 | train |
nabu-3/core | nabu/data/medioteca/base/CNabuMediotecaTypeLanguageBase.php | CNabuMediotecaTypeLanguageBase.setMediotecaTypeId | public function setMediotecaTypeId(int $nb_medioteca_type_id) : CNabuDataObject
{
if ($nb_medioteca_type_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_medioteca_type_id")
);
}
$this->setValue('nb_medioteca_type_id', $nb_medioteca_type_id);
return $this;
} | php | public function setMediotecaTypeId(int $nb_medioteca_type_id) : CNabuDataObject
{
if ($nb_medioteca_type_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_medioteca_type_id")
);
}
$this->setValue('nb_medioteca_type_id', $nb_medioteca_type_id);
return $this;
} | [
"public",
"function",
"setMediotecaTypeId",
"(",
"int",
"$",
"nb_medioteca_type_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_medioteca_type_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL... | Sets the Medioteca Type Id attribute value.
@param int $nb_medioteca_type_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Medioteca",
"Type",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/base/CNabuMediotecaTypeLanguageBase.php#L182-L193 | train |
php-xapi/model | src/Score.php | Score.equals | public function equals(Score $score): bool
{
if (null !== $this->scaled xor null !== $score->scaled) {
return false;
}
if ((float) $this->scaled !== (float) $score->scaled) {
return false;
}
if (null !== $this->raw xor null !== $score->raw) {
return false;
}
if ((float) $this->raw !== (float) $score->raw) {
return false;
}
if (null !== $this->min xor null !== $score->min) {
return false;
}
if ((float) $this->min !== (float) $score->min) {
return false;
}
if (null !== $this->max xor null !== $score->max) {
return false;
}
if ((float) $this->max !== (float) $score->max) {
return false;
}
return true;
} | php | public function equals(Score $score): bool
{
if (null !== $this->scaled xor null !== $score->scaled) {
return false;
}
if ((float) $this->scaled !== (float) $score->scaled) {
return false;
}
if (null !== $this->raw xor null !== $score->raw) {
return false;
}
if ((float) $this->raw !== (float) $score->raw) {
return false;
}
if (null !== $this->min xor null !== $score->min) {
return false;
}
if ((float) $this->min !== (float) $score->min) {
return false;
}
if (null !== $this->max xor null !== $score->max) {
return false;
}
if ((float) $this->max !== (float) $score->max) {
return false;
}
return true;
} | [
"public",
"function",
"equals",
"(",
"Score",
"$",
"score",
")",
":",
"bool",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"scaled",
"xor",
"null",
"!==",
"$",
"score",
"->",
"scaled",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"(",
"... | Checks if another score is equal.
Two scores are equal if and only if all of their properties are equal. | [
"Checks",
"if",
"another",
"score",
"is",
"equal",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/Score.php#L129-L164 | train |
sandstorm/TemplateMailer | Classes/Domain/Service/EmailService.php | EmailService.renderEmailBody | public function renderEmailBody(string $templateName, string $templatePackage, string $format, array $variables, bool $emogrify = true): string
{
$standaloneView = new StandaloneView();
$request = $standaloneView->getRequest();
// $request->setControllerPackageKey('Sandstorm.Maklerapp'); TODO needed?
$request->setFormat($format);
$templatePath = sprintf('resource://%s/Private/EmailTemplates/', $templatePackage);
$templatePathAndFilename = sprintf('%s%s.%s', $templatePath, $templateName, $format);
$standaloneView->setTemplatePathAndFilename($templatePathAndFilename);
$standaloneView->setLayoutRootPath($templatePath . 'Layouts');
$standaloneView->setPartialRootPath($templatePath . 'Partials');
$standaloneView->assignMultiple($variables);
$emailBody = $standaloneView->render();
// Emogrify - this will inline any styles in the HTML for proper display in Gmail.
$emogrifiedFormats = ['htm', 'html'];
if ($emogrify && in_array($format, $emogrifiedFormats)) {
$emogrifier = new Emogrifier($emailBody);
$emailBody = $emogrifier->emogrify();
}
return $emailBody;
} | php | public function renderEmailBody(string $templateName, string $templatePackage, string $format, array $variables, bool $emogrify = true): string
{
$standaloneView = new StandaloneView();
$request = $standaloneView->getRequest();
// $request->setControllerPackageKey('Sandstorm.Maklerapp'); TODO needed?
$request->setFormat($format);
$templatePath = sprintf('resource://%s/Private/EmailTemplates/', $templatePackage);
$templatePathAndFilename = sprintf('%s%s.%s', $templatePath, $templateName, $format);
$standaloneView->setTemplatePathAndFilename($templatePathAndFilename);
$standaloneView->setLayoutRootPath($templatePath . 'Layouts');
$standaloneView->setPartialRootPath($templatePath . 'Partials');
$standaloneView->assignMultiple($variables);
$emailBody = $standaloneView->render();
// Emogrify - this will inline any styles in the HTML for proper display in Gmail.
$emogrifiedFormats = ['htm', 'html'];
if ($emogrify && in_array($format, $emogrifiedFormats)) {
$emogrifier = new Emogrifier($emailBody);
$emailBody = $emogrifier->emogrify();
}
return $emailBody;
} | [
"public",
"function",
"renderEmailBody",
"(",
"string",
"$",
"templateName",
",",
"string",
"$",
"templatePackage",
",",
"string",
"$",
"format",
",",
"array",
"$",
"variables",
",",
"bool",
"$",
"emogrify",
"=",
"true",
")",
":",
"string",
"{",
"$",
"stan... | Renders the email body of a template. Can be used directly to only render the email html body.
if the given format is htm or html, will automatically emogrify the email body.
This can be skipped by setting the last parameter to false.
@param string $templateName
@param string $templateName
@param string $format
@param array $variables
@param bool $emogrify
@return string | [
"Renders",
"the",
"email",
"body",
"of",
"a",
"template",
".",
"Can",
"be",
"used",
"directly",
"to",
"only",
"render",
"the",
"email",
"html",
"body",
".",
"if",
"the",
"given",
"format",
"is",
"htm",
"or",
"html",
"will",
"automatically",
"emogrify",
"... | b6094837b4f28024246bb71aa7e0c890ae038e5e | https://github.com/sandstorm/TemplateMailer/blob/b6094837b4f28024246bb71aa7e0c890ae038e5e/Classes/Domain/Service/EmailService.php#L132-L155 | train |
sandstorm/TemplateMailer | Classes/Domain/Service/EmailService.php | EmailService.sendMail | protected function sendMail(Message $mail): bool
{
$allRecipients = $mail->getTo() + $mail->getCc() + $mail->getBcc();
$totalNumberOfRecipients = count($allRecipients);
$actualNumberOfRecipients = 0;
$exceptionMessage = '';
try {
$actualNumberOfRecipients = $mail->send();
} catch (\Exception $e) {
$exceptionMessage = $e->getMessage();
if ($this->logSendingErrors === self::LOG_LEVEL_LOG) {
$this->systemLogger->logException($e);
} elseif ($this->logSendingErrors === self::LOG_LEVEL_THROW) {
throw $e;
}
}
$emailInfo = [
'recipients' => array_keys($mail->getTo() + $mail->getCc() + $mail->getBcc()),
'failedRecipients' => $mail->getFailedRecipients(),
'subject' => $mail->getSubject(),
'id' => (string)$mail->getHeaders()->get('Message-ID')
];
if (strlen($exceptionMessage) > 0) {
$emailInfo['exception'] = $exceptionMessage;
}
if ($actualNumberOfRecipients < $totalNumberOfRecipients && $this->logSendingErrors === self::LOG_LEVEL_LOG) {
$this->systemLogger->log(
sprintf('Could not send an email to all given recipients. Given %s, sent to %s', $totalNumberOfRecipients, $actualNumberOfRecipients),
LOG_ERR, $emailInfo);
return false;
}
if ($this->logSendingSuccess === self::LOG_LEVEL_LOG) {
$this->systemLogger->log('Email sent successfully.', LOG_INFO, $emailInfo);
}
return true;
} | php | protected function sendMail(Message $mail): bool
{
$allRecipients = $mail->getTo() + $mail->getCc() + $mail->getBcc();
$totalNumberOfRecipients = count($allRecipients);
$actualNumberOfRecipients = 0;
$exceptionMessage = '';
try {
$actualNumberOfRecipients = $mail->send();
} catch (\Exception $e) {
$exceptionMessage = $e->getMessage();
if ($this->logSendingErrors === self::LOG_LEVEL_LOG) {
$this->systemLogger->logException($e);
} elseif ($this->logSendingErrors === self::LOG_LEVEL_THROW) {
throw $e;
}
}
$emailInfo = [
'recipients' => array_keys($mail->getTo() + $mail->getCc() + $mail->getBcc()),
'failedRecipients' => $mail->getFailedRecipients(),
'subject' => $mail->getSubject(),
'id' => (string)$mail->getHeaders()->get('Message-ID')
];
if (strlen($exceptionMessage) > 0) {
$emailInfo['exception'] = $exceptionMessage;
}
if ($actualNumberOfRecipients < $totalNumberOfRecipients && $this->logSendingErrors === self::LOG_LEVEL_LOG) {
$this->systemLogger->log(
sprintf('Could not send an email to all given recipients. Given %s, sent to %s', $totalNumberOfRecipients, $actualNumberOfRecipients),
LOG_ERR, $emailInfo);
return false;
}
if ($this->logSendingSuccess === self::LOG_LEVEL_LOG) {
$this->systemLogger->log('Email sent successfully.', LOG_INFO, $emailInfo);
}
return true;
} | [
"protected",
"function",
"sendMail",
"(",
"Message",
"$",
"mail",
")",
":",
"bool",
"{",
"$",
"allRecipients",
"=",
"$",
"mail",
"->",
"getTo",
"(",
")",
"+",
"$",
"mail",
"->",
"getCc",
"(",
")",
"+",
"$",
"mail",
"->",
"getBcc",
"(",
")",
";",
... | Sends a mail and logs or throws any errors, depending on configuration
@param Message $mail
@return boolean TRUE on success, otherwise FALSE
@throws \Exception | [
"Sends",
"a",
"mail",
"and",
"logs",
"or",
"throws",
"any",
"errors",
"depending",
"on",
"configuration"
] | b6094837b4f28024246bb71aa7e0c890ae038e5e | https://github.com/sandstorm/TemplateMailer/blob/b6094837b4f28024246bb71aa7e0c890ae038e5e/Classes/Domain/Service/EmailService.php#L247-L286 | train |
rips/php-connector-bundle | Services/Application/Scan/ConcatService.php | ConcatService.getAll | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->concats()
->getAll($appId, $scanId, $queryParams);
return new ConcatsResponse($response);
} | php | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->concats()
->getAll($appId, $scanId, $queryParams);
return new ConcatsResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"concat... | Get all concats for a scan
@param int $appId
@param int $scanId
@param array $queryParams
@return ConcatsResponse | [
"Get",
"all",
"concats",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/ConcatService.php#L34-L43 | train |
rips/php-connector-bundle | Services/Application/Scan/ConcatService.php | ConcatService.getById | public function getById($appId, $scanId, $concatId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->concats()
->getById($appId, $scanId, $concatId, $queryParams);
return new ConcatResponse($response);
} | php | public function getById($appId, $scanId, $concatId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->concats()
->getById($appId, $scanId, $concatId, $queryParams);
return new ConcatResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"concatId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
... | Get concat for scan by id
@param int $appId
@param int $scanId
@param int $concatId
@param array $queryParams
@return ConcatResponse | [
"Get",
"concat",
"for",
"scan",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/ConcatService.php#L54-L63 | train |
rips/php-connector-bundle | Hydrators/Application/Profile/ValidatorHydrator.php | ValidatorHydrator.hydrateCollection | public static function hydrateCollection(array $validators)
{
$hydrated = [];
foreach ($validators as $validator) {
$hydrated[] = self::hydrate($validator);
}
return $hydrated;
} | php | public static function hydrateCollection(array $validators)
{
$hydrated = [];
foreach ($validators as $validator) {
$hydrated[] = self::hydrate($validator);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"validators",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"validators",
"as",
"$",
"validator",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hyd... | Hydrate a collection of validator objects into a collection of
ValidatorEntity objects
@param stdClass[] $validators
@return ValidatorEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"validator",
"objects",
"into",
"a",
"collection",
"of",
"ValidatorEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Profile/ValidatorHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/Application/Profile/ValidatorHydrator.php | ValidatorHydrator.hydrate | public static function hydrate(stdClass $validator)
{
$hydrated = new ValidatorEntity();
if (isset($validator->id)) {
$hydrated->setId($validator->id);
}
if (isset($validator->class)) {
$hydrated->setClass($validator->class);
}
if (isset($validator->method)) {
$hydrated->setMethod($validator->method);
}
if (isset($validator->parameter)) {
$hydrated->setParameter($validator->parameter);
}
if (isset($validator->characters)) {
$hydrated->setCharacters($validator->characters);
}
if (isset($validator->issueType)) {
$hydrated->setIssueType(TypeHydrator::hydrate($validator->issueType));
}
return $hydrated;
} | php | public static function hydrate(stdClass $validator)
{
$hydrated = new ValidatorEntity();
if (isset($validator->id)) {
$hydrated->setId($validator->id);
}
if (isset($validator->class)) {
$hydrated->setClass($validator->class);
}
if (isset($validator->method)) {
$hydrated->setMethod($validator->method);
}
if (isset($validator->parameter)) {
$hydrated->setParameter($validator->parameter);
}
if (isset($validator->characters)) {
$hydrated->setCharacters($validator->characters);
}
if (isset($validator->issueType)) {
$hydrated->setIssueType(TypeHydrator::hydrate($validator->issueType));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"validator",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ValidatorEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"validator",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",... | Hydrate a validator object into a ValidatorEntity object
@param stdClass $validator
@return ValidatorEntity | [
"Hydrate",
"a",
"validator",
"object",
"into",
"a",
"ValidatorEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Profile/ValidatorHydrator.php#L35-L64 | train |
nabu-3/core | nabu/data/medioteca/base/CNabuMediotecaTypeBase.php | CNabuMediotecaTypeBase.findByKey | public static function findByKey($nb_customer, $key)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = CNabuMediotecaType::buildObjectFromSQL(
'select * '
. 'from nb_medioteca_type '
. 'where nb_customer_id=%cust_id$d '
. "and nb_medioteca_type_key='%key\$s'",
array(
'cust_id' => $nb_customer_id,
'key' => $key
)
);
} else {
$retval = null;
}
return $retval;
} | php | public static function findByKey($nb_customer, $key)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = CNabuMediotecaType::buildObjectFromSQL(
'select * '
. 'from nb_medioteca_type '
. 'where nb_customer_id=%cust_id$d '
. "and nb_medioteca_type_key='%key\$s'",
array(
'cust_id' => $nb_customer_id,
'key' => $key
)
);
} else {
$retval = null;
}
return $retval;
} | [
"public",
"static",
"function",
"findByKey",
"(",
"$",
"nb_customer",
",",
"$",
"key",
")",
"{",
"$",
"nb_customer_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_customer",
",",
"'nb_customer_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_customer_id",
... | Find an instance identified by nb_medioteca_type_key field.
@param mixed $nb_customer Customer that owns Medioteca Type
@param string $key Key to search
@return CNabuMediotecaType Returns a valid instance if exists or null if not. | [
"Find",
"an",
"instance",
"identified",
"by",
"nb_medioteca_type_key",
"field",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/base/CNabuMediotecaTypeBase.php#L133-L152 | train |
nabu-3/core | nabu/data/medioteca/base/CNabuMediotecaTypeBase.php | CNabuMediotecaTypeBase.getAllMediotecaTypes | public static function getAllMediotecaTypes(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_medioteca_type_id',
'select * '
. 'from nb_medioteca_type '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuMediotecaTypeList();
}
return $retval;
} | php | public static function getAllMediotecaTypes(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, 'nb_customer_id');
if (is_numeric($nb_customer_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_medioteca_type_id',
'select * '
. 'from nb_medioteca_type '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuMediotecaTypeList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllMediotecaTypes",
"(",
"CNabuCustomer",
"$",
"nb_customer",
")",
"{",
"$",
"nb_customer_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_customer",
",",
"'nb_customer_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_customer_... | Get all items in the storage as an associative array where the field 'nb_medioteca_type_id' is the index, and
each value is an instance of class CNabuMediotecaTypeBase.
@param CNabuCustomer $nb_customer The CNabuCustomer instance of the Customer that owns the Medioteca Type List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_medioteca_type_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuMediotecaTypeBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/base/CNabuMediotecaTypeBase.php#L160-L180 | train |
nabu-3/core | nabu/data/medioteca/base/CNabuMediotecaTypeBase.php | CNabuMediotecaTypeBase.getFilteredMediotecaTypeList | public static function getFilteredMediotecaTypeList($nb_customer, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID);
if (is_numeric($nb_customer_id)) {
$fields_part = nb_prefixFieldList(CNabuMediotecaTypeBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuMediotecaTypeBase::getStorageName(), $fields, false, false, '`');
if ($num_items !== 0) {
$limit_part = ($offset > 0 ? $offset . ', ' : '') . $num_items;
} else {
$limit_part = false;
}
$nb_item_list = CNabuEngine::getEngine()->getMainDB()->getQueryAsArray(
"select " . ($fields_part ? $fields_part . ' ' : '* ')
. 'from nb_medioteca_type '
. 'where ' . NABU_CUSTOMER_FIELD_ID . '=%cust_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'cust_id' => $nb_customer_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | php | public static function getFilteredMediotecaTypeList($nb_customer, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID);
if (is_numeric($nb_customer_id)) {
$fields_part = nb_prefixFieldList(CNabuMediotecaTypeBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuMediotecaTypeBase::getStorageName(), $fields, false, false, '`');
if ($num_items !== 0) {
$limit_part = ($offset > 0 ? $offset . ', ' : '') . $num_items;
} else {
$limit_part = false;
}
$nb_item_list = CNabuEngine::getEngine()->getMainDB()->getQueryAsArray(
"select " . ($fields_part ? $fields_part . ' ' : '* ')
. 'from nb_medioteca_type '
. 'where ' . NABU_CUSTOMER_FIELD_ID . '=%cust_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'cust_id' => $nb_customer_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | [
"public",
"static",
"function",
"getFilteredMediotecaTypeList",
"(",
"$",
"nb_customer",
",",
"$",
"q",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"order",
"=",
"null",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"num_items",
"=",
"0",
")",
... | Gets a filtered list of Medioteca Type instances represented as an array. Params allows the capability of select
a subset of fields, order by concrete fields, or truncate the list by a number of rows starting in an offset.
@throws \nabu\core\exceptions\ENabuCoreException Raises an exception if $fields or $order have invalid values.
@param mixed $nb_customer Customer instance, object containing a Customer Id field or an Id.
@param string $q Query string to filter results using a context index.
@param string|array $fields List of fields to put in the results.
@param string|array $order List of fields to order the results. Each field can be suffixed with "ASC" or "DESC"
to determine the short order
@param int $offset Offset of first row in the results having the first row at offset 0.
@param int $num_items Number of continue rows to get as maximum in the results.
@return array Returns an array with all rows found using the criteria. | [
"Gets",
"a",
"filtered",
"list",
"of",
"Medioteca",
"Type",
"instances",
"represented",
"as",
"an",
"array",
".",
"Params",
"allows",
"the",
"capability",
"of",
"select",
"a",
"subset",
"of",
"fields",
"order",
"by",
"concrete",
"fields",
"or",
"truncate",
"... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/base/CNabuMediotecaTypeBase.php#L195-L223 | train |
rips/php-connector-bundle | Services/SourceService.php | SourceService.getAll | public function getAll(array $queryParams = [])
{
$response = $this->api->sources()->getAll($queryParams);
return new SourcesResponse($response);
} | php | public function getAll(array $queryParams = [])
{
$response = $this->api->sources()->getAll($queryParams);
return new SourcesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"sources",
"(",
")",
"->",
"getAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"SourcesResponse",... | Get all directories from the root source directory
@param array $queryParams
@return SourcesResponse | [
"Get",
"all",
"directories",
"from",
"the",
"root",
"source",
"directory"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/SourceService.php#L30-L35 | train |
rips/php-connector-bundle | Services/Application/AclService.php | AclService.getById | public function getById($appId, $aclId, array $queryParams = [])
{
$response = $this->api->applications()->acls()->getById($appId, $aclId, $queryParams);
return new AclResponse($response);
} | php | public function getById($appId, $aclId, array $queryParams = [])
{
$response = $this->api->applications()->acls()->getById($appId, $aclId, $queryParams);
return new AclResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"aclId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"acls",
"(",
")",
"->",
"getById... | Get a acl for application by id
@param int $appId
@param int $aclId
@param array $queryParams
@return AclResponse | [
"Get",
"a",
"acl",
"for",
"application",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/AclService.php#L50-L55 | train |
rips/php-connector-bundle | Services/Application/AclService.php | AclService.create | public function create($appId, AclBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->acls()->create($appId, $input->toArray(), $queryParams);
return new AclResponse($response);
} | php | public function create($appId, AclBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->acls()->create($appId, $input->toArray(), $queryParams);
return new AclResponse($response);
} | [
"public",
"function",
"create",
"(",
"$",
"appId",
",",
"AclBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"acls",
"(",
")",
"... | Create a new acl for a application
@param int $appId
@param AclBuilder $input
@param array $queryParams
@return AclResponse | [
"Create",
"a",
"new",
"acl",
"for",
"a",
"application"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/AclService.php#L65-L70 | train |
rips/php-connector-bundle | Services/Application/AclService.php | AclService.update | public function update($appId, $aclId, AclBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->acls()->update($appId, $aclId, $input->toArray(), $queryParams);
return new AclResponse($response);
} | php | public function update($appId, $aclId, AclBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->acls()->update($appId, $aclId, $input->toArray(), $queryParams);
return new AclResponse($response);
} | [
"public",
"function",
"update",
"(",
"$",
"appId",
",",
"$",
"aclId",
",",
"AclBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
... | Update existing acl for application by id
@param int $appId
@param int $aclId
@param AclBuilder $input
@param array $queryParams
@return AclResponse | [
"Update",
"existing",
"acl",
"for",
"application",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/AclService.php#L81-L86 | train |
php-xapi/model | src/StatementsFilter.php | StatementsFilter.byVerb | public function byVerb(Verb $verb): self
{
$this->filter['verb'] = $verb->getId()->getValue();
return $this;
} | php | public function byVerb(Verb $verb): self
{
$this->filter['verb'] = $verb->getId()->getValue();
return $this;
} | [
"public",
"function",
"byVerb",
"(",
"Verb",
"$",
"verb",
")",
":",
"self",
"{",
"$",
"this",
"->",
"filter",
"[",
"'verb'",
"]",
"=",
"$",
"verb",
"->",
"getId",
"(",
")",
"->",
"getValue",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Filters by a verb. | [
"Filters",
"by",
"a",
"verb",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/StatementsFilter.php#L36-L41 | train |
php-xapi/model | src/StatementsFilter.php | StatementsFilter.byActivity | public function byActivity(Activity $activity): self
{
$this->filter['activity'] = $activity->getId()->getValue();
return $this;
} | php | public function byActivity(Activity $activity): self
{
$this->filter['activity'] = $activity->getId()->getValue();
return $this;
} | [
"public",
"function",
"byActivity",
"(",
"Activity",
"$",
"activity",
")",
":",
"self",
"{",
"$",
"this",
"->",
"filter",
"[",
"'activity'",
"]",
"=",
"$",
"activity",
"->",
"getId",
"(",
")",
"->",
"getValue",
"(",
")",
";",
"return",
"$",
"this",
"... | Filter by an Activity. | [
"Filter",
"by",
"an",
"Activity",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/StatementsFilter.php#L46-L51 | train |
php-xapi/model | src/StatementsFilter.php | StatementsFilter.limit | public function limit(int $limit): self
{
if ($limit < 0) {
throw new \InvalidArgumentException('Limit must be a non-negative integer');
}
$this->filter['limit'] = $limit;
return $this;
} | php | public function limit(int $limit): self
{
if ($limit < 0) {
throw new \InvalidArgumentException('Limit must be a non-negative integer');
}
$this->filter['limit'] = $limit;
return $this;
} | [
"public",
"function",
"limit",
"(",
"int",
"$",
"limit",
")",
":",
"self",
"{",
"if",
"(",
"$",
"limit",
"<",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Limit must be a non-negative integer'",
")",
";",
"}",
"$",
"this",
"->",
... | Sets the maximum number of Statements to return. The server side sets
the maximum number of results when this value is not set or when it is 0.
@throws \InvalidArgumentException if the limit is not a non-negative
integer | [
"Sets",
"the",
"maximum",
"number",
"of",
"Statements",
"to",
"return",
".",
"The",
"server",
"side",
"sets",
"the",
"maximum",
"number",
"of",
"results",
"when",
"this",
"value",
"is",
"not",
"set",
"or",
"when",
"it",
"is",
"0",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/StatementsFilter.php#L130-L139 | train |
nabu-3/core | nabu/data/site/CNabuSiteTargetList.php | CNabuSiteTargetList.acquireItem | public function acquireItem($key, $index = false)
{
if ($index === self::INDEX_KEY) {
$nb_site = CNabuEngine::getEngine()->getApplication()->getRequest()->getSite();
$retval = CNabuSiteTarget::findByKey($nb_site, $key);
} else {
$retval = parent::acquireItem($key, $index);
}
return $retval;
} | php | public function acquireItem($key, $index = false)
{
if ($index === self::INDEX_KEY) {
$nb_site = CNabuEngine::getEngine()->getApplication()->getRequest()->getSite();
$retval = CNabuSiteTarget::findByKey($nb_site, $key);
} else {
$retval = parent::acquireItem($key, $index);
}
return $retval;
} | [
"public",
"function",
"acquireItem",
"(",
"$",
"key",
",",
"$",
"index",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"index",
"===",
"self",
"::",
"INDEX_KEY",
")",
"{",
"$",
"nb_site",
"=",
"CNabuEngine",
"::",
"getEngine",
"(",
")",
"->",
"getApplication... | Overrides temporally this method to support nb_site_target_key acquisitions. | [
"Overrides",
"temporally",
"this",
"method",
"to",
"support",
"nb_site_target_key",
"acquisitions",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteTargetList.php#L85-L95 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetCTARoleBase.php | CNabuSiteTargetCTARoleBase.setSiteTargetCTAId | public function setSiteTargetCTAId(int $nb_site_target_cta_id) : CNabuDataObject
{
if ($nb_site_target_cta_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_site_target_cta_id")
);
}
$this->setValue('nb_site_target_cta_id', $nb_site_target_cta_id);
return $this;
} | php | public function setSiteTargetCTAId(int $nb_site_target_cta_id) : CNabuDataObject
{
if ($nb_site_target_cta_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_site_target_cta_id")
);
}
$this->setValue('nb_site_target_cta_id', $nb_site_target_cta_id);
return $this;
} | [
"public",
"function",
"setSiteTargetCTAId",
"(",
"int",
"$",
"nb_site_target_cta_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_site_target_cta_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NU... | Sets the Site Target CTA Id attribute value.
@param int $nb_site_target_cta_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"CTA",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetCTARoleBase.php#L145-L156 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetSectionBase.php | CNabuSiteTargetSectionBase.findByKey | public static function findByKey($nb_medioteca, $key)
{
$nb_medioteca_id = nb_getMixedValue($nb_medioteca, 'nb_medioteca_id');
if (is_numeric($nb_medioteca_id)) {
$retval = CNabuSiteTargetSection::buildObjectFromSQL(
'select * '
. 'from nb_site_target_section '
. 'where nb_medioteca_id=%medioteca_id$d '
. "and nb_site_target_section_key='%key\$s'",
array(
'medioteca_id' => $nb_medioteca_id,
'key' => $key
)
);
} else {
$retval = null;
}
return $retval;
} | php | public static function findByKey($nb_medioteca, $key)
{
$nb_medioteca_id = nb_getMixedValue($nb_medioteca, 'nb_medioteca_id');
if (is_numeric($nb_medioteca_id)) {
$retval = CNabuSiteTargetSection::buildObjectFromSQL(
'select * '
. 'from nb_site_target_section '
. 'where nb_medioteca_id=%medioteca_id$d '
. "and nb_site_target_section_key='%key\$s'",
array(
'medioteca_id' => $nb_medioteca_id,
'key' => $key
)
);
} else {
$retval = null;
}
return $retval;
} | [
"public",
"static",
"function",
"findByKey",
"(",
"$",
"nb_medioteca",
",",
"$",
"key",
")",
"{",
"$",
"nb_medioteca_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_medioteca",
",",
"'nb_medioteca_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_medioteca_id... | Find an instance identified by nb_site_target_section_key field.
@param mixed $nb_medioteca Medioteca that owns Site Target Section
@param string $key Key to search
@return CNabuSiteTargetSection Returns a valid instance if exists or null if not. | [
"Find",
"an",
"instance",
"identified",
"by",
"nb_site_target_section_key",
"field",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetSectionBase.php#L153-L172 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetSectionBase.php | CNabuSiteTargetSectionBase.getAllSiteTargetSections | public static function getAllSiteTargetSections(CNabuMedioteca $nb_medioteca)
{
$nb_medioteca_id = nb_getMixedValue($nb_medioteca, 'nb_medioteca_id');
if (is_numeric($nb_medioteca_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_site_target_section_id',
'select * '
. 'from nb_site_target_section '
. 'where nb_medioteca_id=%medioteca_id$d',
array(
'medioteca_id' => $nb_medioteca_id
),
$nb_medioteca
);
} else {
$retval = new CNabuSiteTargetSectionList();
}
return $retval;
} | php | public static function getAllSiteTargetSections(CNabuMedioteca $nb_medioteca)
{
$nb_medioteca_id = nb_getMixedValue($nb_medioteca, 'nb_medioteca_id');
if (is_numeric($nb_medioteca_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_site_target_section_id',
'select * '
. 'from nb_site_target_section '
. 'where nb_medioteca_id=%medioteca_id$d',
array(
'medioteca_id' => $nb_medioteca_id
),
$nb_medioteca
);
} else {
$retval = new CNabuSiteTargetSectionList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllSiteTargetSections",
"(",
"CNabuMedioteca",
"$",
"nb_medioteca",
")",
"{",
"$",
"nb_medioteca_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_medioteca",
",",
"'nb_medioteca_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_... | Get all items in the storage as an associative array where the field 'nb_site_target_section_id' is the index,
and each value is an instance of class CNabuSiteTargetSectionBase.
@param CNabuMedioteca $nb_medioteca The CNabuMedioteca instance of the Medioteca that owns the Site Target
Section List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_site_target_section_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuSiteTargetSectionBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetSectionBase.php#L181-L201 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetSectionBase.php | CNabuSiteTargetSectionBase.getFilteredSiteTargetSectionList | public static function getFilteredSiteTargetSectionList($nb_medioteca = null, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_medioteca_id = nb_getMixedValue($nb_customer, NABU_MEDIOTECA_FIELD_ID);
if (is_numeric($nb_medioteca_id)) {
$fields_part = nb_prefixFieldList(CNabuSiteTargetSectionBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuSiteTargetSectionBase::getStorageName(), $fields, false, false, '`');
if ($num_items !== 0) {
$limit_part = ($offset > 0 ? $offset . ', ' : '') . $num_items;
} else {
$limit_part = false;
}
$nb_item_list = CNabuEngine::getEngine()->getMainDB()->getQueryAsArray(
"select " . ($fields_part ? $fields_part . ' ' : '* ')
. 'from nb_site_target_section '
. 'where ' . NABU_MEDIOTECA_FIELD_ID . '=%medioteca_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'medioteca_id' => $nb_medioteca_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | php | public static function getFilteredSiteTargetSectionList($nb_medioteca = null, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_medioteca_id = nb_getMixedValue($nb_customer, NABU_MEDIOTECA_FIELD_ID);
if (is_numeric($nb_medioteca_id)) {
$fields_part = nb_prefixFieldList(CNabuSiteTargetSectionBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuSiteTargetSectionBase::getStorageName(), $fields, false, false, '`');
if ($num_items !== 0) {
$limit_part = ($offset > 0 ? $offset . ', ' : '') . $num_items;
} else {
$limit_part = false;
}
$nb_item_list = CNabuEngine::getEngine()->getMainDB()->getQueryAsArray(
"select " . ($fields_part ? $fields_part . ' ' : '* ')
. 'from nb_site_target_section '
. 'where ' . NABU_MEDIOTECA_FIELD_ID . '=%medioteca_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'medioteca_id' => $nb_medioteca_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | [
"public",
"static",
"function",
"getFilteredSiteTargetSectionList",
"(",
"$",
"nb_medioteca",
"=",
"null",
",",
"$",
"q",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"order",
"=",
"null",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"num_items",
... | Gets a filtered list of Site Target Section instances represented as an array. Params allows the capability of
select a subset of fields, order by concrete fields, or truncate the list by a number of rows starting in an
offset.
@throws \nabu\core\exceptions\ENabuCoreException Raises an exception if $fields or $order have invalid values.
@param mixed $nb_medioteca Medioteca instance, object containing a Medioteca Id field or an Id.
@param string $q Query string to filter results using a context index.
@param string|array $fields List of fields to put in the results.
@param string|array $order List of fields to order the results. Each field can be suffixed with "ASC" or "DESC"
to determine the short order
@param int $offset Offset of first row in the results having the first row at offset 0.
@param int $num_items Number of continue rows to get as maximum in the results.
@return array Returns an array with all rows found using the criteria. | [
"Gets",
"a",
"filtered",
"list",
"of",
"Site",
"Target",
"Section",
"instances",
"represented",
"as",
"an",
"array",
".",
"Params",
"allows",
"the",
"capability",
"of",
"select",
"a",
"subset",
"of",
"fields",
"order",
"by",
"concrete",
"fields",
"or",
"trun... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetSectionBase.php#L217-L245 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteTargetSectionBase.php | CNabuSiteTargetSectionBase.setOrder | public function setOrder(int $order) : CNabuDataObject
{
if ($order === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$order")
);
}
$this->setValue('nb_site_target_section_order', $order);
return $this;
} | php | public function setOrder(int $order) : CNabuDataObject
{
if ($order === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$order")
);
}
$this->setValue('nb_site_target_section_order', $order);
return $this;
} | [
"public",
"function",
"setOrder",
"(",
"int",
"$",
"order",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"order",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
"array"... | Sets the Site Target Section Order attribute value.
@param int $order New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Target",
"Section",
"Order",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteTargetSectionBase.php#L451-L462 | train |
orchestral/lumen | skeleton/app/Http/Controllers/AuthController.php | AuthController.deauthenticate | public function deauthenticate(ResponseFactory $response, Guard $guard, JWTAuth $auth)
{
$guard->logout();
$auth->invalidate();
return $response->json([]);
} | php | public function deauthenticate(ResponseFactory $response, Guard $guard, JWTAuth $auth)
{
$guard->logout();
$auth->invalidate();
return $response->json([]);
} | [
"public",
"function",
"deauthenticate",
"(",
"ResponseFactory",
"$",
"response",
",",
"Guard",
"$",
"guard",
",",
"JWTAuth",
"$",
"auth",
")",
"{",
"$",
"guard",
"->",
"logout",
"(",
")",
";",
"$",
"auth",
"->",
"invalidate",
"(",
")",
";",
"return",
"... | Deauthenticate the user.
Logout the user and remove any cache associated to the user.
Authorization: Bearer xxx
@Delete(uri="/")
@Request(contentType="application/json")
@Transaction({
@Response(200),
}) | [
"Deauthenticate",
"the",
"user",
"."
] | 85a004e7cde0517b527241154f5ad031b7215851 | https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/skeleton/app/Http/Controllers/AuthController.php#L67-L73 | train |
orchestral/lumen | skeleton/app/Http/Controllers/AuthController.php | AuthController.refresh | public function refresh(ResponseFactory $response, JWTAuth $auth)
{
try {
$token = $auth->parseToken()->refresh();
} catch (JWTException $e) {
throw new UnauthorizedHttpException('jwt-auth', $e->getMessage());
}
return $response->json(['token' => $token]);
} | php | public function refresh(ResponseFactory $response, JWTAuth $auth)
{
try {
$token = $auth->parseToken()->refresh();
} catch (JWTException $e) {
throw new UnauthorizedHttpException('jwt-auth', $e->getMessage());
}
return $response->json(['token' => $token]);
} | [
"public",
"function",
"refresh",
"(",
"ResponseFactory",
"$",
"response",
",",
"JWTAuth",
"$",
"auth",
")",
"{",
"try",
"{",
"$",
"token",
"=",
"$",
"auth",
"->",
"parseToken",
"(",
")",
"->",
"refresh",
"(",
")",
";",
"}",
"catch",
"(",
"JWTException"... | Refresh user token.
@Get(uri="refresh")
@Request(contentType="application/json")
@Transaction({
@Response(200, body={"token": "xxx"}),
}) | [
"Refresh",
"user",
"token",
"."
] | 85a004e7cde0517b527241154f5ad031b7215851 | https://github.com/orchestral/lumen/blob/85a004e7cde0517b527241154f5ad031b7215851/skeleton/app/Http/Controllers/AuthController.php#L84-L93 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductBase.php | CNabuCommerceProductBase.getAllCommerceProducts | public static function getAllCommerceProducts(CNabuCommerce $nb_commerce)
{
$nb_commerce_id = nb_getMixedValue($nb_commerce, 'nb_commerce_id');
if (is_numeric($nb_commerce_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_commerce_product_id',
'select * '
. 'from nb_commerce_product '
. 'where nb_commerce_id=%commerce_id$d',
array(
'commerce_id' => $nb_commerce_id
),
$nb_commerce
);
} else {
$retval = new CNabuCommerceProductList();
}
return $retval;
} | php | public static function getAllCommerceProducts(CNabuCommerce $nb_commerce)
{
$nb_commerce_id = nb_getMixedValue($nb_commerce, 'nb_commerce_id');
if (is_numeric($nb_commerce_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_commerce_product_id',
'select * '
. 'from nb_commerce_product '
. 'where nb_commerce_id=%commerce_id$d',
array(
'commerce_id' => $nb_commerce_id
),
$nb_commerce
);
} else {
$retval = new CNabuCommerceProductList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllCommerceProducts",
"(",
"CNabuCommerce",
"$",
"nb_commerce",
")",
"{",
"$",
"nb_commerce_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_commerce",
",",
"'nb_commerce_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_commerc... | Get all items in the storage as an associative array where the field 'nb_commerce_product_id' is the index, and
each value is an instance of class CNabuCommerceProductBase.
@param CNabuCommerce $nb_commerce The CNabuCommerce instance of the Commerce that owns the Commerce Product List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_commerce_product_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuCommerceProductBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductBase.php#L130-L150 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductBase.php | CNabuCommerceProductBase.getFilteredCommerceProductList | public static function getFilteredCommerceProductList($q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_commerce_id = nb_getMixedValue($nb_customer, NABU_COMMERCE_FIELD_ID);
if (is_numeric($nb_commerce_id)) {
$fields_part = nb_prefixFieldList(CNabuCommerceProductBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuCommerceProductBase::getStorageName(), $fields, false, false, '`');
if ($num_items !== 0) {
$limit_part = ($offset > 0 ? $offset . ', ' : '') . $num_items;
} else {
$limit_part = false;
}
$nb_item_list = CNabuEngine::getEngine()->getMainDB()->getQueryAsArray(
"select " . ($fields_part ? $fields_part . ' ' : '* ')
. 'from nb_commerce_product '
. 'where ' . NABU_COMMERCE_FIELD_ID . '=%commerce_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'commerce_id' => $nb_commerce_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | php | public static function getFilteredCommerceProductList($q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_commerce_id = nb_getMixedValue($nb_customer, NABU_COMMERCE_FIELD_ID);
if (is_numeric($nb_commerce_id)) {
$fields_part = nb_prefixFieldList(CNabuCommerceProductBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuCommerceProductBase::getStorageName(), $fields, false, false, '`');
if ($num_items !== 0) {
$limit_part = ($offset > 0 ? $offset . ', ' : '') . $num_items;
} else {
$limit_part = false;
}
$nb_item_list = CNabuEngine::getEngine()->getMainDB()->getQueryAsArray(
"select " . ($fields_part ? $fields_part . ' ' : '* ')
. 'from nb_commerce_product '
. 'where ' . NABU_COMMERCE_FIELD_ID . '=%commerce_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'commerce_id' => $nb_commerce_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | [
"public",
"static",
"function",
"getFilteredCommerceProductList",
"(",
"$",
"q",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"order",
"=",
"null",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"num_items",
"=",
"0",
")",
"{",
"$",
"nb_commerce_id... | Gets a filtered list of Commerce Product instances represented as an array. Params allows the capability of
select a subset of fields, order by concrete fields, or truncate the list by a number of rows starting in an
offset.
@throws \nabu\core\exceptions\ENabuCoreException Raises an exception if $fields or $order have invalid values.
@param string $q Query string to filter results using a context index.
@param string|array $fields List of fields to put in the results.
@param string|array $order List of fields to order the results. Each field can be suffixed with "ASC" or "DESC"
to determine the short order
@param int $offset Offset of first row in the results having the first row at offset 0.
@param int $num_items Number of continue rows to get as maximum in the results.
@return array Returns an array with all rows found using the criteria. | [
"Gets",
"a",
"filtered",
"list",
"of",
"Commerce",
"Product",
"instances",
"represented",
"as",
"an",
"array",
".",
"Params",
"allows",
"the",
"capability",
"of",
"select",
"a",
"subset",
"of",
"fields",
"order",
"by",
"concrete",
"fields",
"or",
"truncate",
... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductBase.php#L165-L193 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductBase.php | CNabuCommerceProductBase.setTaxPercentage | public function setTaxPercentage($tax_percentage) : CNabuDataObject
{
if ($tax_percentage === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$tax_percentage")
);
}
$this->setValue('nb_commerce_product_tax_percentage', $tax_percentage);
return $this;
} | php | public function setTaxPercentage($tax_percentage) : CNabuDataObject
{
if ($tax_percentage === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$tax_percentage")
);
}
$this->setValue('nb_commerce_product_tax_percentage', $tax_percentage);
return $this;
} | [
"public",
"function",
"setTaxPercentage",
"(",
"$",
"tax_percentage",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"tax_percentage",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",... | Sets the Commerce Product Tax Percentage attribute value.
@param mixed $tax_percentage New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Commerce",
"Product",
"Tax",
"Percentage",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductBase.php#L657-L668 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductBase.php | CNabuCommerceProductBase.setTaxAmount | public function setTaxAmount($tax_amount) : CNabuDataObject
{
if ($tax_amount === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$tax_amount")
);
}
$this->setValue('nb_commerce_product_tax_amount', $tax_amount);
return $this;
} | php | public function setTaxAmount($tax_amount) : CNabuDataObject
{
if ($tax_amount === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$tax_amount")
);
}
$this->setValue('nb_commerce_product_tax_amount', $tax_amount);
return $this;
} | [
"public",
"function",
"setTaxAmount",
"(",
"$",
"tax_amount",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"tax_amount",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
"a... | Sets the Commerce Product Tax Amount attribute value.
@param mixed $tax_amount New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Commerce",
"Product",
"Tax",
"Amount",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductBase.php#L684-L695 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductBase.php | CNabuCommerceProductBase.setPriceWithTax | public function setPriceWithTax($price_with_tax) : CNabuDataObject
{
if ($price_with_tax === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$price_with_tax")
);
}
$this->setValue('nb_commerce_product_price_with_tax', $price_with_tax);
return $this;
} | php | public function setPriceWithTax($price_with_tax) : CNabuDataObject
{
if ($price_with_tax === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$price_with_tax")
);
}
$this->setValue('nb_commerce_product_price_with_tax', $price_with_tax);
return $this;
} | [
"public",
"function",
"setPriceWithTax",
"(",
"$",
"price_with_tax",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"price_with_tax",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
... | Sets the Commerce Product Price With Tax attribute value.
@param mixed $price_with_tax New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Commerce",
"Product",
"Price",
"With",
"Tax",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductBase.php#L711-L722 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductBase.php | CNabuCommerceProductBase.setIsUpselling | public function setIsUpselling(string $is_upselling = "F") : CNabuDataObject
{
if ($is_upselling === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$is_upselling")
);
}
$this->setValue('nb_commerce_product_is_upselling', $is_upselling);
return $this;
} | php | public function setIsUpselling(string $is_upselling = "F") : CNabuDataObject
{
if ($is_upselling === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$is_upselling")
);
}
$this->setValue('nb_commerce_product_is_upselling', $is_upselling);
return $this;
} | [
"public",
"function",
"setIsUpselling",
"(",
"string",
"$",
"is_upselling",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"is_upselling",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NUL... | Sets the Commerce Product Is Upselling attribute value.
@param string $is_upselling New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Commerce",
"Product",
"Is",
"Upselling",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductBase.php#L738-L749 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductBase.php | CNabuCommerceProductBase.setSoldIndividually | public function setSoldIndividually(string $sold_individually = "T") : CNabuDataObject
{
if ($sold_individually === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$sold_individually")
);
}
$this->setValue('nb_commerce_product_sold_individually', $sold_individually);
return $this;
} | php | public function setSoldIndividually(string $sold_individually = "T") : CNabuDataObject
{
if ($sold_individually === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$sold_individually")
);
}
$this->setValue('nb_commerce_product_sold_individually', $sold_individually);
return $this;
} | [
"public",
"function",
"setSoldIndividually",
"(",
"string",
"$",
"sold_individually",
"=",
"\"T\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"sold_individually",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::... | Sets the Commerce Product Sold Individually attribute value.
@param string $sold_individually New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Commerce",
"Product",
"Sold",
"Individually",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductBase.php#L765-L776 | train |
nabu-3/core | nabu/data/commerce/base/CNabuCommerceProductBase.php | CNabuCommerceProductBase.setIsVirtual | public function setIsVirtual(string $is_virtual = "F") : CNabuDataObject
{
if ($is_virtual === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$is_virtual")
);
}
$this->setValue('nb_commerce_product_is_virtual', $is_virtual);
return $this;
} | php | public function setIsVirtual(string $is_virtual = "F") : CNabuDataObject
{
if ($is_virtual === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$is_virtual")
);
}
$this->setValue('nb_commerce_product_is_virtual', $is_virtual);
return $this;
} | [
"public",
"function",
"setIsVirtual",
"(",
"string",
"$",
"is_virtual",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"is_virtual",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALU... | Sets the Commerce Product Is Virtual attribute value.
@param string $is_virtual New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Commerce",
"Product",
"Is",
"Virtual",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/base/CNabuCommerceProductBase.php#L792-L803 | train |
nabu-3/core | nabu/data/commerce/traits/TNabuCommerceChild.php | TNabuCommerceChild.getCommerce | public function getCommerce($force = false)
{
if ($this->nb_commerce === null || $force) {
$this->nb_commerce = null;
if (!$this->isBuiltIn() && $this->isValueNumeric(NABU_COMMERCE_FIELD_ID)) {
$nb_commerce = new CNabuCommerce($this->getValue(NABU_COMMERCE_FIELD_ID));
if ($nb_commerce->isFetched()) {
$this->nb_commerce = $nb_commerce;
}
}
}
return $this->nb_commerce;
} | php | public function getCommerce($force = false)
{
if ($this->nb_commerce === null || $force) {
$this->nb_commerce = null;
if (!$this->isBuiltIn() && $this->isValueNumeric(NABU_COMMERCE_FIELD_ID)) {
$nb_commerce = new CNabuCommerce($this->getValue(NABU_COMMERCE_FIELD_ID));
if ($nb_commerce->isFetched()) {
$this->nb_commerce = $nb_commerce;
}
}
}
return $this->nb_commerce;
} | [
"public",
"function",
"getCommerce",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_commerce",
"===",
"null",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_commerce",
"=",
"null",
";",
"if",
"(",
"!",
"$",
"this... | Gets the Commerce instance that owns this object.
@return CNabuCommerce Returns the commerce instance if exists or null if not. | [
"Gets",
"the",
"Commerce",
"instance",
"that",
"owns",
"this",
"object",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/traits/TNabuCommerceChild.php#L48-L61 | train |
nabu-3/core | nabu/data/commerce/traits/TNabuCommerceChild.php | TNabuCommerceChild.setCommerce | public function setCommerce(CNabuCommerce $nb_commerce)
{
$this->nb_commerce = $nb_commerce;
$this->transferValue($nb_commerce, NABU_COMMERCE_FIELD_ID);
return $this;
} | php | public function setCommerce(CNabuCommerce $nb_commerce)
{
$this->nb_commerce = $nb_commerce;
$this->transferValue($nb_commerce, NABU_COMMERCE_FIELD_ID);
return $this;
} | [
"public",
"function",
"setCommerce",
"(",
"CNabuCommerce",
"$",
"nb_commerce",
")",
"{",
"$",
"this",
"->",
"nb_commerce",
"=",
"$",
"nb_commerce",
";",
"$",
"this",
"->",
"transferValue",
"(",
"$",
"nb_commerce",
",",
"NABU_COMMERCE_FIELD_ID",
")",
";",
"retu... | Sets the Commerce instance that onws this object.
@param CNabuCommerce $nb_commerce The Commerce instance to be setted.
@return mixed Return $this to grant cascade chain. | [
"Sets",
"the",
"Commerce",
"instance",
"that",
"onws",
"this",
"object",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/commerce/traits/TNabuCommerceChild.php#L68-L74 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspect.php | CNabuIContactProspect.getProspectsForIContact | public static function getProspectsForIContact(
$nb_icontact,
CNabuIContactProspectStatusType $nb_status_type = null
) : CNabuIContactProspectList {
if (is_numeric($nb_icontact_id = nb_getMixedValue($nb_icontact, 'nb_icontact_id'))) {
$status_id = nb_getMixedValue($nb_status_type, 'nb_icontact_prospect_status_type_id');
$retval = CNabuIContactProspect::buildObjectListFromSQL(
'nb_icontact_prospect_id',
'SELECT ip.*
FROM nb_icontact_prospect ip, nb_icontact i
WHERE ip.nb_icontact_id=i.nb_icontact_id
AND i.nb_icontact_id=%cont_id$d '
. (is_numeric($status_id) ? 'AND ip.nb_icontact_prospect_status_id=%status_id$d ' : '')
. 'ORDER BY ip.nb_icontact_prospect_creation_datetime DESC',
array(
'cont_id' => $nb_icontact_id,
'status_id' => $status_id
),
($nb_icontact instanceof CNabuIContact ? $nb_icontact : null)
);
if ($nb_icontact instanceof CNabuIContact) {
$retval->iterate(function ($key, $nb_prospect) use ($nb_icontact) {
$nb_prospect->setIContact($nb_icontact);
return true;
});
}
} else {
$retval = new CNabuIContactProspectList();
}
return $retval;
} | php | public static function getProspectsForIContact(
$nb_icontact,
CNabuIContactProspectStatusType $nb_status_type = null
) : CNabuIContactProspectList {
if (is_numeric($nb_icontact_id = nb_getMixedValue($nb_icontact, 'nb_icontact_id'))) {
$status_id = nb_getMixedValue($nb_status_type, 'nb_icontact_prospect_status_type_id');
$retval = CNabuIContactProspect::buildObjectListFromSQL(
'nb_icontact_prospect_id',
'SELECT ip.*
FROM nb_icontact_prospect ip, nb_icontact i
WHERE ip.nb_icontact_id=i.nb_icontact_id
AND i.nb_icontact_id=%cont_id$d '
. (is_numeric($status_id) ? 'AND ip.nb_icontact_prospect_status_id=%status_id$d ' : '')
. 'ORDER BY ip.nb_icontact_prospect_creation_datetime DESC',
array(
'cont_id' => $nb_icontact_id,
'status_id' => $status_id
),
($nb_icontact instanceof CNabuIContact ? $nb_icontact : null)
);
if ($nb_icontact instanceof CNabuIContact) {
$retval->iterate(function ($key, $nb_prospect) use ($nb_icontact) {
$nb_prospect->setIContact($nb_icontact);
return true;
});
}
} else {
$retval = new CNabuIContactProspectList();
}
return $retval;
} | [
"public",
"static",
"function",
"getProspectsForIContact",
"(",
"$",
"nb_icontact",
",",
"CNabuIContactProspectStatusType",
"$",
"nb_status_type",
"=",
"null",
")",
":",
"CNabuIContactProspectList",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_icontact_id",
"=",
"nb_ge... | Get related Prospects of a User.
@param mixed $nb_icontact IContact instance where to find Prospects or a CNabuDataObject containing a field
called nb_icontact_prospect_id or an ID.
@param CNabuIContactProspectStatusType|null $nb_status_type If setted, the list is filtered using this status.
@return CNabuIContactProspectList Returns a Prospect List containing all Prospects found. | [
"Get",
"related",
"Prospects",
"of",
"a",
"User",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspect.php#L86-L117 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspect.php | CNabuIContactProspect.getCountProspectsOfUser | public static function getCountProspectsOfUser(
$nb_icontact,
$nb_user,
CNabuIContactProspectStatusType $nb_status_type = null
) : int {
if (is_numeric($nb_icontact_id = nb_getMixedValue($nb_icontact, 'nb_icontact_id')) &&
is_numeric($nb_user_id = nb_getMixedValue($nb_user, 'nb_user_id'))
) {
$status_id = nb_getMixedValue($nb_status_type, 'nb_icontact_prospect_status_type_id');
$retval = CNabuEngine::getEngine()->getMainDB()->getQueryAsCount(
'nb_icontact_prospect ip, nb_icontact i',
null,
"ip.nb_icontact_id=i.nb_icontact_id AND i.nb_icontact_id=$nb_icontact_id"
." AND ip.nb_user_id=$nb_user_id"
. (is_numeric($status_id) ? " AND ip.nb_icontact_prospect_status_id=$status_id " : '')
);
} else {
$retval = 0;
}
return $retval;
} | php | public static function getCountProspectsOfUser(
$nb_icontact,
$nb_user,
CNabuIContactProspectStatusType $nb_status_type = null
) : int {
if (is_numeric($nb_icontact_id = nb_getMixedValue($nb_icontact, 'nb_icontact_id')) &&
is_numeric($nb_user_id = nb_getMixedValue($nb_user, 'nb_user_id'))
) {
$status_id = nb_getMixedValue($nb_status_type, 'nb_icontact_prospect_status_type_id');
$retval = CNabuEngine::getEngine()->getMainDB()->getQueryAsCount(
'nb_icontact_prospect ip, nb_icontact i',
null,
"ip.nb_icontact_id=i.nb_icontact_id AND i.nb_icontact_id=$nb_icontact_id"
." AND ip.nb_user_id=$nb_user_id"
. (is_numeric($status_id) ? " AND ip.nb_icontact_prospect_status_id=$status_id " : '')
);
} else {
$retval = 0;
}
return $retval;
} | [
"public",
"static",
"function",
"getCountProspectsOfUser",
"(",
"$",
"nb_icontact",
",",
"$",
"nb_user",
",",
"CNabuIContactProspectStatusType",
"$",
"nb_status_type",
"=",
"null",
")",
":",
"int",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_icontact_id",
"=",
"... | Get the count of related Prospects of a User.
@param mixed $nb_icontact A CNabuDataObject containing a field called nb_icontact_prospect_id or an ID
where to count Prospects.
@param mixed $nb_user User instance that holds Prospects or a CNabuDataObject containing a field called
nb_user_id or an ID.
@param CNabuIContactProspectStatusType|null $nb_status_type If setted, the list is filtered using this status.
@return int Returns the count of all Prospects found. | [
"Get",
"the",
"count",
"of",
"related",
"Prospects",
"of",
"a",
"User",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspect.php#L175-L196 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspect.php | CNabuIContactProspect.encodeEmail | public static function encodeEmail(string $email) : string
{
return md5(self::EMAIL_PREF . preg_replace('/\\s/', '', mb_strtolower($email)) . self::EMAIL_SUFF);
} | php | public static function encodeEmail(string $email) : string
{
return md5(self::EMAIL_PREF . preg_replace('/\\s/', '', mb_strtolower($email)) . self::EMAIL_SUFF);
} | [
"public",
"static",
"function",
"encodeEmail",
"(",
"string",
"$",
"email",
")",
":",
"string",
"{",
"return",
"md5",
"(",
"self",
"::",
"EMAIL_PREF",
".",
"preg_replace",
"(",
"'/\\\\s/'",
",",
"''",
",",
"mb_strtolower",
"(",
"$",
"email",
")",
")",
".... | Encodes a clear email using the nabu-3 algorithm. This algorithm is not reversible.
@param string $email Email string to be encoded.
@return string Returns the encoded Email as string. | [
"Encodes",
"a",
"clear",
"email",
"using",
"the",
"nabu",
"-",
"3",
"algorithm",
".",
"This",
"algorithm",
"is",
"not",
"reversible",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspect.php#L204-L207 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspect.php | CNabuIContactProspect.setEmail | public function setEmail(string $email = null) : CNabuDataObject
{
parent::setEmail($email);
return parent::setEmailHash(is_string($email) ? self::encodeEmail($email) : null);
} | php | public function setEmail(string $email = null) : CNabuDataObject
{
parent::setEmail($email);
return parent::setEmailHash(is_string($email) ? self::encodeEmail($email) : null);
} | [
"public",
"function",
"setEmail",
"(",
"string",
"$",
"email",
"=",
"null",
")",
":",
"CNabuDataObject",
"{",
"parent",
"::",
"setEmail",
"(",
"$",
"email",
")",
";",
"return",
"parent",
"::",
"setEmailHash",
"(",
"is_string",
"(",
"$",
"email",
")",
"?"... | Sets the Email and encoding it into a nabu-3 hashing algorithm.
@param string|null $email Email string to be encoded and setted.
@return CNabuDataObject Returns the self instance to grant cascade setters. | [
"Sets",
"the",
"Email",
"and",
"encoding",
"it",
"into",
"a",
"nabu",
"-",
"3",
"hashing",
"algorithm",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspect.php#L214-L218 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspect.php | CNabuIContactProspect.findIContactProspectsByEmailHash | public static function findIContactProspectsByEmailHash(
CNabuIContact $nb_icontact,
string $hash
) : CNabuIContactProspectList {
if (is_numeric($nb_icontact_id = nb_getMixedValue($nb_icontact, 'nb_icontact_id')) &&
strlen($hash) === 32
) {
$list = CNabuIContactProspect::buildObjectListFromSQL(
'nb_icontact_prospect_id',
'SELECT *
FROM nb_icontact_prospect
WHERE nb_icontact_id=%icontact_id$d
AND nb_icontact_prospect_email_hash=\'%hash$s\'',
array(
'icontact_id' => $nb_icontact_id,
'hash' => $hash
)
);
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE, array('$hash'));
}
return $list;
} | php | public static function findIContactProspectsByEmailHash(
CNabuIContact $nb_icontact,
string $hash
) : CNabuIContactProspectList {
if (is_numeric($nb_icontact_id = nb_getMixedValue($nb_icontact, 'nb_icontact_id')) &&
strlen($hash) === 32
) {
$list = CNabuIContactProspect::buildObjectListFromSQL(
'nb_icontact_prospect_id',
'SELECT *
FROM nb_icontact_prospect
WHERE nb_icontact_id=%icontact_id$d
AND nb_icontact_prospect_email_hash=\'%hash$s\'',
array(
'icontact_id' => $nb_icontact_id,
'hash' => $hash
)
);
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_UNEXPECTED_PARAM_VALUE, array('$hash'));
}
return $list;
} | [
"public",
"static",
"function",
"findIContactProspectsByEmailHash",
"(",
"CNabuIContact",
"$",
"nb_icontact",
",",
"string",
"$",
"hash",
")",
":",
"CNabuIContactProspectList",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_icontact_id",
"=",
"nb_getMixedValue",
"(",
"... | To find a list of Prospects related by the same Email hash.
@param CNabuIContact $nb_icontact IContact instance that contains requested Prospects.
@param string $hash Hash that identifies the Email.
@return CNabuIContactProspectList The list of Prospects found. | [
"To",
"find",
"a",
"list",
"of",
"Prospects",
"related",
"by",
"the",
"same",
"Email",
"hash",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspect.php#L226-L249 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspect.php | CNabuIContactProspect.getAttachments | public function getAttachments(bool $force = false) : CNabuIContactProspectAttachmentList
{
if ($this->nb_attachment_list->isEmpty() || $force) {
$this->nb_attachment_list->clear();
$this->nb_attachment_list->merge(CNabuIContactProspectAttachment::getAttachmentsForProspect($this));
}
return $this->nb_attachment_list;
} | php | public function getAttachments(bool $force = false) : CNabuIContactProspectAttachmentList
{
if ($this->nb_attachment_list->isEmpty() || $force) {
$this->nb_attachment_list->clear();
$this->nb_attachment_list->merge(CNabuIContactProspectAttachment::getAttachmentsForProspect($this));
}
return $this->nb_attachment_list;
} | [
"public",
"function",
"getAttachments",
"(",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"CNabuIContactProspectAttachmentList",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_attachment_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
... | Get the list of all attachments associated with this instance.
@param bool $force If true then force to refresh list from the database storage.
@return CNabuIContactProspectAttachmentList Returns a list with attachments found. | [
"Get",
"the",
"list",
"of",
"all",
"attachments",
"associated",
"with",
"this",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspect.php#L256-L264 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspect.php | CNabuIContactProspect.addAttachment | public function addAttachment(
string $name,
string $mimetype,
string $file,
CNabuIContactProspectDiary $nb_diary = null,
bool $save = true
) {
if ($this->isFetched()) {
$nb_icontact = $this->getIContact();
$base_path = $nb_icontact->getBasePath();
$retval = $nb_attachment = new CNabuIContactProspectAttachment();
$nb_attachment->setIcontactProspect($this);
$nb_attachment->setIcontactProspectDiaryId(
$nb_diary instanceof CNabuIContactProspectDiary ? $nb_diary->getId() : null
);
$nb_attachment->setName($name);
$nb_attachment->setMIMEType($mimetype);
$nb_attachment->grantHash();
$nb_attachment->putFile($file);
if ($save) {
$nb_attachment->save();
$this->nb_attachment_list->addItem($nb_attachment);
}
return $retval;
} else {
throw new ENabuIContactException(ENabuIContactException::ERROR_ICONTACT_NOT_FETCHED);
}
} | php | public function addAttachment(
string $name,
string $mimetype,
string $file,
CNabuIContactProspectDiary $nb_diary = null,
bool $save = true
) {
if ($this->isFetched()) {
$nb_icontact = $this->getIContact();
$base_path = $nb_icontact->getBasePath();
$retval = $nb_attachment = new CNabuIContactProspectAttachment();
$nb_attachment->setIcontactProspect($this);
$nb_attachment->setIcontactProspectDiaryId(
$nb_diary instanceof CNabuIContactProspectDiary ? $nb_diary->getId() : null
);
$nb_attachment->setName($name);
$nb_attachment->setMIMEType($mimetype);
$nb_attachment->grantHash();
$nb_attachment->putFile($file);
if ($save) {
$nb_attachment->save();
$this->nb_attachment_list->addItem($nb_attachment);
}
return $retval;
} else {
throw new ENabuIContactException(ENabuIContactException::ERROR_ICONTACT_NOT_FETCHED);
}
} | [
"public",
"function",
"addAttachment",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"mimetype",
",",
"string",
"$",
"file",
",",
"CNabuIContactProspectDiary",
"$",
"nb_diary",
"=",
"null",
",",
"bool",
"$",
"save",
"=",
"true",
")",
"{",
"if",
"(",
"$... | Add an Attachment file to this Prospect.
@param string $name Name of the attachment
@param string $mimetype Mime Type of the attachement
@param string $file Full File path and name where the Attachment is originaly stored. I.E. the temporary folder.
@param bool $save If true, the Attachment is inmediately saved in the database storage.
@param CNabuIContactProspectDiary|null $nb_diary If needed the Diary annotation instance
related with this attachment.
@return CNabuIContactProspectAttachment Returns a instance object descriptor of created Attachemnt. | [
"Add",
"an",
"Attachment",
"file",
"to",
"this",
"Prospect",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspect.php#L276-L305 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspect.php | CNabuIContactProspect.deleteAttachment | public function deleteAttachment($nb_attachment) : bool
{
$retval = false;
$nb_attachment_id = nb_getMixedValue($nb_attachment, NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID);
if (is_numeric($nb_attachment_id)) {
$nb_attachment = $this->nb_attachment_list->getItem($nb_attachment_id);
if ($nb_attachment->getIContactProspectId() == $this->getId()) {
$nb_attachment->deleteFile();
$this->nb_attachment_list->removeItem($nb_attachment);
$nb_attachment->delete();
$retval = true;
}
}
return $retval;
} | php | public function deleteAttachment($nb_attachment) : bool
{
$retval = false;
$nb_attachment_id = nb_getMixedValue($nb_attachment, NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID);
if (is_numeric($nb_attachment_id)) {
$nb_attachment = $this->nb_attachment_list->getItem($nb_attachment_id);
if ($nb_attachment->getIContactProspectId() == $this->getId()) {
$nb_attachment->deleteFile();
$this->nb_attachment_list->removeItem($nb_attachment);
$nb_attachment->delete();
$retval = true;
}
}
return $retval;
} | [
"public",
"function",
"deleteAttachment",
"(",
"$",
"nb_attachment",
")",
":",
"bool",
"{",
"$",
"retval",
"=",
"false",
";",
"$",
"nb_attachment_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_attachment",
",",
"NABU_ICONTACT_PROSPECT_ATTACHMENT_FIELD_ID",
")",
";",
... | Delete an Attachment from the list if exists.
@param mixed $nb_attachment A CNabuDataObject containing a field named nb_icontact_prospect_attachment_id
or a valid Id.
@return bool Returns true if the Attachment exists and was deleted.
@throws ENabuIContactException Raises an exception if something happens while delete
the attachment in the storage. | [
"Delete",
"an",
"Attachment",
"from",
"the",
"list",
"if",
"exists",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspect.php#L315-L332 | train |
nabu-3/core | nabu/data/icontact/CNabuIContactProspect.php | CNabuIContactProspect.save | public function save($trace = false)
{
$retval = parent::save($trace);
$this->nb_attachment_list->iterate(
function ($key, CNabuIContactProspectAttachment $nb_attachment) use ($retval) {
$retval |= $nb_attachment->save();
return true;
}
);
return $retval;
} | php | public function save($trace = false)
{
$retval = parent::save($trace);
$this->nb_attachment_list->iterate(
function ($key, CNabuIContactProspectAttachment $nb_attachment) use ($retval) {
$retval |= $nb_attachment->save();
return true;
}
);
return $retval;
} | [
"public",
"function",
"save",
"(",
"$",
"trace",
"=",
"false",
")",
"{",
"$",
"retval",
"=",
"parent",
"::",
"save",
"(",
"$",
"trace",
")",
";",
"$",
"this",
"->",
"nb_attachment_list",
"->",
"iterate",
"(",
"function",
"(",
"$",
"key",
",",
"CNabuI... | Overrides the parent method to save modified subordinated instances.
@param bool $trace If true, traces the query.
@return bool Returns true if success | [
"Overrides",
"the",
"parent",
"method",
"to",
"save",
"modified",
"subordinated",
"instances",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/CNabuIContactProspect.php#L339-L351 | train |
markusjwetzel/laravel-datamapper | src/Providers/MetadataServiceProvider.php | MetadataServiceProvider.registerAnnotations | public function registerAnnotations()
{
$app = $this->app;
$loader = new AnnotationLoader($app['files'], __DIR__ . '/../Annotations');
$loader->registerAll();
} | php | public function registerAnnotations()
{
$app = $this->app;
$loader = new AnnotationLoader($app['files'], __DIR__ . '/../Annotations');
$loader->registerAll();
} | [
"public",
"function",
"registerAnnotations",
"(",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"app",
";",
"$",
"loader",
"=",
"new",
"AnnotationLoader",
"(",
"$",
"app",
"[",
"'files'",
"]",
",",
"__DIR__",
".",
"'/../Annotations'",
")",
";",
"$",
"l... | Registers all annotation classes
@return void | [
"Registers",
"all",
"annotation",
"classes"
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Providers/MetadataServiceProvider.php#L39-L46 | train |
nabu-3/core | nabu/data/lang/base/CNabuLanguageBase.php | CNabuLanguageBase.setIsApi | public function setIsApi(string $is_api = "F") : CNabuDataObject
{
if ($is_api === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$is_api")
);
}
$this->setValue('nb_language_is_api', $is_api);
return $this;
} | php | public function setIsApi(string $is_api = "F") : CNabuDataObject
{
if ($is_api === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$is_api")
);
}
$this->setValue('nb_language_is_api', $is_api);
return $this;
} | [
"public",
"function",
"setIsApi",
"(",
"string",
"$",
"is_api",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"is_api",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWE... | Sets the Language Is Api attribute value.
@param string $is_api New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Language",
"Is",
"Api",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/lang/base/CNabuLanguageBase.php#L311-L322 | train |
nabu-3/core | nabu/data/lang/base/CNabuLanguageBase.php | CNabuLanguageBase.setName | public function setName(string $name) : CNabuDataObject
{
if ($name === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$name")
);
}
$this->setValue('nb_language_name', $name);
return $this;
} | php | public function setName(string $name) : CNabuDataObject
{
if ($name === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$name")
);
}
$this->setValue('nb_language_name', $name);
return $this;
} | [
"public",
"function",
"setName",
"(",
"string",
"$",
"name",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
"array"... | Sets the Language Name attribute value.
@param string $name New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Language",
"Name",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/lang/base/CNabuLanguageBase.php#L401-L412 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/SummaryHydrator.php | SummaryHydrator.hydrateCollection | public static function hydrateCollection(array $summaries)
{
$hydrated = [];
foreach ($summaries as $summary) {
$hydrated[] = self::hydrate($summary);
}
return $hydrated;
} | php | public static function hydrateCollection(array $summaries)
{
$hydrated = [];
foreach ($summaries as $summary) {
$hydrated[] = self::hydrate($summary);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"summaries",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"summaries",
"as",
"$",
"summary",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate... | Hydrate a collection of summary objects into a collection of
SummaryEntity objects
@param stdClass[] $summaries
@return SummaryEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"summary",
"objects",
"into",
"a",
"collection",
"of",
"SummaryEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/SummaryHydrator.php#L20-L29 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/SummaryHydrator.php | SummaryHydrator.hydrate | public static function hydrate(stdClass $summary)
{
$hydrated = new SummaryEntity();
if (isset($summary->id)) {
$hydrated->setId($summary->id);
}
if (isset($summary->line)) {
$hydrated->setLine($summary->line);
}
if (isset($summary->content)) {
$hydrated->setContent($summary->content);
}
if (isset($summary->highlighted_content)) {
$hydrated->setHighlightedContent($summary->highlighted_content);
}
if (isset($summary->file)) {
$hydrated->setFile(FileHydrator::hydrate($summary->file));
}
if (isset($summary->function)) {
$hydrated->setFunction(CustomFunctionHydrator::hydrate($summary->function));
}
if (isset($summary->class)) {
$hydrated->setClass(CustomClassHydrator::hydrate($summary->class));
}
return $hydrated;
} | php | public static function hydrate(stdClass $summary)
{
$hydrated = new SummaryEntity();
if (isset($summary->id)) {
$hydrated->setId($summary->id);
}
if (isset($summary->line)) {
$hydrated->setLine($summary->line);
}
if (isset($summary->content)) {
$hydrated->setContent($summary->content);
}
if (isset($summary->highlighted_content)) {
$hydrated->setHighlightedContent($summary->highlighted_content);
}
if (isset($summary->file)) {
$hydrated->setFile(FileHydrator::hydrate($summary->file));
}
if (isset($summary->function)) {
$hydrated->setFunction(CustomFunctionHydrator::hydrate($summary->function));
}
if (isset($summary->class)) {
$hydrated->setClass(CustomClassHydrator::hydrate($summary->class));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"summary",
")",
"{",
"$",
"hydrated",
"=",
"new",
"SummaryEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"summary",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"("... | Hydrate a summary object into a SummaryEntity object
@param stdClass $summary
@return SummaryEntity | [
"Hydrate",
"a",
"summary",
"object",
"into",
"a",
"SummaryEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/SummaryHydrator.php#L37-L70 | train |
nabu-3/core | nabu/xml/site/CNabuXMLSite.php | CNabuXMLSite.setRedirections | private function setRedirections(SimpleXMLElement $element)
{
$pages = $element->addChild('redirections');
$this->setRedirection($pages, 'default', 'default');
$this->setRedirection($pages, 'page_not_found', 'pageNotFound');
$this->setRedirection($pages, 'login', 'login');
$this->setRedirection($pages, 'login_redirection', 'loginRedirection');
$this->setRedirection($pages, 'logout_redirection', 'logoutRedirection');
$this->setRedirection($pages, 'alias_not_found', 'aliasNotFound');
$this->setRedirection($pages, 'alias_locked', 'aliasLocked');
} | php | private function setRedirections(SimpleXMLElement $element)
{
$pages = $element->addChild('redirections');
$this->setRedirection($pages, 'default', 'default');
$this->setRedirection($pages, 'page_not_found', 'pageNotFound');
$this->setRedirection($pages, 'login', 'login');
$this->setRedirection($pages, 'login_redirection', 'loginRedirection');
$this->setRedirection($pages, 'logout_redirection', 'logoutRedirection');
$this->setRedirection($pages, 'alias_not_found', 'aliasNotFound');
$this->setRedirection($pages, 'alias_locked', 'aliasLocked');
} | [
"private",
"function",
"setRedirections",
"(",
"SimpleXMLElement",
"$",
"element",
")",
"{",
"$",
"pages",
"=",
"$",
"element",
"->",
"addChild",
"(",
"'redirections'",
")",
";",
"$",
"this",
"->",
"setRedirection",
"(",
"$",
"pages",
",",
"'default'",
",",
... | Build redirection pointers for special cases.
@param SimpleXMLElement $element Parent element to put pages collection. | [
"Build",
"redirection",
"pointers",
"for",
"special",
"cases",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/site/CNabuXMLSite.php#L65-L75 | train |
nabu-3/core | nabu/xml/site/CNabuXMLSite.php | CNabuXMLSite.setRedirection | private function setRedirection(SimpleXMLElement $element, string $field, string $tag_name)
{
$page = $element->addChild($tag_name);
switch ($this->nb_data_object->getValue("nb_site_${field}_target_use_uri")) {
case 'T':
$id = $this->nb_data_object->getValue("nb_site_${field}_target_id");
if (is_numeric($id) && is_string($hash = $this->grantTargetHash($id))) {
$page->addAttribute('useURI', 'T');
$page->addAttribute('id', $hash);
$this->putAttributesFromList($page, array(
"nb_site_${field}_error_code" => "errorCode"
));
}
break;
case 'U':
$translations = $this->nb_data_object->getTranslations();
$urls = array();
$translations->iterate(function($lang, $nb_translation) use(&$urls, $field) {
$urls[$lang] = $nb_translation->getValue("nb_site_lang_${field}_target_url");
return true;
});
if (count($urls) > 0) {
$page->addAttribute('useURI', 'U');
foreach ($urls as $lang => $url) {
if (strlen($url) > 0) {
$nb_language = $this->nb_data_object->getLanguage($lang);
$address = $page->addChild('url');
$address->addAttribute('lang', $nb_language->getHash());
$address->addAttribute('url', $url);
}
}
}
$this->putAttributesFromList($page, array(
"nb_site_${field}_error_code" => "errorCode"
), true);
break;
}
} | php | private function setRedirection(SimpleXMLElement $element, string $field, string $tag_name)
{
$page = $element->addChild($tag_name);
switch ($this->nb_data_object->getValue("nb_site_${field}_target_use_uri")) {
case 'T':
$id = $this->nb_data_object->getValue("nb_site_${field}_target_id");
if (is_numeric($id) && is_string($hash = $this->grantTargetHash($id))) {
$page->addAttribute('useURI', 'T');
$page->addAttribute('id', $hash);
$this->putAttributesFromList($page, array(
"nb_site_${field}_error_code" => "errorCode"
));
}
break;
case 'U':
$translations = $this->nb_data_object->getTranslations();
$urls = array();
$translations->iterate(function($lang, $nb_translation) use(&$urls, $field) {
$urls[$lang] = $nb_translation->getValue("nb_site_lang_${field}_target_url");
return true;
});
if (count($urls) > 0) {
$page->addAttribute('useURI', 'U');
foreach ($urls as $lang => $url) {
if (strlen($url) > 0) {
$nb_language = $this->nb_data_object->getLanguage($lang);
$address = $page->addChild('url');
$address->addAttribute('lang', $nb_language->getHash());
$address->addAttribute('url', $url);
}
}
}
$this->putAttributesFromList($page, array(
"nb_site_${field}_error_code" => "errorCode"
), true);
break;
}
} | [
"private",
"function",
"setRedirection",
"(",
"SimpleXMLElement",
"$",
"element",
",",
"string",
"$",
"field",
",",
"string",
"$",
"tag_name",
")",
"{",
"$",
"page",
"=",
"$",
"element",
"->",
"addChild",
"(",
"$",
"tag_name",
")",
";",
"switch",
"(",
"$... | Build a redirection element.
@param SimpleXMLElement $element Parent element.
@param string $field Field part name in the original data object.
@param string $tag_name Tag name of the element. | [
"Build",
"a",
"redirection",
"element",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/site/CNabuXMLSite.php#L83-L120 | train |
nabu-3/core | nabu/xml/site/CNabuXMLSite.php | CNabuXMLSite.setTargets | private function setTargets(SimpleXMLElement $parent)
{
$xml_targets = new CNabuXMLSiteTargetList($this->nb_data_object->getTargets(true));
$xml_targets->build($parent);
} | php | private function setTargets(SimpleXMLElement $parent)
{
$xml_targets = new CNabuXMLSiteTargetList($this->nb_data_object->getTargets(true));
$xml_targets->build($parent);
} | [
"private",
"function",
"setTargets",
"(",
"SimpleXMLElement",
"$",
"parent",
")",
"{",
"$",
"xml_targets",
"=",
"new",
"CNabuXMLSiteTargetList",
"(",
"$",
"this",
"->",
"nb_data_object",
"->",
"getTargets",
"(",
"true",
")",
")",
";",
"$",
"xml_targets",
"->",... | Build Target branch.
@param SimpleXMLElement $parent Parent XML Element to insert targets. | [
"Build",
"Target",
"branch",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/site/CNabuXMLSite.php#L126-L130 | train |
nabu-3/core | nabu/xml/site/CNabuXMLSite.php | CNabuXMLSite.setMaps | private function setMaps(SimpleXMLElement $parent)
{
$xml_targets = new CNabuXMLSiteMapList($this->nb_data_object->getSiteMaps(true));
$xml_targets->build($parent);
} | php | private function setMaps(SimpleXMLElement $parent)
{
$xml_targets = new CNabuXMLSiteMapList($this->nb_data_object->getSiteMaps(true));
$xml_targets->build($parent);
} | [
"private",
"function",
"setMaps",
"(",
"SimpleXMLElement",
"$",
"parent",
")",
"{",
"$",
"xml_targets",
"=",
"new",
"CNabuXMLSiteMapList",
"(",
"$",
"this",
"->",
"nb_data_object",
"->",
"getSiteMaps",
"(",
"true",
")",
")",
";",
"$",
"xml_targets",
"->",
"b... | Build Map branch.
@param SimpleXMLElement $parent Parent XML Element to insert targets. | [
"Build",
"Map",
"branch",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/site/CNabuXMLSite.php#L136-L140 | train |
nabu-3/core | nabu/xml/site/CNabuXMLSite.php | CNabuXMLSite.setStaticContents | private function setStaticContents(SimpleXMLElement $parent)
{
$xml_statics = new CNabuXMLSiteStaticContentList($this->nb_data_object->getStaticContents(true));
$xml_statics->build($parent);
} | php | private function setStaticContents(SimpleXMLElement $parent)
{
$xml_statics = new CNabuXMLSiteStaticContentList($this->nb_data_object->getStaticContents(true));
$xml_statics->build($parent);
} | [
"private",
"function",
"setStaticContents",
"(",
"SimpleXMLElement",
"$",
"parent",
")",
"{",
"$",
"xml_statics",
"=",
"new",
"CNabuXMLSiteStaticContentList",
"(",
"$",
"this",
"->",
"nb_data_object",
"->",
"getStaticContents",
"(",
"true",
")",
")",
";",
"$",
"... | Build Static Content branch.
@param SimpleXMLElement $parent Parent XML Element to insert targets. | [
"Build",
"Static",
"Content",
"branch",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/site/CNabuXMLSite.php#L146-L150 | train |
nabu-3/core | nabu/xml/site/CNabuXMLSite.php | CNabuXMLSite.grantTargetHash | private function grantTargetHash(int $nb_site_target_id) : string
{
$nb_site_target = $this->nb_data_object->getTarget($nb_site_target_id);
return $nb_site_target->isFetched() ? $nb_site_target->grantHash(true) : null;
} | php | private function grantTargetHash(int $nb_site_target_id) : string
{
$nb_site_target = $this->nb_data_object->getTarget($nb_site_target_id);
return $nb_site_target->isFetched() ? $nb_site_target->grantHash(true) : null;
} | [
"private",
"function",
"grantTargetHash",
"(",
"int",
"$",
"nb_site_target_id",
")",
":",
"string",
"{",
"$",
"nb_site_target",
"=",
"$",
"this",
"->",
"nb_data_object",
"->",
"getTarget",
"(",
"$",
"nb_site_target_id",
")",
";",
"return",
"$",
"nb_site_target",... | Grant that a target have a valid hash to identify it.
@param int $nb_site_target_id Id of the target to grant their hash.
@return string Return the hash. | [
"Grant",
"that",
"a",
"target",
"have",
"a",
"valid",
"hash",
"to",
"identify",
"it",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/xml/site/CNabuXMLSite.php#L157-L161 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/FileHydrator.php | FileHydrator.hydrateCollection | public static function hydrateCollection(array $files)
{
$hydrated = [];
foreach ($files as $file) {
$hydrated[] = self::hydrate($file);
}
return $hydrated;
} | php | public static function hydrateCollection(array $files)
{
$hydrated = [];
foreach ($files as $file) {
$hydrated[] = self::hydrate($file);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"files",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"(",
... | Hydrate a collection of file objects into a collection of
FileEntity objects
@param stdClass[] $files
@return FileEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"file",
"objects",
"into",
"a",
"collection",
"of",
"FileEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/FileHydrator.php#L17-L26 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/FileHydrator.php | FileHydrator.hydrate | public static function hydrate(stdClass $file)
{
$hydrated = new FileEntity();
if (isset($file->id)) {
$hydrated->setId($file->id);
}
if (isset($file->loc)) {
$hydrated->setLoc($file->loc);
}
if (isset($file->path)) {
$hydrated->setPath($file->path);
}
if (isset($file->scanned)) {
$hydrated->setScanned($file->scanned);
}
if (isset($file->code)) {
$hydrated->setCode($file->code);
}
return $hydrated;
} | php | public static function hydrate(stdClass $file)
{
$hydrated = new FileEntity();
if (isset($file->id)) {
$hydrated->setId($file->id);
}
if (isset($file->loc)) {
$hydrated->setLoc($file->loc);
}
if (isset($file->path)) {
$hydrated->setPath($file->path);
}
if (isset($file->scanned)) {
$hydrated->setScanned($file->scanned);
}
if (isset($file->code)) {
$hydrated->setCode($file->code);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"file",
")",
"{",
"$",
"hydrated",
"=",
"new",
"FileEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"file",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"(",
"$",
... | Hydrate a file object into a FileEntity object
@param stdClass $file
@return FileEntity | [
"Hydrate",
"a",
"file",
"object",
"into",
"a",
"FileEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/FileHydrator.php#L34-L59 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.addTarget | public function addTarget(CNabuSiteTarget $nb_site_target, $default = false)
{
$nb_site_target->setSite($this);
if ($default) {
$this->setDefaultTarget($nb_site_target);
}
return $this->nb_site_target_list->addItem($nb_site_target);
} | php | public function addTarget(CNabuSiteTarget $nb_site_target, $default = false)
{
$nb_site_target->setSite($this);
if ($default) {
$this->setDefaultTarget($nb_site_target);
}
return $this->nb_site_target_list->addItem($nb_site_target);
} | [
"public",
"function",
"addTarget",
"(",
"CNabuSiteTarget",
"$",
"nb_site_target",
",",
"$",
"default",
"=",
"false",
")",
"{",
"$",
"nb_site_target",
"->",
"setSite",
"(",
"$",
"this",
")",
";",
"if",
"(",
"$",
"default",
")",
"{",
"$",
"this",
"->",
"... | Add a target to a site.
@param CNabuSiteTarget $nb_site_target Target to add to site.
@param bool $default If true sets the target as the default target for this site.
@return CNabuSiteTarget Returns the inserted target. | [
"Add",
"a",
"target",
"to",
"a",
"site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L179-L188 | train |
nabu-3/core | nabu/data/site/CNabuSite.php | CNabuSite.getTarget | public function getTarget($nb_site_target)
{
$nb_site_target_id = nb_getMixedValue($nb_site_target, 'nb_site_target_id');
return (is_numeric($nb_site_target_id) || nb_isValidGUID($nb_site_target_id))
? $this->nb_site_target_list->getItem($nb_site_target_id)->setSite($this)
: null
;
} | php | public function getTarget($nb_site_target)
{
$nb_site_target_id = nb_getMixedValue($nb_site_target, 'nb_site_target_id');
return (is_numeric($nb_site_target_id) || nb_isValidGUID($nb_site_target_id))
? $this->nb_site_target_list->getItem($nb_site_target_id)->setSite($this)
: null
;
} | [
"public",
"function",
"getTarget",
"(",
"$",
"nb_site_target",
")",
"{",
"$",
"nb_site_target_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site_target",
",",
"'nb_site_target_id'",
")",
";",
"return",
"(",
"is_numeric",
"(",
"$",
"nb_site_target_id",
")",
"||",
"... | Gets a Target item from the list of targets loaded in the Site.
@param mixed $nb_site_target An instance that contains a field named 'nb_site_target_id' or an Id.
@return CNabuSiteTarget Returns the requested target if exists or null if not. | [
"Gets",
"a",
"Target",
"item",
"from",
"the",
"list",
"of",
"targets",
"loaded",
"in",
"the",
"Site",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSite.php#L195-L203 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.