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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
php-xapi/model | src/Actor.php | Actor.equals | public function equals(StatementObject $actor): bool
{
if (!parent::equals($actor)) {
return false;
}
if (!$actor instanceof Actor) {
return false;
}
if ($this->name !== $actor->name) {
return false;
}
if (null !== $this->iri xor null !== $actor->iri) {
return false;
}
if (null !== $this->iri && null !== $actor->iri && !$this->iri->equals($actor->iri)) {
return false;
}
return true;
} | php | public function equals(StatementObject $actor): bool
{
if (!parent::equals($actor)) {
return false;
}
if (!$actor instanceof Actor) {
return false;
}
if ($this->name !== $actor->name) {
return false;
}
if (null !== $this->iri xor null !== $actor->iri) {
return false;
}
if (null !== $this->iri && null !== $actor->iri && !$this->iri->equals($actor->iri)) {
return false;
}
return true;
} | [
"public",
"function",
"equals",
"(",
"StatementObject",
"$",
"actor",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"parent",
"::",
"equals",
"(",
"$",
"actor",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"actor",
"instanceof",
"Actor",... | Checks if another actor is equal.
Two actors are equal if and only if all of their properties are equal. | [
"Checks",
"if",
"another",
"actor",
"is",
"equal",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/Actor.php#L51-L74 | train |
mimmi20/WurflCache | src/Utils/FileUtils.php | FileUtils.mkdir | public static function mkdir($path, $mode = 0755)
{
$filesystem = new Filesystem();
try {
$filesystem->mkdir($path, $mode);
} catch (IOException $exception) {
return false;
}
return true;
} | php | public static function mkdir($path, $mode = 0755)
{
$filesystem = new Filesystem();
try {
$filesystem->mkdir($path, $mode);
} catch (IOException $exception) {
return false;
}
return true;
} | [
"public",
"static",
"function",
"mkdir",
"(",
"$",
"path",
",",
"$",
"mode",
"=",
"0755",
")",
"{",
"$",
"filesystem",
"=",
"new",
"Filesystem",
"(",
")",
";",
"try",
"{",
"$",
"filesystem",
"->",
"mkdir",
"(",
"$",
"path",
",",
"$",
"mode",
")",
... | Create a directory structure recursiveley
@param string $path
@param int $mode
@return bool | [
"Create",
"a",
"directory",
"structure",
"recursiveley"
] | 9fc307df74f782a879f4604ab99bf61ecfc165d4 | https://github.com/mimmi20/WurflCache/blob/9fc307df74f782a879f4604ab99bf61ecfc165d4/src/Utils/FileUtils.php#L57-L68 | train |
mimmi20/WurflCache | src/Utils/FileUtils.php | FileUtils.rmdir | public static function rmdir($path)
{
$files = array_diff(scandir($path), array('.', '..'));
$filesystem = new Filesystem();
foreach ($files as $file) {
$file = $path . DIRECTORY_SEPARATOR . $file;
if (!file_exists($file)) {
continue;
}
try {
$filesystem->remove($file);
} catch (IOException $exception) {
return false;
}
}
return true;
} | php | public static function rmdir($path)
{
$files = array_diff(scandir($path), array('.', '..'));
$filesystem = new Filesystem();
foreach ($files as $file) {
$file = $path . DIRECTORY_SEPARATOR . $file;
if (!file_exists($file)) {
continue;
}
try {
$filesystem->remove($file);
} catch (IOException $exception) {
return false;
}
}
return true;
} | [
"public",
"static",
"function",
"rmdir",
"(",
"$",
"path",
")",
"{",
"$",
"files",
"=",
"array_diff",
"(",
"scandir",
"(",
"$",
"path",
")",
",",
"array",
"(",
"'.'",
",",
"'..'",
")",
")",
";",
"$",
"filesystem",
"=",
"new",
"Filesystem",
"(",
")"... | Recursiely remove all files from the given directory NOT including the
specified directory itself
@param string $path Directory to be cleaned out
@return bool | [
"Recursiely",
"remove",
"all",
"files",
"from",
"the",
"given",
"directory",
"NOT",
"including",
"the",
"specified",
"directory",
"itself"
] | 9fc307df74f782a879f4604ab99bf61ecfc165d4 | https://github.com/mimmi20/WurflCache/blob/9fc307df74f782a879f4604ab99bf61ecfc165d4/src/Utils/FileUtils.php#L78-L99 | train |
mimmi20/WurflCache | src/Utils/FileUtils.php | FileUtils.detectStream | private static function detectStream($path)
{
$stream = 'file';
if (false !== strpos($path, '://')) {
$parts = explode('://', $path);
$stream = $parts[0];
}
return $stream;
} | php | private static function detectStream($path)
{
$stream = 'file';
if (false !== strpos($path, '://')) {
$parts = explode('://', $path);
$stream = $parts[0];
}
return $stream;
} | [
"private",
"static",
"function",
"detectStream",
"(",
"$",
"path",
")",
"{",
"$",
"stream",
"=",
"'file'",
";",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"path",
",",
"'://'",
")",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'://'",
",",
"$"... | detects if the the path is linked to an file stream
@param $path
@return string | [
"detects",
"if",
"the",
"the",
"path",
"is",
"linked",
"to",
"an",
"file",
"stream"
] | 9fc307df74f782a879f4604ab99bf61ecfc165d4 | https://github.com/mimmi20/WurflCache/blob/9fc307df74f782a879f4604ab99bf61ecfc165d4/src/Utils/FileUtils.php#L206-L216 | train |
rips/php-connector-bundle | Services/LanguageService.php | LanguageService.getAll | public function getAll(array $queryParams = [])
{
$response = $this->api->languages()->getAll($queryParams);
return new LanguagesResponse($response);
} | php | public function getAll(array $queryParams = [])
{
$response = $this->api->languages()->getAll($queryParams);
return new LanguagesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"languages",
"(",
")",
"->",
"getAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"LanguagesRespon... | Get a collection of language objects
@param array $queryParams
@return LanguagesResponse | [
"Get",
"a",
"collection",
"of",
"language",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/LanguageService.php#L31-L36 | train |
rips/php-connector-bundle | Services/LanguageService.php | LanguageService.getById | public function getById($languageId, array $queryParams = [])
{
$response = $this->api->languages()->getById($languageId, $queryParams);
return new LanguageResponse($response);
} | php | public function getById($languageId, array $queryParams = [])
{
$response = $this->api->languages()->getById($languageId, $queryParams);
return new LanguageResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"languageId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"languages",
"(",
")",
"->",
"getById",
"(",
"$",
"languageId",
",",
"$",
"query... | Get a language by id
@param int $languageId
@param array $queryParams
@return LanguageResponse | [
"Get",
"a",
"language",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/LanguageService.php#L45-L50 | train |
nabu-3/core | nabu/http/CNabuHTTPResponse.php | CNabuHTTPResponse.calculateFrameOptions | private function calculateFrameOptions()
{
$retval = null;
$nb_site = $this->nb_request->getSite();
switch ($nb_site->getXFrameOptions()) {
case 'D':
$retval = 'DENY';
break;
case 'S':
$retval = 'SAMEORIGIN';
break;
case 'A':
if (is_string($url = $nb_site->getXFrameOptionsURL()) &&
strlen($url = preg_replace(array('/^\s*/', '/\s*$/'), '', $url)) > 0) {
$retval = 'ALLOW-FROM ' . $url;
} else {
throw new ENabuHTTPException(ENabuHTTPException::ERROR_X_FRAME_OPTIONS_URL_NOT_FOUND);
}
}
return $retval;
} | php | private function calculateFrameOptions()
{
$retval = null;
$nb_site = $this->nb_request->getSite();
switch ($nb_site->getXFrameOptions()) {
case 'D':
$retval = 'DENY';
break;
case 'S':
$retval = 'SAMEORIGIN';
break;
case 'A':
if (is_string($url = $nb_site->getXFrameOptionsURL()) &&
strlen($url = preg_replace(array('/^\s*/', '/\s*$/'), '', $url)) > 0) {
$retval = 'ALLOW-FROM ' . $url;
} else {
throw new ENabuHTTPException(ENabuHTTPException::ERROR_X_FRAME_OPTIONS_URL_NOT_FOUND);
}
}
return $retval;
} | [
"private",
"function",
"calculateFrameOptions",
"(",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"$",
"nb_site",
"=",
"$",
"this",
"->",
"nb_request",
"->",
"getSite",
"(",
")",
";",
"switch",
"(",
"$",
"nb_site",
"->",
"getXFrameOptions",
"(",
")",
")",
... | Calculates the X-Frame-Options value if setted.
@return string|null If X-Frame-Options is setted returns the proper value,
else if not is setted then returns null.
@throws ENabuHTTPException Raises an exception if kind is ALLOW-FROM and none URL is setted. | [
"Calculates",
"the",
"X",
"-",
"Frame",
"-",
"Options",
"value",
"if",
"setted",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/CNabuHTTPResponse.php#L220-L243 | train |
nabu-3/core | nabu/http/CNabuHTTPResponse.php | CNabuHTTPResponse.buildHeaders | public function buildHeaders()
{
if ($this->use_cors) {
if (strlen($this->cors_allow_origin) > 0) {
header("Access-Control-Allow-Origin: $this->cors_allow_origin");
}
if ($this->cors_with_credentials) {
header('Access-Control-Allow-Credentials: true');
} else {
header('Access-Control-Allow-Credentials: false');
}
}
// Cache Control RFC: https://tools.ietf.org/html/rfc7234
if ($this->nb_request instanceof CNabuHTTPRequest &&
($nb_site_target = $this->nb_request->getSiteTarget()) instanceof CNabuSiteTarget
) {
if (($max_age = $nb_site_target->getDynamicCacheEffectiveMaxAge()) !== false) {
$expire_date = gmdate("D, d M Y H:i:s", time() + $max_age);
$this->setHeader('Expires', $expire_date . 'GMT');
$this->setHeader('Cache-Control', "max-age=$max_age");
$this->setHeader('User-Cache-Control', "max-age=$max_age");
$this->setHeader('Pragma', 'cache');
} else {
$this->setHeader('Expires', 'Thu, 1 Jan 1981 00:00:00 GMT');
$this->setheader('Cache-Control', 'no-store, no-cache, must-revalidate');
$this->setHeader('Pragma', 'no-cache');
}
if ($nb_site_target->getAttachment() === 'T') {
if (is_string($this->attachment_filename) && strlen($this->attachment_filename) > 0) {
$this->setHeader('Content-Disposition', 'attachment; filename=' . $this->attachment_filename);
} else {
$this->setHeader('Content-Disposition', 'attachment');
}
}
}
if (($frame_options = $this->calculateFrameOptions()) !== null) {
$this->setHeader('X-Frame-Options', $frame_options);
}
if (count($this->header_list) > 0) {
foreach ($this->header_list as $name => $value) {
header("$name: $value");
}
}
} | php | public function buildHeaders()
{
if ($this->use_cors) {
if (strlen($this->cors_allow_origin) > 0) {
header("Access-Control-Allow-Origin: $this->cors_allow_origin");
}
if ($this->cors_with_credentials) {
header('Access-Control-Allow-Credentials: true');
} else {
header('Access-Control-Allow-Credentials: false');
}
}
// Cache Control RFC: https://tools.ietf.org/html/rfc7234
if ($this->nb_request instanceof CNabuHTTPRequest &&
($nb_site_target = $this->nb_request->getSiteTarget()) instanceof CNabuSiteTarget
) {
if (($max_age = $nb_site_target->getDynamicCacheEffectiveMaxAge()) !== false) {
$expire_date = gmdate("D, d M Y H:i:s", time() + $max_age);
$this->setHeader('Expires', $expire_date . 'GMT');
$this->setHeader('Cache-Control', "max-age=$max_age");
$this->setHeader('User-Cache-Control', "max-age=$max_age");
$this->setHeader('Pragma', 'cache');
} else {
$this->setHeader('Expires', 'Thu, 1 Jan 1981 00:00:00 GMT');
$this->setheader('Cache-Control', 'no-store, no-cache, must-revalidate');
$this->setHeader('Pragma', 'no-cache');
}
if ($nb_site_target->getAttachment() === 'T') {
if (is_string($this->attachment_filename) && strlen($this->attachment_filename) > 0) {
$this->setHeader('Content-Disposition', 'attachment; filename=' . $this->attachment_filename);
} else {
$this->setHeader('Content-Disposition', 'attachment');
}
}
}
if (($frame_options = $this->calculateFrameOptions()) !== null) {
$this->setHeader('X-Frame-Options', $frame_options);
}
if (count($this->header_list) > 0) {
foreach ($this->header_list as $name => $value) {
header("$name: $value");
}
}
} | [
"public",
"function",
"buildHeaders",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"use_cors",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"this",
"->",
"cors_allow_origin",
")",
">",
"0",
")",
"{",
"header",
"(",
"\"Access-Control-Allow-Origin: $this->cors_all... | Build HTTP Headers. | [
"Build",
"HTTP",
"Headers",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/CNabuHTTPResponse.php#L249-L295 | train |
nabu-3/core | nabu/http/CNabuHTTPResponse.php | CNabuHTTPResponse.getRender | public function getRender()
{
if ($this->render_factory !== null) {
$retval = $this->render_factory->getInterface();
} else {
$retval = $this->render;
}
return $retval;
} | php | public function getRender()
{
if ($this->render_factory !== null) {
$retval = $this->render_factory->getInterface();
} else {
$retval = $this->render;
}
return $retval;
} | [
"public",
"function",
"getRender",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"render_factory",
"!==",
"null",
")",
"{",
"$",
"retval",
"=",
"$",
"this",
"->",
"render_factory",
"->",
"getInterface",
"(",
")",
";",
"}",
"else",
"{",
"$",
"retval",
... | Get the current Render for this response.
@return INabuHTTPResponseRender Returns tge Render instance. | [
"Get",
"the",
"current",
"Render",
"for",
"this",
"response",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/CNabuHTTPResponse.php#L301-L310 | train |
nabu-3/core | nabu/http/CNabuHTTPResponse.php | CNabuHTTPResponse.redirect | public function redirect($code, $nb_site_target, $nb_language = null, $params = null)
{
global $NABU_HTTP_CODES;
if (is_string($nb_site_target)) {
$url = new CNabuURL($nb_site_target);
if (!$url->isValid()) {
$nb_site_target = CNabuSiteTarget::findByKey($this, $nb_site_target);
unset($url);
}
} elseif (is_numeric($nb_site_target)) {
$nb_site_target = new CNabuSiteTarget($nb_site_target);
if ($nb_site_target->isNew()) {
$nb_site_target = null;
}
} elseif ($nb_site_target instanceof CNabuDataObject) {
if (!($nb_site_target instanceof CNabuSiteTarget)) {
$nb_site_target = new CNabuSiteTarget($nb_site_target);
if ($nb_site_target->isNew()) {
$nb_site_target = null;
}
}
} else {
$nb_site_target = null;
}
if ($nb_site_target != null) {
$encoded = '';
if ($params != null && count($params) > 0) {
foreach ($params as $field => $value) {
$encoded .= (strlen($encoded) > 0 ? "&" : "").urlencode($field)."=".urlencode($value);
}
$encoded = '?'.$encoded;
}
$nb_language_id = nb_getMixedValue($nb_language, 'nb_language_id');
$nb_site = $this->nb_request->getSite();
if ($nb_language_id == null) {
$nb_language_id = $nb_site->getDefaultLanguageId();
}
$url = ($nb_site_target instanceof CNabuSiteTarget
? $nb_site_target->getFullyQualifiedURL($nb_language_id) . $encoded
: $nb_site_target);
throw new ENabuRedirectionException($code, $url);
} elseif (isset($url)) {
throw new ENabuRedirectionException($code, $url->getURL());
} else {
$this->http_response_code = 500;
throw new ENabuCoreException(ENabuCoreException::ERROR_REDIRECTION_TARGET_NOT_VALID);
}
} | php | public function redirect($code, $nb_site_target, $nb_language = null, $params = null)
{
global $NABU_HTTP_CODES;
if (is_string($nb_site_target)) {
$url = new CNabuURL($nb_site_target);
if (!$url->isValid()) {
$nb_site_target = CNabuSiteTarget::findByKey($this, $nb_site_target);
unset($url);
}
} elseif (is_numeric($nb_site_target)) {
$nb_site_target = new CNabuSiteTarget($nb_site_target);
if ($nb_site_target->isNew()) {
$nb_site_target = null;
}
} elseif ($nb_site_target instanceof CNabuDataObject) {
if (!($nb_site_target instanceof CNabuSiteTarget)) {
$nb_site_target = new CNabuSiteTarget($nb_site_target);
if ($nb_site_target->isNew()) {
$nb_site_target = null;
}
}
} else {
$nb_site_target = null;
}
if ($nb_site_target != null) {
$encoded = '';
if ($params != null && count($params) > 0) {
foreach ($params as $field => $value) {
$encoded .= (strlen($encoded) > 0 ? "&" : "").urlencode($field)."=".urlencode($value);
}
$encoded = '?'.$encoded;
}
$nb_language_id = nb_getMixedValue($nb_language, 'nb_language_id');
$nb_site = $this->nb_request->getSite();
if ($nb_language_id == null) {
$nb_language_id = $nb_site->getDefaultLanguageId();
}
$url = ($nb_site_target instanceof CNabuSiteTarget
? $nb_site_target->getFullyQualifiedURL($nb_language_id) . $encoded
: $nb_site_target);
throw new ENabuRedirectionException($code, $url);
} elseif (isset($url)) {
throw new ENabuRedirectionException($code, $url->getURL());
} else {
$this->http_response_code = 500;
throw new ENabuCoreException(ENabuCoreException::ERROR_REDIRECTION_TARGET_NOT_VALID);
}
} | [
"public",
"function",
"redirect",
"(",
"$",
"code",
",",
"$",
"nb_site_target",
",",
"$",
"nb_language",
"=",
"null",
",",
"$",
"params",
"=",
"null",
")",
"{",
"global",
"$",
"NABU_HTTP_CODES",
";",
"if",
"(",
"is_string",
"(",
"$",
"nb_site_target",
")... | This function makes the redirection to another page. Parameters permits a wide range of options.
@param int $code result code for HTTP protocol message
@param mixed $nb_site_target target to redirect. It can be a string with a URL or a Site Target key,
an integer with a Site Target ID or a CNabuDataObject containing a field named nb_site_target_id
@param mixed $nb_language language to use in redirection. It can be a Language ID,
a CNabuLanguage object or a CNabuDataObject containing a field named nb_language_id
@param array $params aditional params for URL as an associative array
@return bool If redirection is not allowed, then returns false.
In another case, the function makes exit internally and breaks the program flow. | [
"This",
"function",
"makes",
"the",
"redirection",
"to",
"another",
"page",
".",
"Parameters",
"permits",
"a",
"wide",
"range",
"of",
"options",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/http/CNabuHTTPResponse.php#L396-L447 | train |
pragma-framework/core | Pragma/DB/DB.php | DB.query | public function query($q, $params = array()){
try{
if(!empty($this->pdo)){
$this->st = $this->pdo->prepare($q);
if(!empty($params)){
$keys = array_keys($params);
$qmark = false;//qmark = question mark
if(is_int($keys[0])){//mode '?'
$qmark = true;
}
foreach($params as $p => $val){
if($qmark){
//$p is a numeric - 0, 1, 2, ...
$p += 1;//bindValue starts to 1
}
if(is_array($val) && count($val) == 2){//if called with PDO::PARAM_STR or PDO::PARAM_INT, PDO::PARAM_BOOL
$this->st->bindValue($p, $val[0], $val[1]);
}
else{
if(! is_bool($val)) { //fix fatal error with some php versions
$this->st->bindValue($p, $val);
}
else {
$this->st->bindValue($p, $val, PDO::PARAM_INT);//cast
}
}
}
}
$this->st->execute();
return $this->st;
}
else{
throw new DBException('PDO attribute is undefined');
}
}
catch(\Exception $e){
throw new DBException($e->getMessage(), $e->getCode());
}
} | php | public function query($q, $params = array()){
try{
if(!empty($this->pdo)){
$this->st = $this->pdo->prepare($q);
if(!empty($params)){
$keys = array_keys($params);
$qmark = false;//qmark = question mark
if(is_int($keys[0])){//mode '?'
$qmark = true;
}
foreach($params as $p => $val){
if($qmark){
//$p is a numeric - 0, 1, 2, ...
$p += 1;//bindValue starts to 1
}
if(is_array($val) && count($val) == 2){//if called with PDO::PARAM_STR or PDO::PARAM_INT, PDO::PARAM_BOOL
$this->st->bindValue($p, $val[0], $val[1]);
}
else{
if(! is_bool($val)) { //fix fatal error with some php versions
$this->st->bindValue($p, $val);
}
else {
$this->st->bindValue($p, $val, PDO::PARAM_INT);//cast
}
}
}
}
$this->st->execute();
return $this->st;
}
else{
throw new DBException('PDO attribute is undefined');
}
}
catch(\Exception $e){
throw new DBException($e->getMessage(), $e->getCode());
}
} | [
"public",
"function",
"query",
"(",
"$",
"q",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"pdo",
")",
")",
"{",
"$",
"this",
"->",
"st",
"=",
"$",
"this",
"->",
"pdo",
"... | execute a SQL query with params | [
"execute",
"a",
"SQL",
"query",
"with",
"params"
] | 557f4b4857d36a8fd603483ec99782efdfd51c78 | https://github.com/pragma-framework/core/blob/557f4b4857d36a8fd603483ec99782efdfd51c78/Pragma/DB/DB.php#L66-L106 | train |
KleeGroup/FranceConnect-Symfony | Manager/ContextService.php | ContextService.getUserInfo | public function getUserInfo(array $params)
{
$this->logger->debug('Get User Info.');
if (array_key_exists("error", $params)) {
$this->logger->error(
$params["error"].array_key_exists("error_description", $params) ? $params["error_description"] : ''
);
throw new Exception('FranceConnect error => '.$params["error"]);
}
$this->verifyState($params['state']);
$accessToken = $this->getAccessToken($params['code']);
$userInfo = $this->getInfos($accessToken);
$userInfo['access_token'] = $accessToken;
$token = new FranceConnectToken($userInfo,
[
FranceConnectAuthenticatedVoter::IS_FRANCE_CONNECT_AUTHENTICATED,
AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY,
]
);
$request = $this->requestStack->getCurrentRequest();
if (null !== $request) {
$this->sessionStrategy->onAuthentication($request, $token);
}
$this->tokenStorage->setToken($token);
foreach ($this->providersKeys as $key) {
$this->session->set('_security_'.$key, serialize($token));
}
return json_encode($userInfo, true);
} | php | public function getUserInfo(array $params)
{
$this->logger->debug('Get User Info.');
if (array_key_exists("error", $params)) {
$this->logger->error(
$params["error"].array_key_exists("error_description", $params) ? $params["error_description"] : ''
);
throw new Exception('FranceConnect error => '.$params["error"]);
}
$this->verifyState($params['state']);
$accessToken = $this->getAccessToken($params['code']);
$userInfo = $this->getInfos($accessToken);
$userInfo['access_token'] = $accessToken;
$token = new FranceConnectToken($userInfo,
[
FranceConnectAuthenticatedVoter::IS_FRANCE_CONNECT_AUTHENTICATED,
AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY,
]
);
$request = $this->requestStack->getCurrentRequest();
if (null !== $request) {
$this->sessionStrategy->onAuthentication($request, $token);
}
$this->tokenStorage->setToken($token);
foreach ($this->providersKeys as $key) {
$this->session->set('_security_'.$key, serialize($token));
}
return json_encode($userInfo, true);
} | [
"public",
"function",
"getUserInfo",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'Get User Info.'",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"\"error\"",
",",
"$",
"params",
")",
")",
"{",
"$",
"this",
... | Returns data provided by FranceConnect.
@param array $params query string parameter
@return string data provided by FranceConnect (json)
@throws Exception General exception
@throws SecurityException An exception may be thrown if a security check has failed | [
"Returns",
"data",
"provided",
"by",
"FranceConnect",
"."
] | 3399794782c2be81c862224d27e2c88425d3eb91 | https://github.com/KleeGroup/FranceConnect-Symfony/blob/3399794782c2be81c862224d27e2c88425d3eb91/Manager/ContextService.php#L221-L255 | train |
KleeGroup/FranceConnect-Symfony | Manager/ContextService.php | ContextService.verifyState | private function verifyState($state)
{
$this->logger->debug('Verify parameter state.');
$state = urldecode($state);
$stateArray = [];
parse_str($state, $stateArray);
$token = $stateArray['token'];
$token = preg_replace('~{~', '', $token, 1);
$token = preg_replace('~}~', '', $token, 1);
if ($token != $this->session->get(static::OPENID_SESSION_TOKEN)) {
$this->logger->error('The value of the parameter STATE is not equal to the one which is expected');
throw new SecurityException("The token is invalid.");
}
} | php | private function verifyState($state)
{
$this->logger->debug('Verify parameter state.');
$state = urldecode($state);
$stateArray = [];
parse_str($state, $stateArray);
$token = $stateArray['token'];
$token = preg_replace('~{~', '', $token, 1);
$token = preg_replace('~}~', '', $token, 1);
if ($token != $this->session->get(static::OPENID_SESSION_TOKEN)) {
$this->logger->error('The value of the parameter STATE is not equal to the one which is expected');
throw new SecurityException("The token is invalid.");
}
} | [
"private",
"function",
"verifyState",
"(",
"$",
"state",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'Verify parameter state.'",
")",
";",
"$",
"state",
"=",
"urldecode",
"(",
"$",
"state",
")",
";",
"$",
"stateArray",
"=",
"[",
"]",
";... | Check state parameter for security reason.
@param $state
@throws SecurityException | [
"Check",
"state",
"parameter",
"for",
"security",
"reason",
"."
] | 3399794782c2be81c862224d27e2c88425d3eb91 | https://github.com/KleeGroup/FranceConnect-Symfony/blob/3399794782c2be81c862224d27e2c88425d3eb91/Manager/ContextService.php#L264-L278 | train |
KleeGroup/FranceConnect-Symfony | Manager/ContextService.php | ContextService.getAccessToken | private function getAccessToken($code)
{
$this->logger->debug('Get Access Token.');
$this->initRequest();
$token_url = $this->fcBaseUrl.'token';
$post_data = [
"grant_type" => "authorization_code",
"redirect_uri" => $this->callbackUrl,
"client_id" => $this->clientId,
"client_secret" => $this->clientSecret,
"code" => $code,
];
$this->logger->debug('POST Data to FranceConnect.');
$this->setPostFields($post_data);
$response = \Unirest\Request::post($token_url);
// check status code
if ($response->code != Response::HTTP_OK) {
$result_array = $response->body;
$description = array_key_exists(
"error_description",
$result_array
) ? $result_array["error_description"] : '';
$this->logger->error(
$result_array["error"].$description
);
throw new Exception("FranceConnectError".$response->code." msg = ".$response->raw_body);
}
$result_array = $response->body;
$id_token = $result_array['id_token'];
$this->session->set(static::ID_TOKEN_HINT, $id_token);
$all_part = explode(".", $id_token);
$payload = json_decode(base64_decode($all_part[1]), true);
// check nonce parameter
if ($payload['nonce'] != $this->session->get(static::OPENID_SESSION_NONCE)) {
$this->logger->error('The value of the parameter NONCE is not equal to the one which is expected');
throw new SecurityException("The nonce parameter is invalid");
}
// verify the signature of jwt
$this->logger->debug('Check JWT signature.');
$jws = SimpleJWS::load($id_token);
if (!$jws->verify($this->clientSecret)) {
$this->logger->error('The signature of the JWT is not valid.');
throw new SecurityException("JWS is invalid");
}
$this->session->remove(static::OPENID_SESSION_NONCE);
return $result_array['access_token'];
} | php | private function getAccessToken($code)
{
$this->logger->debug('Get Access Token.');
$this->initRequest();
$token_url = $this->fcBaseUrl.'token';
$post_data = [
"grant_type" => "authorization_code",
"redirect_uri" => $this->callbackUrl,
"client_id" => $this->clientId,
"client_secret" => $this->clientSecret,
"code" => $code,
];
$this->logger->debug('POST Data to FranceConnect.');
$this->setPostFields($post_data);
$response = \Unirest\Request::post($token_url);
// check status code
if ($response->code != Response::HTTP_OK) {
$result_array = $response->body;
$description = array_key_exists(
"error_description",
$result_array
) ? $result_array["error_description"] : '';
$this->logger->error(
$result_array["error"].$description
);
throw new Exception("FranceConnectError".$response->code." msg = ".$response->raw_body);
}
$result_array = $response->body;
$id_token = $result_array['id_token'];
$this->session->set(static::ID_TOKEN_HINT, $id_token);
$all_part = explode(".", $id_token);
$payload = json_decode(base64_decode($all_part[1]), true);
// check nonce parameter
if ($payload['nonce'] != $this->session->get(static::OPENID_SESSION_NONCE)) {
$this->logger->error('The value of the parameter NONCE is not equal to the one which is expected');
throw new SecurityException("The nonce parameter is invalid");
}
// verify the signature of jwt
$this->logger->debug('Check JWT signature.');
$jws = SimpleJWS::load($id_token);
if (!$jws->verify($this->clientSecret)) {
$this->logger->error('The signature of the JWT is not valid.');
throw new SecurityException("JWS is invalid");
}
$this->session->remove(static::OPENID_SESSION_NONCE);
return $result_array['access_token'];
} | [
"private",
"function",
"getAccessToken",
"(",
"$",
"code",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'Get Access Token.'",
")",
";",
"$",
"this",
"->",
"initRequest",
"(",
")",
";",
"$",
"token_url",
"=",
"$",
"this",
"->",
"fcBaseUrl",... | Get Access Token.
@param string $code authorization code
@return string access token
@throws SecurityException
@throws Exception | [
"Get",
"Access",
"Token",
"."
] | 3399794782c2be81c862224d27e2c88425d3eb91 | https://github.com/KleeGroup/FranceConnect-Symfony/blob/3399794782c2be81c862224d27e2c88425d3eb91/Manager/ContextService.php#L289-L340 | train |
KleeGroup/FranceConnect-Symfony | Manager/ContextService.php | ContextService.setPostFields | private function setPostFields(array $post_data)
{
$pd = [];
foreach ($post_data as $k => $v) {
$pd[] = "$k=$v";
}
$pd = implode("&", $pd);
\Unirest\Request::curlOpt(CURLOPT_POST, true);
\Unirest\Request::curlOpt(CURLOPT_POSTFIELDS, $pd);
\Unirest\Request::curlOpt(CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
} | php | private function setPostFields(array $post_data)
{
$pd = [];
foreach ($post_data as $k => $v) {
$pd[] = "$k=$v";
}
$pd = implode("&", $pd);
\Unirest\Request::curlOpt(CURLOPT_POST, true);
\Unirest\Request::curlOpt(CURLOPT_POSTFIELDS, $pd);
\Unirest\Request::curlOpt(CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
} | [
"private",
"function",
"setPostFields",
"(",
"array",
"$",
"post_data",
")",
"{",
"$",
"pd",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"post_data",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"pd",
"[",
"]",
"=",
"\"$k=$v\"",
";",
"}",
"$",
"... | set post fields.
@param array $post_data | [
"set",
"post",
"fields",
"."
] | 3399794782c2be81c862224d27e2c88425d3eb91 | https://github.com/KleeGroup/FranceConnect-Symfony/blob/3399794782c2be81c862224d27e2c88425d3eb91/Manager/ContextService.php#L361-L371 | train |
rips/php-connector-bundle | Services/Application/Scan/SourceService.php | SourceService.getAll | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->sources()
->getAll($appId, $scanId, $queryParams);
return new SourcesResponse($response);
} | php | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->sources()
->getAll($appId, $scanId, $queryParams);
return new SourcesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"source... | Get all sources for a scan
@param int $appId
@param int $scanId
@param array $queryParams
@return SourcesResponse | [
"Get",
"all",
"sources",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/SourceService.php#L34-L43 | train |
rips/php-connector-bundle | Services/Application/Scan/SourceService.php | SourceService.getById | public function getById($appId, $scanId, $sourceId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->sources()
->getById($appId, $scanId, $sourceId, $queryParams);
return new SourceResponse($response);
} | php | public function getById($appId, $scanId, $sourceId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->sources()
->getById($appId, $scanId, $sourceId, $queryParams);
return new SourceResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"sourceId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
... | Get source for scan by id
@param int $appId
@param int $scanId
@param int $sourceId
@param array $queryParams
@return SourceResponse | [
"Get",
"source",
"for",
"scan",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/SourceService.php#L54-L63 | train |
php-xapi/model | src/InverseFunctionalIdentifier.php | InverseFunctionalIdentifier.equals | public function equals(InverseFunctionalIdentifier $iri): bool
{
if (null !== $this->mbox && null !== $iri->mbox && !$this->mbox->equals($iri->mbox)) {
return false;
}
if ($this->mboxSha1Sum !== $iri->mboxSha1Sum) {
return false;
}
if ($this->openId !== $iri->openId) {
return false;
}
if (null === $this->account && null !== $iri->account) {
return false;
}
if (null !== $this->account && null === $iri->account) {
return false;
}
if (null !== $this->account && !$this->account->equals($iri->account)) {
return false;
}
return true;
} | php | public function equals(InverseFunctionalIdentifier $iri): bool
{
if (null !== $this->mbox && null !== $iri->mbox && !$this->mbox->equals($iri->mbox)) {
return false;
}
if ($this->mboxSha1Sum !== $iri->mboxSha1Sum) {
return false;
}
if ($this->openId !== $iri->openId) {
return false;
}
if (null === $this->account && null !== $iri->account) {
return false;
}
if (null !== $this->account && null === $iri->account) {
return false;
}
if (null !== $this->account && !$this->account->equals($iri->account)) {
return false;
}
return true;
} | [
"public",
"function",
"equals",
"(",
"InverseFunctionalIdentifier",
"$",
"iri",
")",
":",
"bool",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"mbox",
"&&",
"null",
"!==",
"$",
"iri",
"->",
"mbox",
"&&",
"!",
"$",
"this",
"->",
"mbox",
"->",
"eq... | Checks if another IRI is equal.
Two inverse functional identifiers are equal if and only if all of their
properties are equal. | [
"Checks",
"if",
"another",
"IRI",
"is",
"equal",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/InverseFunctionalIdentifier.php#L104-L131 | train |
rips/php-connector-bundle | Services/Application/UploadService.php | UploadService.getAll | public function getAll($appId = null, array $queryParams = [])
{
$response = $this->api->applications()->uploads()->getAll($appId, $queryParams);
return new UploadsResponse($response);
} | php | public function getAll($appId = null, array $queryParams = [])
{
$response = $this->api->applications()->uploads()->getAll($appId, $queryParams);
return new UploadsResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
"=",
"null",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"uploads",
"(",
")",
"->",
"getAll",
"(... | Get all uploads for an application
@param int|null $appId
@param array $queryParams
@return UploadsResponse | [
"Get",
"all",
"uploads",
"for",
"an",
"application"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/UploadService.php#L34-L39 | train |
rips/php-connector-bundle | Services/Application/UploadService.php | UploadService.getById | public function getById($appId, $uploadId, array $queryParams = [])
{
$response = $this->api->applications()->uploads()->getById($appId, $uploadId, $queryParams);
return new UploadResponse($response);
} | php | public function getById($appId, $uploadId, array $queryParams = [])
{
$response = $this->api->applications()->uploads()->getById($appId, $uploadId, $queryParams);
return new UploadResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"uploadId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"uploads",
"(",
")",
"->",
"g... | Get upload for application by id
@param int $appId
@param int $uploadId
@param array $queryParams
@return UploadResponse | [
"Get",
"upload",
"for",
"application",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/UploadService.php#L49-L54 | train |
rips/php-connector-bundle | Services/Application/UploadService.php | UploadService.deleteAll | public function deleteAll($appId, array $queryParams = [])
{
$response = $this->api->applications()->uploads()->deleteAll($appId, $queryParams);
return new BaseResponse($response);
} | php | public function deleteAll($appId, array $queryParams = [])
{
$response = $this->api->applications()->uploads()->deleteAll($appId, $queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"deleteAll",
"(",
"$",
"appId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"uploads",
"(",
")",
"->",
"deleteAll",
"(",
"$",
... | Delete all uploads for an application
@param int $appId
@param array $queryParams
@return BaseResponse | [
"Delete",
"all",
"uploads",
"for",
"an",
"application"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/UploadService.php#L79-L84 | train |
rips/php-connector-bundle | Services/Application/UploadService.php | UploadService.deleteById | public function deleteById($appId, $uploadId, array $queryParams = [])
{
$response = $this->api->applications()->uploads()->deleteById($appId, $uploadId, $queryParams);
return new BaseResponse($response);
} | php | public function deleteById($appId, $uploadId, array $queryParams = [])
{
$response = $this->api->applications()->uploads()->deleteById($appId, $uploadId, $queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"deleteById",
"(",
"$",
"appId",
",",
"$",
"uploadId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"uploads",
"(",
")",
"->",
... | Delete upload for an application by id
@param int $appId
@param int $uploadId
@param array $queryParams
@return BaseResponse | [
"Delete",
"upload",
"for",
"an",
"application",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/UploadService.php#L94-L99 | train |
rips/php-connector-bundle | Hydrators/Application/Profile/IgnoredCodeHydrator.php | IgnoredCodeHydrator.hydrate | public static function hydrate(stdClass $ignore)
{
$hydrated = new IgnoredCodeEntity();
if (isset($ignore->id)) {
$hydrated->setId($ignore->id);
}
if (isset($ignore->class)) {
$hydrated->setClass($ignore->class);
}
if (isset($ignore->method)) {
$hydrated->setMethod($ignore->method);
}
if (isset($ignore->exclude)) {
$hydrated->setExclude($ignore->exclude);
}
return $hydrated;
} | php | public static function hydrate(stdClass $ignore)
{
$hydrated = new IgnoredCodeEntity();
if (isset($ignore->id)) {
$hydrated->setId($ignore->id);
}
if (isset($ignore->class)) {
$hydrated->setClass($ignore->class);
}
if (isset($ignore->method)) {
$hydrated->setMethod($ignore->method);
}
if (isset($ignore->exclude)) {
$hydrated->setExclude($ignore->exclude);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"ignore",
")",
"{",
"$",
"hydrated",
"=",
"new",
"IgnoredCodeEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"ignore",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"... | Hydrate a ignore object into a IgnoredCodeEntity object
@param stdClass $ignore
@return IgnoredCodeEntity | [
"Hydrate",
"a",
"ignore",
"object",
"into",
"a",
"IgnoredCodeEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Profile/IgnoredCodeHydrator.php#L34-L55 | train |
rips/php-connector-bundle | Hydrators/Quota/AclHydrator.php | AclHydrator.hydrateCollection | public static function hydrateCollection(array $acls)
{
$hydrated = [];
foreach ($acls as $acl) {
$hydrated[] = self::hydrate($acl);
}
return $hydrated;
} | php | public static function hydrateCollection(array $acls)
{
$hydrated = [];
foreach ($acls as $acl) {
$hydrated[] = self::hydrate($acl);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"acls",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"acls",
"as",
"$",
"acl",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",
"(",
"$... | Hydrate a collection of acl objects into a collection of
AclEntity objects
@param stdClass[] $acls
@return AclEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"acl",
"objects",
"into",
"a",
"collection",
"of",
"AclEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Quota/AclHydrator.php#L20-L29 | train |
nabu-3/core | nabu/data/cluster/base/CNabuServerHostBase.php | CNabuServerHostBase.setServerId | public function setServerId(int $nb_server_id) : CNabuDataObject
{
if ($nb_server_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_server_id")
);
}
$this->setValue('nb_server_id', $nb_server_id);
return $this;
} | php | public function setServerId(int $nb_server_id) : CNabuDataObject
{
if ($nb_server_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_server_id")
);
}
$this->setValue('nb_server_id', $nb_server_id);
return $this;
} | [
"public",
"function",
"setServerId",
"(",
"int",
"$",
"nb_server_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_server_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",... | Sets the Server Id attribute value.
@param int $nb_server_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Server",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/cluster/base/CNabuServerHostBase.php#L178-L189 | train |
nabu-3/core | nabu/data/cluster/base/CNabuServerHostBase.php | CNabuServerHostBase.setIPId | public function setIPId(int $nb_ip_id) : CNabuDataObject
{
if ($nb_ip_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_ip_id")
);
}
$this->setValue('nb_ip_id', $nb_ip_id);
return $this;
} | php | public function setIPId(int $nb_ip_id) : CNabuDataObject
{
if ($nb_ip_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_ip_id")
);
}
$this->setValue('nb_ip_id', $nb_ip_id);
return $this;
} | [
"public",
"function",
"setIPId",
"(",
"int",
"$",
"nb_ip_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_ip_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",",
"a... | Sets the IP Id attribute value.
@param int $nb_ip_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"IP",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/cluster/base/CNabuServerHostBase.php#L205-L216 | train |
nabu-3/core | nabu/data/cluster/base/CNabuServerHostBase.php | CNabuServerHostBase.setClusterGroupServiceId | public function setClusterGroupServiceId(int $nb_cluster_group_service_id) : CNabuDataObject
{
if ($nb_cluster_group_service_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_cluster_group_service_id")
);
}
$this->setValue('nb_cluster_group_service_id', $nb_cluster_group_service_id);
return $this;
} | php | public function setClusterGroupServiceId(int $nb_cluster_group_service_id) : CNabuDataObject
{
if ($nb_cluster_group_service_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_cluster_group_service_id")
);
}
$this->setValue('nb_cluster_group_service_id', $nb_cluster_group_service_id);
return $this;
} | [
"public",
"function",
"setClusterGroupServiceId",
"(",
"int",
"$",
"nb_cluster_group_service_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_cluster_group_service_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
... | Sets the Cluster Group Service Id attribute value.
@param int $nb_cluster_group_service_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Cluster",
"Group",
"Service",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/cluster/base/CNabuServerHostBase.php#L259-L270 | train |
nabu-3/core | nabu/data/cluster/base/CNabuServerHostBase.php | CNabuServerHostBase.setPort | public function setPort(int $port = 80) : CNabuDataObject
{
if ($port === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$port")
);
}
$this->setValue('nb_server_host_port', $port);
return $this;
} | php | public function setPort(int $port = 80) : CNabuDataObject
{
if ($port === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$port")
);
}
$this->setValue('nb_server_host_port', $port);
return $this;
} | [
"public",
"function",
"setPort",
"(",
"int",
"$",
"port",
"=",
"80",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"port",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
",... | Sets the Server Host Port attribute value.
@param int $port New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Server",
"Host",
"Port",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/cluster/base/CNabuServerHostBase.php#L286-L297 | train |
nabu-3/core | nabu/data/site/CNabuSiteTarget.php | CNabuSiteTarget.findByURL | public static function findByURL(CNabuSite $nb_site, string $target_url)
{
$retval = null;
if ($nb_site->isPublicBasePathEnabled()) {
$check_pbp = CNabuEngine::getEngine()->getMainDB()->getQueryAsSingleField(
'nb_site_lang_public_base_path',
"SELECT *
FROM nb_site_lang
WHERE nb_site_id=%site_id\$d
AND length(nb_site_lang_public_base_path) > 0
AND instr('%url\$s', nb_site_lang_public_base_path)=1
LIMIT 1",
array(
'site_id' => $nb_site->getId(),
'url' => $target_url
)
);
if (strlen($check_pbp) > 0) {
$target_url = substr($target_url, strlen($check_pbp));
} else {
$target_url = null;
}
}
if ($target_url !== null) {
$retval = CNabuSiteTarget::buildObjectFromSQL(
"SELECT ca.*, cal.nb_language_id, cal.nb_site_target_lang_url
FROM nb_site_target ca, nb_site_target_lang cal, nb_site_lang sl
WHERE ca.nb_site_target_id = cal.nb_site_target_id
AND ca.nb_site_id=%site_id\$d
AND ca.nb_site_id=sl.nb_site_id
AND sl.nb_site_lang_enabled='T'
AND cal.nb_language_id=sl.nb_language_id
AND ca.nb_site_target_url_filter='U'
AND cal.nb_site_target_lang_url='%url\$s'
LIMIT 1",
array('site_id' => $nb_site->getId(), 'url' => $target_url)
)
??
CNabuSiteTarget::buildObjectFromSQL(
"SELECT ca.*, cal.nb_language_id, cal.nb_site_target_lang_url
FROM nb_site_target ca, nb_site_target_lang cal, nb_site_lang sl
WHERE ca.nb_site_target_id = cal.nb_site_target_id
AND ca.nb_site_id=%site_id\$d
AND ca.nb_site_id=sl.nb_site_id
AND sl.nb_site_lang_enabled='T'
AND cal.nb_language_id=sl.nb_language_id
AND ca.nb_site_target_url_filter='R'
AND length(cal.nb_site_target_lang_url)>0
AND '%url\$s' REGEXP cal.nb_site_target_lang_url
ORDER BY ca.nb_site_target_order ASC
LIMIT 1",
array('site_id' => $nb_site->getValue('nb_site_id'), 'url' => $target_url)
)
??
CNabuSiteTarget::buildObjectFromSQL(
"SELECT ca.*, cal.nb_language_id, cal.nb_site_target_lang_url
FROM nb_site_target ca, nb_site_target_lang cal, nb_site_lang sl
WHERE ca.nb_site_target_id = cal.nb_site_target_id
AND ca.nb_site_id=%site_id\$d
AND ca.nb_site_id=sl.nb_site_id
AND sl.nb_site_lang_enabled='T'
AND cal.nb_language_id=sl.nb_language_id
AND ca.nb_site_target_url_filter='L'
AND length(cal.nb_site_target_lang_url)>0
AND '%url\$s' LIKE cal.nb_site_target_lang_url
ORDER BY ca.nb_site_target_order ASC
LIMIT 1",
array('site_id' => $nb_site->getId(), 'url' => $target_url)
)
;
}
if ($retval !== null) {
$retval->setSite($nb_site);
}
return $retval;
} | php | public static function findByURL(CNabuSite $nb_site, string $target_url)
{
$retval = null;
if ($nb_site->isPublicBasePathEnabled()) {
$check_pbp = CNabuEngine::getEngine()->getMainDB()->getQueryAsSingleField(
'nb_site_lang_public_base_path',
"SELECT *
FROM nb_site_lang
WHERE nb_site_id=%site_id\$d
AND length(nb_site_lang_public_base_path) > 0
AND instr('%url\$s', nb_site_lang_public_base_path)=1
LIMIT 1",
array(
'site_id' => $nb_site->getId(),
'url' => $target_url
)
);
if (strlen($check_pbp) > 0) {
$target_url = substr($target_url, strlen($check_pbp));
} else {
$target_url = null;
}
}
if ($target_url !== null) {
$retval = CNabuSiteTarget::buildObjectFromSQL(
"SELECT ca.*, cal.nb_language_id, cal.nb_site_target_lang_url
FROM nb_site_target ca, nb_site_target_lang cal, nb_site_lang sl
WHERE ca.nb_site_target_id = cal.nb_site_target_id
AND ca.nb_site_id=%site_id\$d
AND ca.nb_site_id=sl.nb_site_id
AND sl.nb_site_lang_enabled='T'
AND cal.nb_language_id=sl.nb_language_id
AND ca.nb_site_target_url_filter='U'
AND cal.nb_site_target_lang_url='%url\$s'
LIMIT 1",
array('site_id' => $nb_site->getId(), 'url' => $target_url)
)
??
CNabuSiteTarget::buildObjectFromSQL(
"SELECT ca.*, cal.nb_language_id, cal.nb_site_target_lang_url
FROM nb_site_target ca, nb_site_target_lang cal, nb_site_lang sl
WHERE ca.nb_site_target_id = cal.nb_site_target_id
AND ca.nb_site_id=%site_id\$d
AND ca.nb_site_id=sl.nb_site_id
AND sl.nb_site_lang_enabled='T'
AND cal.nb_language_id=sl.nb_language_id
AND ca.nb_site_target_url_filter='R'
AND length(cal.nb_site_target_lang_url)>0
AND '%url\$s' REGEXP cal.nb_site_target_lang_url
ORDER BY ca.nb_site_target_order ASC
LIMIT 1",
array('site_id' => $nb_site->getValue('nb_site_id'), 'url' => $target_url)
)
??
CNabuSiteTarget::buildObjectFromSQL(
"SELECT ca.*, cal.nb_language_id, cal.nb_site_target_lang_url
FROM nb_site_target ca, nb_site_target_lang cal, nb_site_lang sl
WHERE ca.nb_site_target_id = cal.nb_site_target_id
AND ca.nb_site_id=%site_id\$d
AND ca.nb_site_id=sl.nb_site_id
AND sl.nb_site_lang_enabled='T'
AND cal.nb_language_id=sl.nb_language_id
AND ca.nb_site_target_url_filter='L'
AND length(cal.nb_site_target_lang_url)>0
AND '%url\$s' LIKE cal.nb_site_target_lang_url
ORDER BY ca.nb_site_target_order ASC
LIMIT 1",
array('site_id' => $nb_site->getId(), 'url' => $target_url)
)
;
}
if ($retval !== null) {
$retval->setSite($nb_site);
}
return $retval;
} | [
"public",
"static",
"function",
"findByURL",
"(",
"CNabuSite",
"$",
"nb_site",
",",
"string",
"$",
"target_url",
")",
"{",
"$",
"retval",
"=",
"null",
";",
"if",
"(",
"$",
"nb_site",
"->",
"isPublicBasePathEnabled",
"(",
")",
")",
"{",
"$",
"check_pbp",
... | Locate a Target by their URL. If the Site is multi-language, the search is performed in all languages.
Accessible via getValue method, you can access to additional fields nb_language_id and nb_site_target_lang_url.
@param CNabuSite $nb_site Site instance that owns the URL.
@param string $target_url The URL to search.
@return CNabuSiteTarget|null Returns an instance of CNabuSiteTarget if found or null if not. | [
"Locate",
"a",
"Target",
"by",
"their",
"URL",
".",
"If",
"the",
"Site",
"is",
"multi",
"-",
"language",
"the",
"search",
"is",
"performed",
"in",
"all",
"languages",
".",
"Accessible",
"via",
"getValue",
"method",
"you",
"can",
"access",
"to",
"additional... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteTarget.php#L101-L185 | train |
nabu-3/core | nabu/data/site/CNabuSiteTarget.php | CNabuSiteTarget.addCTAObject | public function addCTAObject(CNabuSiteTargetCTA $nb_site_target_cta)
{
$nb_site_target_cta->setSiteTarget($this);
return $this->nb_site_target_cta_list->addItem($nb_site_target_cta);
} | php | public function addCTAObject(CNabuSiteTargetCTA $nb_site_target_cta)
{
$nb_site_target_cta->setSiteTarget($this);
return $this->nb_site_target_cta_list->addItem($nb_site_target_cta);
} | [
"public",
"function",
"addCTAObject",
"(",
"CNabuSiteTargetCTA",
"$",
"nb_site_target_cta",
")",
"{",
"$",
"nb_site_target_cta",
"->",
"setSiteTarget",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"nb_site_target_cta_list",
"->",
"addItem",
"(",
"$",
... | Add a CTA to this Site Target instance.
@param CNabuSiteTargetCTA $nb_site_target_cta CTA instance to be added.
@return CNabuSiteTargetCTA Returns the CTA added. | [
"Add",
"a",
"CTA",
"to",
"this",
"Site",
"Target",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteTarget.php#L442-L447 | train |
nabu-3/core | nabu/data/site/CNabuSiteTarget.php | CNabuSiteTarget.getCTAs | public function getCTAs($force = false)
{
if ($this->nb_site_target_cta_list->isEmpty() || $force) {
$this->nb_site_target_cta_list->clear();
$this->nb_site_target_cta_list->merge(CNabuSiteTargetCTA::getSiteTargetCTAs($this));
$translations = CNabuSiteTargetCTALanguage::getCTATranslationsForSiteTarget($this);
if (is_array($translations) && count($translations) > 0) {
foreach ($translations as $translation) {
$nb_site_target_cta = $this->nb_site_target_cta_list->getItem($translation->getSiteTargetCTAId());
if ($nb_site_target_cta instanceof CNabuSiteTargetCTA) {
$nb_site_target_cta->setTranslation($translation);
}
}
}
$roles = CNabuSiteTargetCTARole::getCTARolesForSiteTarget($this);
if (is_array($roles) && count($roles) > 0) {
foreach ($roles as $role) {
$nb_site_target_cta = $this->nb_site_target_cta_list->getItem($role->getSiteTargetCTAId());
if ($nb_site_target_cta instanceof CNabuSiteTargetCTA) {
$nb_site_target_cta->addRole($role);
}
}
}
}
return $this->nb_site_target_cta_list;
} | php | public function getCTAs($force = false)
{
if ($this->nb_site_target_cta_list->isEmpty() || $force) {
$this->nb_site_target_cta_list->clear();
$this->nb_site_target_cta_list->merge(CNabuSiteTargetCTA::getSiteTargetCTAs($this));
$translations = CNabuSiteTargetCTALanguage::getCTATranslationsForSiteTarget($this);
if (is_array($translations) && count($translations) > 0) {
foreach ($translations as $translation) {
$nb_site_target_cta = $this->nb_site_target_cta_list->getItem($translation->getSiteTargetCTAId());
if ($nb_site_target_cta instanceof CNabuSiteTargetCTA) {
$nb_site_target_cta->setTranslation($translation);
}
}
}
$roles = CNabuSiteTargetCTARole::getCTARolesForSiteTarget($this);
if (is_array($roles) && count($roles) > 0) {
foreach ($roles as $role) {
$nb_site_target_cta = $this->nb_site_target_cta_list->getItem($role->getSiteTargetCTAId());
if ($nb_site_target_cta instanceof CNabuSiteTargetCTA) {
$nb_site_target_cta->addRole($role);
}
}
}
}
return $this->nb_site_target_cta_list;
} | [
"public",
"function",
"getCTAs",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_site_target_cta_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
"{",
"$",
"this",
"->",
"nb_site_target_cta_list",
"->",
"clear",
"("... | Get CTAs assigned to this Site Target instance.
@param bool $force If true, the CTA list is refreshed from the database.
@return CNabuSiteTargetCTAList Returns the list of CTAs. If none CTA exists, the list is empty. | [
"Get",
"CTAs",
"assigned",
"to",
"this",
"Site",
"Target",
"instance",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteTarget.php#L454-L480 | train |
nabu-3/core | nabu/data/site/CNabuSiteTarget.php | CNabuSiteTarget.getCTAByKey | public function getCTAByKey($key, $force = false)
{
$this->getCTAs($force);
return $this->nb_site_target_cta_list->getItem($key, CNabuSiteTargetCTAList::INDEX_KEY);
} | php | public function getCTAByKey($key, $force = false)
{
$this->getCTAs($force);
return $this->nb_site_target_cta_list->getItem($key, CNabuSiteTargetCTAList::INDEX_KEY);
} | [
"public",
"function",
"getCTAByKey",
"(",
"$",
"key",
",",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"getCTAs",
"(",
"$",
"force",
")",
";",
"return",
"$",
"this",
"->",
"nb_site_target_cta_list",
"->",
"getItem",
"(",
"$",
"key",
",",
... | Gets a CTA from the list of CTAs using their key.
@param string $key Key of CTA to looking for.
@param bool $force If true, forces to reload CTA from database storage.
@return CNabuSiteTargetCTA Returns the requested target if exists or null if not. | [
"Gets",
"a",
"CTA",
"from",
"the",
"list",
"of",
"CTAs",
"using",
"their",
"key",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteTarget.php#L488-L493 | train |
nabu-3/core | nabu/data/site/CNabuSiteTarget.php | CNabuSiteTarget.getDynamicCacheEffectiveMaxAge | public function getDynamicCacheEffectiveMaxAge()
{
if (($nb_site = $this->getSite()) === null) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
}
$retval = false;
if (($nb_application = CNabuEngine::getEngine()->getApplication()) !== null) {
if (($nb_running_site = $nb_application->getRequest()->getSite()) instanceof CNabuSite &&
($nb_running_site->getId() === $nb_site->getId())
) {
if (($nb_security_manager = $nb_application->getSecurityManager()) !== null &&
(!$nb_security_manager->isUserLogged() || $nb_security_manager->arePoliciesAccepted())) {
$site_cache_control = $nb_site->getDynamicCacheControl();
$site_max_age = $nb_site->getDynamicCacheDefaultMaxAge();
$target_cache_control = $this->getDynamicCacheControl();
$target_max_age = $this->getDynamicCacheMaxAge();
if ($target_cache_control === self::DYNAMIC_CACHE_CONTROL_INHERITED &&
$site_cache_control === CNabuSite::DYNAMIC_CACHE_CONTROL_ENABLED &&
is_numeric($site_max_age) &&
$site_max_age > 0
) {
$retval = $site_max_age;
} elseif ($target_cache_control === self::DYNAMIC_CACHE_CONTROL_ENABLED &&
is_numeric($target_max_age) &&
$target_max_age > 0
) {
$retval = $target_max_age;
}
}
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITES_DOES_NOT_MATCH);
}
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_APPLICATION_REQUIRED);
}
return $retval;
} | php | public function getDynamicCacheEffectiveMaxAge()
{
if (($nb_site = $this->getSite()) === null) {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
}
$retval = false;
if (($nb_application = CNabuEngine::getEngine()->getApplication()) !== null) {
if (($nb_running_site = $nb_application->getRequest()->getSite()) instanceof CNabuSite &&
($nb_running_site->getId() === $nb_site->getId())
) {
if (($nb_security_manager = $nb_application->getSecurityManager()) !== null &&
(!$nb_security_manager->isUserLogged() || $nb_security_manager->arePoliciesAccepted())) {
$site_cache_control = $nb_site->getDynamicCacheControl();
$site_max_age = $nb_site->getDynamicCacheDefaultMaxAge();
$target_cache_control = $this->getDynamicCacheControl();
$target_max_age = $this->getDynamicCacheMaxAge();
if ($target_cache_control === self::DYNAMIC_CACHE_CONTROL_INHERITED &&
$site_cache_control === CNabuSite::DYNAMIC_CACHE_CONTROL_ENABLED &&
is_numeric($site_max_age) &&
$site_max_age > 0
) {
$retval = $site_max_age;
} elseif ($target_cache_control === self::DYNAMIC_CACHE_CONTROL_ENABLED &&
is_numeric($target_max_age) &&
$target_max_age > 0
) {
$retval = $target_max_age;
}
}
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_SITES_DOES_NOT_MATCH);
}
} else {
throw new ENabuCoreException(ENabuCoreException::ERROR_APPLICATION_REQUIRED);
}
return $retval;
} | [
"public",
"function",
"getDynamicCacheEffectiveMaxAge",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"nb_site",
"=",
"$",
"this",
"->",
"getSite",
"(",
")",
")",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_SI... | Gets the effective max-age value for Cache-Control HTTP Headers. This method only returns a valid value
it the Target is running inside their Application.
@return bool|int Returns false if no-cache or the max-age in seconds if cache is applicable.
@throws ENabuCoreException Raises an exception it the Site instance is not set. | [
"Gets",
"the",
"effective",
"max",
"-",
"age",
"value",
"for",
"Cache",
"-",
"Control",
"HTTP",
"Headers",
".",
"This",
"method",
"only",
"returns",
"a",
"valid",
"value",
"it",
"the",
"Target",
"is",
"running",
"inside",
"their",
"Application",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteTarget.php#L596-L636 | train |
nabu-3/core | nabu/data/site/CNabuSiteUser.php | CNabuSiteUser.logAccess | public function logAccess()
{
$this->db->executeUpdate(
"update nb_site_user "
. "set nb_site_user_last_login_datetime=now() "
. "where nb_site_id=%site_id\$d "
. "and nb_role_id=%role_id\$d "
. "and nb_user_id=%user_id\$d",
array(
'site_id' => $this->getValue('nb_site_id'),
'role_id' => $this->getValue('nb_role_id'),
'user_id' => $this->getValue('nb_user_id')
)
);
} | php | public function logAccess()
{
$this->db->executeUpdate(
"update nb_site_user "
. "set nb_site_user_last_login_datetime=now() "
. "where nb_site_id=%site_id\$d "
. "and nb_role_id=%role_id\$d "
. "and nb_user_id=%user_id\$d",
array(
'site_id' => $this->getValue('nb_site_id'),
'role_id' => $this->getValue('nb_role_id'),
'user_id' => $this->getValue('nb_user_id')
)
);
} | [
"public",
"function",
"logAccess",
"(",
")",
"{",
"$",
"this",
"->",
"db",
"->",
"executeUpdate",
"(",
"\"update nb_site_user \"",
".",
"\"set nb_site_user_last_login_datetime=now() \"",
".",
"\"where nb_site_id=%site_id\\$d \"",
".",
"\"and nb_role_id=%role_id\\$d \"",
".",
... | Upate table to set last access datetime of the user. | [
"Upate",
"table",
"to",
"set",
"last",
"access",
"datetime",
"of",
"the",
"user",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteUser.php#L46-L60 | train |
nabu-3/core | nabu/data/site/CNabuSiteUser.php | CNabuSiteUser.getSitesForUser | public static function getSitesForUser($nb_user)
{
if (is_numeric ($nb_user_id = nb_getMixedValue($nb_user, NABU_USER_FIELD_ID))) {
$retval = CNabuSiteUser::buildObjectListFromSQL(
'nb_site_id',
'SELECT su.*
FROM nb_site_user su, nb_user u, nb_site s
WHERE su.nb_user_id=u.nb_user_id
AND su.nb_site_id=s.nb_site_id
AND su.nb_user_id=%user_id$d',
array(
'user_id' => $nb_user_id
),
($nb_user instanceof CNabuUser ? $nb_user : null)
);
} else {
$retval = new CNabuSiteUserList();
}
return $retval;
} | php | public static function getSitesForUser($nb_user)
{
if (is_numeric ($nb_user_id = nb_getMixedValue($nb_user, NABU_USER_FIELD_ID))) {
$retval = CNabuSiteUser::buildObjectListFromSQL(
'nb_site_id',
'SELECT su.*
FROM nb_site_user su, nb_user u, nb_site s
WHERE su.nb_user_id=u.nb_user_id
AND su.nb_site_id=s.nb_site_id
AND su.nb_user_id=%user_id$d',
array(
'user_id' => $nb_user_id
),
($nb_user instanceof CNabuUser ? $nb_user : null)
);
} else {
$retval = new CNabuSiteUserList();
}
return $retval;
} | [
"public",
"static",
"function",
"getSitesForUser",
"(",
"$",
"nb_user",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_user_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_user",
",",
"NABU_USER_FIELD_ID",
")",
")",
")",
"{",
"$",
"retval",
"=",
"CNabuSiteUser... | Get the list of Profiles of a User.
@param mixed $nb_user A CNabuDataObject that contains a nb_user_id field or a valid Id.
@return CNabuSiteUserList Returns the list of all profiles found. | [
"Get",
"the",
"list",
"of",
"Profiles",
"of",
"a",
"User",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteUser.php#L67-L87 | train |
nabu-3/core | nabu/data/site/CNabuSiteUser.php | CNabuSiteUser.getAvailableSitesForUser | public static function getAvailableSitesForUser(CNabuCustomer $nb_customer, $nb_user)
{
if ($nb_customer->isFetched() &&
is_numeric($nb_user_id = nb_getMixedValue($nb_user, NABU_USER_FIELD_ID))
) {
if (!($nb_user = $nb_customer->getUser($nb_user_id))) {
throw new ENabuSecurityException(ENabuSecurityException::ERROR_USER_NOT_ALLOWED);
}
$retval = CNabuSite::buildObjectListFromSQL(
'nb_site_id',
'SELECT s.*, su.nb_user_id
FROM nb_site s
LEFT OUTER JOIN nb_site_user su
ON s.nb_site_id=su.nb_site_id
AND su.nb_user_id=%user_id$d
WHERE s.nb_customer_id=%cust_id$d
HAVING su.nb_user_id IS NULL',
array(
'cust_id' => $nb_customer->getId(),
'user_id' => $nb_user->getId()
),
$nb_customer
);
} else {
$retval = new CNabuSiteList($nb_customer);
}
return $retval;
} | php | public static function getAvailableSitesForUser(CNabuCustomer $nb_customer, $nb_user)
{
if ($nb_customer->isFetched() &&
is_numeric($nb_user_id = nb_getMixedValue($nb_user, NABU_USER_FIELD_ID))
) {
if (!($nb_user = $nb_customer->getUser($nb_user_id))) {
throw new ENabuSecurityException(ENabuSecurityException::ERROR_USER_NOT_ALLOWED);
}
$retval = CNabuSite::buildObjectListFromSQL(
'nb_site_id',
'SELECT s.*, su.nb_user_id
FROM nb_site s
LEFT OUTER JOIN nb_site_user su
ON s.nb_site_id=su.nb_site_id
AND su.nb_user_id=%user_id$d
WHERE s.nb_customer_id=%cust_id$d
HAVING su.nb_user_id IS NULL',
array(
'cust_id' => $nb_customer->getId(),
'user_id' => $nb_user->getId()
),
$nb_customer
);
} else {
$retval = new CNabuSiteList($nb_customer);
}
return $retval;
} | [
"public",
"static",
"function",
"getAvailableSitesForUser",
"(",
"CNabuCustomer",
"$",
"nb_customer",
",",
"$",
"nb_user",
")",
"{",
"if",
"(",
"$",
"nb_customer",
"->",
"isFetched",
"(",
")",
"&&",
"is_numeric",
"(",
"$",
"nb_user_id",
"=",
"nb_getMixedValue",
... | Get not subscribed available Sites for a User.
@param CNabuCustomer $nb_customer The Customer that owns Sites and User.
@param mixed $nb_user The User to looking for.
@return CNabuSiteList The list of Sites availables for requested User.
@throws ENabuSecurityException Raises an exception if the User is not owned by the Customer. | [
"Get",
"not",
"subscribed",
"available",
"Sites",
"for",
"a",
"User",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/CNabuSiteUser.php#L96-L124 | train |
mpaleo/scaffolder | src/Scaffolder/Commands/BaseCommand.php | BaseCommand.writeStatus | protected function writeStatus($status, $webExecution)
{
if ($webExecution)
{
$cachedStatus = unserialize(Cache::get('scaffolder-status'));
array_push($cachedStatus, $status);
Cache::forever('scaffolder-status', serialize($cachedStatus));
}
else
{
$this->info($status);
}
} | php | protected function writeStatus($status, $webExecution)
{
if ($webExecution)
{
$cachedStatus = unserialize(Cache::get('scaffolder-status'));
array_push($cachedStatus, $status);
Cache::forever('scaffolder-status', serialize($cachedStatus));
}
else
{
$this->info($status);
}
} | [
"protected",
"function",
"writeStatus",
"(",
"$",
"status",
",",
"$",
"webExecution",
")",
"{",
"if",
"(",
"$",
"webExecution",
")",
"{",
"$",
"cachedStatus",
"=",
"unserialize",
"(",
"Cache",
"::",
"get",
"(",
"'scaffolder-status'",
")",
")",
";",
"array_... | Store status in cache or print.
@param string $status
@param bool $webExecution | [
"Store",
"status",
"in",
"cache",
"or",
"print",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Commands/BaseCommand.php#L16-L28 | train |
rips/php-connector-bundle | Services/QuotaService.php | QuotaService.getAll | public function getAll(array $queryParams = [])
{
$response = $this->api->quotas()->getAll($queryParams);
return new QuotasResponse($response);
} | php | public function getAll(array $queryParams = [])
{
$response = $this->api->quotas()->getAll($queryParams);
return new QuotasResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"quotas",
"(",
")",
"->",
"getAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"QuotasResponse",
... | Get all quotas
@param array $queryParams
@return QuotasResponse | [
"Get",
"all",
"quotas"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/QuotaService.php#L33-L38 | train |
rips/php-connector-bundle | Services/QuotaService.php | QuotaService.create | public function create(QuotaBuilder $input, array $queryParams = [])
{
$response = $this->api->quotas()->create($input->toArray(), $queryParams);
return new QuotaResponse($response);
} | php | public function create(QuotaBuilder $input, array $queryParams = [])
{
$response = $this->api->quotas()->create($input->toArray(), $queryParams);
return new QuotaResponse($response);
} | [
"public",
"function",
"create",
"(",
"QuotaBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"quotas",
"(",
")",
"->",
"create",
"(",
"$",
"input",
"->",
"toArray"... | Create a new quota
@param QuotaBuilder $input
@param array $queryParams
@return QuotaResponse | [
"Create",
"a",
"new",
"quota"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/QuotaService.php#L61-L66 | train |
rips/php-connector-bundle | Services/QuotaService.php | QuotaService.update | public function update($quotaId, QuotaBuilder $input, array $queryParams = [])
{
$response = $this->api->quotas()->update($quotaId, $input->toArray(), $queryParams);
return new QuotaResponse($response);
} | php | public function update($quotaId, QuotaBuilder $input, array $queryParams = [])
{
$response = $this->api->quotas()->update($quotaId, $input->toArray(), $queryParams);
return new QuotaResponse($response);
} | [
"public",
"function",
"update",
"(",
"$",
"quotaId",
",",
"QuotaBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"quotas",
"(",
")",
"->",
"update",
"(",
"$",
"... | Update an existing quota
@param int $quotaId
@param QuotaBuilder $input
@param array $queryParams
@return QuotaResponse | [
"Update",
"an",
"existing",
"quota"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/QuotaService.php#L76-L81 | train |
rips/php-connector-bundle | Services/QuotaService.php | QuotaService.deleteAll | public function deleteAll(array $queryParams = [])
{
$response = $this->api->quotas()->deleteAll($queryParams);
return new BaseResponse($response);
} | php | public function deleteAll(array $queryParams = [])
{
$response = $this->api->quotas()->deleteAll($queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"deleteAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"quotas",
"(",
")",
"->",
"deleteAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"BaseResponse... | Delete all quotas
@param array $queryParams
@return BaseResponse | [
"Delete",
"all",
"quotas"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/QuotaService.php#L89-L94 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/ContextHydrator.php | ContextHydrator.hydrateCollection | public static function hydrateCollection(array $contexts)
{
$hydrated = [];
foreach ($contexts as $context) {
$hydrated[] = self::hydrate($context);
}
return $hydrated;
} | php | public static function hydrateCollection(array $contexts)
{
$hydrated = [];
foreach ($contexts as $context) {
$hydrated[] = self::hydrate($context);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"contexts",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"contexts",
"as",
"$",
"context",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"hydrate",... | Hydrate a collection of context objects into a collection of
ContextEntity objects
@param stdClass[] $contexts
@return ContextEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"context",
"objects",
"into",
"a",
"collection",
"of",
"ContextEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/ContextHydrator.php#L18-L27 | train |
rips/php-connector-bundle | Hydrators/Application/Scan/Issue/ContextHydrator.php | ContextHydrator.hydrate | public static function hydrate(stdClass $context)
{
$hydrated = new ContextEntity();
if (isset($context->id)) {
$hydrated->setId($context->id);
}
if (isset($context->parts)) {
$hydrated->setParts(PartHydrator::hydrateCollection($context->parts));
}
return $hydrated;
} | php | public static function hydrate(stdClass $context)
{
$hydrated = new ContextEntity();
if (isset($context->id)) {
$hydrated->setId($context->id);
}
if (isset($context->parts)) {
$hydrated->setParts(PartHydrator::hydrateCollection($context->parts));
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"context",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ContextEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"context",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setId",
"("... | Hydrate a context object into a ContextEntity object
@param stdClass $context
@return ContextEntity | [
"Hydrate",
"a",
"context",
"object",
"into",
"a",
"ContextEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Scan/Issue/ContextHydrator.php#L35-L48 | train |
nabu-3/core | nabu/data/messaging/base/CNabuMessagingServiceBase.php | CNabuMessagingServiceBase.findByKey | public static function findByKey($nb_messaging, $key)
{
$nb_messaging_id = nb_getMixedValue($nb_messaging, 'nb_messaging_id');
if (is_numeric($nb_messaging_id)) {
$retval = CNabuMessagingService::buildObjectFromSQL(
'select * '
. 'from nb_messaging_service '
. 'where nb_messaging_id=%messaging_id$d '
. "and nb_messaging_service_key='%key\$s'",
array(
'messaging_id' => $nb_messaging_id,
'key' => $key
)
);
} else {
$retval = null;
}
return $retval;
} | php | public static function findByKey($nb_messaging, $key)
{
$nb_messaging_id = nb_getMixedValue($nb_messaging, 'nb_messaging_id');
if (is_numeric($nb_messaging_id)) {
$retval = CNabuMessagingService::buildObjectFromSQL(
'select * '
. 'from nb_messaging_service '
. 'where nb_messaging_id=%messaging_id$d '
. "and nb_messaging_service_key='%key\$s'",
array(
'messaging_id' => $nb_messaging_id,
'key' => $key
)
);
} else {
$retval = null;
}
return $retval;
} | [
"public",
"static",
"function",
"findByKey",
"(",
"$",
"nb_messaging",
",",
"$",
"key",
")",
"{",
"$",
"nb_messaging_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_messaging",
",",
"'nb_messaging_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_messaging_id... | Find an instance identified by nb_messaging_service_key field.
@param mixed $nb_messaging Messaging that owns Messaging Service
@param string $key Key to search
@return CNabuMessagingService Returns a valid instance if exists or null if not. | [
"Find",
"an",
"instance",
"identified",
"by",
"nb_messaging_service_key",
"field",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/messaging/base/CNabuMessagingServiceBase.php#L120-L139 | train |
nabu-3/core | nabu/data/messaging/base/CNabuMessagingServiceBase.php | CNabuMessagingServiceBase.getFilteredMessagingServiceList | public static function getFilteredMessagingServiceList($nb_messaging = null, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_messaging_id = nb_getMixedValue($nb_customer, NABU_MESSAGING_FIELD_ID);
if (is_numeric($nb_messaging_id)) {
$fields_part = nb_prefixFieldList(CNabuMessagingServiceBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuMessagingServiceBase::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_messaging_service '
. 'where ' . NABU_MESSAGING_FIELD_ID . '=%messaging_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'messaging_id' => $nb_messaging_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | php | public static function getFilteredMessagingServiceList($nb_messaging = null, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_messaging_id = nb_getMixedValue($nb_customer, NABU_MESSAGING_FIELD_ID);
if (is_numeric($nb_messaging_id)) {
$fields_part = nb_prefixFieldList(CNabuMessagingServiceBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuMessagingServiceBase::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_messaging_service '
. 'where ' . NABU_MESSAGING_FIELD_ID . '=%messaging_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'messaging_id' => $nb_messaging_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | [
"public",
"static",
"function",
"getFilteredMessagingServiceList",
"(",
"$",
"nb_messaging",
"=",
"null",
",",
"$",
"q",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"order",
"=",
"null",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"num_items",
... | Gets a filtered list of Messaging Service 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_messaging Messaging instance, object containing a Messaging 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",
"Messaging",
"Service",
"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/messaging/base/CNabuMessagingServiceBase.php#L184-L212 | train |
nabu-3/core | nabu/data/customer/traits/TNabuCustomerChild.php | TNabuCustomerChild.setCustomer | public function setCustomer(CNabuCustomer $nb_customer, $field = NABU_CUSTOMER_FIELD_ID)
{
$this->nb_customer = $nb_customer;
if ($this instanceof CNabuDataObject) {
if ($nb_customer !== null) {
$this->transferValue($nb_customer, NABU_CUSTOMER_FIELD_ID, $field);
} else {
$this->setValue(NABU_CUSTOMER_FIELD_ID, null);
}
}
return $this;
} | php | public function setCustomer(CNabuCustomer $nb_customer, $field = NABU_CUSTOMER_FIELD_ID)
{
$this->nb_customer = $nb_customer;
if ($this instanceof CNabuDataObject) {
if ($nb_customer !== null) {
$this->transferValue($nb_customer, NABU_CUSTOMER_FIELD_ID, $field);
} else {
$this->setValue(NABU_CUSTOMER_FIELD_ID, null);
}
}
return $this;
} | [
"public",
"function",
"setCustomer",
"(",
"CNabuCustomer",
"$",
"nb_customer",
",",
"$",
"field",
"=",
"NABU_CUSTOMER_FIELD_ID",
")",
"{",
"$",
"this",
"->",
"nb_customer",
"=",
"$",
"nb_customer",
";",
"if",
"(",
"$",
"this",
"instanceof",
"CNabuDataObject",
... | Sets the customer instance that owns this object and sets the field containing the customer id.
@param CNabuCustomer $nb_customer Customer instance to be setted.
@param string $field Field name where the customer id will be stored.
@return CNabuDataObject Returns $this to allow the cascade chain of setters. | [
"Sets",
"the",
"customer",
"instance",
"that",
"owns",
"this",
"object",
"and",
"sets",
"the",
"field",
"containing",
"the",
"customer",
"id",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/traits/TNabuCustomerChild.php#L71-L83 | train |
nabu-3/core | nabu/data/customer/traits/TNabuCustomerChild.php | TNabuCustomerChild.validateCustomer | public function validateCustomer($nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID);
return ($this instanceof CNabuDataObject) &&
(is_numeric($nb_customer_id) || nb_isValidGUID($nb_customer_id)) &&
$this->isValueEqualThan(NABU_CUSTOMER_FIELD_ID, $nb_customer_id)
;
} | php | public function validateCustomer($nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID);
return ($this instanceof CNabuDataObject) &&
(is_numeric($nb_customer_id) || nb_isValidGUID($nb_customer_id)) &&
$this->isValueEqualThan(NABU_CUSTOMER_FIELD_ID, $nb_customer_id)
;
} | [
"public",
"function",
"validateCustomer",
"(",
"$",
"nb_customer",
")",
"{",
"$",
"nb_customer_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_customer",
",",
"NABU_CUSTOMER_FIELD_ID",
")",
";",
"return",
"(",
"$",
"this",
"instanceof",
"CNabuDataObject",
")",
"&&",
... | Checks if the object is owned by the customer passed as param.
@param mixed $nb_customer object containing the field nb_customer_id or an scalar value containing
the customer ID.
@return bool Returns true if $nb_customer is a valid customer ID and is the owner of the object. | [
"Checks",
"if",
"the",
"object",
"is",
"owned",
"by",
"the",
"customer",
"passed",
"as",
"param",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/customer/traits/TNabuCustomerChild.php#L91-L98 | train |
nabu-3/core | nabu/render/managers/CNabuRenderPoolManager.php | CNabuRenderPoolManager.getRenderFactory | public function getRenderFactory(CNabuRenderInterfaceDescriptor $nb_descriptor)
{
if (!($retval = $this->nb_render_factory_list->getItem($nb_descriptor->getKey()))) {
$retval = $this->nb_render_factory_list->addItem(new CNabuRenderFactory($nb_descriptor));
}
return $retval;
} | php | public function getRenderFactory(CNabuRenderInterfaceDescriptor $nb_descriptor)
{
if (!($retval = $this->nb_render_factory_list->getItem($nb_descriptor->getKey()))) {
$retval = $this->nb_render_factory_list->addItem(new CNabuRenderFactory($nb_descriptor));
}
return $retval;
} | [
"public",
"function",
"getRenderFactory",
"(",
"CNabuRenderInterfaceDescriptor",
"$",
"nb_descriptor",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"retval",
"=",
"$",
"this",
"->",
"nb_render_factory_list",
"->",
"getItem",
"(",
"$",
"nb_descriptor",
"->",
"getKey",
"("... | Gets a Render Factory instance for a Descriptor. If Factory instance already exists then returns it.
@param CNabuRenderInterfaceDescriptor $nb_descriptor Render Descriptor instance to locate the required Factory.
@return CNabuRenderFactory|false Returns the Factory if $nb_mimetype exists, or false if not. | [
"Gets",
"a",
"Render",
"Factory",
"instance",
"for",
"a",
"Descriptor",
".",
"If",
"Factory",
"instance",
"already",
"exists",
"then",
"returns",
"it",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/render/managers/CNabuRenderPoolManager.php#L73-L80 | train |
nabu-3/core | nabu/render/managers/CNabuRenderPoolManager.php | CNabuRenderPoolManager.getTransformFactory | public function getTransformFactory(CNabuRenderTransformInterfaceDescriptor $nb_descriptor)
{
if (!($retval = $this->nb_render_transform_factory_list->getItem($nb_descriptor->getKey()))) {
$retval = $this->nb_render_transform_factory_list->addItem(new CNabuRenderTransformFactory($nb_descriptor));
}
return $retval;
} | php | public function getTransformFactory(CNabuRenderTransformInterfaceDescriptor $nb_descriptor)
{
if (!($retval = $this->nb_render_transform_factory_list->getItem($nb_descriptor->getKey()))) {
$retval = $this->nb_render_transform_factory_list->addItem(new CNabuRenderTransformFactory($nb_descriptor));
}
return $retval;
} | [
"public",
"function",
"getTransformFactory",
"(",
"CNabuRenderTransformInterfaceDescriptor",
"$",
"nb_descriptor",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"retval",
"=",
"$",
"this",
"->",
"nb_render_transform_factory_list",
"->",
"getItem",
"(",
"$",
"nb_descriptor",
"... | Gets a Render Transform Factory instance for a Descriptor. If Factory instance already exists then returns it.
@param CNabuRenderTransformInterfaceDescriptor $nb_descriptor Render Transform Descriptor instance to locate
the required Factory.
@return CNabuRenderTransformFactory|false Returns the Factory if exists, or false if not. | [
"Gets",
"a",
"Render",
"Transform",
"Factory",
"instance",
"for",
"a",
"Descriptor",
".",
"If",
"Factory",
"instance",
"already",
"exists",
"then",
"returns",
"it",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/render/managers/CNabuRenderPoolManager.php#L88-L95 | train |
rips/php-connector-bundle | Services/Quota/AclService.php | AclService.getById | public function getById($quotaId, $aclId, array $queryParams = [])
{
$response = $this->api->quotas()->acls()->getById($quotaId, $aclId, $queryParams);
return new AclResponse($response);
} | php | public function getById($quotaId, $aclId, array $queryParams = [])
{
$response = $this->api->quotas()->acls()->getById($quotaId, $aclId, $queryParams);
return new AclResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"quotaId",
",",
"$",
"aclId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"quotas",
"(",
")",
"->",
"acls",
"(",
")",
"->",
"getById",
... | Get a acl for quota by id
@param int $quotaId
@param int $aclId
@param array $queryParams
@return AclResponse | [
"Get",
"a",
"acl",
"for",
"quota",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Quota/AclService.php#L50-L55 | train |
rips/php-connector-bundle | Services/Quota/AclService.php | AclService.create | public function create($quotaId, AclBuilder $input, array $queryParams = [])
{
$response = $this->api->quotas()->acls()->create($quotaId, $input->toArray(), $queryParams);
return new AclResponse($response);
} | php | public function create($quotaId, AclBuilder $input, array $queryParams = [])
{
$response = $this->api->quotas()->acls()->create($quotaId, $input->toArray(), $queryParams);
return new AclResponse($response);
} | [
"public",
"function",
"create",
"(",
"$",
"quotaId",
",",
"AclBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"quotas",
"(",
")",
"->",
"acls",
"(",
")",
"->",... | Create a new acl for a quota
@param int $quotaId
@param AclBuilder $input
@param array $queryParams
@return AclResponse | [
"Create",
"a",
"new",
"acl",
"for",
"a",
"quota"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Quota/AclService.php#L65-L70 | train |
rips/php-connector-bundle | Services/Quota/AclService.php | AclService.update | public function update($quotaId, $aclId, AclBuilder $input, array $queryParams = [])
{
$response = $this->api->quotas()->acls()->update($quotaId, $aclId, $input->toArray(), $queryParams);
return new AclResponse($response);
} | php | public function update($quotaId, $aclId, AclBuilder $input, array $queryParams = [])
{
$response = $this->api->quotas()->acls()->update($quotaId, $aclId, $input->toArray(), $queryParams);
return new AclResponse($response);
} | [
"public",
"function",
"update",
"(",
"$",
"quotaId",
",",
"$",
"aclId",
",",
"AclBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"quotas",
"(",
")",
"->",
"acl... | Update existing acl for quota by id
@param int $quotaId
@param int $aclId
@param AclBuilder $input
@param array $queryParams
@return AclResponse | [
"Update",
"existing",
"acl",
"for",
"quota",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Quota/AclService.php#L81-L86 | train |
rips/php-connector-bundle | Services/Quota/AclService.php | AclService.deleteAll | public function deleteAll($quotaId, array $queryParams = [])
{
$response = $this->api->quotas()->acls()->deleteAll($quotaId, $queryParams);
return new BaseResponse($response);
} | php | public function deleteAll($quotaId, array $queryParams = [])
{
$response = $this->api->quotas()->acls()->deleteAll($quotaId, $queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"deleteAll",
"(",
"$",
"quotaId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"quotas",
"(",
")",
"->",
"acls",
"(",
")",
"->",
"deleteAll",
"(",
"$",
"quota... | Delete all acls for a quota
@param int $quotaId
@param array $queryParams
@return BaseResponse | [
"Delete",
"all",
"acls",
"for",
"a",
"quota"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Quota/AclService.php#L95-L100 | train |
nabu-3/core | nabu/data/medioteca/CNabuMedioteca.php | CNabuMedioteca.getItems | public function getItems($force = false)
{
if (!$this->isBuiltIn() && ($this->nb_medioteca_item_list->isEmpty() || $force)) {
$this->nb_medioteca_item_list = CNabuMediotecaItem::getItemsForMedioteca($this);
}
return $this->nb_medioteca_item_list;
} | php | public function getItems($force = false)
{
if (!$this->isBuiltIn() && ($this->nb_medioteca_item_list->isEmpty() || $force)) {
$this->nb_medioteca_item_list = CNabuMediotecaItem::getItemsForMedioteca($this);
}
return $this->nb_medioteca_item_list;
} | [
"public",
"function",
"getItems",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isBuiltIn",
"(",
")",
"&&",
"(",
"$",
"this",
"->",
"nb_medioteca_item_list",
"->",
"isEmpty",
"(",
")",
"||",
"$",
"force",
")",
")",
... | Gets all items in the Medioteca.
@param bool $force If true, clears current items list and retrieves a new list.
@return CNabuMediotecaItemList Returns a list object with avaliable items. | [
"Gets",
"all",
"items",
"in",
"the",
"Medioteca",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/CNabuMedioteca.php#L53-L60 | train |
nabu-3/core | nabu/data/medioteca/CNabuMedioteca.php | CNabuMedioteca.getItem | public function getItem($nb_medioteca_item)
{
$nb_medioteca_item_id = nb_getMixedValue($nb_medioteca_item, 'nb_medioteca_item_id');
if (is_numeric($nb_medioteca_item_id) || nb_isValidGUID($nb_medioteca_item_id)) {
return $this->nb_medioteca_item_list->getItem($nb_medioteca_item_id);
}
return null;
} | php | public function getItem($nb_medioteca_item)
{
$nb_medioteca_item_id = nb_getMixedValue($nb_medioteca_item, 'nb_medioteca_item_id');
if (is_numeric($nb_medioteca_item_id) || nb_isValidGUID($nb_medioteca_item_id)) {
return $this->nb_medioteca_item_list->getItem($nb_medioteca_item_id);
}
return null;
} | [
"public",
"function",
"getItem",
"(",
"$",
"nb_medioteca_item",
")",
"{",
"$",
"nb_medioteca_item_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_medioteca_item",
",",
"'nb_medioteca_item_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_medioteca_item_id",
")",
... | Gets an item from the Medioteca by their ID.
@param mixed $nb_medioteca_item An instance descending from CNabuDataObject that contains a field named
nb_medioteca_item_id or an ID.
@return CNabuMediotecaItem If an Item exists, then returns their instance elsewhere returns null. | [
"Gets",
"an",
"item",
"from",
"the",
"Medioteca",
"by",
"their",
"ID",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/CNabuMedioteca.php#L68-L76 | train |
nabu-3/core | nabu/data/medioteca/CNabuMedioteca.php | CNabuMedioteca.newItem | public function newItem(string $key = null)
{
$nb_medioteca_item = $this->isBuiltIn()
? new CNabuBuiltInMediotecaItem()
: new CNabuMediotecaItem()
;
$nb_medioteca_item->setKey($key);
return $this->addItemObject($nb_medioteca_item);
} | php | public function newItem(string $key = null)
{
$nb_medioteca_item = $this->isBuiltIn()
? new CNabuBuiltInMediotecaItem()
: new CNabuMediotecaItem()
;
$nb_medioteca_item->setKey($key);
return $this->addItemObject($nb_medioteca_item);
} | [
"public",
"function",
"newItem",
"(",
"string",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"nb_medioteca_item",
"=",
"$",
"this",
"->",
"isBuiltIn",
"(",
")",
"?",
"new",
"CNabuBuiltInMediotecaItem",
"(",
")",
":",
"new",
"CNabuMediotecaItem",
"(",
")",
";",
... | Create a new Item in the list.
@param string $key Optional key of the item to be assigned.
@return CNabuMediotecaItem Returns the created Item instance. | [
"Create",
"a",
"new",
"Item",
"in",
"the",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/CNabuMedioteca.php#L93-L102 | train |
nabu-3/core | nabu/data/medioteca/CNabuMedioteca.php | CNabuMedioteca.findItemByURL | public function findItemByURL(string $url, $nb_language = null)
{
$retval = false;
$nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);
$this->getItems()->iterate(
function ($key, CNabuMediotecaItem $nb_item)
use (&$retval, $url, $nb_language_id)
{
if (is_numeric($nb_language_id) &&
($nb_translation = $nb_item->getTranslation($nb_language_id)) instanceof CNabuMediotecaItemLanguage &&
$nb_translation->getURL() === $url
) {
$retval = $nb_item;
} else {
$nb_item->getTranslations()->iterate(
function ($key, CNabuMediotecaItemLanguage $nb_translation)
use (&$retval, $nb_item, $url)
{
if ($nb_translation->getURL() === $url) {
$retval = $nb_item;
}
return !$retval;
}
);
}
return !$retval;
}
);
return $retval;
} | php | public function findItemByURL(string $url, $nb_language = null)
{
$retval = false;
$nb_language_id = nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID);
$this->getItems()->iterate(
function ($key, CNabuMediotecaItem $nb_item)
use (&$retval, $url, $nb_language_id)
{
if (is_numeric($nb_language_id) &&
($nb_translation = $nb_item->getTranslation($nb_language_id)) instanceof CNabuMediotecaItemLanguage &&
$nb_translation->getURL() === $url
) {
$retval = $nb_item;
} else {
$nb_item->getTranslations()->iterate(
function ($key, CNabuMediotecaItemLanguage $nb_translation)
use (&$retval, $nb_item, $url)
{
if ($nb_translation->getURL() === $url) {
$retval = $nb_item;
}
return !$retval;
}
);
}
return !$retval;
}
);
return $retval;
} | [
"public",
"function",
"findItemByURL",
"(",
"string",
"$",
"url",
",",
"$",
"nb_language",
"=",
"null",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"$",
"nb_language_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_language",
",",
"NABU_LANG_FIELD_ID",
")",
";",
... | Find a Item using their url.
@param string $url Slug of Product to find.
@param mixed|null $nb_language Language to search the Slug.
@return CNabuMediotecaItem|false Returns the Product instance if exists or false if not. | [
"Find",
"a",
"Item",
"using",
"their",
"url",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/CNabuMedioteca.php#L110-L141 | train |
nabu-3/core | nabu/data/medioteca/CNabuMedioteca.php | CNabuMedioteca.addItemObject | public function addItemObject(CNabuMediotecaItem $nb_medioteca_item)
{
$nb_medioteca_item->setMedioteca($this);
return $this->nb_medioteca_item_list->addItem($nb_medioteca_item);
} | php | public function addItemObject(CNabuMediotecaItem $nb_medioteca_item)
{
$nb_medioteca_item->setMedioteca($this);
return $this->nb_medioteca_item_list->addItem($nb_medioteca_item);
} | [
"public",
"function",
"addItemObject",
"(",
"CNabuMediotecaItem",
"$",
"nb_medioteca_item",
")",
"{",
"$",
"nb_medioteca_item",
"->",
"setMedioteca",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this",
"->",
"nb_medioteca_item_list",
"->",
"addItem",
"(",
"$",
"n... | Add an Item instance to the list.
@param CNabuMediotecaItem $nb_medioteca_item Item instance to be added.
@return CNabuMediotecaItem Returns the item added. | [
"Add",
"an",
"Item",
"instance",
"to",
"the",
"list",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/CNabuMedioteca.php#L148-L153 | train |
nabu-3/core | nabu/data/medioteca/CNabuMedioteca.php | CNabuMedioteca.getMediotecasForCustomer | static public function getMediotecasForCustomer(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID);
if (is_numeric($nb_customer_id)) {
$retval = CNabuMedioteca::buildObjectListFromSQL(
NABU_MEDIOTECA_FIELD_ID,
'select * '
. 'from ' . NABU_MEDIOTECA_TABLE . ' '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuMediotecaList($nb_customer);
}
return $retval;
} | php | static public function getMediotecasForCustomer(CNabuCustomer $nb_customer)
{
$nb_customer_id = nb_getMixedValue($nb_customer, NABU_CUSTOMER_FIELD_ID);
if (is_numeric($nb_customer_id)) {
$retval = CNabuMedioteca::buildObjectListFromSQL(
NABU_MEDIOTECA_FIELD_ID,
'select * '
. 'from ' . NABU_MEDIOTECA_TABLE . ' '
. 'where nb_customer_id=%cust_id$d',
array(
'cust_id' => $nb_customer_id
),
$nb_customer
);
} else {
$retval = new CNabuMediotecaList($nb_customer);
}
return $retval;
} | [
"static",
"public",
"function",
"getMediotecasForCustomer",
"(",
"CNabuCustomer",
"$",
"nb_customer",
")",
"{",
"$",
"nb_customer_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_customer",
",",
"NABU_CUSTOMER_FIELD_ID",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb... | Get all Mediotecas of a Customer.
@param CNabuCustomer $nb_customer Customer instance that owns Mediotecas to be getted.
@return CNabuMediotecaList Returns a list of all instances. If no instances available the list object is empty. | [
"Get",
"all",
"Mediotecas",
"of",
"a",
"Customer",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/CNabuMedioteca.php#L198-L217 | train |
nabu-3/core | nabu/data/medioteca/CNabuMedioteca.php | CNabuMedioteca.refresh | public function refresh(bool $force = false, bool $cascade = false) : bool
{
return parent::refresh($force, $cascade) && (!$cascade || $this->getItems($force));
} | php | public function refresh(bool $force = false, bool $cascade = false) : bool
{
return parent::refresh($force, $cascade) && (!$cascade || $this->getItems($force));
} | [
"public",
"function",
"refresh",
"(",
"bool",
"$",
"force",
"=",
"false",
",",
"bool",
"$",
"cascade",
"=",
"false",
")",
":",
"bool",
"{",
"return",
"parent",
"::",
"refresh",
"(",
"$",
"force",
",",
"$",
"cascade",
")",
"&&",
"(",
"!",
"$",
"casc... | Overrides refresh method to add Medioteca subentities to be refreshed.
@param bool $force Forces to reload entities from the database storage.
@param bool $cascade Forces to reload child entities from the database storage.
@return bool Returns true if transations are empty or refreshed. | [
"Overrides",
"refresh",
"method",
"to",
"add",
"Medioteca",
"subentities",
"to",
"be",
"refreshed",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/medioteca/CNabuMedioteca.php#L225-L228 | train |
nabu-3/core | nabu/data/domain/base/CNabuDomainZoneHostBase.php | CNabuDomainZoneHostBase.setDomainZoneId | public function setDomainZoneId(int $nb_domain_zone_id) : CNabuDataObject
{
if ($nb_domain_zone_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_domain_zone_id")
);
}
$this->setValue('nb_domain_zone_id', $nb_domain_zone_id);
return $this;
} | php | public function setDomainZoneId(int $nb_domain_zone_id) : CNabuDataObject
{
if ($nb_domain_zone_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_domain_zone_id")
);
}
$this->setValue('nb_domain_zone_id', $nb_domain_zone_id);
return $this;
} | [
"public",
"function",
"setDomainZoneId",
"(",
"int",
"$",
"nb_domain_zone_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_domain_zone_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NO... | Sets the Domain Zone Id attribute value.
@param int $nb_domain_zone_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Domain",
"Zone",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/domain/base/CNabuDomainZoneHostBase.php#L179-L190 | train |
WPBP/PointerPlus | pointerplus.php | PointerPlus.initial_pointers | function initial_pointers() {
global $pagenow;
$defaults = array(
'class' => '',
'width' => 300, //only fixed value
'align' => 'middle',
'edge' => 'left',
'post_type' => array(),
'pages' => array(),
'icon_class' => ''
);
$screen = get_current_screen();
$current_post_type = isset( $screen->post_type ) ? $screen->post_type : false;
$search_pt = false;
$pointers = apply_filters( $this->prefix . '-pointerplus_list', array(
// Pointers are added through the 'initial_pointerplus' filter
), $this->prefix );
foreach ( $pointers as $key => $pointer ) {
$pointers[ $key ] = wp_parse_args( $pointer, $defaults );
$search_pt = false;
// Clean from null ecc
$pointers[ $key ][ 'post_type' ] = array_filter( $pointers[ $key ][ 'post_type' ] );
if ( !empty( $pointers[ $key ][ 'post_type' ] ) ) {
if ( !empty( $current_post_type ) ) {
if ( is_array( $pointers[ $key ][ 'post_type' ] ) ) {
// Search the post_type
foreach ( $pointers[ $key ][ 'post_type' ] as $value ) {
if ( $value === $current_post_type ) {
$search_pt = true;
}
}
if ( $search_pt === false ) {
unset( $pointers[ $key ] );
}
} else {
new WP_Error( 'broke', __( 'PointerPlus Error: post_type is not an array!' ) );
}
// If not in CPT view remove all the pointers with post_type
} else {
unset( $pointers[ $key ] );
}
}
// Clean from null ecc
if ( isset( $pointers[ $key ][ 'pages' ] ) ) {
if ( is_array( $pointers[ $key ][ 'pages' ] ) ) {
$pointers[ $key ][ 'pages' ] = array_filter( $pointers[ $key ][ 'pages' ] );
}
if ( !empty( $pointers[ $key ][ 'pages' ] ) ) {
if ( is_array( $pointers[ $key ][ 'pages' ] ) ) {
// Search the page
foreach ( $pointers[ $key ][ 'pages' ] as $value ) {
if ( $pagenow === $value ) {
$search_pt = true;
}
}
if ( $search_pt === false ) {
unset( $pointers[ $key ] );
}
} else {
new WP_Error( 'broke', __( 'PointerPlus Error: pages is not an array!' ) );
}
}
}
}
return $pointers;
} | php | function initial_pointers() {
global $pagenow;
$defaults = array(
'class' => '',
'width' => 300, //only fixed value
'align' => 'middle',
'edge' => 'left',
'post_type' => array(),
'pages' => array(),
'icon_class' => ''
);
$screen = get_current_screen();
$current_post_type = isset( $screen->post_type ) ? $screen->post_type : false;
$search_pt = false;
$pointers = apply_filters( $this->prefix . '-pointerplus_list', array(
// Pointers are added through the 'initial_pointerplus' filter
), $this->prefix );
foreach ( $pointers as $key => $pointer ) {
$pointers[ $key ] = wp_parse_args( $pointer, $defaults );
$search_pt = false;
// Clean from null ecc
$pointers[ $key ][ 'post_type' ] = array_filter( $pointers[ $key ][ 'post_type' ] );
if ( !empty( $pointers[ $key ][ 'post_type' ] ) ) {
if ( !empty( $current_post_type ) ) {
if ( is_array( $pointers[ $key ][ 'post_type' ] ) ) {
// Search the post_type
foreach ( $pointers[ $key ][ 'post_type' ] as $value ) {
if ( $value === $current_post_type ) {
$search_pt = true;
}
}
if ( $search_pt === false ) {
unset( $pointers[ $key ] );
}
} else {
new WP_Error( 'broke', __( 'PointerPlus Error: post_type is not an array!' ) );
}
// If not in CPT view remove all the pointers with post_type
} else {
unset( $pointers[ $key ] );
}
}
// Clean from null ecc
if ( isset( $pointers[ $key ][ 'pages' ] ) ) {
if ( is_array( $pointers[ $key ][ 'pages' ] ) ) {
$pointers[ $key ][ 'pages' ] = array_filter( $pointers[ $key ][ 'pages' ] );
}
if ( !empty( $pointers[ $key ][ 'pages' ] ) ) {
if ( is_array( $pointers[ $key ][ 'pages' ] ) ) {
// Search the page
foreach ( $pointers[ $key ][ 'pages' ] as $value ) {
if ( $pagenow === $value ) {
$search_pt = true;
}
}
if ( $search_pt === false ) {
unset( $pointers[ $key ] );
}
} else {
new WP_Error( 'broke', __( 'PointerPlus Error: pages is not an array!' ) );
}
}
}
}
return $pointers;
} | [
"function",
"initial_pointers",
"(",
")",
"{",
"global",
"$",
"pagenow",
";",
"$",
"defaults",
"=",
"array",
"(",
"'class'",
"=>",
"''",
",",
"'width'",
"=>",
"300",
",",
"//only fixed value",
"'align'",
"=>",
"'middle'",
",",
"'edge'",
"=>",
"'left'",
","... | Set pointers and its options
@since 1.0.0 | [
"Set",
"pointers",
"and",
"its",
"options"
] | 04e251281a4e54629b469d74ed52a00278bc9252 | https://github.com/WPBP/PointerPlus/blob/04e251281a4e54629b469d74ed52a00278bc9252/pointerplus.php#L41-L109 | train |
WPBP/PointerPlus | pointerplus.php | PointerPlus.maybe_add_pointers | function maybe_add_pointers() {
// Get default pointers that we want to create
$default_keys = $this->initial_pointers();
// Get pointers dismissed by user
$dismissed = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
// Check that our pointers haven't been dismissed already
$diff = array_diff_key( $default_keys, array_combine( $dismissed, $dismissed ) );
// If we have some pointers to show, save them and start enqueuing assets to display them
if ( !empty( $diff ) ) {
$this->pointers = $diff;
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
foreach ( $diff as $pointer ) {
if ( isset( $pointer[ 'phpcode' ] ) ) {
add_action( 'admin_notices', $pointer[ 'phpcode' ] );
}
}
}
$this->pointers[ 'l10n' ] = array( 'next' => __( 'Next' ) );
} | php | function maybe_add_pointers() {
// Get default pointers that we want to create
$default_keys = $this->initial_pointers();
// Get pointers dismissed by user
$dismissed = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
// Check that our pointers haven't been dismissed already
$diff = array_diff_key( $default_keys, array_combine( $dismissed, $dismissed ) );
// If we have some pointers to show, save them and start enqueuing assets to display them
if ( !empty( $diff ) ) {
$this->pointers = $diff;
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
foreach ( $diff as $pointer ) {
if ( isset( $pointer[ 'phpcode' ] ) ) {
add_action( 'admin_notices', $pointer[ 'phpcode' ] );
}
}
}
$this->pointers[ 'l10n' ] = array( 'next' => __( 'Next' ) );
} | [
"function",
"maybe_add_pointers",
"(",
")",
"{",
"// Get default pointers that we want to create",
"$",
"default_keys",
"=",
"$",
"this",
"->",
"initial_pointers",
"(",
")",
";",
"// Get pointers dismissed by user",
"$",
"dismissed",
"=",
"explode",
"(",
"','",
",",
"... | Check that pointers haven't been dismissed already. If there are pointers to show, enqueue assets.
@since 1.0.0 | [
"Check",
"that",
"pointers",
"haven",
"t",
"been",
"dismissed",
"already",
".",
"If",
"there",
"are",
"pointers",
"to",
"show",
"enqueue",
"assets",
"."
] | 04e251281a4e54629b469d74ed52a00278bc9252 | https://github.com/WPBP/PointerPlus/blob/04e251281a4e54629b469d74ed52a00278bc9252/pointerplus.php#L116-L138 | train |
WPBP/PointerPlus | pointerplus.php | PointerPlus.admin_enqueue_assets | function admin_enqueue_assets() {
$base_url = plugins_url( '', __FILE__ );
wp_enqueue_style( $this->prefix, $base_url . '/pointerplus.css', array( 'wp-pointer' ) );
wp_enqueue_script( $this->prefix, $base_url . '/pointerplus.js?var=' . str_replace( '-', '_', $this->prefix ) . '_pointerplus', array( 'wp-pointer' ) );
wp_localize_script( $this->prefix, str_replace( '-', '_', $this->prefix ) . '_pointerplus', apply_filters( $this->prefix . '_pointerplus_js_vars', $this->pointers ) );
} | php | function admin_enqueue_assets() {
$base_url = plugins_url( '', __FILE__ );
wp_enqueue_style( $this->prefix, $base_url . '/pointerplus.css', array( 'wp-pointer' ) );
wp_enqueue_script( $this->prefix, $base_url . '/pointerplus.js?var=' . str_replace( '-', '_', $this->prefix ) . '_pointerplus', array( 'wp-pointer' ) );
wp_localize_script( $this->prefix, str_replace( '-', '_', $this->prefix ) . '_pointerplus', apply_filters( $this->prefix . '_pointerplus_js_vars', $this->pointers ) );
} | [
"function",
"admin_enqueue_assets",
"(",
")",
"{",
"$",
"base_url",
"=",
"plugins_url",
"(",
"''",
",",
"__FILE__",
")",
";",
"wp_enqueue_style",
"(",
"$",
"this",
"->",
"prefix",
",",
"$",
"base_url",
".",
"'/pointerplus.css'",
",",
"array",
"(",
"'wp-point... | Enqueue pointer styles and scripts to display them.
@since 1.0.0 | [
"Enqueue",
"pointer",
"styles",
"and",
"scripts",
"to",
"display",
"them",
"."
] | 04e251281a4e54629b469d74ed52a00278bc9252 | https://github.com/WPBP/PointerPlus/blob/04e251281a4e54629b469d74ed52a00278bc9252/pointerplus.php#L145-L150 | train |
WPBP/PointerPlus | pointerplus.php | PointerPlus._reset_pointer | function _reset_pointer( $id = 'me' ) {
if ( $id === 'me' ) {
$id = get_current_user_id();
}
$pointers = explode( ',', get_user_meta( $id, 'dismissed_wp_pointers', true ) );
foreach ( $pointers as $key => $pointer ) {
if ( strpos( $pointer, $this->prefix ) === 0 ) {
unset( $pointers[ $key ] );
}
}
$meta = implode( ',', $pointers );
update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $meta );
} | php | function _reset_pointer( $id = 'me' ) {
if ( $id === 'me' ) {
$id = get_current_user_id();
}
$pointers = explode( ',', get_user_meta( $id, 'dismissed_wp_pointers', true ) );
foreach ( $pointers as $key => $pointer ) {
if ( strpos( $pointer, $this->prefix ) === 0 ) {
unset( $pointers[ $key ] );
}
}
$meta = implode( ',', $pointers );
update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $meta );
} | [
"function",
"_reset_pointer",
"(",
"$",
"id",
"=",
"'me'",
")",
"{",
"if",
"(",
"$",
"id",
"===",
"'me'",
")",
"{",
"$",
"id",
"=",
"get_current_user_id",
"(",
")",
";",
"}",
"$",
"pointers",
"=",
"explode",
"(",
"','",
",",
"get_user_meta",
"(",
"... | Reset pointer in hook
@since 1.0.0 | [
"Reset",
"pointer",
"in",
"hook"
] | 04e251281a4e54629b469d74ed52a00278bc9252 | https://github.com/WPBP/PointerPlus/blob/04e251281a4e54629b469d74ed52a00278bc9252/pointerplus.php#L166-L179 | train |
nabu-3/core | nabu/data/project/base/CNabuProjectVersionLanguageBase.php | CNabuProjectVersionLanguageBase.setProjectVersionId | public function setProjectVersionId(int $nb_project_version_id) : CNabuDataObject
{
if ($nb_project_version_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_project_version_id")
);
}
$this->setValue('nb_project_version_id', $nb_project_version_id);
return $this;
} | php | public function setProjectVersionId(int $nb_project_version_id) : CNabuDataObject
{
if ($nb_project_version_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_project_version_id")
);
}
$this->setValue('nb_project_version_id', $nb_project_version_id);
return $this;
} | [
"public",
"function",
"setProjectVersionId",
"(",
"int",
"$",
"nb_project_version_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_project_version_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_N... | Sets the Project Version Id attribute value.
@param int $nb_project_version_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Project",
"Version",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/project/base/CNabuProjectVersionLanguageBase.php#L182-L193 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteRoleLanguageBase.php | CNabuSiteRoleLanguageBase.getSelectRegister | public function getSelectRegister()
{
return ($this->isValueNumeric('nb_site_id') && $this->isValueNumeric('nb_role_id') && $this->isValueNumeric('nb_language_id'))
? $this->buildSentence(
'select * '
. 'from nb_site_role_lang '
. "where nb_site_id=%nb_site_id\$d "
. "and nb_role_id=%nb_role_id\$d "
. "and nb_language_id=%nb_language_id\$d "
)
: null;
} | php | public function getSelectRegister()
{
return ($this->isValueNumeric('nb_site_id') && $this->isValueNumeric('nb_role_id') && $this->isValueNumeric('nb_language_id'))
? $this->buildSentence(
'select * '
. 'from nb_site_role_lang '
. "where nb_site_id=%nb_site_id\$d "
. "and nb_role_id=%nb_role_id\$d "
. "and nb_language_id=%nb_language_id\$d "
)
: null;
} | [
"public",
"function",
"getSelectRegister",
"(",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"isValueNumeric",
"(",
"'nb_site_id'",
")",
"&&",
"$",
"this",
"->",
"isValueNumeric",
"(",
"'nb_role_id'",
")",
"&&",
"$",
"this",
"->",
"isValueNumeric",
"(",
"'nb_... | Gets SELECT sentence to load a single register from the storage.
@return string Return the sentence. | [
"Gets",
"SELECT",
"sentence",
"to",
"load",
"a",
"single",
"register",
"from",
"the",
"storage",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteRoleLanguageBase.php#L99-L110 | train |
jstewmc/chunker | src/File.php | File.setName | public function setName($name)
{
if ( ! is_string($name)) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, name, to be a string"
);
}
if ( ! is_readable($name)) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, name, to be a readable filename"
);
}
$this->name = $name;
return $this;
} | php | public function setName($name)
{
if ( ! is_string($name)) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, name, to be a string"
);
}
if ( ! is_readable($name)) {
throw new \InvalidArgumentException(
__METHOD__."() expects parameter one, name, to be a readable filename"
);
}
$this->name = $name;
return $this;
} | [
"public",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"__METHOD__",
".",
"\"() expects parameter one, name, to be a string\"",
")",
";",
... | Sets the file's name
@param string $name the file's name
@return self
@throws InvalidArgumentException if $name is not a string
@throws InvalidArgumentException if $name is not a readable file name
@since 0.1.0 | [
"Sets",
"the",
"file",
"s",
"name"
] | 563b870bc73987b386728ff3d23fe41033fb143d | https://github.com/jstewmc/chunker/blob/563b870bc73987b386728ff3d23fe41033fb143d/src/File.php#L73-L90 | train |
jstewmc/chunker | src/File.php | File.getMaxChunks | public function getMaxChunks()
{
return ceil(($this->name !== null ? filesize($this->name) : 0) / $this->size);
} | php | public function getMaxChunks()
{
return ceil(($this->name !== null ? filesize($this->name) : 0) / $this->size);
} | [
"public",
"function",
"getMaxChunks",
"(",
")",
"{",
"return",
"ceil",
"(",
"(",
"$",
"this",
"->",
"name",
"!==",
"null",
"?",
"filesize",
"(",
"$",
"this",
"->",
"name",
")",
":",
"0",
")",
"/",
"$",
"this",
"->",
"size",
")",
";",
"}"
] | Returns the maximum number of chunks in the file
@return int
@throws BadMethodCallException if $name property is null
@since 0.1.0 | [
"Returns",
"the",
"maximum",
"number",
"of",
"chunks",
"in",
"the",
"file"
] | 563b870bc73987b386728ff3d23fe41033fb143d | https://github.com/jstewmc/chunker/blob/563b870bc73987b386728ff3d23fe41033fb143d/src/File.php#L130-L133 | train |
jstewmc/chunker | src/File.php | File.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"
);
}
if ($this->name !== null) {
// get the single-byte chunk...
// keep in mind, if file_get_contents() encounters an invalid offset, it
// will return false AND raise an E_WARNING; we don't want the
// E_WARNING, only the false
// also, make sure you floor the offset to 0; negative values will start
// that many bytes from the end of the file
//
$sbChunk = @file_get_contents(
$this->name,
false,
null,
max(0, $offset - self::MAX_SIZE_CHARACTER),
$this->size + self::MAX_SIZE_CHARACTER
);
if ($sbChunk !== false) {
$mbChunk = mb_strcut(
$sbChunk,
min(max(0, $offset), self::MAX_SIZE_CHARACTER),
$this->size,
$this->encoding
);
} else {
// otherwise, a chunk does not exist
$mbChunk = false;
}
} else {
// otherwise, name was empty
$mbChunk = false;
}
return $mbChunk;
} | 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"
);
}
if ($this->name !== null) {
// get the single-byte chunk...
// keep in mind, if file_get_contents() encounters an invalid offset, it
// will return false AND raise an E_WARNING; we don't want the
// E_WARNING, only the false
// also, make sure you floor the offset to 0; negative values will start
// that many bytes from the end of the file
//
$sbChunk = @file_get_contents(
$this->name,
false,
null,
max(0, $offset - self::MAX_SIZE_CHARACTER),
$this->size + self::MAX_SIZE_CHARACTER
);
if ($sbChunk !== false) {
$mbChunk = mb_strcut(
$sbChunk,
min(max(0, $offset), self::MAX_SIZE_CHARACTER),
$this->size,
$this->encoding
);
} else {
// otherwise, a chunk does not exist
$mbChunk = false;
}
} else {
// otherwise, name was empty
$mbChunk = false;
}
return $mbChunk;
} | [
"protected",
"function",
"getChunk",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"offset",
")",
"||",
"!",
"is_int",
"(",
"+",
"$",
"offset",
")",
"||",
"$",
"offset",
"<",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgu... | Returns a multi-byte-safe file chunk or false
The bad news is that there is no multi-byte file read function in PHP! The
good news is that even though PHP assumes each byte is a character (wrong!)
it doesn't make any changes.
When I chunk a string of multi-byte characters by byte instead of character,
obviously, it's possible that the current chunk will end in the middle of a
multi-byte character. If it does, the last character in the current chunk and
the first character in the next chunk will be malformed byte sequences (aka,
"?" characters).
For example (if the string has three four-byte characters, the chunk's offset
is 0, and the chunk's size is 10 bytes):
string: AAAABBBBCCCC
chunk: ----------
The chunk above would result in "AB?" because the chunk ends two-bytes into
the four-byte "C" character.
To prevent malformed byte sequences, I'll pad the chunk's offset and length by
the maximum number of bytes in a single character in any multi-byte encoding.
That way, no matter what the encoding is, the chunk is always padded with a
well-formed byte sequence.
For example (continued from above):
string: AAAABBBBCCCC
chunk: --------------
The chunk above would result in "ABC" because we've captured all four bytes
of the four-byte "C" character, which is great. But, we've only kicked the
can down the road. Our chunk could just as easily still end in two-bytes of a
four-byte character.
Enter PHP's mb_strcut() function. The mb_strcut() function will cut a string
of multi-byte characters based on an offset and length in bytes. If the cut
begins in the middle of a multi-byte character, mb_strcut() will move the
cut's offset to the left, and if the cut ends in the middle of a multi-byte
character, it'll shorten the cut's length to exclude the character.
For example (continued from above):
string: AAAABBBBCCCC
chunk: --------------
strcut: ------------
That's it! With the padding and the mb_strcut() function, we have a multi-byte
safe file_get_contents()!
@param int $offset the chunk's offset
@return string|false
@throws InvalidArgumentException if $offset is not an integer
@since 0.1.0 | [
"Returns",
"a",
"multi",
"-",
"byte",
"-",
"safe",
"file",
"chunk",
"or",
"false"
] | 563b870bc73987b386728ff3d23fe41033fb143d | https://github.com/jstewmc/chunker/blob/563b870bc73987b386728ff3d23fe41033fb143d/src/File.php#L195-L236 | train |
nabu-3/core | nabu/data/CNabuDataObjectListIndex.php | CNabuDataObjectListIndex.extractNodes | protected function extractNodes(CNabuDataObject $item)
{
$main_index_name = $this->list->getIndexedFieldName();
if (($item->isValueNumeric($main_index_name) || $item->isValueGUID($main_index_name)) &&
($item->isValueString($this->key_field) || $item->isValueNumeric($this->key_field))
) {
$key = $item->getValue($this->key_field);
$retval = array(
'key' => $key,
'pointer' => $item->getValue($main_index_name)
);
if ($item->isValueNumeric($this->order_field) || $item->isValueString($this->order_field)) {
$retval['order'] = $item->getValue($this->order_field);
}
$retval = array($key => $retval);
} else {
$retval = null;
}
return $retval;
} | php | protected function extractNodes(CNabuDataObject $item)
{
$main_index_name = $this->list->getIndexedFieldName();
if (($item->isValueNumeric($main_index_name) || $item->isValueGUID($main_index_name)) &&
($item->isValueString($this->key_field) || $item->isValueNumeric($this->key_field))
) {
$key = $item->getValue($this->key_field);
$retval = array(
'key' => $key,
'pointer' => $item->getValue($main_index_name)
);
if ($item->isValueNumeric($this->order_field) || $item->isValueString($this->order_field)) {
$retval['order'] = $item->getValue($this->order_field);
}
$retval = array($key => $retval);
} else {
$retval = null;
}
return $retval;
} | [
"protected",
"function",
"extractNodes",
"(",
"CNabuDataObject",
"$",
"item",
")",
"{",
"$",
"main_index_name",
"=",
"$",
"this",
"->",
"list",
"->",
"getIndexedFieldName",
"(",
")",
";",
"if",
"(",
"(",
"$",
"item",
"->",
"isValueNumeric",
"(",
"$",
"main... | Extract Nodes list for an item in this node.
This method can be overrided in child classes to change the extraction method of nodes.
@param CNabuDataObject $item Item of which will extract the nodes.
@return array Returns an array of found nodes or null when they are not available nodes. | [
"Extract",
"Nodes",
"list",
"for",
"an",
"item",
"in",
"this",
"node",
".",
"This",
"method",
"can",
"be",
"overrided",
"in",
"child",
"classes",
"to",
"change",
"the",
"extraction",
"method",
"of",
"nodes",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/CNabuDataObjectListIndex.php#L149-L169 | train |
nabu-3/core | nabu/data/CNabuDataObjectListIndex.php | CNabuDataObjectListIndex.addItem | public function addItem(CNabuDataObject $item)
{
if (is_array($nodes = $this->extractNodes($item)) && count($nodes) > 0) {
if ($this->index === null) {
$this->index = $nodes;
} else {
$this->index = array_merge($this->index, $nodes);
}
}
} | php | public function addItem(CNabuDataObject $item)
{
if (is_array($nodes = $this->extractNodes($item)) && count($nodes) > 0) {
if ($this->index === null) {
$this->index = $nodes;
} else {
$this->index = array_merge($this->index, $nodes);
}
}
} | [
"public",
"function",
"addItem",
"(",
"CNabuDataObject",
"$",
"item",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"nodes",
"=",
"$",
"this",
"->",
"extractNodes",
"(",
"$",
"item",
")",
")",
"&&",
"count",
"(",
"$",
"nodes",
")",
">",
"0",
")",
"{",... | Adds a new item to the index.
@param CNabuDataObject $item item to be added.
@return CNabuDataObject Returns the item added. | [
"Adds",
"a",
"new",
"item",
"to",
"the",
"index",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/CNabuDataObjectListIndex.php#L176-L185 | train |
nabu-3/core | nabu/data/project/CNabuProject.php | CNabuProject.getVersions | public function getVersions($force = false)
{
if ($this->nb_project_version_list === null) {
$this->nb_project_version_list = new CNabuProjectVersionList();
}
if ($this->nb_project_version_list->isEmpty() || $force) {
$this->nb_project_version_list->clear();
$this->nb_project_version_list->merge(CNabuProjectVersion::getAllProjectVersions($this));
}
return $this->nb_project_version_list;
} | php | public function getVersions($force = false)
{
if ($this->nb_project_version_list === null) {
$this->nb_project_version_list = new CNabuProjectVersionList();
}
if ($this->nb_project_version_list->isEmpty() || $force) {
$this->nb_project_version_list->clear();
$this->nb_project_version_list->merge(CNabuProjectVersion::getAllProjectVersions($this));
}
return $this->nb_project_version_list;
} | [
"public",
"function",
"getVersions",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"nb_project_version_list",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"nb_project_version_list",
"=",
"new",
"CNabuProjectVersionList",
"(",
")",
"... | Gets Versions assigned to the project.
@param bool $force If true, the Project Version list is refreshed from the database.
@return CNabuProjectVersionList Returns the list of Versions. If none Version exists, the list is empty. | [
"Gets",
"Versions",
"assigned",
"to",
"the",
"project",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/project/CNabuProject.php#L49-L61 | train |
nabu-3/core | nabu/data/icontact/base/CNabuIContactProspectDiaryBase.php | CNabuIContactProspectDiaryBase.setIcontactProspectId | public function setIcontactProspectId(int $nb_icontact_prospect_id) : CNabuDataObject
{
if ($nb_icontact_prospect_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_icontact_prospect_id")
);
}
$this->setValue('nb_icontact_prospect_id', $nb_icontact_prospect_id);
return $this;
} | php | public function setIcontactProspectId(int $nb_icontact_prospect_id) : CNabuDataObject
{
if ($nb_icontact_prospect_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_icontact_prospect_id")
);
}
$this->setValue('nb_icontact_prospect_id', $nb_icontact_prospect_id);
return $this;
} | [
"public",
"function",
"setIcontactProspectId",
"(",
"int",
"$",
"nb_icontact_prospect_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_icontact_prospect_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"E... | Sets the Icontact Prospect Id attribute value.
@param int $nb_icontact_prospect_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Icontact",
"Prospect",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/base/CNabuIContactProspectDiaryBase.php#L180-L191 | train |
rips/php-connector-bundle | Services/LicenseService.php | LicenseService.getAll | public function getAll(array $queryParams = [])
{
$response = $this->api->licenses()->getAll($queryParams);
return new LicensesResponse($response);
} | php | public function getAll(array $queryParams = [])
{
$response = $this->api->licenses()->getAll($queryParams);
return new LicensesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"licenses",
"(",
")",
"->",
"getAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"LicensesResponse... | Get all licenses
@param array $queryParams
@return LicensesResponse | [
"Get",
"all",
"licenses"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/LicenseService.php#L32-L37 | train |
rips/php-connector-bundle | Services/LicenseService.php | LicenseService.getById | public function getById($appId, array $queryParams = [])
{
$response = $this->api->licenses()->getById($appId, $queryParams);
return new LicenseResponse($response);
} | php | public function getById($appId, array $queryParams = [])
{
$response = $this->api->licenses()->getById($appId, $queryParams);
return new LicenseResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"licenses",
"(",
")",
"->",
"getById",
"(",
"$",
"appId",
",",
"$",
"queryParams",
... | Get license by id
@param int $appId
@param array $queryParams
@return LicenseResponse | [
"Get",
"license",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/LicenseService.php#L46-L51 | train |
php-xapi/model | src/StatementFactory.php | StatementFactory.createStatement | public function createStatement(): Statement
{
if (null === $this->actor) {
throw new InvalidStateException('A statement actor is missing.');
}
if (null === $this->verb) {
throw new InvalidStateException('A statement verb is missing.');
}
if (null === $this->object) {
throw new InvalidStateException('A statement object is missing.');
}
return new Statement($this->id, $this->actor, $this->verb, $this->object, $this->result, $this->authority, $this->created, $this->stored, $this->context);
} | php | public function createStatement(): Statement
{
if (null === $this->actor) {
throw new InvalidStateException('A statement actor is missing.');
}
if (null === $this->verb) {
throw new InvalidStateException('A statement verb is missing.');
}
if (null === $this->object) {
throw new InvalidStateException('A statement object is missing.');
}
return new Statement($this->id, $this->actor, $this->verb, $this->object, $this->result, $this->authority, $this->created, $this->stored, $this->context);
} | [
"public",
"function",
"createStatement",
"(",
")",
":",
"Statement",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"actor",
")",
"{",
"throw",
"new",
"InvalidStateException",
"(",
"'A statement actor is missing.'",
")",
";",
"}",
"if",
"(",
"null",
"==="... | Returns a statement based on the current configuration.
Multiple calls to this method will return different instances.
@throws InvalidStateException | [
"Returns",
"a",
"statement",
"based",
"on",
"the",
"current",
"configuration",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/StatementFactory.php#L85-L100 | train |
nabu-3/core | nabu/messaging/CNabuMessagingFactory.php | CNabuMessagingFactory.discoverServiceInterface | private function discoverServiceInterface(CNabuMessagingService $nb_service) : INabuMessagingServiceInterface
{
$retval = false;
$nb_engine = CNabuEngine::getEngine();
if (is_string($interface_name = $nb_service->getInterface())) {
if (is_array($this->nb_service_interface_list) &&
array_key_exists($interface_name, $this->nb_service_interface_list)
) {
$retval = $this->nb_service_interface_list[$interface_name];
} elseif (
is_string($provider_key = $nb_service->getProvider()) &&
count(list($vendor_key, $module_key) = preg_split("/:/", $provider_key)) === 2 &&
($nb_manager = $nb_engine->getProviderManager($vendor_key, $module_key)) instanceof INabuMessagingModule &&
($retval = $nb_manager->createServiceInterface($interface_name)) instanceof INabuMessagingServiceInterface
) {
if (is_array($this->nb_service_interface_list)) {
$this->nb_service_interface_list[$interface_name] = $retval;
} else {
$this->nb_service_interface_list = array($interface_name => $retval);
}
$retval->connect($nb_service);
} else {
throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_SERVICE_INSTANCE);
}
} else {
throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_SERVICE_CLASS_NAME);
}
return $retval;
} | php | private function discoverServiceInterface(CNabuMessagingService $nb_service) : INabuMessagingServiceInterface
{
$retval = false;
$nb_engine = CNabuEngine::getEngine();
if (is_string($interface_name = $nb_service->getInterface())) {
if (is_array($this->nb_service_interface_list) &&
array_key_exists($interface_name, $this->nb_service_interface_list)
) {
$retval = $this->nb_service_interface_list[$interface_name];
} elseif (
is_string($provider_key = $nb_service->getProvider()) &&
count(list($vendor_key, $module_key) = preg_split("/:/", $provider_key)) === 2 &&
($nb_manager = $nb_engine->getProviderManager($vendor_key, $module_key)) instanceof INabuMessagingModule &&
($retval = $nb_manager->createServiceInterface($interface_name)) instanceof INabuMessagingServiceInterface
) {
if (is_array($this->nb_service_interface_list)) {
$this->nb_service_interface_list[$interface_name] = $retval;
} else {
$this->nb_service_interface_list = array($interface_name => $retval);
}
$retval->connect($nb_service);
} else {
throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_SERVICE_INSTANCE);
}
} else {
throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_SERVICE_CLASS_NAME);
}
return $retval;
} | [
"private",
"function",
"discoverServiceInterface",
"(",
"CNabuMessagingService",
"$",
"nb_service",
")",
":",
"INabuMessagingServiceInterface",
"{",
"$",
"retval",
"=",
"false",
";",
"$",
"nb_engine",
"=",
"CNabuEngine",
"::",
"getEngine",
"(",
")",
";",
"if",
"("... | Discover the Service Interface.
@param CNabuMessagingService $nb_service A Messaging Service instance mapped to required Service Interface.
@return INabuMessagingServiceInterface If Service is mapped then returns a valid interface ready to use.
@throws ENabuMessagingException Raises an exception if the designated Service is not valid or applicable. | [
"Discover",
"the",
"Service",
"Interface",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/messaging/CNabuMessagingFactory.php#L68-L98 | train |
nabu-3/core | nabu/messaging/CNabuMessagingFactory.php | CNabuMessagingFactory.discoverTemplate | private function discoverTemplate($nb_template) : CNabuMessagingTemplate
{
if (!($nb_template instanceof CNabuMessagingTemplate)) {
if (is_numeric($nb_template_id = nb_getMixedValue($nb_template, NABU_MESSAGING_TEMPLATE_FIELD_ID))) {
$nb_template = $this->nb_messaging->getTemplate($nb_template_id);
} elseif (is_string($nb_template_id)) {
$nb_template = $this->nb_messaging->getTemplateByKey($nb_template_id);
}
}
if (!($nb_template instanceof CNabuMessagingTemplate)) {
throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_TEMPLATE);
} elseif ($nb_template->getMessagingId() !== $this->nb_messaging->getId()) {
throw new ENabuMessagingException(
ENabuMessagingException::ERROR_TEMPLATE_NOT_ALLOWED,
array($nb_template->getId())
);
}
return $nb_template;
} | php | private function discoverTemplate($nb_template) : CNabuMessagingTemplate
{
if (!($nb_template instanceof CNabuMessagingTemplate)) {
if (is_numeric($nb_template_id = nb_getMixedValue($nb_template, NABU_MESSAGING_TEMPLATE_FIELD_ID))) {
$nb_template = $this->nb_messaging->getTemplate($nb_template_id);
} elseif (is_string($nb_template_id)) {
$nb_template = $this->nb_messaging->getTemplateByKey($nb_template_id);
}
}
if (!($nb_template instanceof CNabuMessagingTemplate)) {
throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_TEMPLATE);
} elseif ($nb_template->getMessagingId() !== $this->nb_messaging->getId()) {
throw new ENabuMessagingException(
ENabuMessagingException::ERROR_TEMPLATE_NOT_ALLOWED,
array($nb_template->getId())
);
}
return $nb_template;
} | [
"private",
"function",
"discoverTemplate",
"(",
"$",
"nb_template",
")",
":",
"CNabuMessagingTemplate",
"{",
"if",
"(",
"!",
"(",
"$",
"nb_template",
"instanceof",
"CNabuMessagingTemplate",
")",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_template_id",
"=",... | Discover the Messaging Template instance beside a lazzy reference to it.
@param mixed $nb_template A Template instance, a CNabuDataObject containing a field named
nb_messaging_template_id or a valid Id.
@return CNabuMessagingTemplate Returns the Messaging Template instance discovered.
@throws ENabuMessagingException Raises an exception if the reference is not valid. | [
"Discover",
"the",
"Messaging",
"Template",
"instance",
"beside",
"a",
"lazzy",
"reference",
"to",
"it",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/messaging/CNabuMessagingFactory.php#L107-L127 | train |
nabu-3/core | nabu/messaging/CNabuMessagingFactory.php | CNabuMessagingFactory.discoverLanguage | private function discoverLanguage($nb_language) : CNabuLanguage
{
if (!($nb_language instanceof CNabuLanguage)) {
$nb_language = new CNabuLanguage(nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID));
}
if (!($nb_language instanceof CNabuLanguage) || $nb_language->isNew()) {
throw new ENabuCoreException(ENabuCoreException::ERROR_LANGUAGE_REQUIRED);
}
return $nb_language;
} | php | private function discoverLanguage($nb_language) : CNabuLanguage
{
if (!($nb_language instanceof CNabuLanguage)) {
$nb_language = new CNabuLanguage(nb_getMixedValue($nb_language, NABU_LANG_FIELD_ID));
}
if (!($nb_language instanceof CNabuLanguage) || $nb_language->isNew()) {
throw new ENabuCoreException(ENabuCoreException::ERROR_LANGUAGE_REQUIRED);
}
return $nb_language;
} | [
"private",
"function",
"discoverLanguage",
"(",
"$",
"nb_language",
")",
":",
"CNabuLanguage",
"{",
"if",
"(",
"!",
"(",
"$",
"nb_language",
"instanceof",
"CNabuLanguage",
")",
")",
"{",
"$",
"nb_language",
"=",
"new",
"CNabuLanguage",
"(",
"nb_getMixedValue",
... | Discover the Language instance beside a lazzy reference to it.
@param mixed $nb_language A Language instance, a CNabuDataObject containing a field named nb_language_id,
or a valid Id.
@return CNabuLanguage Returns the Language instance discovered.
@throws ENabuCoreException Raises an exception if the reference is not valid. | [
"Discover",
"the",
"Language",
"instance",
"beside",
"a",
"lazzy",
"reference",
"to",
"it",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/messaging/CNabuMessagingFactory.php#L136-L147 | train |
nabu-3/core | nabu/messaging/CNabuMessagingFactory.php | CNabuMessagingFactory.prepareMessageUsingTemplate | private function prepareMessageUsingTemplate(
CNabuMessagingTemplate $nb_template,
CNabuLanguage $nb_language,
array $params = null
) : array
{
$nb_engine = CNabuEngine::getEngine();
if (is_string($interface_name = $nb_template->getRenderInterface()) &&
is_string($provider_key = $nb_template->getRenderProvider()) &&
count(list($vendor_key, $module_key) = preg_split("/:/", $provider_key)) === 2 &&
($nb_manager = $nb_engine->getProviderManager($vendor_key, $module_key)) instanceof INabuMessagingModule &&
($nb_interface = $nb_manager->createTemplateRenderInterface($interface_name)) instanceof INabuMessagingTemplateRenderInterface
) {
$nb_interface->setTemplate($nb_template);
$nb_interface->setLanguage($nb_language);
$subject = $nb_interface->createSubject($params);
$body_html = $nb_interface->createBodyHTML($params);
$body_text = $nb_interface->createBodyText($params);
return array($subject, $body_html, $body_text);
} else {
throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_TEMPLATE_RENDER_INSTANCE);
}
} | php | private function prepareMessageUsingTemplate(
CNabuMessagingTemplate $nb_template,
CNabuLanguage $nb_language,
array $params = null
) : array
{
$nb_engine = CNabuEngine::getEngine();
if (is_string($interface_name = $nb_template->getRenderInterface()) &&
is_string($provider_key = $nb_template->getRenderProvider()) &&
count(list($vendor_key, $module_key) = preg_split("/:/", $provider_key)) === 2 &&
($nb_manager = $nb_engine->getProviderManager($vendor_key, $module_key)) instanceof INabuMessagingModule &&
($nb_interface = $nb_manager->createTemplateRenderInterface($interface_name)) instanceof INabuMessagingTemplateRenderInterface
) {
$nb_interface->setTemplate($nb_template);
$nb_interface->setLanguage($nb_language);
$subject = $nb_interface->createSubject($params);
$body_html = $nb_interface->createBodyHTML($params);
$body_text = $nb_interface->createBodyText($params);
return array($subject, $body_html, $body_text);
} else {
throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_TEMPLATE_RENDER_INSTANCE);
}
} | [
"private",
"function",
"prepareMessageUsingTemplate",
"(",
"CNabuMessagingTemplate",
"$",
"nb_template",
",",
"CNabuLanguage",
"$",
"nb_language",
",",
"array",
"$",
"params",
"=",
"null",
")",
":",
"array",
"{",
"$",
"nb_engine",
"=",
"CNabuEngine",
"::",
"getEng... | Prepares the subject and body of a message using a template.
@param CNabuMessagingTemplate $nb_template The Template instance to be used to render the message.
@param CNabuLanguage $nb_language The Language instance to get valid fields.
@param array|null $params An associative array with additional data for the template.
@return array Retuns an array of three cells, where the first is the subject, the second is the body in HTML
and the third the body as text.
@throws ENabuMessagingException Raises an exception if the designated template is not valid or applicable. | [
"Prepares",
"the",
"subject",
"and",
"body",
"of",
"a",
"message",
"using",
"a",
"template",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/messaging/CNabuMessagingFactory.php#L158-L182 | train |
nabu-3/core | nabu/messaging/CNabuMessagingFactory.php | CNabuMessagingFactory.postTemplateMessage | public function postTemplateMessage(
$nb_template,
$nb_language,
$to = null,
$cc = null,
$bcc = null,
array $params = null,
array $attachments = null
) : bool
{
$nb_template = $this->discoverTemplate($nb_template);
$nb_language = $this->discoverLanguage($nb_language);
list($subject, $body_html, $body_text) = $this->prepareMessageUsingTemplate($nb_template, $nb_language, $params);
return $this->postMessage($nb_template->getActiveServices(), $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments);
} | php | public function postTemplateMessage(
$nb_template,
$nb_language,
$to = null,
$cc = null,
$bcc = null,
array $params = null,
array $attachments = null
) : bool
{
$nb_template = $this->discoverTemplate($nb_template);
$nb_language = $this->discoverLanguage($nb_language);
list($subject, $body_html, $body_text) = $this->prepareMessageUsingTemplate($nb_template, $nb_language, $params);
return $this->postMessage($nb_template->getActiveServices(), $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments);
} | [
"public",
"function",
"postTemplateMessage",
"(",
"$",
"nb_template",
",",
"$",
"nb_language",
",",
"$",
"to",
"=",
"null",
",",
"$",
"cc",
"=",
"null",
",",
"$",
"bcc",
"=",
"null",
",",
"array",
"$",
"params",
"=",
"null",
",",
"array",
"$",
"attac... | Post a Message in the Messaging queue using a predefined template.
@param mixed $nb_template A Template instance, a child of CNabuDataObject containing a field named
nb_messaging_template_id or a valid Id.
@param mixed $nb_language A Language instance, a child of CNabuDataObject containing a field named
nb_language_id or a valid Id.
@param CNabuUser|CNabuUserList|string|array $to A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send TO.
@param CNabuUser|CNabuUserList|string|array $cc A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send in Carbon Copy.
@param CNabuUser|CNabuUserList|string|array $bcc A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send in Blind Carbon Copy.
@param array|null $params An associative array with additional data for the template.
@param array|null $attachments An array of attached files to send in the message.
@return bool Returns true if the message was posted.
@throws ENabuMessagingException Raises an exception if something is wrong. | [
"Post",
"a",
"Message",
"in",
"the",
"Messaging",
"queue",
"using",
"a",
"predefined",
"template",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/messaging/CNabuMessagingFactory.php#L201-L216 | train |
nabu-3/core | nabu/messaging/CNabuMessagingFactory.php | CNabuMessagingFactory.sendTemplateMessage | public function sendTemplateMessage(
$nb_template,
$to = null,
$cc = null,
$bcc = null,
array $params = null,
array $attachments = null
) : bool
{
$nb_template = $this->discoverTemplate($nb_template);
$nb_language = $this->discoverLanguage($nb_language);
list($subject, $body_html, $body_text) = $this->prepareMessageUsingTemplate($nb_template, $params);
return $this->sendMessage($nb_template->getServices(), $to, $bc, $bcc, $subject, $body_html, $body_text, $attachments);
} | php | public function sendTemplateMessage(
$nb_template,
$to = null,
$cc = null,
$bcc = null,
array $params = null,
array $attachments = null
) : bool
{
$nb_template = $this->discoverTemplate($nb_template);
$nb_language = $this->discoverLanguage($nb_language);
list($subject, $body_html, $body_text) = $this->prepareMessageUsingTemplate($nb_template, $params);
return $this->sendMessage($nb_template->getServices(), $to, $bc, $bcc, $subject, $body_html, $body_text, $attachments);
} | [
"public",
"function",
"sendTemplateMessage",
"(",
"$",
"nb_template",
",",
"$",
"to",
"=",
"null",
",",
"$",
"cc",
"=",
"null",
",",
"$",
"bcc",
"=",
"null",
",",
"array",
"$",
"params",
"=",
"null",
",",
"array",
"$",
"attachments",
"=",
"null",
")"... | Send a Message directly using a predefined template.
@param mixed $nb_template A Template instance, a child of CNabuDataObject containing a field named
nb_messaging_template_id or a valid Id.
@param CNabuUser|CNabuUserList|string|array $to A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send TO.
@param CNabuUser|CNabuUserList|string|array $cc A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send in Carbon Copy.
@param CNabuUser|CNabuUserList|string|array $bcc A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send in Blind Carbon Copy.
@param array|null $params An associative array with additional data for the template.
@param array|null $attachments An array of attached files to send in the message.
@return bool Returns true if the message was posted.
@throws ENabuMessagingException Raises an exception if something is wrong. | [
"Send",
"a",
"Message",
"directly",
"using",
"a",
"predefined",
"template",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/messaging/CNabuMessagingFactory.php#L233-L247 | train |
nabu-3/core | nabu/messaging/CNabuMessagingFactory.php | CNabuMessagingFactory.postMessage | public function postMessage(CNabuMessagingServiceList $nb_service_list, $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments) : bool
{
$retval = false;
$nb_service_list->iterate(
function($key, CNabuMessagingService $nb_service)
use (&$retval, $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments)
{
$nb_interface = $this->discoverServiceInterface($nb_service);
$nb_interface->post($to, $cc, $bcc, $subject, $body_html, $body_text, $attachments);
$retval |= true;
return true;
}
);
return $retval;
} | php | public function postMessage(CNabuMessagingServiceList $nb_service_list, $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments) : bool
{
$retval = false;
$nb_service_list->iterate(
function($key, CNabuMessagingService $nb_service)
use (&$retval, $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments)
{
$nb_interface = $this->discoverServiceInterface($nb_service);
$nb_interface->post($to, $cc, $bcc, $subject, $body_html, $body_text, $attachments);
$retval |= true;
return true;
}
);
return $retval;
} | [
"public",
"function",
"postMessage",
"(",
"CNabuMessagingServiceList",
"$",
"nb_service_list",
",",
"$",
"to",
",",
"$",
"cc",
",",
"$",
"bcc",
",",
"$",
"subject",
",",
"$",
"body_html",
",",
"$",
"body_text",
",",
"$",
"attachments",
")",
":",
"bool",
... | Post a Message in the Messaging queue.
@param CNabuMessagingServiceList $nb_service_list List of Services to be used to post the message.
@param CNabuUser|CNabuUserList|string|array $to A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send TO.
@param CNabuUser|CNabuUserList|string|array $cc A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send in Carbon Copy.
@param CNabuUser|CNabuUserList|string|array $bcc A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send in Blind Carbon Copy.
@param string $subject Subject of the message if any.
@param string $body_html Body of the message in HTML format.
@param string $body_text Body of the message in text format.
@param array $attachments An array of attached files to send in the message.
@return bool Returns true if the message was posted.
@throws ENabuMessagingException Raises an exception if something is wrong. | [
"Post",
"a",
"Message",
"in",
"the",
"Messaging",
"queue",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/messaging/CNabuMessagingFactory.php#L265-L282 | train |
nabu-3/core | nabu/messaging/CNabuMessagingFactory.php | CNabuMessagingFactory.sendMessage | public function sendMessage(CNabuMessagingServiceList $nb_service_list, $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments)
{
$retval = false;
$nb_service_list->iterate(
function($key, CNabuMessagingService $nb_service)
use (&$retval, $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments)
{
$nb_interface = $this->prepareServiceInterface($nb_service);
$nb_interface->send($to, $cc, $bcc, $subject, $body_html, $body_text, $attachments);
$retval |= true;
return true;
});
return $retval;
} | php | public function sendMessage(CNabuMessagingServiceList $nb_service_list, $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments)
{
$retval = false;
$nb_service_list->iterate(
function($key, CNabuMessagingService $nb_service)
use (&$retval, $to, $cc, $bcc, $subject, $body_html, $body_text, $attachments)
{
$nb_interface = $this->prepareServiceInterface($nb_service);
$nb_interface->send($to, $cc, $bcc, $subject, $body_html, $body_text, $attachments);
$retval |= true;
return true;
});
return $retval;
} | [
"public",
"function",
"sendMessage",
"(",
"CNabuMessagingServiceList",
"$",
"nb_service_list",
",",
"$",
"to",
",",
"$",
"cc",
",",
"$",
"bcc",
",",
"$",
"subject",
",",
"$",
"body_html",
",",
"$",
"body_text",
",",
"$",
"attachments",
")",
"{",
"$",
"re... | Send a Message directly.
@param CNabuMessagingServiceList $nb_service_list List of Services to be used to post the message.
@param CNabuUser|CNabuUserList|string|array $to A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send TO.
@param CNabuUser|CNabuUserList|string|array $cc A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send in Carbon Copy.
@param CNabuUser|CNabuUserList|string|array $bcc A User or User List instance, an inbox as string or an array
of strings each one an inbox, to send in Blind Carbon Copy.
@param string $subject Subject of the message if any.
@param string $body_html Body of the message in HTML format.
@param string $body_text Body of the message in text format.
@param array $attachments An array of attached files to send in the message.
@return bool Returns true if the message was sent.
@throws ENabuMessagingException Raises an exception if something is wrong. | [
"Send",
"a",
"Message",
"directly",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/messaging/CNabuMessagingFactory.php#L300-L316 | train |
rips/php-connector-bundle | Services/Application/Scan/LibraryService.php | LibraryService.getAll | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->libraries()
->getAll($appId, $scanId, $queryParams);
return new LibrariesResponse($response);
} | php | public function getAll($appId, $scanId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->libraries()
->getAll($appId, $scanId, $queryParams);
return new LibrariesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
"(",
")",
"->",
"librar... | Get all libraries for a scan
@param int $appId
@param int $scanId
@param array $queryParams
@return LibrariesResponse | [
"Get",
"all",
"libraries",
"for",
"a",
"scan"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/LibraryService.php#L36-L45 | train |
rips/php-connector-bundle | Services/Application/Scan/LibraryService.php | LibraryService.getById | public function getById($appId, $scanId, $libraryId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->libraries()
->getById($appId, $scanId, $libraryId, $queryParams);
return new LibraryResponse($response);
} | php | public function getById($appId, $scanId, $libraryId, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->libraries()
->getById($appId, $scanId, $libraryId, $queryParams);
return new LibraryResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"libraryId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"scans",
... | Get library for scan by id
@param int $appId
@param int $scanId
@param int $libraryId
@param array $queryParams
@return LibraryResponse | [
"Get",
"library",
"for",
"scan",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/LibraryService.php#L56-L65 | train |
rips/php-connector-bundle | Services/Application/Scan/LibraryService.php | LibraryService.update | public function update($appId, $scanId, $libraryId, $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->libraries()
->update($appId, $scanId, $libraryId, $input->toArray(), $queryParams);
return new LibraryResponse($response);
} | php | public function update($appId, $scanId, $libraryId, $input, array $queryParams = [])
{
$response = $this->api
->applications()
->scans()
->libraries()
->update($appId, $scanId, $libraryId, $input->toArray(), $queryParams);
return new LibraryResponse($response);
} | [
"public",
"function",
"update",
"(",
"$",
"appId",
",",
"$",
"scanId",
",",
"$",
"libraryId",
",",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
"... | Update a library for a service
@param int $appId
@param int $scanId
@param int $libraryId
@param LibraryBuilder $input
@param array $queryParams
@return LibraryResponse | [
"Update",
"a",
"library",
"for",
"a",
"service"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Scan/LibraryService.php#L97-L106 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/Core/Api/ApiRouteCompiler.php | ApiRouteCompiler.compile | public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, array $extensions, $extra = null)
{
$this->stub = $stub;
$this->replaceResource($modelName);
return $this->stub;
} | php | public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, array $extensions, $extra = null)
{
$this->stub = $stub;
$this->replaceResource($modelName);
return $this->stub;
} | [
"public",
"function",
"compile",
"(",
"$",
"stub",
",",
"$",
"modelName",
",",
"$",
"modelData",
",",
"stdClass",
"$",
"scaffolderConfig",
",",
"$",
"hash",
",",
"array",
"$",
"extensions",
",",
"$",
"extra",
"=",
"null",
")",
"{",
"$",
"this",
"->",
... | Compiles a route.
@param $stub
@param $modelName
@param $modelData
@param \stdClass $scaffolderConfig
@param $hash
@param \Scaffolder\Support\Contracts\ScaffolderExtensionInterface[] $extensions
@param null $extra
@return string | [
"Compiles",
"a",
"route",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/Core/Api/ApiRouteCompiler.php#L25-L32 | train |
mpaleo/scaffolder | src/Scaffolder/Compilers/Core/ControllerCompiler.php | ControllerCompiler.setValidations | protected function setValidations($modelData)
{
$fields = '';
$firstIteration = true;
foreach ($modelData->fields as $field)
{
if ($firstIteration)
{
$fields .= sprintf("'%s' => '%s'," . PHP_EOL, $field->name, $field->validations);
$firstIteration = false;
}
else
{
$fields .= sprintf($this->tab(3) . "'%s' => '%s'," . PHP_EOL, $field->name, $field->validations);
}
}
$this->stub = str_replace('{{validations}}', $fields, $this->stub);
return $this;
} | php | protected function setValidations($modelData)
{
$fields = '';
$firstIteration = true;
foreach ($modelData->fields as $field)
{
if ($firstIteration)
{
$fields .= sprintf("'%s' => '%s'," . PHP_EOL, $field->name, $field->validations);
$firstIteration = false;
}
else
{
$fields .= sprintf($this->tab(3) . "'%s' => '%s'," . PHP_EOL, $field->name, $field->validations);
}
}
$this->stub = str_replace('{{validations}}', $fields, $this->stub);
return $this;
} | [
"protected",
"function",
"setValidations",
"(",
"$",
"modelData",
")",
"{",
"$",
"fields",
"=",
"''",
";",
"$",
"firstIteration",
"=",
"true",
";",
"foreach",
"(",
"$",
"modelData",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"firstIt... | Set validations.
@param $modelData
@return $this | [
"Set",
"validations",
"."
] | c68062dc1d71784b93e5ef77a8abd283b716633f | https://github.com/mpaleo/scaffolder/blob/c68062dc1d71784b93e5ef77a8abd283b716633f/src/Scaffolder/Compilers/Core/ControllerCompiler.php#L85-L106 | train |
rips/php-connector-bundle | Hydrators/Application/Profile/ControllerHydrator.php | ControllerHydrator.hydrateCollection | public static function hydrateCollection(array $controllers)
{
$hydrated = [];
foreach ($controllers as $controller) {
$hydrated[] = self::hydrate($controller);
}
return $hydrated;
} | php | public static function hydrateCollection(array $controllers)
{
$hydrated = [];
foreach ($controllers as $controller) {
$hydrated[] = self::hydrate($controller);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrateCollection",
"(",
"array",
"$",
"controllers",
")",
"{",
"$",
"hydrated",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"controllers",
"as",
"$",
"controller",
")",
"{",
"$",
"hydrated",
"[",
"]",
"=",
"self",
"::",
"... | Hydrate a collection of controller objects into a collection of
ControllerEntity objects
@param stdClass[] $controllers
@return ControllerEntity[] | [
"Hydrate",
"a",
"collection",
"of",
"controller",
"objects",
"into",
"a",
"collection",
"of",
"ControllerEntity",
"objects"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Profile/ControllerHydrator.php#L17-L26 | train |
rips/php-connector-bundle | Hydrators/Application/Profile/ControllerHydrator.php | ControllerHydrator.hydrate | public static function hydrate(stdClass $controller)
{
$hydrated = new ControllerEntity();
if (isset($controller->id)) {
$hydrated->setId($controller->id);
}
if (isset($controller->class)) {
$hydrated->setClass($controller->class);
}
if (isset($controller->method)) {
$hydrated->setMethod($controller->method);
}
if (isset($controller->parameter)) {
$hydrated->setParameter($controller->parameter);
}
if (isset($controller->type)) {
$hydrated->setType($controller->type);
}
return $hydrated;
} | php | public static function hydrate(stdClass $controller)
{
$hydrated = new ControllerEntity();
if (isset($controller->id)) {
$hydrated->setId($controller->id);
}
if (isset($controller->class)) {
$hydrated->setClass($controller->class);
}
if (isset($controller->method)) {
$hydrated->setMethod($controller->method);
}
if (isset($controller->parameter)) {
$hydrated->setParameter($controller->parameter);
}
if (isset($controller->type)) {
$hydrated->setType($controller->type);
}
return $hydrated;
} | [
"public",
"static",
"function",
"hydrate",
"(",
"stdClass",
"$",
"controller",
")",
"{",
"$",
"hydrated",
"=",
"new",
"ControllerEntity",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"controller",
"->",
"id",
")",
")",
"{",
"$",
"hydrated",
"->",
"setI... | Hydrate a controller object into a SourceEntity object
@param stdClass $controller
@return ControllerEntity | [
"Hydrate",
"a",
"controller",
"object",
"into",
"a",
"SourceEntity",
"object"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Hydrators/Application/Profile/ControllerHydrator.php#L34-L59 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteMapBase.php | CNabuSiteMapBase.getAllSiteMaps | public static function getAllSiteMaps(CNabuSite $nb_site)
{
$nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
if (is_numeric($nb_site_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_site_map_id',
'select * '
. 'from nb_site_map '
. 'where nb_site_id=%site_id$d',
array(
'site_id' => $nb_site_id
),
$nb_site
);
} else {
$retval = new CNabuSiteMapList();
}
return $retval;
} | php | public static function getAllSiteMaps(CNabuSite $nb_site)
{
$nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
if (is_numeric($nb_site_id)) {
$retval = forward_static_call(
array(get_called_class(), 'buildObjectListFromSQL'),
'nb_site_map_id',
'select * '
. 'from nb_site_map '
. 'where nb_site_id=%site_id$d',
array(
'site_id' => $nb_site_id
),
$nb_site
);
} else {
$retval = new CNabuSiteMapList();
}
return $retval;
} | [
"public",
"static",
"function",
"getAllSiteMaps",
"(",
"CNabuSite",
"$",
"nb_site",
")",
"{",
"$",
"nb_site_id",
"=",
"nb_getMixedValue",
"(",
"$",
"nb_site",
",",
"'nb_site_id'",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"nb_site_id",
")",
")",
"{",
"$... | Get all items in the storage as an associative array where the field 'nb_site_map_id' is the index, and each
value is an instance of class CNabuSiteMapBase.
@param CNabuSite $nb_site The CNabuSite instance of the Site that owns the Site Map List.
@return mixed Returns and array with all items. | [
"Get",
"all",
"items",
"in",
"the",
"storage",
"as",
"an",
"associative",
"array",
"where",
"the",
"field",
"nb_site_map_id",
"is",
"the",
"index",
"and",
"each",
"value",
"is",
"an",
"instance",
"of",
"class",
"CNabuSiteMapBase",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteMapBase.php#L180-L200 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteMapBase.php | CNabuSiteMapBase.getFilteredSiteMapList | public static function getFilteredSiteMapList($nb_site, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_site_id = nb_getMixedValue($nb_customer, NABU_SITE_FIELD_ID);
if (is_numeric($nb_site_id)) {
$fields_part = nb_prefixFieldList(CNabuSiteMapBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuSiteMapBase::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_map '
. 'where ' . NABU_SITE_FIELD_ID . '=%site_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'site_id' => $nb_site_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | php | public static function getFilteredSiteMapList($nb_site, $q = null, $fields = null, $order = null, $offset = 0, $num_items = 0)
{
$nb_site_id = nb_getMixedValue($nb_customer, NABU_SITE_FIELD_ID);
if (is_numeric($nb_site_id)) {
$fields_part = nb_prefixFieldList(CNabuSiteMapBase::getStorageName(), $fields, false, true, '`');
$order_part = nb_prefixFieldList(CNabuSiteMapBase::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_map '
. 'where ' . NABU_SITE_FIELD_ID . '=%site_id$d '
. ($order_part ? "order by $order_part " : '')
. ($limit_part ? "limit $limit_part" : ''),
array(
'site_id' => $nb_site_id
)
);
} else {
$nb_item_list = null;
}
return $nb_item_list;
} | [
"public",
"static",
"function",
"getFilteredSiteMapList",
"(",
"$",
"nb_site",
",",
"$",
"q",
"=",
"null",
",",
"$",
"fields",
"=",
"null",
",",
"$",
"order",
"=",
"null",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"num_items",
"=",
"0",
")",
"{",
"$"... | Gets a filtered list of Site Map 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_site Site instance, object containing a Site 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",
"Map",
"instances",
"represented",
"as",
"an",
"array",
".",
"Params",
"allows",
"the",
"capability",
"of",
"select",
"a",
"subset",
"of",
"fields",
"order",
"by",
"concrete",
"fields",
"or",
"truncate",
"the",
... | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteMapBase.php#L215-L243 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteMapBase.php | CNabuSiteMapBase.setCustomerRequired | public function setCustomerRequired(string $customer_required = "B") : CNabuDataObject
{
if ($customer_required === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$customer_required")
);
}
$this->setValue('nb_site_map_customer_required', $customer_required);
return $this;
} | php | public function setCustomerRequired(string $customer_required = "B") : CNabuDataObject
{
if ($customer_required === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$customer_required")
);
}
$this->setValue('nb_site_map_customer_required', $customer_required);
return $this;
} | [
"public",
"function",
"setCustomerRequired",
"(",
"string",
"$",
"customer_required",
"=",
"\"B\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"customer_required",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::... | Sets the Site Map Customer Required attribute value.
@param string $customer_required New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Map",
"Customer",
"Required",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteMapBase.php#L455-L466 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteMapBase.php | CNabuSiteMapBase.setLevel | public function setLevel(int $level = 1) : CNabuDataObject
{
if ($level === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$level")
);
}
$this->setValue('nb_site_map_level', $level);
return $this;
} | php | public function setLevel(int $level = 1) : CNabuDataObject
{
if ($level === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$level")
);
}
$this->setValue('nb_site_map_level', $level);
return $this;
} | [
"public",
"function",
"setLevel",
"(",
"int",
"$",
"level",
"=",
"1",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"level",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWED_IN",
... | Sets the Site Map Level attribute value.
@param int $level New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Map",
"Level",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteMapBase.php#L482-L493 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteMapBase.php | CNabuSiteMapBase.setUseURI | public function setUseURI(string $use_uri = "N") : CNabuDataObject
{
if ($use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_uri")
);
}
$this->setValue('nb_site_map_use_uri', $use_uri);
return $this;
} | php | public function setUseURI(string $use_uri = "N") : CNabuDataObject
{
if ($use_uri === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$use_uri")
);
}
$this->setValue('nb_site_map_use_uri', $use_uri);
return $this;
} | [
"public",
"function",
"setUseURI",
"(",
"string",
"$",
"use_uri",
"=",
"\"N\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"use_uri",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALL... | Sets the Site Map Use URI attribute value.
@param string $use_uri New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Map",
"Use",
"URI",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteMapBase.php#L551-L562 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteMapBase.php | CNabuSiteMapBase.setOpenPopup | public function setOpenPopup(string $open_popup = "F") : CNabuDataObject
{
if ($open_popup === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$open_popup")
);
}
$this->setValue('nb_site_map_open_popup', $open_popup);
return $this;
} | php | public function setOpenPopup(string $open_popup = "F") : CNabuDataObject
{
if ($open_popup === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$open_popup")
);
}
$this->setValue('nb_site_map_open_popup', $open_popup);
return $this;
} | [
"public",
"function",
"setOpenPopup",
"(",
"string",
"$",
"open_popup",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"open_popup",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALU... | Sets the Site Map Open Popup attribute value.
@param string $open_popup New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Map",
"Open",
"Popup",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteMapBase.php#L578-L589 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteMapBase.php | CNabuSiteMapBase.setVisible | public function setVisible(string $visible = "T") : CNabuDataObject
{
if ($visible === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$visible")
);
}
$this->setValue('nb_site_map_visible', $visible);
return $this;
} | php | public function setVisible(string $visible = "T") : CNabuDataObject
{
if ($visible === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$visible")
);
}
$this->setValue('nb_site_map_visible', $visible);
return $this;
} | [
"public",
"function",
"setVisible",
"(",
"string",
"$",
"visible",
"=",
"\"T\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"visible",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_AL... | Sets the Site Map Visible attribute value.
@param string $visible New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Map",
"Visible",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteMapBase.php#L626-L637 | train |
nabu-3/core | nabu/data/site/base/CNabuSiteMapBase.php | CNabuSiteMapBase.setSeparator | public function setSeparator(string $separator = "F") : CNabuDataObject
{
if ($separator === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$separator")
);
}
$this->setValue('nb_site_map_separator', $separator);
return $this;
} | php | public function setSeparator(string $separator = "F") : CNabuDataObject
{
if ($separator === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$separator")
);
}
$this->setValue('nb_site_map_separator', $separator);
return $this;
} | [
"public",
"function",
"setSeparator",
"(",
"string",
"$",
"separator",
"=",
"\"F\"",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"separator",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_... | Sets the Site Map Separator attribute value.
@param string $separator New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Site",
"Map",
"Separator",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/site/base/CNabuSiteMapBase.php#L653-L664 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.