id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
31,800 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.RestorePagingInfoFromSession | public function RestorePagingInfoFromSession($iStartRecord, $iPageSize)
{
$identKey = $this->GetListIdentKey();
$aTmpData = TdbShopArticleList::GetInstanceDataFromSession($identKey);
$bPagingWasRestoredFromSession = false;
if (!is_null($aTmpData)) {
$bPagingWasRestoredFromSession = $this->SetPagingInfo($aTmpData['iStartRecord'], $aTmpData['iPageSize']);
}
if (false === $bPagingWasRestoredFromSession) {
// use default... BUT if there is a post request for this list (ie list key given) and a page
// is transfered, we use it
$oGlobal = TGlobal::instance();
$sRequestKey = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME);
if ($sRequestKey == $identKey) {
$iRequestStartPage = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_CURRENT_PAGE);
$iRequestStartPage = intval($iRequestStartPage);
if ($iRequestStartPage > 0) {
$iStartRecord = $iPageSize * ($iRequestStartPage - 1);
}
$this->SetPagingInfo($iStartRecord, $iPageSize);
$sRequest = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_REQUEST);
$this->HandleURLRequest($sRequest);
} else {
if (false === $this->SetPagingInfo($iStartRecord, $iPageSize)) {
$this->SetPagingInfo(0, $iPageSize);
}
}
}
} | php | public function RestorePagingInfoFromSession($iStartRecord, $iPageSize)
{
$identKey = $this->GetListIdentKey();
$aTmpData = TdbShopArticleList::GetInstanceDataFromSession($identKey);
$bPagingWasRestoredFromSession = false;
if (!is_null($aTmpData)) {
$bPagingWasRestoredFromSession = $this->SetPagingInfo($aTmpData['iStartRecord'], $aTmpData['iPageSize']);
}
if (false === $bPagingWasRestoredFromSession) {
// use default... BUT if there is a post request for this list (ie list key given) and a page
// is transfered, we use it
$oGlobal = TGlobal::instance();
$sRequestKey = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME);
if ($sRequestKey == $identKey) {
$iRequestStartPage = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_CURRENT_PAGE);
$iRequestStartPage = intval($iRequestStartPage);
if ($iRequestStartPage > 0) {
$iStartRecord = $iPageSize * ($iRequestStartPage - 1);
}
$this->SetPagingInfo($iStartRecord, $iPageSize);
$sRequest = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_REQUEST);
$this->HandleURLRequest($sRequest);
} else {
if (false === $this->SetPagingInfo($iStartRecord, $iPageSize)) {
$this->SetPagingInfo(0, $iPageSize);
}
}
}
} | [
"public",
"function",
"RestorePagingInfoFromSession",
"(",
"$",
"iStartRecord",
",",
"$",
"iPageSize",
")",
"{",
"$",
"identKey",
"=",
"$",
"this",
"->",
"GetListIdentKey",
"(",
")",
";",
"$",
"aTmpData",
"=",
"TdbShopArticleList",
"::",
"GetInstanceDataFromSession",
"(",
"$",
"identKey",
")",
";",
"$",
"bPagingWasRestoredFromSession",
"=",
"false",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"aTmpData",
")",
")",
"{",
"$",
"bPagingWasRestoredFromSession",
"=",
"$",
"this",
"->",
"SetPagingInfo",
"(",
"$",
"aTmpData",
"[",
"'iStartRecord'",
"]",
",",
"$",
"aTmpData",
"[",
"'iPageSize'",
"]",
")",
";",
"}",
"if",
"(",
"false",
"===",
"$",
"bPagingWasRestoredFromSession",
")",
"{",
"// use default... BUT if there is a post request for this list (ie list key given) and a page",
"// is transfered, we use it",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"sRequestKey",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"TdbShopArticleList",
"::",
"URL_LIST_KEY_NAME",
")",
";",
"if",
"(",
"$",
"sRequestKey",
"==",
"$",
"identKey",
")",
"{",
"$",
"iRequestStartPage",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"TdbShopArticleList",
"::",
"URL_LIST_CURRENT_PAGE",
")",
";",
"$",
"iRequestStartPage",
"=",
"intval",
"(",
"$",
"iRequestStartPage",
")",
";",
"if",
"(",
"$",
"iRequestStartPage",
">",
"0",
")",
"{",
"$",
"iStartRecord",
"=",
"$",
"iPageSize",
"*",
"(",
"$",
"iRequestStartPage",
"-",
"1",
")",
";",
"}",
"$",
"this",
"->",
"SetPagingInfo",
"(",
"$",
"iStartRecord",
",",
"$",
"iPageSize",
")",
";",
"$",
"sRequest",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"TdbShopArticleList",
"::",
"URL_LIST_REQUEST",
")",
";",
"$",
"this",
"->",
"HandleURLRequest",
"(",
"$",
"sRequest",
")",
";",
"}",
"else",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"SetPagingInfo",
"(",
"$",
"iStartRecord",
",",
"$",
"iPageSize",
")",
")",
"{",
"$",
"this",
"->",
"SetPagingInfo",
"(",
"0",
",",
"$",
"iPageSize",
")",
";",
"}",
"}",
"}",
"}"
] | set the paging info from session.. if no value is set in session, use the passed values.
@param int $iStartRecord
@param int $iPageSize | [
"set",
"the",
"paging",
"info",
"from",
"session",
"..",
"if",
"no",
"value",
"is",
"set",
"in",
"session",
"use",
"the",
"passed",
"values",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L364-L392 |
31,801 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.GetNextPageLink | public function GetNextPageLink()
{
$sLink = false;
if ($this->HasNextPage()) {
$oGlobal = TGlobal::instance();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
$aAdditionalParameters = array('module_fnc['.$oExecutingModule->sModuleSpotName.']' => 'ChangePage', TdbShopArticleList::URL_LIST_KEY_NAME => $this->GetListIdentKey(), TdbShopArticleList::URL_LIST_REQUEST => 'NextPage', TdbShopArticleList::URL_LIST_CURRENT_PAGE => $this->GetCurrentPageNumber());
$sLink = $this->getActivePageService()->getLinkToActivePageRelative($aAdditionalParameters, TdbShopArticleList::GetParametersToIgnoreInPageLinks());
}
return $sLink;
} | php | public function GetNextPageLink()
{
$sLink = false;
if ($this->HasNextPage()) {
$oGlobal = TGlobal::instance();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
$aAdditionalParameters = array('module_fnc['.$oExecutingModule->sModuleSpotName.']' => 'ChangePage', TdbShopArticleList::URL_LIST_KEY_NAME => $this->GetListIdentKey(), TdbShopArticleList::URL_LIST_REQUEST => 'NextPage', TdbShopArticleList::URL_LIST_CURRENT_PAGE => $this->GetCurrentPageNumber());
$sLink = $this->getActivePageService()->getLinkToActivePageRelative($aAdditionalParameters, TdbShopArticleList::GetParametersToIgnoreInPageLinks());
}
return $sLink;
} | [
"public",
"function",
"GetNextPageLink",
"(",
")",
"{",
"$",
"sLink",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"HasNextPage",
"(",
")",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"oExecutingModule",
"=",
"&",
"$",
"oGlobal",
"->",
"GetExecutingModulePointer",
"(",
")",
";",
"$",
"aAdditionalParameters",
"=",
"array",
"(",
"'module_fnc['",
".",
"$",
"oExecutingModule",
"->",
"sModuleSpotName",
".",
"']'",
"=>",
"'ChangePage'",
",",
"TdbShopArticleList",
"::",
"URL_LIST_KEY_NAME",
"=>",
"$",
"this",
"->",
"GetListIdentKey",
"(",
")",
",",
"TdbShopArticleList",
"::",
"URL_LIST_REQUEST",
"=>",
"'NextPage'",
",",
"TdbShopArticleList",
"::",
"URL_LIST_CURRENT_PAGE",
"=>",
"$",
"this",
"->",
"GetCurrentPageNumber",
"(",
")",
")",
";",
"$",
"sLink",
"=",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getLinkToActivePageRelative",
"(",
"$",
"aAdditionalParameters",
",",
"TdbShopArticleList",
"::",
"GetParametersToIgnoreInPageLinks",
"(",
")",
")",
";",
"}",
"return",
"$",
"sLink",
";",
"}"
] | return link to next page, or false if there is no next page.
@return string | [
"return",
"link",
"to",
"next",
"page",
"or",
"false",
"if",
"there",
"is",
"no",
"next",
"page",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L399-L410 |
31,802 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.GetNextPageLinkAsAJAXCall | public function GetNextPageLinkAsAJAXCall($bGetAsJSFunction = true)
{
$sLink = false;
if ($this->HasNextPage()) {
$oGlobal = TGlobal::instance();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
$aAdditionalParameters = array('module_fnc['.$oExecutingModule->sModuleSpotName.']' => 'ExecuteAjaxCall', '_fnc' => 'ChangePageAjax', TdbShopArticleList::URL_LIST_KEY_NAME => $this->GetListIdentKey(), TdbShopArticleList::URL_LIST_REQUEST => 'NextPage',
);
$sLink = $this->getActivePageService()->getLinkToActivePageRelative($aAdditionalParameters, TdbShopArticleList::GetParametersToIgnoreInPageLinks());
if ($bGetAsJSFunction) {
$sLink = "GetAjaxCall('{$sLink}', ShowListItems)";
}
}
return $sLink;
} | php | public function GetNextPageLinkAsAJAXCall($bGetAsJSFunction = true)
{
$sLink = false;
if ($this->HasNextPage()) {
$oGlobal = TGlobal::instance();
$oExecutingModule = &$oGlobal->GetExecutingModulePointer();
$aAdditionalParameters = array('module_fnc['.$oExecutingModule->sModuleSpotName.']' => 'ExecuteAjaxCall', '_fnc' => 'ChangePageAjax', TdbShopArticleList::URL_LIST_KEY_NAME => $this->GetListIdentKey(), TdbShopArticleList::URL_LIST_REQUEST => 'NextPage',
);
$sLink = $this->getActivePageService()->getLinkToActivePageRelative($aAdditionalParameters, TdbShopArticleList::GetParametersToIgnoreInPageLinks());
if ($bGetAsJSFunction) {
$sLink = "GetAjaxCall('{$sLink}', ShowListItems)";
}
}
return $sLink;
} | [
"public",
"function",
"GetNextPageLinkAsAJAXCall",
"(",
"$",
"bGetAsJSFunction",
"=",
"true",
")",
"{",
"$",
"sLink",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"HasNextPage",
"(",
")",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"oExecutingModule",
"=",
"&",
"$",
"oGlobal",
"->",
"GetExecutingModulePointer",
"(",
")",
";",
"$",
"aAdditionalParameters",
"=",
"array",
"(",
"'module_fnc['",
".",
"$",
"oExecutingModule",
"->",
"sModuleSpotName",
".",
"']'",
"=>",
"'ExecuteAjaxCall'",
",",
"'_fnc'",
"=>",
"'ChangePageAjax'",
",",
"TdbShopArticleList",
"::",
"URL_LIST_KEY_NAME",
"=>",
"$",
"this",
"->",
"GetListIdentKey",
"(",
")",
",",
"TdbShopArticleList",
"::",
"URL_LIST_REQUEST",
"=>",
"'NextPage'",
",",
")",
";",
"$",
"sLink",
"=",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getLinkToActivePageRelative",
"(",
"$",
"aAdditionalParameters",
",",
"TdbShopArticleList",
"::",
"GetParametersToIgnoreInPageLinks",
"(",
")",
")",
";",
"if",
"(",
"$",
"bGetAsJSFunction",
")",
"{",
"$",
"sLink",
"=",
"\"GetAjaxCall('{$sLink}', ShowListItems)\"",
";",
"}",
"}",
"return",
"$",
"sLink",
";",
"}"
] | returns the javascript call to fetch the items for the next page.
@param bool $bGetAsJSFunction - set to false if you just want the link
@return string | [
"returns",
"the",
"javascript",
"call",
"to",
"fetch",
"the",
"items",
"for",
"the",
"next",
"page",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L419-L434 |
31,803 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleList.class.php | TShopArticleList.HandleURLRequest | public function HandleURLRequest($sRequest, $bCheckIdentKey = false)
{
$bAllowRequest = true;
if ($bCheckIdentKey) {
$currentListKey = $this->GetListIdentKey();
$oGlobal = TGlobal::instance();
$callingIdentKey = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME);
if ($callingIdentKey != $currentListKey) {
$bAllowRequest = false;
}
}
if ($bAllowRequest) {
switch ($sRequest) {
case 'NextPage':
$this->SetPagingInfoNextPage();
break;
case 'PreviousPage':
$this->SetPagingInfoPreviousPage();
break;
case 'GoToPage':
$oGlobal = TGlobal::instance();
$iRequestStartPage = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_CURRENT_PAGE);
$this->JumpToPage($iRequestStartPage);
break;
default:
break;
}
}
$this->StoreListObjectInSession();
} | php | public function HandleURLRequest($sRequest, $bCheckIdentKey = false)
{
$bAllowRequest = true;
if ($bCheckIdentKey) {
$currentListKey = $this->GetListIdentKey();
$oGlobal = TGlobal::instance();
$callingIdentKey = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_KEY_NAME);
if ($callingIdentKey != $currentListKey) {
$bAllowRequest = false;
}
}
if ($bAllowRequest) {
switch ($sRequest) {
case 'NextPage':
$this->SetPagingInfoNextPage();
break;
case 'PreviousPage':
$this->SetPagingInfoPreviousPage();
break;
case 'GoToPage':
$oGlobal = TGlobal::instance();
$iRequestStartPage = $oGlobal->GetUserData(TdbShopArticleList::URL_LIST_CURRENT_PAGE);
$this->JumpToPage($iRequestStartPage);
break;
default:
break;
}
}
$this->StoreListObjectInSession();
} | [
"public",
"function",
"HandleURLRequest",
"(",
"$",
"sRequest",
",",
"$",
"bCheckIdentKey",
"=",
"false",
")",
"{",
"$",
"bAllowRequest",
"=",
"true",
";",
"if",
"(",
"$",
"bCheckIdentKey",
")",
"{",
"$",
"currentListKey",
"=",
"$",
"this",
"->",
"GetListIdentKey",
"(",
")",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"callingIdentKey",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"TdbShopArticleList",
"::",
"URL_LIST_KEY_NAME",
")",
";",
"if",
"(",
"$",
"callingIdentKey",
"!=",
"$",
"currentListKey",
")",
"{",
"$",
"bAllowRequest",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"$",
"bAllowRequest",
")",
"{",
"switch",
"(",
"$",
"sRequest",
")",
"{",
"case",
"'NextPage'",
":",
"$",
"this",
"->",
"SetPagingInfoNextPage",
"(",
")",
";",
"break",
";",
"case",
"'PreviousPage'",
":",
"$",
"this",
"->",
"SetPagingInfoPreviousPage",
"(",
")",
";",
"break",
";",
"case",
"'GoToPage'",
":",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"iRequestStartPage",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"TdbShopArticleList",
"::",
"URL_LIST_CURRENT_PAGE",
")",
";",
"$",
"this",
"->",
"JumpToPage",
"(",
"$",
"iRequestStartPage",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"}",
"$",
"this",
"->",
"StoreListObjectInSession",
"(",
")",
";",
"}"
] | process any request made for this item.
@param string $sRequest
@param bool $bCheckIdentKey | [
"process",
"any",
"request",
"made",
"for",
"this",
"item",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleList.class.php#L538-L569 |
31,804 | PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getEnzyme | private function getEnzyme(\SimpleXMLElement $xmlEnzyme)
{
$enzyme = array();
foreach ($xmlEnzyme->attributes() as $attribute => $value) {
switch ($attribute) {
case 'cTermGain':
$enzyme['cTermGain'] = (string) $value;
break;
case 'id':
$enzyme['id'] = (string) $value;
break;
case 'minDistance':
$enzyme['minDistance'] = (int) $value;
break;
case 'missedCleavages':
$enzyme['missedCleavages'] = (int) $value;
break;
case 'nTermGain':
$enzyme['nTermGain'] = (string) $value;
break;
case 'name':
$enzyme['name'] = (string) $value;
break;
case 'semiSpecific':
$enzyme['semiSpecific'] = (string) $value == 'true';
break;
default:
// Unknown element
break;
}
}
if (isset($xmlEnzyme->EnzymeName)) {
$enzyme['EnzymeName'] = $this->getEnzymeName($xmlEnzyme->EnzymeName);
}
return $enzyme;
} | php | private function getEnzyme(\SimpleXMLElement $xmlEnzyme)
{
$enzyme = array();
foreach ($xmlEnzyme->attributes() as $attribute => $value) {
switch ($attribute) {
case 'cTermGain':
$enzyme['cTermGain'] = (string) $value;
break;
case 'id':
$enzyme['id'] = (string) $value;
break;
case 'minDistance':
$enzyme['minDistance'] = (int) $value;
break;
case 'missedCleavages':
$enzyme['missedCleavages'] = (int) $value;
break;
case 'nTermGain':
$enzyme['nTermGain'] = (string) $value;
break;
case 'name':
$enzyme['name'] = (string) $value;
break;
case 'semiSpecific':
$enzyme['semiSpecific'] = (string) $value == 'true';
break;
default:
// Unknown element
break;
}
}
if (isset($xmlEnzyme->EnzymeName)) {
$enzyme['EnzymeName'] = $this->getEnzymeName($xmlEnzyme->EnzymeName);
}
return $enzyme;
} | [
"private",
"function",
"getEnzyme",
"(",
"\\",
"SimpleXMLElement",
"$",
"xmlEnzyme",
")",
"{",
"$",
"enzyme",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xmlEnzyme",
"->",
"attributes",
"(",
")",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"attribute",
")",
"{",
"case",
"'cTermGain'",
":",
"$",
"enzyme",
"[",
"'cTermGain'",
"]",
"=",
"(",
"string",
")",
"$",
"value",
";",
"break",
";",
"case",
"'id'",
":",
"$",
"enzyme",
"[",
"'id'",
"]",
"=",
"(",
"string",
")",
"$",
"value",
";",
"break",
";",
"case",
"'minDistance'",
":",
"$",
"enzyme",
"[",
"'minDistance'",
"]",
"=",
"(",
"int",
")",
"$",
"value",
";",
"break",
";",
"case",
"'missedCleavages'",
":",
"$",
"enzyme",
"[",
"'missedCleavages'",
"]",
"=",
"(",
"int",
")",
"$",
"value",
";",
"break",
";",
"case",
"'nTermGain'",
":",
"$",
"enzyme",
"[",
"'nTermGain'",
"]",
"=",
"(",
"string",
")",
"$",
"value",
";",
"break",
";",
"case",
"'name'",
":",
"$",
"enzyme",
"[",
"'name'",
"]",
"=",
"(",
"string",
")",
"$",
"value",
";",
"break",
";",
"case",
"'semiSpecific'",
":",
"$",
"enzyme",
"[",
"'semiSpecific'",
"]",
"=",
"(",
"string",
")",
"$",
"value",
"==",
"'true'",
";",
"break",
";",
"default",
":",
"// Unknown element",
"break",
";",
"}",
"}",
"if",
"(",
"isset",
"(",
"$",
"xmlEnzyme",
"->",
"EnzymeName",
")",
")",
"{",
"$",
"enzyme",
"[",
"'EnzymeName'",
"]",
"=",
"$",
"this",
"->",
"getEnzymeName",
"(",
"$",
"xmlEnzyme",
"->",
"EnzymeName",
")",
";",
"}",
"return",
"$",
"enzyme",
";",
"}"
] | The details of an individual cleavage enzyme should be provided by giving a regular expression or a CV term if a "standard" enzyme cleavage has been
performed.
@param \SimpleXMLElement $xmlEnzyme
The XML element
@return string[]|number[]|boolean[]|NULL[]|string[][] | [
"The",
"details",
"of",
"an",
"individual",
"cleavage",
"enzyme",
"should",
"be",
"provided",
"by",
"giving",
"a",
"regular",
"expression",
"or",
"a",
"CV",
"term",
"if",
"a",
"standard",
"enzyme",
"cleavage",
"has",
"been",
"performed",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L304-L342 |
31,805 | PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getEnzymes | protected function getEnzymes(\SimpleXMLElement $xml)
{
$enzymes = array();
foreach ($xml->Enzyme as $xmlEnzyme) {
$enzyme = $this->getEnzyme($xmlEnzyme);
if (isset($enzyme['id'])) {
$enzymes[$enzyme['id']] = $enzyme;
continue;
}
$enzymes[] = $enzyme;
}
return $enzymes;
} | php | protected function getEnzymes(\SimpleXMLElement $xml)
{
$enzymes = array();
foreach ($xml->Enzyme as $xmlEnzyme) {
$enzyme = $this->getEnzyme($xmlEnzyme);
if (isset($enzyme['id'])) {
$enzymes[$enzyme['id']] = $enzyme;
continue;
}
$enzymes[] = $enzyme;
}
return $enzymes;
} | [
"protected",
"function",
"getEnzymes",
"(",
"\\",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"enzymes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xml",
"->",
"Enzyme",
"as",
"$",
"xmlEnzyme",
")",
"{",
"$",
"enzyme",
"=",
"$",
"this",
"->",
"getEnzyme",
"(",
"$",
"xmlEnzyme",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"enzyme",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"enzymes",
"[",
"$",
"enzyme",
"[",
"'id'",
"]",
"]",
"=",
"$",
"enzyme",
";",
"continue",
";",
"}",
"$",
"enzymes",
"[",
"]",
"=",
"$",
"enzyme",
";",
"}",
"return",
"$",
"enzymes",
";",
"}"
] | The list of enzymes used in experiment
@param \SimpleXMLElement $xml
@return array | [
"The",
"list",
"of",
"enzymes",
"used",
"in",
"experiment"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L359-L375 |
31,806 | PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getFileFormat | private function getFileFormat(\SimpleXMLElement $xml)
{
$formats = array();
foreach ($xml->cvParam as $xmlCvParam) {
$cvParam = $this->getCvParam($xmlCvParam);
$formats[] = $cvParam[PsiVerb::CV_ACCESSION];
}
return $formats;
} | php | private function getFileFormat(\SimpleXMLElement $xml)
{
$formats = array();
foreach ($xml->cvParam as $xmlCvParam) {
$cvParam = $this->getCvParam($xmlCvParam);
$formats[] = $cvParam[PsiVerb::CV_ACCESSION];
}
return $formats;
} | [
"private",
"function",
"getFileFormat",
"(",
"\\",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"formats",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xml",
"->",
"cvParam",
"as",
"$",
"xmlCvParam",
")",
"{",
"$",
"cvParam",
"=",
"$",
"this",
"->",
"getCvParam",
"(",
"$",
"xmlCvParam",
")",
";",
"$",
"formats",
"[",
"]",
"=",
"$",
"cvParam",
"[",
"PsiVerb",
"::",
"CV_ACCESSION",
"]",
";",
"}",
"return",
"$",
"formats",
";",
"}"
] | The format of the ExternalData file, for example "tiff" for image files.
@param \SimpleXMLElement $xml
XML to parse | [
"The",
"format",
"of",
"the",
"ExternalData",
"file",
"for",
"example",
"tiff",
"for",
"image",
"files",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L393-L404 |
31,807 | PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getPeptideHypothesis | private function getPeptideHypothesis(\SimpleXMLElement $xml)
{
$hypothesis = array();
$ref = (string) $xml->attributes()->peptideEvidence_ref;
$hypothesis['peptide'] = $ref;
$hypothesis['spectra'] = array();
// TODO: Nothing we can currently do with this data - yet
foreach ($xml->SpectrumIdentificationItemRef as $spectrumIdentificationItemRef) {
$hypothesis['spectra'][] = $this->getSpectrumIdentificationItemRef($spectrumIdentificationItemRef);
}
return $hypothesis;
} | php | private function getPeptideHypothesis(\SimpleXMLElement $xml)
{
$hypothesis = array();
$ref = (string) $xml->attributes()->peptideEvidence_ref;
$hypothesis['peptide'] = $ref;
$hypothesis['spectra'] = array();
// TODO: Nothing we can currently do with this data - yet
foreach ($xml->SpectrumIdentificationItemRef as $spectrumIdentificationItemRef) {
$hypothesis['spectra'][] = $this->getSpectrumIdentificationItemRef($spectrumIdentificationItemRef);
}
return $hypothesis;
} | [
"private",
"function",
"getPeptideHypothesis",
"(",
"\\",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"hypothesis",
"=",
"array",
"(",
")",
";",
"$",
"ref",
"=",
"(",
"string",
")",
"$",
"xml",
"->",
"attributes",
"(",
")",
"->",
"peptideEvidence_ref",
";",
"$",
"hypothesis",
"[",
"'peptide'",
"]",
"=",
"$",
"ref",
";",
"$",
"hypothesis",
"[",
"'spectra'",
"]",
"=",
"array",
"(",
")",
";",
"// TODO: Nothing we can currently do with this data - yet",
"foreach",
"(",
"$",
"xml",
"->",
"SpectrumIdentificationItemRef",
"as",
"$",
"spectrumIdentificationItemRef",
")",
"{",
"$",
"hypothesis",
"[",
"'spectra'",
"]",
"[",
"]",
"=",
"$",
"this",
"->",
"getSpectrumIdentificationItemRef",
"(",
"$",
"spectrumIdentificationItemRef",
")",
";",
"}",
"return",
"$",
"hypothesis",
";",
"}"
] | Peptide evidence on which this ProteinHypothesis is based by reference to a PeptideEvidence element.
@param \SimpleXMLElement $xml
XML to parse | [
"Peptide",
"evidence",
"on",
"which",
"this",
"ProteinHypothesis",
"is",
"based",
"by",
"reference",
"to",
"a",
"PeptideEvidence",
"element",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L612-L626 |
31,808 | PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getProteinAmbiguityGroup | private function getProteinAmbiguityGroup(\SimpleXMLElement $xml)
{
$hypos = array();
foreach ($xml->ProteinDetectionHypothesis as $proteinDetectionHypothesis) {
$hypo = $this->getProteinDetectionHypothesis($proteinDetectionHypothesis);
$hypos[$hypo['id']] = $hypo;
}
return $hypos;
} | php | private function getProteinAmbiguityGroup(\SimpleXMLElement $xml)
{
$hypos = array();
foreach ($xml->ProteinDetectionHypothesis as $proteinDetectionHypothesis) {
$hypo = $this->getProteinDetectionHypothesis($proteinDetectionHypothesis);
$hypos[$hypo['id']] = $hypo;
}
return $hypos;
} | [
"private",
"function",
"getProteinAmbiguityGroup",
"(",
"\\",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"hypos",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"xml",
"->",
"ProteinDetectionHypothesis",
"as",
"$",
"proteinDetectionHypothesis",
")",
"{",
"$",
"hypo",
"=",
"$",
"this",
"->",
"getProteinDetectionHypothesis",
"(",
"$",
"proteinDetectionHypothesis",
")",
";",
"$",
"hypos",
"[",
"$",
"hypo",
"[",
"'id'",
"]",
"]",
"=",
"$",
"hypo",
";",
"}",
"return",
"$",
"hypos",
";",
"}"
] | A set of logically related results from a protein detection, for example to represent conflicting assignments of peptides to proteins.
@param \SimpleXMLElement $xml
XML to parse | [
"A",
"set",
"of",
"logically",
"related",
"results",
"from",
"a",
"protein",
"detection",
"for",
"example",
"to",
"represent",
"conflicting",
"assignments",
"of",
"peptides",
"to",
"proteins",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L644-L653 |
31,809 | PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getProteinDetectionList | public function getProteinDetectionList()
{
$this->getSequenceCollection();
$groups = array();
if (! isset($this->xmlReader->DataCollection->AnalysisData->ProteinDetectionList->ProteinAmbiguityGroup)) {
return null;
}
foreach ($this->xmlReader->DataCollection->AnalysisData->ProteinDetectionList->ProteinAmbiguityGroup as $proteinAmbiguityGroup) {
$group = $this->getProteinAmbiguityGroup($proteinAmbiguityGroup);
$groupId = $this->getAttributeId($proteinAmbiguityGroup);
// Reprocess each group to change refs to element
foreach ($group as $id => $value) {
$group[$id]['protein'] = $this->proteins[$value['protein']];
foreach ($value['peptides'] as $pepId => $peptide) {
$group[$id]['peptides'][$pepId] = $this->peptides[$this->evidence[$peptide['peptide']]['peptide']];
}
}
$groups[$groupId] = $group;
}
return $groups;
} | php | public function getProteinDetectionList()
{
$this->getSequenceCollection();
$groups = array();
if (! isset($this->xmlReader->DataCollection->AnalysisData->ProteinDetectionList->ProteinAmbiguityGroup)) {
return null;
}
foreach ($this->xmlReader->DataCollection->AnalysisData->ProteinDetectionList->ProteinAmbiguityGroup as $proteinAmbiguityGroup) {
$group = $this->getProteinAmbiguityGroup($proteinAmbiguityGroup);
$groupId = $this->getAttributeId($proteinAmbiguityGroup);
// Reprocess each group to change refs to element
foreach ($group as $id => $value) {
$group[$id]['protein'] = $this->proteins[$value['protein']];
foreach ($value['peptides'] as $pepId => $peptide) {
$group[$id]['peptides'][$pepId] = $this->peptides[$this->evidence[$peptide['peptide']]['peptide']];
}
}
$groups[$groupId] = $group;
}
return $groups;
} | [
"public",
"function",
"getProteinDetectionList",
"(",
")",
"{",
"$",
"this",
"->",
"getSequenceCollection",
"(",
")",
";",
"$",
"groups",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"xmlReader",
"->",
"DataCollection",
"->",
"AnalysisData",
"->",
"ProteinDetectionList",
"->",
"ProteinAmbiguityGroup",
")",
")",
"{",
"return",
"null",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"xmlReader",
"->",
"DataCollection",
"->",
"AnalysisData",
"->",
"ProteinDetectionList",
"->",
"ProteinAmbiguityGroup",
"as",
"$",
"proteinAmbiguityGroup",
")",
"{",
"$",
"group",
"=",
"$",
"this",
"->",
"getProteinAmbiguityGroup",
"(",
"$",
"proteinAmbiguityGroup",
")",
";",
"$",
"groupId",
"=",
"$",
"this",
"->",
"getAttributeId",
"(",
"$",
"proteinAmbiguityGroup",
")",
";",
"// Reprocess each group to change refs to element",
"foreach",
"(",
"$",
"group",
"as",
"$",
"id",
"=>",
"$",
"value",
")",
"{",
"$",
"group",
"[",
"$",
"id",
"]",
"[",
"'protein'",
"]",
"=",
"$",
"this",
"->",
"proteins",
"[",
"$",
"value",
"[",
"'protein'",
"]",
"]",
";",
"foreach",
"(",
"$",
"value",
"[",
"'peptides'",
"]",
"as",
"$",
"pepId",
"=>",
"$",
"peptide",
")",
"{",
"$",
"group",
"[",
"$",
"id",
"]",
"[",
"'peptides'",
"]",
"[",
"$",
"pepId",
"]",
"=",
"$",
"this",
"->",
"peptides",
"[",
"$",
"this",
"->",
"evidence",
"[",
"$",
"peptide",
"[",
"'peptide'",
"]",
"]",
"[",
"'peptide'",
"]",
"]",
";",
"}",
"}",
"$",
"groups",
"[",
"$",
"groupId",
"]",
"=",
"$",
"group",
";",
"}",
"return",
"$",
"groups",
";",
"}"
] | The protein list resulting from a protein detection process. | [
"The",
"protein",
"list",
"resulting",
"from",
"a",
"protein",
"detection",
"process",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L702-L728 |
31,810 | PGB-LIV/php-ms | src/Reader/MzIdentMlReader1r1.php | MzIdentMlReader1r1.getSpectrumIdFormat | private function getSpectrumIdFormat(\SimpleXMLElement $xml)
{
$cvParam = $this->getCvParam($xml->cvParam);
return $cvParam[PsiVerb::CV_ACCESSION];
} | php | private function getSpectrumIdFormat(\SimpleXMLElement $xml)
{
$cvParam = $this->getCvParam($xml->cvParam);
return $cvParam[PsiVerb::CV_ACCESSION];
} | [
"private",
"function",
"getSpectrumIdFormat",
"(",
"\\",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"cvParam",
"=",
"$",
"this",
"->",
"getCvParam",
"(",
"$",
"xml",
"->",
"cvParam",
")",
";",
"return",
"$",
"cvParam",
"[",
"PsiVerb",
"::",
"CV_ACCESSION",
"]",
";",
"}"
] | The format of the spectrum identifier within the source file.
@param \SimpleXMLElement $xml
XML to parse
@return string | [
"The",
"format",
"of",
"the",
"spectrum",
"identifier",
"within",
"the",
"source",
"file",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReader1r1.php#L997-L1002 |
31,811 | PGB-LIV/php-ms | src/Core/ProteinTrait.php | ProteinTrait.addProtein | public function addProtein(Protein $protein, $start = null, $end = null)
{
$entry = new ProteinEntry($protein);
if (! is_null($start)) {
$entry->setStart($start);
}
if (! is_null($end)) {
$entry->setEnd($end);
}
$this->addProteinEntry($entry);
} | php | public function addProtein(Protein $protein, $start = null, $end = null)
{
$entry = new ProteinEntry($protein);
if (! is_null($start)) {
$entry->setStart($start);
}
if (! is_null($end)) {
$entry->setEnd($end);
}
$this->addProteinEntry($entry);
} | [
"public",
"function",
"addProtein",
"(",
"Protein",
"$",
"protein",
",",
"$",
"start",
"=",
"null",
",",
"$",
"end",
"=",
"null",
")",
"{",
"$",
"entry",
"=",
"new",
"ProteinEntry",
"(",
"$",
"protein",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"start",
")",
")",
"{",
"$",
"entry",
"->",
"setStart",
"(",
"$",
"start",
")",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"end",
")",
")",
"{",
"$",
"entry",
"->",
"setEnd",
"(",
"$",
"end",
")",
";",
"}",
"$",
"this",
"->",
"addProteinEntry",
"(",
"$",
"entry",
")",
";",
"}"
] | Add a new protein mapping to this object.
Start and end positions on the protein sequence can be specified
@param Protein $protein
The protein to map to
@param int $start
The start position of this peptide in the sequence
@param int $end
The end position this peptide in the sequence | [
"Add",
"a",
"new",
"protein",
"mapping",
"to",
"this",
"object",
".",
"Start",
"and",
"end",
"positions",
"on",
"the",
"protein",
"sequence",
"can",
"be",
"specified"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ProteinTrait.php#L47-L59 |
31,812 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.PostInsertHook | protected function PostInsertHook()
{
parent::PostInsertHook();
// we need to add an customer number to the order... since generation of this number may differ
// from shop to shop, we have added the method to fetch a new customer number to the shop class
if (empty($this->sqlData['customer_number']) || empty($this->sqlData['shop_id'])) {
$aUpdateData = array();
if (empty($this->sqlData['customer_number'])) {
$aUpdateData['customer_number'] = $this->GetCustomerNumber();
}
if (empty($this->sqlData['shop_id'])) {
$oShop = TdbShop::GetInstance();
$aUpdateData['shop_id'] = $oShop->id;
}
if (count($aUpdateData) > 0) {
$this->SaveFieldsFast($aUpdateData);
}
}
TdbDataExtranetGroup::UpdateAutoAssignToUser($this);
} | php | protected function PostInsertHook()
{
parent::PostInsertHook();
// we need to add an customer number to the order... since generation of this number may differ
// from shop to shop, we have added the method to fetch a new customer number to the shop class
if (empty($this->sqlData['customer_number']) || empty($this->sqlData['shop_id'])) {
$aUpdateData = array();
if (empty($this->sqlData['customer_number'])) {
$aUpdateData['customer_number'] = $this->GetCustomerNumber();
}
if (empty($this->sqlData['shop_id'])) {
$oShop = TdbShop::GetInstance();
$aUpdateData['shop_id'] = $oShop->id;
}
if (count($aUpdateData) > 0) {
$this->SaveFieldsFast($aUpdateData);
}
}
TdbDataExtranetGroup::UpdateAutoAssignToUser($this);
} | [
"protected",
"function",
"PostInsertHook",
"(",
")",
"{",
"parent",
"::",
"PostInsertHook",
"(",
")",
";",
"// we need to add an customer number to the order... since generation of this number may differ",
"// from shop to shop, we have added the method to fetch a new customer number to the shop class",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'customer_number'",
"]",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'shop_id'",
"]",
")",
")",
"{",
"$",
"aUpdateData",
"=",
"array",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'customer_number'",
"]",
")",
")",
"{",
"$",
"aUpdateData",
"[",
"'customer_number'",
"]",
"=",
"$",
"this",
"->",
"GetCustomerNumber",
"(",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'shop_id'",
"]",
")",
")",
"{",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"aUpdateData",
"[",
"'shop_id'",
"]",
"=",
"$",
"oShop",
"->",
"id",
";",
"}",
"if",
"(",
"count",
"(",
"$",
"aUpdateData",
")",
">",
"0",
")",
"{",
"$",
"this",
"->",
"SaveFieldsFast",
"(",
"$",
"aUpdateData",
")",
";",
"}",
"}",
"TdbDataExtranetGroup",
"::",
"UpdateAutoAssignToUser",
"(",
"$",
"this",
")",
";",
"}"
] | we use the post insert hook to set the customer number. | [
"we",
"use",
"the",
"post",
"insert",
"hook",
"to",
"set",
"the",
"customer",
"number",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L39-L59 |
31,813 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.GetCustomerNumber | public function GetCustomerNumber()
{
$sCustNr = parent::GetCustomerNumber();
if (empty($sCustNr)) {
$oShop = TdbShop::GetInstance();
$sCustNr = $oShop->GetNextFreeCustomerNumber();
$aData = $this->sqlData;
$aData['customer_number'] = $sCustNr;
$this->LoadFromRow($aData);
}
return $this->fieldCustomerNumber;
} | php | public function GetCustomerNumber()
{
$sCustNr = parent::GetCustomerNumber();
if (empty($sCustNr)) {
$oShop = TdbShop::GetInstance();
$sCustNr = $oShop->GetNextFreeCustomerNumber();
$aData = $this->sqlData;
$aData['customer_number'] = $sCustNr;
$this->LoadFromRow($aData);
}
return $this->fieldCustomerNumber;
} | [
"public",
"function",
"GetCustomerNumber",
"(",
")",
"{",
"$",
"sCustNr",
"=",
"parent",
"::",
"GetCustomerNumber",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"sCustNr",
")",
")",
"{",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"sCustNr",
"=",
"$",
"oShop",
"->",
"GetNextFreeCustomerNumber",
"(",
")",
";",
"$",
"aData",
"=",
"$",
"this",
"->",
"sqlData",
";",
"$",
"aData",
"[",
"'customer_number'",
"]",
"=",
"$",
"sCustNr",
";",
"$",
"this",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"}",
"return",
"$",
"this",
"->",
"fieldCustomerNumber",
";",
"}"
] | returns the users customer number, if set.
@return string | [
"returns",
"the",
"users",
"customer",
"number",
"if",
"set",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L108-L120 |
31,814 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.PostLoginHookMergeTemporaryHistoryWithDatabaseHistory | protected function PostLoginHookMergeTemporaryHistoryWithDatabaseHistory()
{
// merge current data with user data
$aHistory = $this->GetArticleViewHistory();
$aTmpList = array_reverse($aHistory, true);
foreach (array_keys($aTmpList) as $histKey) {
if (is_null($aTmpList[$histKey]->id)) {
$aData = $aTmpList[$histKey]->sqlData;
$aData['data_extranet_user_id'] = $this->id;
$aTmpList[$histKey]->LoadFromRow($aData);
$aTmpList[$histKey]->AllowEditByAll(true);
$aTmpList[$histKey]->Save();
}
}
$this->aArticleViewHistory = null;
$this->GetArticleViewHistory();
// remove items from cookie...
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
if ('www.' == substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_HISTORY, '', time() - 3600, '/', '.'.$domain, false, true);
} | php | protected function PostLoginHookMergeTemporaryHistoryWithDatabaseHistory()
{
// merge current data with user data
$aHistory = $this->GetArticleViewHistory();
$aTmpList = array_reverse($aHistory, true);
foreach (array_keys($aTmpList) as $histKey) {
if (is_null($aTmpList[$histKey]->id)) {
$aData = $aTmpList[$histKey]->sqlData;
$aData['data_extranet_user_id'] = $this->id;
$aTmpList[$histKey]->LoadFromRow($aData);
$aTmpList[$histKey]->AllowEditByAll(true);
$aTmpList[$histKey]->Save();
}
}
$this->aArticleViewHistory = null;
$this->GetArticleViewHistory();
// remove items from cookie...
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
if ('www.' == substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_HISTORY, '', time() - 3600, '/', '.'.$domain, false, true);
} | [
"protected",
"function",
"PostLoginHookMergeTemporaryHistoryWithDatabaseHistory",
"(",
")",
"{",
"// merge current data with user data",
"$",
"aHistory",
"=",
"$",
"this",
"->",
"GetArticleViewHistory",
"(",
")",
";",
"$",
"aTmpList",
"=",
"array_reverse",
"(",
"$",
"aHistory",
",",
"true",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"aTmpList",
")",
"as",
"$",
"histKey",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"aTmpList",
"[",
"$",
"histKey",
"]",
"->",
"id",
")",
")",
"{",
"$",
"aData",
"=",
"$",
"aTmpList",
"[",
"$",
"histKey",
"]",
"->",
"sqlData",
";",
"$",
"aData",
"[",
"'data_extranet_user_id'",
"]",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"aTmpList",
"[",
"$",
"histKey",
"]",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"$",
"aTmpList",
"[",
"$",
"histKey",
"]",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"aTmpList",
"[",
"$",
"histKey",
"]",
"->",
"Save",
"(",
")",
";",
"}",
"}",
"$",
"this",
"->",
"aArticleViewHistory",
"=",
"null",
";",
"$",
"this",
"->",
"GetArticleViewHistory",
"(",
")",
";",
"// remove items from cookie...",
"$",
"domain",
"=",
"TCMSSmartURLData",
"::",
"GetActive",
"(",
")",
"->",
"sOriginalDomainName",
";",
"if",
"(",
"'www.'",
"==",
"substr",
"(",
"$",
"domain",
",",
"0",
",",
"4",
")",
")",
"{",
"$",
"domain",
"=",
"substr",
"(",
"$",
"domain",
",",
"4",
")",
";",
"}",
"setcookie",
"(",
"TdbDataExtranetUser",
"::",
"COOKIE_NAME_HISTORY",
",",
"''",
",",
"time",
"(",
")",
"-",
"3600",
",",
"'/'",
",",
"'.'",
".",
"$",
"domain",
",",
"false",
",",
"true",
")",
";",
"}"
] | takes the article view history from session and merges it with the data
in the database. this is done when the user logs in to make the history permanent. | [
"takes",
"the",
"article",
"view",
"history",
"from",
"session",
"and",
"merges",
"it",
"with",
"the",
"data",
"in",
"the",
"database",
".",
"this",
"is",
"done",
"when",
"the",
"user",
"logs",
"in",
"to",
"make",
"the",
"history",
"permanent",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L136-L158 |
31,815 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.PostLoginHookMergeTemporaryNoticeListWithDatabaseHistory | protected function PostLoginHookMergeTemporaryNoticeListWithDatabaseHistory()
{
// merge current notice list with existing notice list
$aNoticeList = $this->GetNoticeListArticles();
$aTmpList = array_reverse($aNoticeList, true);
foreach (array_keys($aTmpList) as $iArticleId) {
if (is_null($aTmpList[$iArticleId]->id)) {
// check if the user has such an item on the list... if he does, no change
$oItem = TdbShopUserNoticeList::GetNewInstance();
/** @var $oItem TdbShopUserNoticeList */
if (!$oItem->LoadFromFields(array('data_extranet_user_id' => $this->id, 'shop_article_id' => $iArticleId))) {
$aData = $aTmpList[$iArticleId]->sqlData;
$aData['data_extranet_user_id'] = $this->id;
$aTmpList[$iArticleId]->LoadFromRow($aData);
$aTmpList[$iArticleId]->AllowEditByAll(true);
$aTmpList[$iArticleId]->Save();
}
}
}
$this->aNoticeList = null;
$this->GetNoticeListArticles();
// remove items from cookie...
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
if ('www.' == substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_NOTICELIST, '', time() - 3600, '/', '.'.$domain, false, true);
} | php | protected function PostLoginHookMergeTemporaryNoticeListWithDatabaseHistory()
{
// merge current notice list with existing notice list
$aNoticeList = $this->GetNoticeListArticles();
$aTmpList = array_reverse($aNoticeList, true);
foreach (array_keys($aTmpList) as $iArticleId) {
if (is_null($aTmpList[$iArticleId]->id)) {
// check if the user has such an item on the list... if he does, no change
$oItem = TdbShopUserNoticeList::GetNewInstance();
/** @var $oItem TdbShopUserNoticeList */
if (!$oItem->LoadFromFields(array('data_extranet_user_id' => $this->id, 'shop_article_id' => $iArticleId))) {
$aData = $aTmpList[$iArticleId]->sqlData;
$aData['data_extranet_user_id'] = $this->id;
$aTmpList[$iArticleId]->LoadFromRow($aData);
$aTmpList[$iArticleId]->AllowEditByAll(true);
$aTmpList[$iArticleId]->Save();
}
}
}
$this->aNoticeList = null;
$this->GetNoticeListArticles();
// remove items from cookie...
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
if ('www.' == substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_NOTICELIST, '', time() - 3600, '/', '.'.$domain, false, true);
} | [
"protected",
"function",
"PostLoginHookMergeTemporaryNoticeListWithDatabaseHistory",
"(",
")",
"{",
"// merge current notice list with existing notice list",
"$",
"aNoticeList",
"=",
"$",
"this",
"->",
"GetNoticeListArticles",
"(",
")",
";",
"$",
"aTmpList",
"=",
"array_reverse",
"(",
"$",
"aNoticeList",
",",
"true",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"aTmpList",
")",
"as",
"$",
"iArticleId",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"aTmpList",
"[",
"$",
"iArticleId",
"]",
"->",
"id",
")",
")",
"{",
"// check if the user has such an item on the list... if he does, no change",
"$",
"oItem",
"=",
"TdbShopUserNoticeList",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oItem TdbShopUserNoticeList */",
"if",
"(",
"!",
"$",
"oItem",
"->",
"LoadFromFields",
"(",
"array",
"(",
"'data_extranet_user_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'shop_article_id'",
"=>",
"$",
"iArticleId",
")",
")",
")",
"{",
"$",
"aData",
"=",
"$",
"aTmpList",
"[",
"$",
"iArticleId",
"]",
"->",
"sqlData",
";",
"$",
"aData",
"[",
"'data_extranet_user_id'",
"]",
"=",
"$",
"this",
"->",
"id",
";",
"$",
"aTmpList",
"[",
"$",
"iArticleId",
"]",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"$",
"aTmpList",
"[",
"$",
"iArticleId",
"]",
"->",
"AllowEditByAll",
"(",
"true",
")",
";",
"$",
"aTmpList",
"[",
"$",
"iArticleId",
"]",
"->",
"Save",
"(",
")",
";",
"}",
"}",
"}",
"$",
"this",
"->",
"aNoticeList",
"=",
"null",
";",
"$",
"this",
"->",
"GetNoticeListArticles",
"(",
")",
";",
"// remove items from cookie...",
"$",
"domain",
"=",
"TCMSSmartURLData",
"::",
"GetActive",
"(",
")",
"->",
"sOriginalDomainName",
";",
"if",
"(",
"'www.'",
"==",
"substr",
"(",
"$",
"domain",
",",
"0",
",",
"4",
")",
")",
"{",
"$",
"domain",
"=",
"substr",
"(",
"$",
"domain",
",",
"4",
")",
";",
"}",
"setcookie",
"(",
"TdbDataExtranetUser",
"::",
"COOKIE_NAME_NOTICELIST",
",",
"''",
",",
"time",
"(",
")",
"-",
"3600",
",",
"'/'",
",",
"'.'",
".",
"$",
"domain",
",",
"false",
",",
"true",
")",
";",
"}"
] | takes the notice list from session and merges it with the data
in the database. this is done when the user logs in to make the notice list permanent. | [
"takes",
"the",
"notice",
"list",
"from",
"session",
"and",
"merges",
"it",
"with",
"the",
"data",
"in",
"the",
"database",
".",
"this",
"is",
"done",
"when",
"the",
"user",
"logs",
"in",
"to",
"make",
"the",
"notice",
"list",
"permanent",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L164-L191 |
31,816 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.GetUserAlias | public function GetUserAlias()
{
$sAlias = trim($this->fieldAliasName);
if (empty($sAlias)) {
$sAlias = $this->fieldFirstname.' '.mb_substr($this->fieldLastname, 0, 1).'.';
}
return $sAlias;
} | php | public function GetUserAlias()
{
$sAlias = trim($this->fieldAliasName);
if (empty($sAlias)) {
$sAlias = $this->fieldFirstname.' '.mb_substr($this->fieldLastname, 0, 1).'.';
}
return $sAlias;
} | [
"public",
"function",
"GetUserAlias",
"(",
")",
"{",
"$",
"sAlias",
"=",
"trim",
"(",
"$",
"this",
"->",
"fieldAliasName",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"sAlias",
")",
")",
"{",
"$",
"sAlias",
"=",
"$",
"this",
"->",
"fieldFirstname",
".",
"' '",
".",
"mb_substr",
"(",
"$",
"this",
"->",
"fieldLastname",
",",
"0",
",",
"1",
")",
".",
"'.'",
";",
"}",
"return",
"$",
"sAlias",
";",
"}"
] | return alias for the user.
@return string | [
"return",
"alias",
"for",
"the",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L198-L206 |
31,817 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.GetArticleViewHistory | public function GetArticleViewHistory()
{
if (is_null($this->aArticleViewHistory)) {
$this->aArticleViewHistory = array();
$iMaxQueueLength = 100;
$shop = $this->getShopService()->getActiveShop();
if ($shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount < $iMaxQueueLength && $shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount > 0) {
$iMaxQueueLength = $shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount;
}
if ($this->IsLoggedIn()) {
// fetch from user
$iNumRecsAdded = 0;
$oHistoryList = &$this->GetFieldDataExtranetUserShopArticleHistoryList();
while (($oHistoryItem = $oHistoryList->Next()) && $iNumRecsAdded <= $iMaxQueueLength) {
$this->aArticleViewHistory[] = $oHistoryItem->sqlData;
}
} else {
// fetch from cookie
$aTmpHist = null;
if (array_key_exists(TdbDataExtranetUser::COOKIE_NAME_HISTORY, $_COOKIE)) {
$sHistory = base64_decode($_COOKIE[TdbDataExtranetUser::COOKIE_NAME_HISTORY]);
$aTmpHist = json_decode($sHistory, true);
}
if (is_array($aTmpHist)) {
reset($aTmpHist);
foreach ($aTmpHist as $iKey => $aHistItemData) {
$oHistoryItem = TdbDataExtranetUserShopArticleHistory::GetNewInstance();
$oHistoryItem->LoadFromRow($aHistItemData);
$this->aArticleViewHistory[] = $oHistoryItem->sqlData;
}
}
}
}
$historyList = array();
foreach ($this->aArticleViewHistory as $item) {
$historyList[] = TdbDataExtranetUserShopArticleHistory::GetNewInstance($item);
}
return $historyList;
} | php | public function GetArticleViewHistory()
{
if (is_null($this->aArticleViewHistory)) {
$this->aArticleViewHistory = array();
$iMaxQueueLength = 100;
$shop = $this->getShopService()->getActiveShop();
if ($shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount < $iMaxQueueLength && $shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount > 0) {
$iMaxQueueLength = $shop->fieldDataExtranetUserShopArticleHistoryMaxArticleCount;
}
if ($this->IsLoggedIn()) {
// fetch from user
$iNumRecsAdded = 0;
$oHistoryList = &$this->GetFieldDataExtranetUserShopArticleHistoryList();
while (($oHistoryItem = $oHistoryList->Next()) && $iNumRecsAdded <= $iMaxQueueLength) {
$this->aArticleViewHistory[] = $oHistoryItem->sqlData;
}
} else {
// fetch from cookie
$aTmpHist = null;
if (array_key_exists(TdbDataExtranetUser::COOKIE_NAME_HISTORY, $_COOKIE)) {
$sHistory = base64_decode($_COOKIE[TdbDataExtranetUser::COOKIE_NAME_HISTORY]);
$aTmpHist = json_decode($sHistory, true);
}
if (is_array($aTmpHist)) {
reset($aTmpHist);
foreach ($aTmpHist as $iKey => $aHistItemData) {
$oHistoryItem = TdbDataExtranetUserShopArticleHistory::GetNewInstance();
$oHistoryItem->LoadFromRow($aHistItemData);
$this->aArticleViewHistory[] = $oHistoryItem->sqlData;
}
}
}
}
$historyList = array();
foreach ($this->aArticleViewHistory as $item) {
$historyList[] = TdbDataExtranetUserShopArticleHistory::GetNewInstance($item);
}
return $historyList;
} | [
"public",
"function",
"GetArticleViewHistory",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"aArticleViewHistory",
")",
")",
"{",
"$",
"this",
"->",
"aArticleViewHistory",
"=",
"array",
"(",
")",
";",
"$",
"iMaxQueueLength",
"=",
"100",
";",
"$",
"shop",
"=",
"$",
"this",
"->",
"getShopService",
"(",
")",
"->",
"getActiveShop",
"(",
")",
";",
"if",
"(",
"$",
"shop",
"->",
"fieldDataExtranetUserShopArticleHistoryMaxArticleCount",
"<",
"$",
"iMaxQueueLength",
"&&",
"$",
"shop",
"->",
"fieldDataExtranetUserShopArticleHistoryMaxArticleCount",
">",
"0",
")",
"{",
"$",
"iMaxQueueLength",
"=",
"$",
"shop",
"->",
"fieldDataExtranetUserShopArticleHistoryMaxArticleCount",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"IsLoggedIn",
"(",
")",
")",
"{",
"// fetch from user",
"$",
"iNumRecsAdded",
"=",
"0",
";",
"$",
"oHistoryList",
"=",
"&",
"$",
"this",
"->",
"GetFieldDataExtranetUserShopArticleHistoryList",
"(",
")",
";",
"while",
"(",
"(",
"$",
"oHistoryItem",
"=",
"$",
"oHistoryList",
"->",
"Next",
"(",
")",
")",
"&&",
"$",
"iNumRecsAdded",
"<=",
"$",
"iMaxQueueLength",
")",
"{",
"$",
"this",
"->",
"aArticleViewHistory",
"[",
"]",
"=",
"$",
"oHistoryItem",
"->",
"sqlData",
";",
"}",
"}",
"else",
"{",
"// fetch from cookie",
"$",
"aTmpHist",
"=",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"TdbDataExtranetUser",
"::",
"COOKIE_NAME_HISTORY",
",",
"$",
"_COOKIE",
")",
")",
"{",
"$",
"sHistory",
"=",
"base64_decode",
"(",
"$",
"_COOKIE",
"[",
"TdbDataExtranetUser",
"::",
"COOKIE_NAME_HISTORY",
"]",
")",
";",
"$",
"aTmpHist",
"=",
"json_decode",
"(",
"$",
"sHistory",
",",
"true",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"aTmpHist",
")",
")",
"{",
"reset",
"(",
"$",
"aTmpHist",
")",
";",
"foreach",
"(",
"$",
"aTmpHist",
"as",
"$",
"iKey",
"=>",
"$",
"aHistItemData",
")",
"{",
"$",
"oHistoryItem",
"=",
"TdbDataExtranetUserShopArticleHistory",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oHistoryItem",
"->",
"LoadFromRow",
"(",
"$",
"aHistItemData",
")",
";",
"$",
"this",
"->",
"aArticleViewHistory",
"[",
"]",
"=",
"$",
"oHistoryItem",
"->",
"sqlData",
";",
"}",
"}",
"}",
"}",
"$",
"historyList",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"aArticleViewHistory",
"as",
"$",
"item",
")",
"{",
"$",
"historyList",
"[",
"]",
"=",
"TdbDataExtranetUserShopArticleHistory",
"::",
"GetNewInstance",
"(",
"$",
"item",
")",
";",
"}",
"return",
"$",
"historyList",
";",
"}"
] | returns the ids of up to the last 100 articles viewed.
@return array | [
"returns",
"the",
"ids",
"of",
"up",
"to",
"the",
"last",
"100",
"articles",
"viewed",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L330-L371 |
31,818 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.AddArticleIdToNoticeList | public function AddArticleIdToNoticeList($iArticleId, $iAmount = 1)
{
$dNewAmountOnList = 0;
if (is_null($this->aNoticeList)) {
$this->GetNoticeListArticles();
}
// check if the item being pushed is already in the end of the queue
$iMaxQueueLength = 1000;
$queNotEmpty = (count($this->aNoticeList) > 0);
if (array_key_exists($iArticleId, $this->aNoticeList)) {
// we do not allow placing an article more than once on the notice list
$dNewAmountOnList = false;
} else {
$oNoticeListItem = TdbShopUserNoticeList::GetNewInstance();
/** @var $oNoticeListItem TdbShopUserNoticeList */
$aData = array('shop_article_id' => $iArticleId, 'date_added' => date('Y-m-d H:i:s'), 'data_extranet_user_id' => $this->id, 'amount' => $iAmount);
$oNoticeListItem->LoadFromRow($aData);
if (!is_null($this->id) && $this->IsLoggedIn()) {
$oNoticeListItem->Save();
}
$this->aNoticeList[$oNoticeListItem->fieldShopArticleId] = $oNoticeListItem->sqlData;
}
if (false !== $dNewAmountOnList) {
// remove item if amount drops to zero
if ($this->aNoticeList[$iArticleId]['amount'] <= 0) {
unset($this->aNoticeList[$iArticleId]);
} else {
$dNewAmountOnList = $this->aNoticeList[$iArticleId]['amount'];
}
// if the list is full, remove last item
if (count($this->aNoticeList) > $iMaxQueueLength) {
array_pop($this->aNoticeList);
}
// save list to cookie for users not signed in
if (!$this->IsLoggedIn()) {
$this->CommitNoticeListToCookie();
}
}
return $dNewAmountOnList;
} | php | public function AddArticleIdToNoticeList($iArticleId, $iAmount = 1)
{
$dNewAmountOnList = 0;
if (is_null($this->aNoticeList)) {
$this->GetNoticeListArticles();
}
// check if the item being pushed is already in the end of the queue
$iMaxQueueLength = 1000;
$queNotEmpty = (count($this->aNoticeList) > 0);
if (array_key_exists($iArticleId, $this->aNoticeList)) {
// we do not allow placing an article more than once on the notice list
$dNewAmountOnList = false;
} else {
$oNoticeListItem = TdbShopUserNoticeList::GetNewInstance();
/** @var $oNoticeListItem TdbShopUserNoticeList */
$aData = array('shop_article_id' => $iArticleId, 'date_added' => date('Y-m-d H:i:s'), 'data_extranet_user_id' => $this->id, 'amount' => $iAmount);
$oNoticeListItem->LoadFromRow($aData);
if (!is_null($this->id) && $this->IsLoggedIn()) {
$oNoticeListItem->Save();
}
$this->aNoticeList[$oNoticeListItem->fieldShopArticleId] = $oNoticeListItem->sqlData;
}
if (false !== $dNewAmountOnList) {
// remove item if amount drops to zero
if ($this->aNoticeList[$iArticleId]['amount'] <= 0) {
unset($this->aNoticeList[$iArticleId]);
} else {
$dNewAmountOnList = $this->aNoticeList[$iArticleId]['amount'];
}
// if the list is full, remove last item
if (count($this->aNoticeList) > $iMaxQueueLength) {
array_pop($this->aNoticeList);
}
// save list to cookie for users not signed in
if (!$this->IsLoggedIn()) {
$this->CommitNoticeListToCookie();
}
}
return $dNewAmountOnList;
} | [
"public",
"function",
"AddArticleIdToNoticeList",
"(",
"$",
"iArticleId",
",",
"$",
"iAmount",
"=",
"1",
")",
"{",
"$",
"dNewAmountOnList",
"=",
"0",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"aNoticeList",
")",
")",
"{",
"$",
"this",
"->",
"GetNoticeListArticles",
"(",
")",
";",
"}",
"// check if the item being pushed is already in the end of the queue",
"$",
"iMaxQueueLength",
"=",
"1000",
";",
"$",
"queNotEmpty",
"=",
"(",
"count",
"(",
"$",
"this",
"->",
"aNoticeList",
")",
">",
"0",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"iArticleId",
",",
"$",
"this",
"->",
"aNoticeList",
")",
")",
"{",
"// we do not allow placing an article more than once on the notice list",
"$",
"dNewAmountOnList",
"=",
"false",
";",
"}",
"else",
"{",
"$",
"oNoticeListItem",
"=",
"TdbShopUserNoticeList",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oNoticeListItem TdbShopUserNoticeList */",
"$",
"aData",
"=",
"array",
"(",
"'shop_article_id'",
"=>",
"$",
"iArticleId",
",",
"'date_added'",
"=>",
"date",
"(",
"'Y-m-d H:i:s'",
")",
",",
"'data_extranet_user_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'amount'",
"=>",
"$",
"iAmount",
")",
";",
"$",
"oNoticeListItem",
"->",
"LoadFromRow",
"(",
"$",
"aData",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"id",
")",
"&&",
"$",
"this",
"->",
"IsLoggedIn",
"(",
")",
")",
"{",
"$",
"oNoticeListItem",
"->",
"Save",
"(",
")",
";",
"}",
"$",
"this",
"->",
"aNoticeList",
"[",
"$",
"oNoticeListItem",
"->",
"fieldShopArticleId",
"]",
"=",
"$",
"oNoticeListItem",
"->",
"sqlData",
";",
"}",
"if",
"(",
"false",
"!==",
"$",
"dNewAmountOnList",
")",
"{",
"// remove item if amount drops to zero",
"if",
"(",
"$",
"this",
"->",
"aNoticeList",
"[",
"$",
"iArticleId",
"]",
"[",
"'amount'",
"]",
"<=",
"0",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"aNoticeList",
"[",
"$",
"iArticleId",
"]",
")",
";",
"}",
"else",
"{",
"$",
"dNewAmountOnList",
"=",
"$",
"this",
"->",
"aNoticeList",
"[",
"$",
"iArticleId",
"]",
"[",
"'amount'",
"]",
";",
"}",
"// if the list is full, remove last item",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"aNoticeList",
")",
">",
"$",
"iMaxQueueLength",
")",
"{",
"array_pop",
"(",
"$",
"this",
"->",
"aNoticeList",
")",
";",
"}",
"// save list to cookie for users not signed in",
"if",
"(",
"!",
"$",
"this",
"->",
"IsLoggedIn",
"(",
")",
")",
"{",
"$",
"this",
"->",
"CommitNoticeListToCookie",
"(",
")",
";",
"}",
"}",
"return",
"$",
"dNewAmountOnList",
";",
"}"
] | add an article to the notice list.
@param int $iArticleId
@param float $iAmount
@return float - new amount on list | [
"add",
"an",
"article",
"to",
"the",
"notice",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L427-L473 |
31,819 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.CommitNoticeListToCookie | protected function CommitNoticeListToCookie()
{
$aNoticeList = array();
reset($this->aNoticeList);
foreach (array_keys($this->aNoticeList) as $iItemId) {
$aNoticeList[$iItemId] = $this->aNoticeList[$iItemId];
}
$sNoticeList = json_encode($aNoticeList);
$sNoticeList = base64_encode($sNoticeList);
$iLifeTime = 31536000; // 1 year
if ($iLifeTime > CHAMELEON_MAX_COOKIE_LIFETIME) {
$iLifeTime = CHAMELEON_MAX_COOKIE_LIFETIME;
}
$expireTime = $iLifeTime + time();
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
// drop 'www' subdomain
if ('www.' === substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_NOTICELIST, $sNoticeList, $expireTime, '/', '.'.$domain, false, true);
} | php | protected function CommitNoticeListToCookie()
{
$aNoticeList = array();
reset($this->aNoticeList);
foreach (array_keys($this->aNoticeList) as $iItemId) {
$aNoticeList[$iItemId] = $this->aNoticeList[$iItemId];
}
$sNoticeList = json_encode($aNoticeList);
$sNoticeList = base64_encode($sNoticeList);
$iLifeTime = 31536000; // 1 year
if ($iLifeTime > CHAMELEON_MAX_COOKIE_LIFETIME) {
$iLifeTime = CHAMELEON_MAX_COOKIE_LIFETIME;
}
$expireTime = $iLifeTime + time();
$domain = TCMSSmartURLData::GetActive()->sOriginalDomainName;
// drop 'www' subdomain
if ('www.' === substr($domain, 0, 4)) {
$domain = substr($domain, 4);
}
setcookie(TdbDataExtranetUser::COOKIE_NAME_NOTICELIST, $sNoticeList, $expireTime, '/', '.'.$domain, false, true);
} | [
"protected",
"function",
"CommitNoticeListToCookie",
"(",
")",
"{",
"$",
"aNoticeList",
"=",
"array",
"(",
")",
";",
"reset",
"(",
"$",
"this",
"->",
"aNoticeList",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"aNoticeList",
")",
"as",
"$",
"iItemId",
")",
"{",
"$",
"aNoticeList",
"[",
"$",
"iItemId",
"]",
"=",
"$",
"this",
"->",
"aNoticeList",
"[",
"$",
"iItemId",
"]",
";",
"}",
"$",
"sNoticeList",
"=",
"json_encode",
"(",
"$",
"aNoticeList",
")",
";",
"$",
"sNoticeList",
"=",
"base64_encode",
"(",
"$",
"sNoticeList",
")",
";",
"$",
"iLifeTime",
"=",
"31536000",
";",
"// 1 year",
"if",
"(",
"$",
"iLifeTime",
">",
"CHAMELEON_MAX_COOKIE_LIFETIME",
")",
"{",
"$",
"iLifeTime",
"=",
"CHAMELEON_MAX_COOKIE_LIFETIME",
";",
"}",
"$",
"expireTime",
"=",
"$",
"iLifeTime",
"+",
"time",
"(",
")",
";",
"$",
"domain",
"=",
"TCMSSmartURLData",
"::",
"GetActive",
"(",
")",
"->",
"sOriginalDomainName",
";",
"// drop 'www' subdomain",
"if",
"(",
"'www.'",
"===",
"substr",
"(",
"$",
"domain",
",",
"0",
",",
"4",
")",
")",
"{",
"$",
"domain",
"=",
"substr",
"(",
"$",
"domain",
",",
"4",
")",
";",
"}",
"setcookie",
"(",
"TdbDataExtranetUser",
"::",
"COOKIE_NAME_NOTICELIST",
",",
"$",
"sNoticeList",
",",
"$",
"expireTime",
",",
"'/'",
",",
"'.'",
".",
"$",
"domain",
",",
"false",
",",
"true",
")",
";",
"}"
] | save user notice list to cookie. | [
"save",
"user",
"notice",
"list",
"to",
"cookie",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L478-L498 |
31,820 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.RemoveArticleFromNoticeList | public function RemoveArticleFromNoticeList($sArticleId)
{
$this->GetNoticeListArticles();
if (array_key_exists($sArticleId, $this->aNoticeList)) {
unset($this->aNoticeList[$sArticleId]);
if ($this->IsLoggedIn()) {
$noticeListItemObject = TdbShopUserNoticeList::GetNewInstance();
if (true === $noticeListItemObject->LoadFromFields(
array(
'data_extranet_user_id' => $this->id,
'shop_article_id' => $sArticleId,
)
)) {
$noticeListItemObject->Delete();
}
} else {
$this->CommitNoticeListToCookie();
}
}
} | php | public function RemoveArticleFromNoticeList($sArticleId)
{
$this->GetNoticeListArticles();
if (array_key_exists($sArticleId, $this->aNoticeList)) {
unset($this->aNoticeList[$sArticleId]);
if ($this->IsLoggedIn()) {
$noticeListItemObject = TdbShopUserNoticeList::GetNewInstance();
if (true === $noticeListItemObject->LoadFromFields(
array(
'data_extranet_user_id' => $this->id,
'shop_article_id' => $sArticleId,
)
)) {
$noticeListItemObject->Delete();
}
} else {
$this->CommitNoticeListToCookie();
}
}
} | [
"public",
"function",
"RemoveArticleFromNoticeList",
"(",
"$",
"sArticleId",
")",
"{",
"$",
"this",
"->",
"GetNoticeListArticles",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"sArticleId",
",",
"$",
"this",
"->",
"aNoticeList",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"aNoticeList",
"[",
"$",
"sArticleId",
"]",
")",
";",
"if",
"(",
"$",
"this",
"->",
"IsLoggedIn",
"(",
")",
")",
"{",
"$",
"noticeListItemObject",
"=",
"TdbShopUserNoticeList",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"true",
"===",
"$",
"noticeListItemObject",
"->",
"LoadFromFields",
"(",
"array",
"(",
"'data_extranet_user_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'shop_article_id'",
"=>",
"$",
"sArticleId",
",",
")",
")",
")",
"{",
"$",
"noticeListItemObject",
"->",
"Delete",
"(",
")",
";",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"CommitNoticeListToCookie",
"(",
")",
";",
"}",
"}",
"}"
] | remove an article form the notice list.
@param string $sArticleId | [
"remove",
"an",
"article",
"form",
"the",
"notice",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L505-L524 |
31,821 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.ValidateData | public function ValidateData($sFormDataName = null)
{
if (is_null($sFormDataName)) {
$sFormDataName = TdbDataExtranetUser::MSG_FORM_FIELD;
}
$bIsValid = parent::ValidateData($sFormDataName);
$oMsgManager = TCMSMessageManager::GetInstance();
// check postal code for country
$bHasCountry = (array_key_exists('data_country_id', $this->sqlData) && !empty($this->sqlData['data_country_id']));
$bHasPostalcode = (array_key_exists('postalcode', $this->sqlData) && !empty($this->sqlData['postalcode']));
if ($bHasCountry && $bHasPostalcode) {
$oCountry = TdbDataCountry::GetNewInstance();
/** @var $oCountry TdbDataCountry */
if ($oCountry->Load($this->sqlData['data_country_id'])) {
if (!$oCountry->IsValidPostalcode($this->sqlData['postalcode'])) {
$oMsgManager->AddMessage($sFormDataName.'-postalcode', 'ERROR-USER-FIELD-INVALID-POSTALCODE');
$bIsValid = false;
}
}
}
return $bIsValid;
} | php | public function ValidateData($sFormDataName = null)
{
if (is_null($sFormDataName)) {
$sFormDataName = TdbDataExtranetUser::MSG_FORM_FIELD;
}
$bIsValid = parent::ValidateData($sFormDataName);
$oMsgManager = TCMSMessageManager::GetInstance();
// check postal code for country
$bHasCountry = (array_key_exists('data_country_id', $this->sqlData) && !empty($this->sqlData['data_country_id']));
$bHasPostalcode = (array_key_exists('postalcode', $this->sqlData) && !empty($this->sqlData['postalcode']));
if ($bHasCountry && $bHasPostalcode) {
$oCountry = TdbDataCountry::GetNewInstance();
/** @var $oCountry TdbDataCountry */
if ($oCountry->Load($this->sqlData['data_country_id'])) {
if (!$oCountry->IsValidPostalcode($this->sqlData['postalcode'])) {
$oMsgManager->AddMessage($sFormDataName.'-postalcode', 'ERROR-USER-FIELD-INVALID-POSTALCODE');
$bIsValid = false;
}
}
}
return $bIsValid;
} | [
"public",
"function",
"ValidateData",
"(",
"$",
"sFormDataName",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"sFormDataName",
")",
")",
"{",
"$",
"sFormDataName",
"=",
"TdbDataExtranetUser",
"::",
"MSG_FORM_FIELD",
";",
"}",
"$",
"bIsValid",
"=",
"parent",
"::",
"ValidateData",
"(",
"$",
"sFormDataName",
")",
";",
"$",
"oMsgManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"// check postal code for country",
"$",
"bHasCountry",
"=",
"(",
"array_key_exists",
"(",
"'data_country_id'",
",",
"$",
"this",
"->",
"sqlData",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'data_country_id'",
"]",
")",
")",
";",
"$",
"bHasPostalcode",
"=",
"(",
"array_key_exists",
"(",
"'postalcode'",
",",
"$",
"this",
"->",
"sqlData",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'postalcode'",
"]",
")",
")",
";",
"if",
"(",
"$",
"bHasCountry",
"&&",
"$",
"bHasPostalcode",
")",
"{",
"$",
"oCountry",
"=",
"TdbDataCountry",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oCountry TdbDataCountry */",
"if",
"(",
"$",
"oCountry",
"->",
"Load",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'data_country_id'",
"]",
")",
")",
"{",
"if",
"(",
"!",
"$",
"oCountry",
"->",
"IsValidPostalcode",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'postalcode'",
"]",
")",
")",
"{",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sFormDataName",
".",
"'-postalcode'",
",",
"'ERROR-USER-FIELD-INVALID-POSTALCODE'",
")",
";",
"$",
"bIsValid",
"=",
"false",
";",
"}",
"}",
"}",
"return",
"$",
"bIsValid",
";",
"}"
] | validates the user data.
@param string $sFormDataName - the array name used for the form. send error messages here
@return bool | [
"validates",
"the",
"user",
"data",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L533-L556 |
31,822 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.GetTotalOrderValue | public function GetTotalOrderValue($sStartDate = null, $sEndDate = null)
{
$query = "SELECT SUM(value_total) AS ordervalue
FROM `shop_order`
WHERE `data_extranet_user_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
AND (`shop_order`.`id` IS NULL OR `shop_order`.`canceled` = '0')
";
if (!is_null($sStartDate)) {
$query .= " AND `datecreated` >= '".MySqlLegacySupport::getInstance()->real_escape_string($sStartDate)."' ";
}
if (!is_null($sEndDate)) {
$query .= " AND `datecreated` <= '".MySqlLegacySupport::getInstance()->real_escape_string($sEndDate)."' ";
}
$query .= ' GROUP BY `data_extranet_user_id`';
$dValue = 0;
if ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$dValue = $aRow['ordervalue'];
}
return $dValue;
} | php | public function GetTotalOrderValue($sStartDate = null, $sEndDate = null)
{
$query = "SELECT SUM(value_total) AS ordervalue
FROM `shop_order`
WHERE `data_extranet_user_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->id)."'
AND (`shop_order`.`id` IS NULL OR `shop_order`.`canceled` = '0')
";
if (!is_null($sStartDate)) {
$query .= " AND `datecreated` >= '".MySqlLegacySupport::getInstance()->real_escape_string($sStartDate)."' ";
}
if (!is_null($sEndDate)) {
$query .= " AND `datecreated` <= '".MySqlLegacySupport::getInstance()->real_escape_string($sEndDate)."' ";
}
$query .= ' GROUP BY `data_extranet_user_id`';
$dValue = 0;
if ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
$dValue = $aRow['ordervalue'];
}
return $dValue;
} | [
"public",
"function",
"GetTotalOrderValue",
"(",
"$",
"sStartDate",
"=",
"null",
",",
"$",
"sEndDate",
"=",
"null",
")",
"{",
"$",
"query",
"=",
"\"SELECT SUM(value_total) AS ordervalue\n FROM `shop_order`\n WHERE `data_extranet_user_id` = '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"this",
"->",
"id",
")",
".",
"\"'\n AND (`shop_order`.`id` IS NULL OR `shop_order`.`canceled` = '0')\n \"",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"sStartDate",
")",
")",
"{",
"$",
"query",
".=",
"\" AND `datecreated` >= '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sStartDate",
")",
".",
"\"' \"",
";",
"}",
"if",
"(",
"!",
"is_null",
"(",
"$",
"sEndDate",
")",
")",
"{",
"$",
"query",
".=",
"\" AND `datecreated` <= '\"",
".",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"real_escape_string",
"(",
"$",
"sEndDate",
")",
".",
"\"' \"",
";",
"}",
"$",
"query",
".=",
"' GROUP BY `data_extranet_user_id`'",
";",
"$",
"dValue",
"=",
"0",
";",
"if",
"(",
"$",
"aRow",
"=",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"fetch_assoc",
"(",
"MySqlLegacySupport",
"::",
"getInstance",
"(",
")",
"->",
"query",
"(",
"$",
"query",
")",
")",
")",
"{",
"$",
"dValue",
"=",
"$",
"aRow",
"[",
"'ordervalue'",
"]",
";",
"}",
"return",
"$",
"dValue",
";",
"}"
] | return the total order value of the customer.
@param string|null $sStartDate
@param string|null $sEndDate
@return float | [
"return",
"the",
"total",
"order",
"value",
"of",
"the",
"customer",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L566-L586 |
31,823 | chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php | TShopDataExtranetUser.Logout | public function Logout()
{
$oBasket = TShopBasket::GetInstance();
if (is_array($oBasket->aCompletedOrderStepList)) {
reset($oBasket->aCompletedOrderStepList);
foreach ($oBasket->aCompletedOrderStepList as $sStepName => $bValue) {
$oBasket->aCompletedOrderStepList[$sStepName] = false;
}
}
parent::Logout();
if (SHOP_CLEAR_BASKET_CONTENTS_ON_LOGOUT) {
if (class_exists('TShopBasket')) {
$oBasket = TShopBasket::GetInstance();
$oBasket->ClearBasket();
}
}
} | php | public function Logout()
{
$oBasket = TShopBasket::GetInstance();
if (is_array($oBasket->aCompletedOrderStepList)) {
reset($oBasket->aCompletedOrderStepList);
foreach ($oBasket->aCompletedOrderStepList as $sStepName => $bValue) {
$oBasket->aCompletedOrderStepList[$sStepName] = false;
}
}
parent::Logout();
if (SHOP_CLEAR_BASKET_CONTENTS_ON_LOGOUT) {
if (class_exists('TShopBasket')) {
$oBasket = TShopBasket::GetInstance();
$oBasket->ClearBasket();
}
}
} | [
"public",
"function",
"Logout",
"(",
")",
"{",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"oBasket",
"->",
"aCompletedOrderStepList",
")",
")",
"{",
"reset",
"(",
"$",
"oBasket",
"->",
"aCompletedOrderStepList",
")",
";",
"foreach",
"(",
"$",
"oBasket",
"->",
"aCompletedOrderStepList",
"as",
"$",
"sStepName",
"=>",
"$",
"bValue",
")",
"{",
"$",
"oBasket",
"->",
"aCompletedOrderStepList",
"[",
"$",
"sStepName",
"]",
"=",
"false",
";",
"}",
"}",
"parent",
"::",
"Logout",
"(",
")",
";",
"if",
"(",
"SHOP_CLEAR_BASKET_CONTENTS_ON_LOGOUT",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'TShopBasket'",
")",
")",
"{",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oBasket",
"->",
"ClearBasket",
"(",
")",
";",
"}",
"}",
"}"
] | logs the user out. | [
"logs",
"the",
"user",
"out",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php#L605-L622 |
31,824 | chameleon-system/chameleon-shop | src/ShopBundle/Payment/PaymentConfig/ShopPaymentConfigLoader.php | ShopPaymentConfigLoader.isApplicable | private function isApplicable(ShopPaymentConfigRawValue $value, $environment, $portalId)
{
return (($environment === $value->getEnvironment()) || (IPkgShopOrderPaymentConfig::ENVIRONMENT_COMMON === $value->getEnvironment()))
&& (($portalId === $value->getPortalId()) || ('' === $value->getPortalId()));
} | php | private function isApplicable(ShopPaymentConfigRawValue $value, $environment, $portalId)
{
return (($environment === $value->getEnvironment()) || (IPkgShopOrderPaymentConfig::ENVIRONMENT_COMMON === $value->getEnvironment()))
&& (($portalId === $value->getPortalId()) || ('' === $value->getPortalId()));
} | [
"private",
"function",
"isApplicable",
"(",
"ShopPaymentConfigRawValue",
"$",
"value",
",",
"$",
"environment",
",",
"$",
"portalId",
")",
"{",
"return",
"(",
"(",
"$",
"environment",
"===",
"$",
"value",
"->",
"getEnvironment",
"(",
")",
")",
"||",
"(",
"IPkgShopOrderPaymentConfig",
"::",
"ENVIRONMENT_COMMON",
"===",
"$",
"value",
"->",
"getEnvironment",
"(",
")",
")",
")",
"&&",
"(",
"(",
"$",
"portalId",
"===",
"$",
"value",
"->",
"getPortalId",
"(",
")",
")",
"||",
"(",
"''",
"===",
"$",
"value",
"->",
"getPortalId",
"(",
")",
")",
")",
";",
"}"
] | Returns true if the given config value can be applied, i.e. the environment and portal do match.
@param ShopPaymentConfigRawValue $value
@param string $environment one of IPkgShopOrderPaymentConfig::ENVIRONMENT_*
@param string $portalId
@return bool | [
"Returns",
"true",
"if",
"the",
"given",
"config",
"value",
"can",
"be",
"applied",
"i",
".",
"e",
".",
"the",
"environment",
"and",
"portal",
"do",
"match",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/Payment/PaymentConfig/ShopPaymentConfigLoader.php#L301-L305 |
31,825 | chameleon-system/chameleon-shop | src/ShopBundle/Payment/PaymentConfig/ShopPaymentConfigLoader.php | ShopPaymentConfigLoader.hasHigherPriority | private function hasHigherPriority(
ShopPaymentConfigRawValue $value1,
ShopPaymentConfigRawValue $value2,
$environment,
$portalId
) {
if ($this->hasHigherSourcePriority($value1, $value2)) {
return true;
}
if ($this->hasHigherPortalPriority($value1, $value2, $portalId)) {
return true;
}
if ($this->hasHigherEnvironmentPriority($value1, $value2, $environment)) {
return true;
}
return false;
} | php | private function hasHigherPriority(
ShopPaymentConfigRawValue $value1,
ShopPaymentConfigRawValue $value2,
$environment,
$portalId
) {
if ($this->hasHigherSourcePriority($value1, $value2)) {
return true;
}
if ($this->hasHigherPortalPriority($value1, $value2, $portalId)) {
return true;
}
if ($this->hasHigherEnvironmentPriority($value1, $value2, $environment)) {
return true;
}
return false;
} | [
"private",
"function",
"hasHigherPriority",
"(",
"ShopPaymentConfigRawValue",
"$",
"value1",
",",
"ShopPaymentConfigRawValue",
"$",
"value2",
",",
"$",
"environment",
",",
"$",
"portalId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasHigherSourcePriority",
"(",
"$",
"value1",
",",
"$",
"value2",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"hasHigherPortalPriority",
"(",
"$",
"value1",
",",
"$",
"value2",
",",
"$",
"portalId",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"hasHigherEnvironmentPriority",
"(",
"$",
"value1",
",",
"$",
"value2",
",",
"$",
"environment",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Returns true if value1 has a higher priority than value2.
@param ShopPaymentConfigRawValue $value1
@param ShopPaymentConfigRawValue $value2
@param string $environment one of IPkgShopOrderPaymentConfig::ENVIRONMENT_*
@param string $portalId
@return bool | [
"Returns",
"true",
"if",
"value1",
"has",
"a",
"higher",
"priority",
"than",
"value2",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/Payment/PaymentConfig/ShopPaymentConfigLoader.php#L317-L334 |
31,826 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/WebServerExample.php | WebServerExample.waitForNotificationToBeProcessedBeforeContinuing | protected function waitForNotificationToBeProcessedBeforeContinuing(
$identifier,
$notificationType
) {
$fileName = $this->folderPath . $identifier . "_" . $notificationType . ".txt";
// timeout after 1 minute
$totalChecks = 0;
while (!file_exists($fileName) && $totalChecks < 20) {
sleep(5);
$totalChecks += 1;
}
if ($totalChecks >= 20) {
throw new ErrorException(
"IPN has not been received within timeout period exiting sample"
);
}
} | php | protected function waitForNotificationToBeProcessedBeforeContinuing(
$identifier,
$notificationType
) {
$fileName = $this->folderPath . $identifier . "_" . $notificationType . ".txt";
// timeout after 1 minute
$totalChecks = 0;
while (!file_exists($fileName) && $totalChecks < 20) {
sleep(5);
$totalChecks += 1;
}
if ($totalChecks >= 20) {
throw new ErrorException(
"IPN has not been received within timeout period exiting sample"
);
}
} | [
"protected",
"function",
"waitForNotificationToBeProcessedBeforeContinuing",
"(",
"$",
"identifier",
",",
"$",
"notificationType",
")",
"{",
"$",
"fileName",
"=",
"$",
"this",
"->",
"folderPath",
".",
"$",
"identifier",
".",
"\"_\"",
".",
"$",
"notificationType",
".",
"\".txt\"",
";",
"// timeout after 1 minute",
"$",
"totalChecks",
"=",
"0",
";",
"while",
"(",
"!",
"file_exists",
"(",
"$",
"fileName",
")",
"&&",
"$",
"totalChecks",
"<",
"20",
")",
"{",
"sleep",
"(",
"5",
")",
";",
"$",
"totalChecks",
"+=",
"1",
";",
"}",
"if",
"(",
"$",
"totalChecks",
">=",
"20",
")",
"{",
"throw",
"new",
"ErrorException",
"(",
"\"IPN has not been received within timeout period exiting sample\"",
")",
";",
"}",
"}"
] | Check that we have received an IPN notification for the defined event
For PHP, there is an IPN handler that will write the contents of the IPN to
a file in the format of
<amazonOrderReferenceId>_<amazonAuthorizationId>_Authorization.
This method will check for the presnece of this file
and will loop/timeout until the notification has been handled.
Merchants can use alternative approaches such as memory caches,
shared memory or database storage so that scripts serving user
pages are able to check on the status of a notification
@param string $identifier transaction that we are waiting to query
@param string $notificationType notificationType notification type
that we expect
@return void | [
"Check",
"that",
"we",
"have",
"received",
"an",
"IPN",
"notification",
"for",
"the",
"defined",
"event"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/WebServerExample.php#L105-L122 |
31,827 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/WebServerExample.php | WebServerExample.printResponseToWebpage | protected function printResponseToWebpage($stepName, $arg=array())
{
ob_start();
call_user_func_array($stepName, $arg);
$result = ob_get_contents();
ob_clean();
$result = preg_replace("/(\\n)/", HTML_LB, $result);
$result = preg_replace("/(\\s)/", " ", $result);
print $result;
} | php | protected function printResponseToWebpage($stepName, $arg=array())
{
ob_start();
call_user_func_array($stepName, $arg);
$result = ob_get_contents();
ob_clean();
$result = preg_replace("/(\\n)/", HTML_LB, $result);
$result = preg_replace("/(\\s)/", " ", $result);
print $result;
} | [
"protected",
"function",
"printResponseToWebpage",
"(",
"$",
"stepName",
",",
"$",
"arg",
"=",
"array",
"(",
")",
")",
"{",
"ob_start",
"(",
")",
";",
"call_user_func_array",
"(",
"$",
"stepName",
",",
"$",
"arg",
")",
";",
"$",
"result",
"=",
"ob_get_contents",
"(",
")",
";",
"ob_clean",
"(",
")",
";",
"$",
"result",
"=",
"preg_replace",
"(",
"\"/(\\\\n)/\"",
",",
"HTML_LB",
",",
"$",
"result",
")",
";",
"$",
"result",
"=",
"preg_replace",
"(",
"\"/(\\\\s)/\"",
",",
"\" \"",
",",
"$",
"result",
")",
";",
"print",
"$",
"result",
";",
"}"
] | Invoke the passed in function and print the results out in
html format to the output buffer
@param string $stepName Name of the function to call
@param array $arg Function arguments
@return void | [
"Invoke",
"the",
"passed",
"in",
"function",
"and",
"print",
"the",
"results",
"out",
"in",
"html",
"format",
"to",
"the",
"output",
"buffer"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/WebServerExample.php#L160-L169 |
31,828 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.getBillingAgreementDetails | public function getBillingAgreementDetails ()
{
$getBillingAgreementDetailsRequest = new OffAmazonPaymentsService_Model_GetBillingAgreementDetailsRequest();
$getBillingAgreementDetailsRequest->setSellerId($this->_sellerId);
$getBillingAgreementDetailsRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
return $this->_service->getBillingAgreementDetails($getBillingAgreementDetailsRequest);
} | php | public function getBillingAgreementDetails ()
{
$getBillingAgreementDetailsRequest = new OffAmazonPaymentsService_Model_GetBillingAgreementDetailsRequest();
$getBillingAgreementDetailsRequest->setSellerId($this->_sellerId);
$getBillingAgreementDetailsRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
return $this->_service->getBillingAgreementDetails($getBillingAgreementDetailsRequest);
} | [
"public",
"function",
"getBillingAgreementDetails",
"(",
")",
"{",
"$",
"getBillingAgreementDetailsRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_GetBillingAgreementDetailsRequest",
"(",
")",
";",
"$",
"getBillingAgreementDetailsRequest",
"->",
"setSellerId",
"(",
"$",
"this",
"->",
"_sellerId",
")",
";",
"$",
"getBillingAgreementDetailsRequest",
"->",
"setAmazonBillingAgreementId",
"(",
"$",
"this",
"->",
"_amazonBillingAgreementId",
")",
";",
"return",
"$",
"this",
"->",
"_service",
"->",
"getBillingAgreementDetails",
"(",
"$",
"getBillingAgreementDetailsRequest",
")",
";",
"}"
] | Use the billing agreement object to query the automatic payment
information, including the current physical delivery address as selected
by the buyer
@return OffAmazonPaymentsService_Model_GetBillingAgreementDetailsResponse
service response | [
"Use",
"the",
"billing",
"agreement",
"object",
"to",
"query",
"the",
"automatic",
"payment",
"information",
"including",
"the",
"current",
"physical",
"delivery",
"address",
"as",
"selected",
"by",
"the",
"buyer"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L87-L95 |
31,829 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.calculatePaymentAmountBasedOnBuyerDetails | public function calculatePaymentAmountBasedOnBuyerDetails ($BillingAgreementDetails,
$orderAmountPreTaxAndShipping, $shippingType)
{
return $this->_shippingAndTaxCostHelper->calculateTotalAmount($BillingAgreementDetails,
$orderAmountPreTaxAndShipping, $shippingType);
} | php | public function calculatePaymentAmountBasedOnBuyerDetails ($BillingAgreementDetails,
$orderAmountPreTaxAndShipping, $shippingType)
{
return $this->_shippingAndTaxCostHelper->calculateTotalAmount($BillingAgreementDetails,
$orderAmountPreTaxAndShipping, $shippingType);
} | [
"public",
"function",
"calculatePaymentAmountBasedOnBuyerDetails",
"(",
"$",
"BillingAgreementDetails",
",",
"$",
"orderAmountPreTaxAndShipping",
",",
"$",
"shippingType",
")",
"{",
"return",
"$",
"this",
"->",
"_shippingAndTaxCostHelper",
"->",
"calculateTotalAmount",
"(",
"$",
"BillingAgreementDetails",
",",
"$",
"orderAmountPreTaxAndShipping",
",",
"$",
"shippingType",
")",
";",
"}"
] | Calculate the amount to charge the buyer for each payment, based on the
buyer destination address
Note that until the billing agreement is confirmed, the name & address
fields will not be returned to the client.
@param OffAmazonPaymentsService_Model_BillingAgreementDetails $BillingAgreementDetails
response
@param string $orderAmountPreTaxAndShipping
order amount
@param int $shippingType
shipping type
@return float total amount for the order, with shipping and tax included | [
"Calculate",
"the",
"amount",
"to",
"charge",
"the",
"buyer",
"for",
"each",
"payment",
"based",
"on",
"the",
"buyer",
"destination",
"address"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L113-L118 |
31,830 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.addSellerInformationToBillingAgreement | public function addSellerInformationToBillingAgreement ()
{
$sellerBillingAgreementAttributes = new OffAmazonPaymentsService_Model_SellerBillingAgreementAttributes();
$sellerBillingAgreementAttributes->setSellerBillingAgreementId(
$this->_amazonBillingAgreementId);
$sellerBillingAgreementAttributes->setStoreName("Your store name here");
$sellerBillingAgreementAttributes->setCustomInformation(
"Additional information you wish to include with this billing agreement.");
$billingAgreementAttributes = new OffAmazonPaymentsService_Model_BillingAgreementAttributes();
$billingAgreementAttributes->setSellerNote(
"Description of the billing agreement that is displayed to the buyer in the emails.");
$billingAgreementAttributes->setSellerBillingAgreementAttributes(
$sellerBillingAgreementAttributes);
$setBillingAgreementDetailsRequest = new OffAmazonPaymentsService_Model_SetBillingAgreementDetailsRequest();
$setBillingAgreementDetailsRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$setBillingAgreementDetailsRequest->setSellerId($this->_sellerId);
$setBillingAgreementDetailsRequest->setBillingAgreementAttributes(
$billingAgreementAttributes);
return $this->_service->setBillingAgreementDetails($setBillingAgreementDetailsRequest);
} | php | public function addSellerInformationToBillingAgreement ()
{
$sellerBillingAgreementAttributes = new OffAmazonPaymentsService_Model_SellerBillingAgreementAttributes();
$sellerBillingAgreementAttributes->setSellerBillingAgreementId(
$this->_amazonBillingAgreementId);
$sellerBillingAgreementAttributes->setStoreName("Your store name here");
$sellerBillingAgreementAttributes->setCustomInformation(
"Additional information you wish to include with this billing agreement.");
$billingAgreementAttributes = new OffAmazonPaymentsService_Model_BillingAgreementAttributes();
$billingAgreementAttributes->setSellerNote(
"Description of the billing agreement that is displayed to the buyer in the emails.");
$billingAgreementAttributes->setSellerBillingAgreementAttributes(
$sellerBillingAgreementAttributes);
$setBillingAgreementDetailsRequest = new OffAmazonPaymentsService_Model_SetBillingAgreementDetailsRequest();
$setBillingAgreementDetailsRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$setBillingAgreementDetailsRequest->setSellerId($this->_sellerId);
$setBillingAgreementDetailsRequest->setBillingAgreementAttributes(
$billingAgreementAttributes);
return $this->_service->setBillingAgreementDetails($setBillingAgreementDetailsRequest);
} | [
"public",
"function",
"addSellerInformationToBillingAgreement",
"(",
")",
"{",
"$",
"sellerBillingAgreementAttributes",
"=",
"new",
"OffAmazonPaymentsService_Model_SellerBillingAgreementAttributes",
"(",
")",
";",
"$",
"sellerBillingAgreementAttributes",
"->",
"setSellerBillingAgreementId",
"(",
"$",
"this",
"->",
"_amazonBillingAgreementId",
")",
";",
"$",
"sellerBillingAgreementAttributes",
"->",
"setStoreName",
"(",
"\"Your store name here\"",
")",
";",
"$",
"sellerBillingAgreementAttributes",
"->",
"setCustomInformation",
"(",
"\"Additional information you wish to include with this billing agreement.\"",
")",
";",
"$",
"billingAgreementAttributes",
"=",
"new",
"OffAmazonPaymentsService_Model_BillingAgreementAttributes",
"(",
")",
";",
"$",
"billingAgreementAttributes",
"->",
"setSellerNote",
"(",
"\"Description of the billing agreement that is displayed to the buyer in the emails.\"",
")",
";",
"$",
"billingAgreementAttributes",
"->",
"setSellerBillingAgreementAttributes",
"(",
"$",
"sellerBillingAgreementAttributes",
")",
";",
"$",
"setBillingAgreementDetailsRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_SetBillingAgreementDetailsRequest",
"(",
")",
";",
"$",
"setBillingAgreementDetailsRequest",
"->",
"setAmazonBillingAgreementId",
"(",
"$",
"this",
"->",
"_amazonBillingAgreementId",
")",
";",
"$",
"setBillingAgreementDetailsRequest",
"->",
"setSellerId",
"(",
"$",
"this",
"->",
"_sellerId",
")",
";",
"$",
"setBillingAgreementDetailsRequest",
"->",
"setBillingAgreementAttributes",
"(",
"$",
"billingAgreementAttributes",
")",
";",
"return",
"$",
"this",
"->",
"_service",
"->",
"setBillingAgreementDetails",
"(",
"$",
"setBillingAgreementDetailsRequest",
")",
";",
"}"
] | Set seller specific information to the billing agreement details.
@return OffAmazonPaymentsService_Model_SetBillingAgreementDetailsResponse
service response | [
"Set",
"seller",
"specific",
"information",
"to",
"the",
"billing",
"agreement",
"details",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L126-L148 |
31,831 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.confirmBillingAgreement | public function confirmBillingAgreement ()
{
$confirmBillingAgreementRequest = new OffAmazonPaymentsService_Model_ConfirmBillingAgreementRequest();
$confirmBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$confirmBillingAgreementRequest->setSellerId($this->_sellerId);
return $this->_service->confirmBillingAgreement($confirmBillingAgreementRequest);
} | php | public function confirmBillingAgreement ()
{
$confirmBillingAgreementRequest = new OffAmazonPaymentsService_Model_ConfirmBillingAgreementRequest();
$confirmBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$confirmBillingAgreementRequest->setSellerId($this->_sellerId);
return $this->_service->confirmBillingAgreement($confirmBillingAgreementRequest);
} | [
"public",
"function",
"confirmBillingAgreement",
"(",
")",
"{",
"$",
"confirmBillingAgreementRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_ConfirmBillingAgreementRequest",
"(",
")",
";",
"$",
"confirmBillingAgreementRequest",
"->",
"setAmazonBillingAgreementId",
"(",
"$",
"this",
"->",
"_amazonBillingAgreementId",
")",
";",
"$",
"confirmBillingAgreementRequest",
"->",
"setSellerId",
"(",
"$",
"this",
"->",
"_sellerId",
")",
";",
"return",
"$",
"this",
"->",
"_service",
"->",
"confirmBillingAgreement",
"(",
"$",
"confirmBillingAgreementRequest",
")",
";",
"}"
] | Confirm the billing agreement information, allowing for authorizations
and captures to be created
@return OffAmazonPaymentsService_Model_ConfirmBillingAgreementResponse
service response | [
"Confirm",
"the",
"billing",
"agreement",
"information",
"allowing",
"for",
"authorizations",
"and",
"captures",
"to",
"be",
"created"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L157-L165 |
31,832 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.validateBillingAgreement | public function validateBillingAgreement ()
{
$validateBillingAgreementRequest = new OffAmazonPaymentsService_Model_ValidateBillingAgreementRequest();
$validateBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$validateBillingAgreementRequest->setSellerId($this->_sellerId);
return $this->_service->validateBillingAgreement($validateBillingAgreementRequest);
} | php | public function validateBillingAgreement ()
{
$validateBillingAgreementRequest = new OffAmazonPaymentsService_Model_ValidateBillingAgreementRequest();
$validateBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$validateBillingAgreementRequest->setSellerId($this->_sellerId);
return $this->_service->validateBillingAgreement($validateBillingAgreementRequest);
} | [
"public",
"function",
"validateBillingAgreement",
"(",
")",
"{",
"$",
"validateBillingAgreementRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_ValidateBillingAgreementRequest",
"(",
")",
";",
"$",
"validateBillingAgreementRequest",
"->",
"setAmazonBillingAgreementId",
"(",
"$",
"this",
"->",
"_amazonBillingAgreementId",
")",
";",
"$",
"validateBillingAgreementRequest",
"->",
"setSellerId",
"(",
"$",
"this",
"->",
"_sellerId",
")",
";",
"return",
"$",
"this",
"->",
"_service",
"->",
"validateBillingAgreement",
"(",
"$",
"validateBillingAgreementRequest",
")",
";",
"}"
] | Check that the billing agreement is in valid status and the selected payment
method is also valid.
@return OffAmazonPaymentsService_Model_ValidateBillingAgreementResponse
service response | [
"Check",
"that",
"the",
"billing",
"agreement",
"is",
"in",
"valid",
"status",
"and",
"the",
"selected",
"payment",
"method",
"is",
"also",
"valid",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L174-L182 |
31,833 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.authorizePaymentAmount | public function authorizePaymentAmount ($authorizationAmount, $authorizationReferenceId)
{
$authorizeOnBillingAgreementRequest = $this->_createAuthorizeOnBillingAgreementRequest(
$authorizationAmount, $authorizationReferenceId, false);
return $this->_service->authorizeOnBillingAgreement($authorizeOnBillingAgreementRequest);
} | php | public function authorizePaymentAmount ($authorizationAmount, $authorizationReferenceId)
{
$authorizeOnBillingAgreementRequest = $this->_createAuthorizeOnBillingAgreementRequest(
$authorizationAmount, $authorizationReferenceId, false);
return $this->_service->authorizeOnBillingAgreement($authorizeOnBillingAgreementRequest);
} | [
"public",
"function",
"authorizePaymentAmount",
"(",
"$",
"authorizationAmount",
",",
"$",
"authorizationReferenceId",
")",
"{",
"$",
"authorizeOnBillingAgreementRequest",
"=",
"$",
"this",
"->",
"_createAuthorizeOnBillingAgreementRequest",
"(",
"$",
"authorizationAmount",
",",
"$",
"authorizationReferenceId",
",",
"false",
")",
";",
"return",
"$",
"this",
"->",
"_service",
"->",
"authorizeOnBillingAgreement",
"(",
"$",
"authorizeOnBillingAgreementRequest",
")",
";",
"}"
] | Perform the authorize call on the billing agreement
@param float $authorizationAmount
amount to authorize from the buyer
@param string $authorizationReferenceId
seller provided authorization reference id
@return OffAmazonPaymentsService_Model_AuthorizeOnBillingAgreementResponse
service response | [
"Perform",
"the",
"authorize",
"call",
"on",
"the",
"billing",
"agreement"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L196-L201 |
31,834 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.authorizePaymentAmountWithCaptureNow | public function authorizePaymentAmountWithCaptureNow ($authorizationAmount,
$authorizationReferenceId)
{
$authorizeOnBillingAgreementRequest = $this->_createAuthorizeOnBillingAgreementRequest(
$authorizationAmount, $authorizationReferenceId, true);
return $this->_service->authorizeOnBillingAgreement($authorizeOnBillingAgreementRequest);
} | php | public function authorizePaymentAmountWithCaptureNow ($authorizationAmount,
$authorizationReferenceId)
{
$authorizeOnBillingAgreementRequest = $this->_createAuthorizeOnBillingAgreementRequest(
$authorizationAmount, $authorizationReferenceId, true);
return $this->_service->authorizeOnBillingAgreement($authorizeOnBillingAgreementRequest);
} | [
"public",
"function",
"authorizePaymentAmountWithCaptureNow",
"(",
"$",
"authorizationAmount",
",",
"$",
"authorizationReferenceId",
")",
"{",
"$",
"authorizeOnBillingAgreementRequest",
"=",
"$",
"this",
"->",
"_createAuthorizeOnBillingAgreementRequest",
"(",
"$",
"authorizationAmount",
",",
"$",
"authorizationReferenceId",
",",
"true",
")",
";",
"return",
"$",
"this",
"->",
"_service",
"->",
"authorizeOnBillingAgreement",
"(",
"$",
"authorizeOnBillingAgreementRequest",
")",
";",
"}"
] | Authorize on the billing agreement with auto capture
@param float $authorizationAmount
amount to authorize from the buyer
@param string $authorizationReferenceId
seller provided authorization reference id
@return OffAmazonPaymentsService_Model_AuthorizeOnBillingAgreementResponse
service response | [
"Authorize",
"on",
"the",
"billing",
"agreement",
"with",
"auto",
"capture"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L215-L221 |
31,835 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample._createAuthorizeOnBillingAgreementRequest | private function _createAuthorizeOnBillingAgreementRequest ($authorizationAmount,
$authorizationReferenceId, $CaptureNow)
{
$authorizeOnBillingAgreementRequest = new OffAmazonPaymentsService_Model_AuthorizeOnBillingAgreementRequest();
$authorizeOnBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$authorizeOnBillingAgreementRequest->setSellerId($this->_sellerId);
$authorizeOnBillingAgreementRequest->setAuthorizationReferenceId($authorizationReferenceId);
$authorizeOnBillingAgreementRequest->setAuthorizationAmount(
new OffAmazonPaymentsService_Model_Price());
$authorizeOnBillingAgreementRequest->getAuthorizationAmount()->setAmount(
$authorizationAmount);
$authorizeOnBillingAgreementRequest->getAuthorizationAmount()->setCurrencyCode(
$this->_service->getMerchantValues()
->getCurrency());
$authorizeOnBillingAgreementRequest->setCaptureNow($CaptureNow);
return $authorizeOnBillingAgreementRequest;
} | php | private function _createAuthorizeOnBillingAgreementRequest ($authorizationAmount,
$authorizationReferenceId, $CaptureNow)
{
$authorizeOnBillingAgreementRequest = new OffAmazonPaymentsService_Model_AuthorizeOnBillingAgreementRequest();
$authorizeOnBillingAgreementRequest->setAmazonBillingAgreementId(
$this->_amazonBillingAgreementId);
$authorizeOnBillingAgreementRequest->setSellerId($this->_sellerId);
$authorizeOnBillingAgreementRequest->setAuthorizationReferenceId($authorizationReferenceId);
$authorizeOnBillingAgreementRequest->setAuthorizationAmount(
new OffAmazonPaymentsService_Model_Price());
$authorizeOnBillingAgreementRequest->getAuthorizationAmount()->setAmount(
$authorizationAmount);
$authorizeOnBillingAgreementRequest->getAuthorizationAmount()->setCurrencyCode(
$this->_service->getMerchantValues()
->getCurrency());
$authorizeOnBillingAgreementRequest->setCaptureNow($CaptureNow);
return $authorizeOnBillingAgreementRequest;
} | [
"private",
"function",
"_createAuthorizeOnBillingAgreementRequest",
"(",
"$",
"authorizationAmount",
",",
"$",
"authorizationReferenceId",
",",
"$",
"CaptureNow",
")",
"{",
"$",
"authorizeOnBillingAgreementRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_AuthorizeOnBillingAgreementRequest",
"(",
")",
";",
"$",
"authorizeOnBillingAgreementRequest",
"->",
"setAmazonBillingAgreementId",
"(",
"$",
"this",
"->",
"_amazonBillingAgreementId",
")",
";",
"$",
"authorizeOnBillingAgreementRequest",
"->",
"setSellerId",
"(",
"$",
"this",
"->",
"_sellerId",
")",
";",
"$",
"authorizeOnBillingAgreementRequest",
"->",
"setAuthorizationReferenceId",
"(",
"$",
"authorizationReferenceId",
")",
";",
"$",
"authorizeOnBillingAgreementRequest",
"->",
"setAuthorizationAmount",
"(",
"new",
"OffAmazonPaymentsService_Model_Price",
"(",
")",
")",
";",
"$",
"authorizeOnBillingAgreementRequest",
"->",
"getAuthorizationAmount",
"(",
")",
"->",
"setAmount",
"(",
"$",
"authorizationAmount",
")",
";",
"$",
"authorizeOnBillingAgreementRequest",
"->",
"getAuthorizationAmount",
"(",
")",
"->",
"setCurrencyCode",
"(",
"$",
"this",
"->",
"_service",
"->",
"getMerchantValues",
"(",
")",
"->",
"getCurrency",
"(",
")",
")",
";",
"$",
"authorizeOnBillingAgreementRequest",
"->",
"setCaptureNow",
"(",
"$",
"CaptureNow",
")",
";",
"return",
"$",
"authorizeOnBillingAgreementRequest",
";",
"}"
] | Create AuthorizeOnBillingAgreement request
@param float $authorizationAmount
@param string $authorizationReferenceId
@param bool $CaptureNow
@return OffAmazonPaymentsService_Model_AuthorizeOnBillingAgreementRequest | [
"Create",
"AuthorizeOnBillingAgreement",
"request"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L232-L249 |
31,836 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.getCaptureDetails | public function getCaptureDetails ($amazonCaptureId)
{
$captureDetailsRequest = new OffAmazonPaymentsService_Model_GetCaptureDetailsRequest();
$captureDetailsRequest->setSellerId($this->_sellerId);
$captureDetailsRequest->setAmazonCaptureId($amazonCaptureId);
return $this->_service->getCaptureDetails($captureDetailsRequest);
} | php | public function getCaptureDetails ($amazonCaptureId)
{
$captureDetailsRequest = new OffAmazonPaymentsService_Model_GetCaptureDetailsRequest();
$captureDetailsRequest->setSellerId($this->_sellerId);
$captureDetailsRequest->setAmazonCaptureId($amazonCaptureId);
return $this->_service->getCaptureDetails($captureDetailsRequest);
} | [
"public",
"function",
"getCaptureDetails",
"(",
"$",
"amazonCaptureId",
")",
"{",
"$",
"captureDetailsRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_GetCaptureDetailsRequest",
"(",
")",
";",
"$",
"captureDetailsRequest",
"->",
"setSellerId",
"(",
"$",
"this",
"->",
"_sellerId",
")",
";",
"$",
"captureDetailsRequest",
"->",
"setAmazonCaptureId",
"(",
"$",
"amazonCaptureId",
")",
";",
"return",
"$",
"this",
"->",
"_service",
"->",
"getCaptureDetails",
"(",
"$",
"captureDetailsRequest",
")",
";",
"}"
] | Perform the get capture details call for the order
@param string $amazonCaptureId
capture it to get details for
@return OffAmazonPaymentsService_Model_CaptureResponse service response | [
"Perform",
"the",
"get",
"capture",
"details",
"call",
"for",
"the",
"order"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L338-L345 |
31,837 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php | AutomaticPaymentsSimpleCheckoutExample.closeBillingAgreement | public function closeBillingAgreement ()
{
$closeBillingAgreementRequest = new OffAmazonPaymentsService_Model_CloseBillingAgreementRequest();
$closeBillingAgreementRequest->setSellerId($this->_sellerId);
$closeBillingAgreementRequest->setAmazonBillingAgreementId($this->_amazonBillingAgreementId);
$closeBillingAgreementRequest->setClosureReason("Automatic payment complete");
return $this->_service->closeBillingAgreement($closeBillingAgreementRequest);
} | php | public function closeBillingAgreement ()
{
$closeBillingAgreementRequest = new OffAmazonPaymentsService_Model_CloseBillingAgreementRequest();
$closeBillingAgreementRequest->setSellerId($this->_sellerId);
$closeBillingAgreementRequest->setAmazonBillingAgreementId($this->_amazonBillingAgreementId);
$closeBillingAgreementRequest->setClosureReason("Automatic payment complete");
return $this->_service->closeBillingAgreement($closeBillingAgreementRequest);
} | [
"public",
"function",
"closeBillingAgreement",
"(",
")",
"{",
"$",
"closeBillingAgreementRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_CloseBillingAgreementRequest",
"(",
")",
";",
"$",
"closeBillingAgreementRequest",
"->",
"setSellerId",
"(",
"$",
"this",
"->",
"_sellerId",
")",
";",
"$",
"closeBillingAgreementRequest",
"->",
"setAmazonBillingAgreementId",
"(",
"$",
"this",
"->",
"_amazonBillingAgreementId",
")",
";",
"$",
"closeBillingAgreementRequest",
"->",
"setClosureReason",
"(",
"\"Automatic payment complete\"",
")",
";",
"return",
"$",
"this",
"->",
"_service",
"->",
"closeBillingAgreement",
"(",
"$",
"closeBillingAgreementRequest",
")",
";",
"}"
] | Close this billing agreement to indicate that the billing agreement is
complete, and
no further authorizations and captures will be performed on this billing
agreement.
@return OffAmazonPaymentsService_Model_CloseBillingAgreementResponse
service response | [
"Close",
"this",
"billing",
"agreement",
"to",
"indicate",
"that",
"the",
"billing",
"agreement",
"is",
"complete",
"and",
"no",
"further",
"authorizations",
"and",
"captures",
"will",
"be",
"performed",
"on",
"this",
"billing",
"agreement",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/AutomaticPaymentsSimpleCheckoutExample.php#L356-L364 |
31,838 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategoryList.class.php | TShopCategoryList.& | public static function &GetArticleCategories($iArticleId, $sLanguageID = null)
{
$oList = null;
$sCategoryRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction();
if (!empty($sCategoryRestriction)) {
$sCategoryRestriction = ' AND '.$sCategoryRestriction;
}
$db = \ChameleonSystem\CoreBundle\ServiceLocator::get('database_connection');
$query = 'SELECT `shop_category`.*, 1 AS isprimary
FROM `shop_article`
INNER JOIN `shop_category` ON `shop_article`.`shop_category_id` = `shop_category`.`id`
WHERE `shop_article`.`id` = '.$db->quote($iArticleId)."
{$sCategoryRestriction}
UNION DISTINCT
SELECT `shop_category`.*, if (`shop_category`.`id` = `shop_article`.`shop_category_id`, 1, 0) AS isprimary
FROM `shop_category`
INNER JOIN `shop_article_shop_category_mlt` ON `shop_category`.`id` = `shop_article_shop_category_mlt`.`target_id`
INNER JOIN `shop_article` on `shop_article_shop_category_mlt`.`source_id` = `shop_article`.`id`
WHERE `shop_article_shop_category_mlt`.`source_id` = ".$db->quote($iArticleId)."
{$sCategoryRestriction}
ORDER BY isprimary DESC, position ASC
";
return TdbShopCategoryList::GetList($query, $sLanguageID);
} | php | public static function &GetArticleCategories($iArticleId, $sLanguageID = null)
{
$oList = null;
$sCategoryRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction();
if (!empty($sCategoryRestriction)) {
$sCategoryRestriction = ' AND '.$sCategoryRestriction;
}
$db = \ChameleonSystem\CoreBundle\ServiceLocator::get('database_connection');
$query = 'SELECT `shop_category`.*, 1 AS isprimary
FROM `shop_article`
INNER JOIN `shop_category` ON `shop_article`.`shop_category_id` = `shop_category`.`id`
WHERE `shop_article`.`id` = '.$db->quote($iArticleId)."
{$sCategoryRestriction}
UNION DISTINCT
SELECT `shop_category`.*, if (`shop_category`.`id` = `shop_article`.`shop_category_id`, 1, 0) AS isprimary
FROM `shop_category`
INNER JOIN `shop_article_shop_category_mlt` ON `shop_category`.`id` = `shop_article_shop_category_mlt`.`target_id`
INNER JOIN `shop_article` on `shop_article_shop_category_mlt`.`source_id` = `shop_article`.`id`
WHERE `shop_article_shop_category_mlt`.`source_id` = ".$db->quote($iArticleId)."
{$sCategoryRestriction}
ORDER BY isprimary DESC, position ASC
";
return TdbShopCategoryList::GetList($query, $sLanguageID);
} | [
"public",
"static",
"function",
"&",
"GetArticleCategories",
"(",
"$",
"iArticleId",
",",
"$",
"sLanguageID",
"=",
"null",
")",
"{",
"$",
"oList",
"=",
"null",
";",
"$",
"sCategoryRestriction",
"=",
"TdbShopCategoryList",
"::",
"GetActiveCategoryQueryRestriction",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sCategoryRestriction",
")",
")",
"{",
"$",
"sCategoryRestriction",
"=",
"' AND '",
".",
"$",
"sCategoryRestriction",
";",
"}",
"$",
"db",
"=",
"\\",
"ChameleonSystem",
"\\",
"CoreBundle",
"\\",
"ServiceLocator",
"::",
"get",
"(",
"'database_connection'",
")",
";",
"$",
"query",
"=",
"'SELECT `shop_category`.*, 1 AS isprimary\n FROM `shop_article`\n INNER JOIN `shop_category` ON `shop_article`.`shop_category_id` = `shop_category`.`id`\n WHERE `shop_article`.`id` = '",
".",
"$",
"db",
"->",
"quote",
"(",
"$",
"iArticleId",
")",
".",
"\"\n {$sCategoryRestriction}\n\n UNION DISTINCT\n\n SELECT `shop_category`.*, if (`shop_category`.`id` = `shop_article`.`shop_category_id`, 1, 0) AS isprimary\n FROM `shop_category`\n INNER JOIN `shop_article_shop_category_mlt` ON `shop_category`.`id` = `shop_article_shop_category_mlt`.`target_id`\n INNER JOIN `shop_article` on `shop_article_shop_category_mlt`.`source_id` = `shop_article`.`id`\n WHERE `shop_article_shop_category_mlt`.`source_id` = \"",
".",
"$",
"db",
"->",
"quote",
"(",
"$",
"iArticleId",
")",
".",
"\"\n {$sCategoryRestriction}\n\n ORDER BY isprimary DESC, position ASC\n \"",
";",
"return",
"TdbShopCategoryList",
"::",
"GetList",
"(",
"$",
"query",
",",
"$",
"sLanguageID",
")",
";",
"}"
] | return all categories connected to the article
Add main category from article to list on first position.
@param int $iArticleId
@param string $sLanguageID
@return TdbShopCategoryList | [
"return",
"all",
"categories",
"connected",
"to",
"the",
"article",
"Add",
"main",
"category",
"from",
"article",
"to",
"list",
"on",
"first",
"position",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L29-L57 |
31,839 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategoryList.class.php | TShopCategoryList.& | public static function &GetRootCategoryList($sLanguageID = null)
{
if (null === $sLanguageID) {
$sLanguageID = self::getMyLanguageService()->getActiveLanguageId();
}
$sRestriction = "(`shop_category`.`shop_category_id` = '0' OR `shop_category`.`shop_category_id` = '')";
$sCategoryRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction();
if (!empty($sCategoryRestriction)) {
$sRestriction = $sRestriction.' AND '.$sCategoryRestriction;
}
$sQuery = self::GetDefaultQuery($sLanguageID, $sRestriction);
return TdbShopCategoryList::GetList($sQuery, $sLanguageID);
} | php | public static function &GetRootCategoryList($sLanguageID = null)
{
if (null === $sLanguageID) {
$sLanguageID = self::getMyLanguageService()->getActiveLanguageId();
}
$sRestriction = "(`shop_category`.`shop_category_id` = '0' OR `shop_category`.`shop_category_id` = '')";
$sCategoryRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction();
if (!empty($sCategoryRestriction)) {
$sRestriction = $sRestriction.' AND '.$sCategoryRestriction;
}
$sQuery = self::GetDefaultQuery($sLanguageID, $sRestriction);
return TdbShopCategoryList::GetList($sQuery, $sLanguageID);
} | [
"public",
"static",
"function",
"&",
"GetRootCategoryList",
"(",
"$",
"sLanguageID",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"sLanguageID",
")",
"{",
"$",
"sLanguageID",
"=",
"self",
"::",
"getMyLanguageService",
"(",
")",
"->",
"getActiveLanguageId",
"(",
")",
";",
"}",
"$",
"sRestriction",
"=",
"\"(`shop_category`.`shop_category_id` = '0' OR `shop_category`.`shop_category_id` = '')\"",
";",
"$",
"sCategoryRestriction",
"=",
"TdbShopCategoryList",
"::",
"GetActiveCategoryQueryRestriction",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sCategoryRestriction",
")",
")",
"{",
"$",
"sRestriction",
"=",
"$",
"sRestriction",
".",
"' AND '",
".",
"$",
"sCategoryRestriction",
";",
"}",
"$",
"sQuery",
"=",
"self",
"::",
"GetDefaultQuery",
"(",
"$",
"sLanguageID",
",",
"$",
"sRestriction",
")",
";",
"return",
"TdbShopCategoryList",
"::",
"GetList",
"(",
"$",
"sQuery",
",",
"$",
"sLanguageID",
")",
";",
"}"
] | return root category list.
@param string|null $sLanguageID
@return TdbShopCategoryList | [
"return",
"root",
"category",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L66-L79 |
31,840 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategoryList.class.php | TShopCategoryList.& | public static function &GetDefaultCategory()
{
static $oCategory;
if (!$oCategory) {
$oRootCategories = &TdbShopCategoryList::GetChildCategories();
if ($oRootCategories->Length() > 0) {
$oCategory = &$oRootCategories->Current();
}
}
return $oCategory;
} | php | public static function &GetDefaultCategory()
{
static $oCategory;
if (!$oCategory) {
$oRootCategories = &TdbShopCategoryList::GetChildCategories();
if ($oRootCategories->Length() > 0) {
$oCategory = &$oRootCategories->Current();
}
}
return $oCategory;
} | [
"public",
"static",
"function",
"&",
"GetDefaultCategory",
"(",
")",
"{",
"static",
"$",
"oCategory",
";",
"if",
"(",
"!",
"$",
"oCategory",
")",
"{",
"$",
"oRootCategories",
"=",
"&",
"TdbShopCategoryList",
"::",
"GetChildCategories",
"(",
")",
";",
"if",
"(",
"$",
"oRootCategories",
"->",
"Length",
"(",
")",
">",
"0",
")",
"{",
"$",
"oCategory",
"=",
"&",
"$",
"oRootCategories",
"->",
"Current",
"(",
")",
";",
"}",
"}",
"return",
"$",
"oCategory",
";",
"}"
] | returns the shops default article category.
@return TdbShopCategory | [
"returns",
"the",
"shops",
"default",
"article",
"category",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L111-L122 |
31,841 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategoryList.class.php | TShopCategoryList.& | public static function &GetChildCategories($iParentId = null, $aFilter = null, $sLanguageID = null)
{
$sActiveSnippetRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction();
if (is_null($iParentId)) {
$iParentId = '';
}
$parameters = array(
'parentId' => $iParentId,
);
$parameterType = array();
$query = 'SELECT `shop_category`.*
FROM `shop_category`
WHERE `shop_category`.`shop_category_id` = :parentId
';
if (!is_null($aFilter) && count($aFilter) > 0) {
$parameters['filter'] = $aFilter;
$parameterType['filter'] = Connection::PARAM_STR_ARRAY;
$query .= ' AND `shop_category`.`id` IN (:filter) ';
}
if (!empty($sActiveSnippetRestriction)) {
$query .= ' AND '.$sActiveSnippetRestriction;
}
$query .= ' ORDER BY `shop_category`.`position` ASC, `shop_category`.`name` ASC';
$oCategories = new TdbShopCategoryList();
$oCategories->SetLanguage($sLanguageID);
$oCategories->Load($query, $parameters, $parameterType);
return $oCategories;
} | php | public static function &GetChildCategories($iParentId = null, $aFilter = null, $sLanguageID = null)
{
$sActiveSnippetRestriction = TdbShopCategoryList::GetActiveCategoryQueryRestriction();
if (is_null($iParentId)) {
$iParentId = '';
}
$parameters = array(
'parentId' => $iParentId,
);
$parameterType = array();
$query = 'SELECT `shop_category`.*
FROM `shop_category`
WHERE `shop_category`.`shop_category_id` = :parentId
';
if (!is_null($aFilter) && count($aFilter) > 0) {
$parameters['filter'] = $aFilter;
$parameterType['filter'] = Connection::PARAM_STR_ARRAY;
$query .= ' AND `shop_category`.`id` IN (:filter) ';
}
if (!empty($sActiveSnippetRestriction)) {
$query .= ' AND '.$sActiveSnippetRestriction;
}
$query .= ' ORDER BY `shop_category`.`position` ASC, `shop_category`.`name` ASC';
$oCategories = new TdbShopCategoryList();
$oCategories->SetLanguage($sLanguageID);
$oCategories->Load($query, $parameters, $parameterType);
return $oCategories;
} | [
"public",
"static",
"function",
"&",
"GetChildCategories",
"(",
"$",
"iParentId",
"=",
"null",
",",
"$",
"aFilter",
"=",
"null",
",",
"$",
"sLanguageID",
"=",
"null",
")",
"{",
"$",
"sActiveSnippetRestriction",
"=",
"TdbShopCategoryList",
"::",
"GetActiveCategoryQueryRestriction",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"iParentId",
")",
")",
"{",
"$",
"iParentId",
"=",
"''",
";",
"}",
"$",
"parameters",
"=",
"array",
"(",
"'parentId'",
"=>",
"$",
"iParentId",
",",
")",
";",
"$",
"parameterType",
"=",
"array",
"(",
")",
";",
"$",
"query",
"=",
"'SELECT `shop_category`.*\n FROM `shop_category`\n WHERE `shop_category`.`shop_category_id` = :parentId\n '",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"aFilter",
")",
"&&",
"count",
"(",
"$",
"aFilter",
")",
">",
"0",
")",
"{",
"$",
"parameters",
"[",
"'filter'",
"]",
"=",
"$",
"aFilter",
";",
"$",
"parameterType",
"[",
"'filter'",
"]",
"=",
"Connection",
"::",
"PARAM_STR_ARRAY",
";",
"$",
"query",
".=",
"' AND `shop_category`.`id` IN (:filter) '",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"sActiveSnippetRestriction",
")",
")",
"{",
"$",
"query",
".=",
"' AND '",
".",
"$",
"sActiveSnippetRestriction",
";",
"}",
"$",
"query",
".=",
"' ORDER BY `shop_category`.`position` ASC, `shop_category`.`name` ASC'",
";",
"$",
"oCategories",
"=",
"new",
"TdbShopCategoryList",
"(",
")",
";",
"$",
"oCategories",
"->",
"SetLanguage",
"(",
"$",
"sLanguageID",
")",
";",
"$",
"oCategories",
"->",
"Load",
"(",
"$",
"query",
",",
"$",
"parameters",
",",
"$",
"parameterType",
")",
";",
"return",
"$",
"oCategories",
";",
"}"
] | returns the child categories of the category identified by iParentId
if no parent id is given, then the root categories will be returned.
@param string|null $iParentId
@param array $aFilter - an optional filter list for the category
@param string|null $sLanguageID
@return TdbShopCategoryList | [
"returns",
"the",
"child",
"categories",
"of",
"the",
"category",
"identified",
"by",
"iParentId",
"if",
"no",
"parent",
"id",
"is",
"given",
"then",
"the",
"root",
"categories",
"will",
"be",
"returned",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L167-L198 |
31,842 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategoryList.class.php | TShopCategoryList.& | public static function &GetCategoryPath($iEndNodeId, $iStartNodeId = null, $sLanguageID = null)
{
if (null === $sLanguageID) {
$sLanguageID = self::getLanguageService()->getActiveLanguageId();
}
$bDone = false;
$iCurrentCatId = $iEndNodeId;
$aTmpList = array(); // we store the list in a tmp array so we can reverse the order
do {
$oCategory = TdbShopCategory::GetNewInstance();
$oCategory->SetLanguage($sLanguageID);
if (!$oCategory->Load($iCurrentCatId)) {
$oCategory = null;
$bDone = true;
} else {
$aTmpList[] = $oCategory;
if (null !== $iStartNodeId && $iStartNodeId == $iCurrentCatId) {
$bDone = true;
} else {
$oCategory = $oCategory->GetParent();
if (null === $oCategory) {
$bDone = true;
} else {
$iCurrentCatId = $oCategory->id;
}
}
}
} while (!$bDone);
$aTmpList = array_reverse($aTmpList);
$oCategoryPath = new TIterator();
foreach (array_keys($aTmpList) as $iTmpIndex) {
$oCategoryPath->AddItem($aTmpList[$iTmpIndex]);
}
return $oCategoryPath;
} | php | public static function &GetCategoryPath($iEndNodeId, $iStartNodeId = null, $sLanguageID = null)
{
if (null === $sLanguageID) {
$sLanguageID = self::getLanguageService()->getActiveLanguageId();
}
$bDone = false;
$iCurrentCatId = $iEndNodeId;
$aTmpList = array(); // we store the list in a tmp array so we can reverse the order
do {
$oCategory = TdbShopCategory::GetNewInstance();
$oCategory->SetLanguage($sLanguageID);
if (!$oCategory->Load($iCurrentCatId)) {
$oCategory = null;
$bDone = true;
} else {
$aTmpList[] = $oCategory;
if (null !== $iStartNodeId && $iStartNodeId == $iCurrentCatId) {
$bDone = true;
} else {
$oCategory = $oCategory->GetParent();
if (null === $oCategory) {
$bDone = true;
} else {
$iCurrentCatId = $oCategory->id;
}
}
}
} while (!$bDone);
$aTmpList = array_reverse($aTmpList);
$oCategoryPath = new TIterator();
foreach (array_keys($aTmpList) as $iTmpIndex) {
$oCategoryPath->AddItem($aTmpList[$iTmpIndex]);
}
return $oCategoryPath;
} | [
"public",
"static",
"function",
"&",
"GetCategoryPath",
"(",
"$",
"iEndNodeId",
",",
"$",
"iStartNodeId",
"=",
"null",
",",
"$",
"sLanguageID",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"sLanguageID",
")",
"{",
"$",
"sLanguageID",
"=",
"self",
"::",
"getLanguageService",
"(",
")",
"->",
"getActiveLanguageId",
"(",
")",
";",
"}",
"$",
"bDone",
"=",
"false",
";",
"$",
"iCurrentCatId",
"=",
"$",
"iEndNodeId",
";",
"$",
"aTmpList",
"=",
"array",
"(",
")",
";",
"// we store the list in a tmp array so we can reverse the order",
"do",
"{",
"$",
"oCategory",
"=",
"TdbShopCategory",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"oCategory",
"->",
"SetLanguage",
"(",
"$",
"sLanguageID",
")",
";",
"if",
"(",
"!",
"$",
"oCategory",
"->",
"Load",
"(",
"$",
"iCurrentCatId",
")",
")",
"{",
"$",
"oCategory",
"=",
"null",
";",
"$",
"bDone",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"aTmpList",
"[",
"]",
"=",
"$",
"oCategory",
";",
"if",
"(",
"null",
"!==",
"$",
"iStartNodeId",
"&&",
"$",
"iStartNodeId",
"==",
"$",
"iCurrentCatId",
")",
"{",
"$",
"bDone",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"oCategory",
"=",
"$",
"oCategory",
"->",
"GetParent",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"oCategory",
")",
"{",
"$",
"bDone",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"iCurrentCatId",
"=",
"$",
"oCategory",
"->",
"id",
";",
"}",
"}",
"}",
"}",
"while",
"(",
"!",
"$",
"bDone",
")",
";",
"$",
"aTmpList",
"=",
"array_reverse",
"(",
"$",
"aTmpList",
")",
";",
"$",
"oCategoryPath",
"=",
"new",
"TIterator",
"(",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"aTmpList",
")",
"as",
"$",
"iTmpIndex",
")",
"{",
"$",
"oCategoryPath",
"->",
"AddItem",
"(",
"$",
"aTmpList",
"[",
"$",
"iTmpIndex",
"]",
")",
";",
"}",
"return",
"$",
"oCategoryPath",
";",
"}"
] | return category path from iEndNodeId to iStartNodeId. if not start node is given,
the path will start at the root category.
@param int $iStartNodeId
@param int $iEndNodeId
@param string $sLanguageID
@return TIterator | [
"return",
"category",
"path",
"from",
"iEndNodeId",
"to",
"iStartNodeId",
".",
"if",
"not",
"start",
"node",
"is",
"given",
"the",
"path",
"will",
"start",
"at",
"the",
"root",
"category",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L233-L270 |
31,843 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategoryList.class.php | TShopCategoryList.getParentCategoryList | public static function getParentCategoryList($categoryId)
{
$categoryList = new TIterator();
$aTmpList = array(); // we store the list in a tmp array so we can reverse the order
$currentCategoryId = $categoryId;
$bDone = false;
$requestInfoService = self::getRequestInfoService();
$languageService = self::getLanguageService();
if ($requestInfoService->isBackendMode()) {
$languageId = $languageService->getActiveEditLanguage()->id;
} else {
$languageId = $languageService->getActiveLanguageId();
}
do {
$category = TdbShopCategory::GetNewInstance();
$category->SetLanguage($languageId);
if (!$category->Load($currentCategoryId)) {
$category = null;
$bDone = true;
} else {
$category = $category->GetParent();
if (!is_null($category)) {
$aTmpList[] = $category;
$currentCategoryId = $category->id;
} else {
$bDone = true;
}
}
} while (!$bDone);
$aTmpList = array_reverse($aTmpList);
foreach ($aTmpList as $tempCategory) {
$categoryList->AddItem($tempCategory);
}
return $categoryList;
} | php | public static function getParentCategoryList($categoryId)
{
$categoryList = new TIterator();
$aTmpList = array(); // we store the list in a tmp array so we can reverse the order
$currentCategoryId = $categoryId;
$bDone = false;
$requestInfoService = self::getRequestInfoService();
$languageService = self::getLanguageService();
if ($requestInfoService->isBackendMode()) {
$languageId = $languageService->getActiveEditLanguage()->id;
} else {
$languageId = $languageService->getActiveLanguageId();
}
do {
$category = TdbShopCategory::GetNewInstance();
$category->SetLanguage($languageId);
if (!$category->Load($currentCategoryId)) {
$category = null;
$bDone = true;
} else {
$category = $category->GetParent();
if (!is_null($category)) {
$aTmpList[] = $category;
$currentCategoryId = $category->id;
} else {
$bDone = true;
}
}
} while (!$bDone);
$aTmpList = array_reverse($aTmpList);
foreach ($aTmpList as $tempCategory) {
$categoryList->AddItem($tempCategory);
}
return $categoryList;
} | [
"public",
"static",
"function",
"getParentCategoryList",
"(",
"$",
"categoryId",
")",
"{",
"$",
"categoryList",
"=",
"new",
"TIterator",
"(",
")",
";",
"$",
"aTmpList",
"=",
"array",
"(",
")",
";",
"// we store the list in a tmp array so we can reverse the order",
"$",
"currentCategoryId",
"=",
"$",
"categoryId",
";",
"$",
"bDone",
"=",
"false",
";",
"$",
"requestInfoService",
"=",
"self",
"::",
"getRequestInfoService",
"(",
")",
";",
"$",
"languageService",
"=",
"self",
"::",
"getLanguageService",
"(",
")",
";",
"if",
"(",
"$",
"requestInfoService",
"->",
"isBackendMode",
"(",
")",
")",
"{",
"$",
"languageId",
"=",
"$",
"languageService",
"->",
"getActiveEditLanguage",
"(",
")",
"->",
"id",
";",
"}",
"else",
"{",
"$",
"languageId",
"=",
"$",
"languageService",
"->",
"getActiveLanguageId",
"(",
")",
";",
"}",
"do",
"{",
"$",
"category",
"=",
"TdbShopCategory",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"category",
"->",
"SetLanguage",
"(",
"$",
"languageId",
")",
";",
"if",
"(",
"!",
"$",
"category",
"->",
"Load",
"(",
"$",
"currentCategoryId",
")",
")",
"{",
"$",
"category",
"=",
"null",
";",
"$",
"bDone",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"category",
"=",
"$",
"category",
"->",
"GetParent",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"category",
")",
")",
"{",
"$",
"aTmpList",
"[",
"]",
"=",
"$",
"category",
";",
"$",
"currentCategoryId",
"=",
"$",
"category",
"->",
"id",
";",
"}",
"else",
"{",
"$",
"bDone",
"=",
"true",
";",
"}",
"}",
"}",
"while",
"(",
"!",
"$",
"bDone",
")",
";",
"$",
"aTmpList",
"=",
"array_reverse",
"(",
"$",
"aTmpList",
")",
";",
"foreach",
"(",
"$",
"aTmpList",
"as",
"$",
"tempCategory",
")",
"{",
"$",
"categoryList",
"->",
"AddItem",
"(",
"$",
"tempCategory",
")",
";",
"}",
"return",
"$",
"categoryList",
";",
"}"
] | return all parent categories from the tree.
@param string $categoryId
@return TIterator | [
"return",
"all",
"parent",
"categories",
"from",
"the",
"tree",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategoryList.class.php#L313-L349 |
31,844 | comporu/compo-core | src/Compo/Sonata/AdminBundle/Form/FormMapper.php | FormMapper.tab | public function tab($name, array $options = [])
{
if (!isset($options['label'])) {
$options['label'] = 'form.tab_' . $name;
}
return parent::tab($name, $options);
} | php | public function tab($name, array $options = [])
{
if (!isset($options['label'])) {
$options['label'] = 'form.tab_' . $name;
}
return parent::tab($name, $options);
} | [
"public",
"function",
"tab",
"(",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'label'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'label'",
"]",
"=",
"'form.tab_'",
".",
"$",
"name",
";",
"}",
"return",
"parent",
"::",
"tab",
"(",
"$",
"name",
",",
"$",
"options",
")",
";",
"}"
] | Add new tab.
@param string $name
@param array $options
@return BaseGroupedMapper | [
"Add",
"new",
"tab",
"."
] | ebaa9fe8a4b831506c78fdf637da6b4deadec1e2 | https://github.com/comporu/compo-core/blob/ebaa9fe8a4b831506c78fdf637da6b4deadec1e2/src/Compo/Sonata/AdminBundle/Form/FormMapper.php#L27-L34 |
31,845 | PGB-LIV/php-ms | src/Core/ModifiableSequenceTrait.php | ModifiableSequenceTrait.removeModification | public function removeModification(Modification $searchModification)
{
foreach ($this->modifications as $key => $modification) {
if ($modification !== $searchModification) {
continue;
}
unset($this->modifications[$key]);
}
} | php | public function removeModification(Modification $searchModification)
{
foreach ($this->modifications as $key => $modification) {
if ($modification !== $searchModification) {
continue;
}
unset($this->modifications[$key]);
}
} | [
"public",
"function",
"removeModification",
"(",
"Modification",
"$",
"searchModification",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"modifications",
"as",
"$",
"key",
"=>",
"$",
"modification",
")",
"{",
"if",
"(",
"$",
"modification",
"!==",
"$",
"searchModification",
")",
"{",
"continue",
";",
"}",
"unset",
"(",
"$",
"this",
"->",
"modifications",
"[",
"$",
"key",
"]",
")",
";",
"}",
"}"
] | Remove a modification | [
"Remove",
"a",
"modification"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ModifiableSequenceTrait.php#L121-L130 |
31,846 | PGB-LIV/php-ms | src/Core/ModifiableSequenceTrait.php | ModifiableSequenceTrait.getMonoisotopicMass | public function getMonoisotopicMass()
{
$acids = str_split($this->getSequence(), 1);
$mass = ChemicalConstants::HYDROGEN_MASS + ChemicalConstants::HYDROGEN_MASS + ChemicalConstants::OXYGEN_MASS;
foreach ($acids as $acid) {
switch ($acid) {
case 'X':
case 'B':
case 'Z':
continue;
default:
$mass += AminoAcidMono::getMonoisotopicMass($acid);
break;
}
}
// Add modification mass
// Catch modification on position, residue or terminus
foreach ($this->getModifications() as $modification) {
if (! is_null($modification->getLocation())) {
$mass += $modification->getMonoisotopicMass();
continue;
}
switch ($modification->getPosition()) {
case Modification::POSITION_NTERM:
case Modification::POSITION_PROTEIN_NTERM:
// TODO: Handle protein level safely
// A peptide can be both at protein n-term and not since multiple proteins supported
$nTerm = $this->sequence[0];
if (in_array($nTerm, $modification->getResidues())) {
$mass += $modification->getMonoisotopicMass();
}
break;
case Modification::POSITION_CTERM:
case Modification::POSITION_PROTEIN_CTERM:
// TODO: Handle protein level safely
// A peptide can be both at protein n-term and not since multiple proteins supported
$cTerm = $this->sequence[strlen($this->sequence) - 1];
if (in_array($cTerm, $modification->getResidues())) {
$mass += $modification->getMonoisotopicMass();
}
break;
default:
foreach ($acids as $acid) {
if (in_array($acid, $modification->getResidues())) {
$mass += $modification->getMonoisotopicMass();
}
}
break;
}
}
return $mass;
} | php | public function getMonoisotopicMass()
{
$acids = str_split($this->getSequence(), 1);
$mass = ChemicalConstants::HYDROGEN_MASS + ChemicalConstants::HYDROGEN_MASS + ChemicalConstants::OXYGEN_MASS;
foreach ($acids as $acid) {
switch ($acid) {
case 'X':
case 'B':
case 'Z':
continue;
default:
$mass += AminoAcidMono::getMonoisotopicMass($acid);
break;
}
}
// Add modification mass
// Catch modification on position, residue or terminus
foreach ($this->getModifications() as $modification) {
if (! is_null($modification->getLocation())) {
$mass += $modification->getMonoisotopicMass();
continue;
}
switch ($modification->getPosition()) {
case Modification::POSITION_NTERM:
case Modification::POSITION_PROTEIN_NTERM:
// TODO: Handle protein level safely
// A peptide can be both at protein n-term and not since multiple proteins supported
$nTerm = $this->sequence[0];
if (in_array($nTerm, $modification->getResidues())) {
$mass += $modification->getMonoisotopicMass();
}
break;
case Modification::POSITION_CTERM:
case Modification::POSITION_PROTEIN_CTERM:
// TODO: Handle protein level safely
// A peptide can be both at protein n-term and not since multiple proteins supported
$cTerm = $this->sequence[strlen($this->sequence) - 1];
if (in_array($cTerm, $modification->getResidues())) {
$mass += $modification->getMonoisotopicMass();
}
break;
default:
foreach ($acids as $acid) {
if (in_array($acid, $modification->getResidues())) {
$mass += $modification->getMonoisotopicMass();
}
}
break;
}
}
return $mass;
} | [
"public",
"function",
"getMonoisotopicMass",
"(",
")",
"{",
"$",
"acids",
"=",
"str_split",
"(",
"$",
"this",
"->",
"getSequence",
"(",
")",
",",
"1",
")",
";",
"$",
"mass",
"=",
"ChemicalConstants",
"::",
"HYDROGEN_MASS",
"+",
"ChemicalConstants",
"::",
"HYDROGEN_MASS",
"+",
"ChemicalConstants",
"::",
"OXYGEN_MASS",
";",
"foreach",
"(",
"$",
"acids",
"as",
"$",
"acid",
")",
"{",
"switch",
"(",
"$",
"acid",
")",
"{",
"case",
"'X'",
":",
"case",
"'B'",
":",
"case",
"'Z'",
":",
"continue",
";",
"default",
":",
"$",
"mass",
"+=",
"AminoAcidMono",
"::",
"getMonoisotopicMass",
"(",
"$",
"acid",
")",
";",
"break",
";",
"}",
"}",
"// Add modification mass",
"// Catch modification on position, residue or terminus",
"foreach",
"(",
"$",
"this",
"->",
"getModifications",
"(",
")",
"as",
"$",
"modification",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"modification",
"->",
"getLocation",
"(",
")",
")",
")",
"{",
"$",
"mass",
"+=",
"$",
"modification",
"->",
"getMonoisotopicMass",
"(",
")",
";",
"continue",
";",
"}",
"switch",
"(",
"$",
"modification",
"->",
"getPosition",
"(",
")",
")",
"{",
"case",
"Modification",
"::",
"POSITION_NTERM",
":",
"case",
"Modification",
"::",
"POSITION_PROTEIN_NTERM",
":",
"// TODO: Handle protein level safely",
"// A peptide can be both at protein n-term and not since multiple proteins supported",
"$",
"nTerm",
"=",
"$",
"this",
"->",
"sequence",
"[",
"0",
"]",
";",
"if",
"(",
"in_array",
"(",
"$",
"nTerm",
",",
"$",
"modification",
"->",
"getResidues",
"(",
")",
")",
")",
"{",
"$",
"mass",
"+=",
"$",
"modification",
"->",
"getMonoisotopicMass",
"(",
")",
";",
"}",
"break",
";",
"case",
"Modification",
"::",
"POSITION_CTERM",
":",
"case",
"Modification",
"::",
"POSITION_PROTEIN_CTERM",
":",
"// TODO: Handle protein level safely",
"// A peptide can be both at protein n-term and not since multiple proteins supported",
"$",
"cTerm",
"=",
"$",
"this",
"->",
"sequence",
"[",
"strlen",
"(",
"$",
"this",
"->",
"sequence",
")",
"-",
"1",
"]",
";",
"if",
"(",
"in_array",
"(",
"$",
"cTerm",
",",
"$",
"modification",
"->",
"getResidues",
"(",
")",
")",
")",
"{",
"$",
"mass",
"+=",
"$",
"modification",
"->",
"getMonoisotopicMass",
"(",
")",
";",
"}",
"break",
";",
"default",
":",
"foreach",
"(",
"$",
"acids",
"as",
"$",
"acid",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"acid",
",",
"$",
"modification",
"->",
"getResidues",
"(",
")",
")",
")",
"{",
"$",
"mass",
"+=",
"$",
"modification",
"->",
"getMonoisotopicMass",
"(",
")",
";",
"}",
"}",
"break",
";",
"}",
"}",
"return",
"$",
"mass",
";",
"}"
] | Gets the theoretical monoisotopic neutral mass for this sequence and it's modifications
@return float The neutral mass of the sequence | [
"Gets",
"the",
"theoretical",
"monoisotopic",
"neutral",
"mass",
"for",
"this",
"sequence",
"and",
"it",
"s",
"modifications"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/ModifiableSequenceTrait.php#L193-L253 |
31,847 | edmondscommerce/doctrine-static-meta | codeTemplates/src/Entity/Relations/TemplateEntity/Traits/HasRequiredTemplateEntitiesAbstract.php | HasRequiredTemplateEntitiesAbstract.initTemplateEntities | private function initTemplateEntities(): self
{
if (null !== $this->templateEntities) {
return $this;
}
$this->templateEntities = new ArrayCollection();
return $this;
} | php | private function initTemplateEntities(): self
{
if (null !== $this->templateEntities) {
return $this;
}
$this->templateEntities = new ArrayCollection();
return $this;
} | [
"private",
"function",
"initTemplateEntities",
"(",
")",
":",
"self",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"templateEntities",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"templateEntities",
"=",
"new",
"ArrayCollection",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Initialise the templateEntities property as a Doctrine ArrayCollection
@return $this
@SuppressWarnings(PHPMD.UnusedPrivateMethod) | [
"Initialise",
"the",
"templateEntities",
"property",
"as",
"a",
"Doctrine",
"ArrayCollection"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/codeTemplates/src/Entity/Relations/TemplateEntity/Traits/HasRequiredTemplateEntitiesAbstract.php#L138-L146 |
31,848 | edmondscommerce/doctrine-static-meta | src/Entity/Traits/AlwaysValidTrait.php | AlwaysValidTrait.injectEntityDataValidator | public function injectEntityDataValidator(EntityDataValidatorInterface $entityDataValidator)
{
$this->entityDataValidator = $entityDataValidator;
$this->entityDataValidator->setEntity($this);
} | php | public function injectEntityDataValidator(EntityDataValidatorInterface $entityDataValidator)
{
$this->entityDataValidator = $entityDataValidator;
$this->entityDataValidator->setEntity($this);
} | [
"public",
"function",
"injectEntityDataValidator",
"(",
"EntityDataValidatorInterface",
"$",
"entityDataValidator",
")",
"{",
"$",
"this",
"->",
"entityDataValidator",
"=",
"$",
"entityDataValidator",
";",
"$",
"this",
"->",
"entityDataValidator",
"->",
"setEntity",
"(",
"$",
"this",
")",
";",
"}"
] | This method is called automatically by the EntityFactory when initialisig the Entity, by way of the
EntityDependencyInjector
@param EntityDataValidatorInterface $entityDataValidator | [
"This",
"method",
"is",
"called",
"automatically",
"by",
"the",
"EntityFactory",
"when",
"initialisig",
"the",
"Entity",
"by",
"way",
"of",
"the",
"EntityDependencyInjector"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Traits/AlwaysValidTrait.php#L129-L133 |
31,849 | edmondscommerce/doctrine-static-meta | src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php | ImplementNotifyChangeTrackingPolicy.ensureMetaDataIsSet | public function ensureMetaDataIsSet(EntityManagerInterface $entityManager): void
{
self::getDoctrineStaticMeta()->setMetaData($entityManager->getClassMetadata(self::class));
} | php | public function ensureMetaDataIsSet(EntityManagerInterface $entityManager): void
{
self::getDoctrineStaticMeta()->setMetaData($entityManager->getClassMetadata(self::class));
} | [
"public",
"function",
"ensureMetaDataIsSet",
"(",
"EntityManagerInterface",
"$",
"entityManager",
")",
":",
"void",
"{",
"self",
"::",
"getDoctrineStaticMeta",
"(",
")",
"->",
"setMetaData",
"(",
"$",
"entityManager",
"->",
"getClassMetadata",
"(",
"self",
"::",
"class",
")",
")",
";",
"}"
] | The meta data is set to the entity when the meta data is loaded, however if metadata is cached that wont happen
This call ensures that the meta data is set
@param EntityManagerInterface $entityManager | [
"The",
"meta",
"data",
"is",
"set",
"to",
"the",
"entity",
"when",
"the",
"meta",
"data",
"is",
"loaded",
"however",
"if",
"metadata",
"is",
"cached",
"that",
"wont",
"happen",
"This",
"call",
"ensures",
"that",
"the",
"meta",
"data",
"is",
"set"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php#L52-L55 |
31,850 | edmondscommerce/doctrine-static-meta | src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php | ImplementNotifyChangeTrackingPolicy.notifyEmbeddablePrefixedProperties | public function notifyEmbeddablePrefixedProperties(
string $embeddablePropertyName,
?string $propName = null,
$oldValue = null,
$newValue = null
): void {
if ($oldValue !== null && $oldValue === $newValue) {
return;
}
/**
* @var ClassMetadata $metaData
*/
$metaData = self::getDoctrineStaticMeta()->getMetaData();
foreach ($metaData->getFieldNames() as $fieldName) {
if (true === \ts\stringStartsWith($fieldName, $embeddablePropertyName)
&& false !== \ts\stringContains($fieldName, '.')
) {
if ($fieldName !== null && $fieldName !== "$embeddablePropertyName.$propName") {
continue;
}
foreach ($this->notifyChangeTrackingListeners as $listener) {
//wondering if we can get away with not passing in the values?
$listener->propertyChanged($this, $fieldName, $oldValue, $newValue);
}
}
}
} | php | public function notifyEmbeddablePrefixedProperties(
string $embeddablePropertyName,
?string $propName = null,
$oldValue = null,
$newValue = null
): void {
if ($oldValue !== null && $oldValue === $newValue) {
return;
}
/**
* @var ClassMetadata $metaData
*/
$metaData = self::getDoctrineStaticMeta()->getMetaData();
foreach ($metaData->getFieldNames() as $fieldName) {
if (true === \ts\stringStartsWith($fieldName, $embeddablePropertyName)
&& false !== \ts\stringContains($fieldName, '.')
) {
if ($fieldName !== null && $fieldName !== "$embeddablePropertyName.$propName") {
continue;
}
foreach ($this->notifyChangeTrackingListeners as $listener) {
//wondering if we can get away with not passing in the values?
$listener->propertyChanged($this, $fieldName, $oldValue, $newValue);
}
}
}
} | [
"public",
"function",
"notifyEmbeddablePrefixedProperties",
"(",
"string",
"$",
"embeddablePropertyName",
",",
"?",
"string",
"$",
"propName",
"=",
"null",
",",
"$",
"oldValue",
"=",
"null",
",",
"$",
"newValue",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"$",
"oldValue",
"!==",
"null",
"&&",
"$",
"oldValue",
"===",
"$",
"newValue",
")",
"{",
"return",
";",
"}",
"/**\n * @var ClassMetadata $metaData\n */",
"$",
"metaData",
"=",
"self",
"::",
"getDoctrineStaticMeta",
"(",
")",
"->",
"getMetaData",
"(",
")",
";",
"foreach",
"(",
"$",
"metaData",
"->",
"getFieldNames",
"(",
")",
"as",
"$",
"fieldName",
")",
"{",
"if",
"(",
"true",
"===",
"\\",
"ts",
"\\",
"stringStartsWith",
"(",
"$",
"fieldName",
",",
"$",
"embeddablePropertyName",
")",
"&&",
"false",
"!==",
"\\",
"ts",
"\\",
"stringContains",
"(",
"$",
"fieldName",
",",
"'.'",
")",
")",
"{",
"if",
"(",
"$",
"fieldName",
"!==",
"null",
"&&",
"$",
"fieldName",
"!==",
"\"$embeddablePropertyName.$propName\"",
")",
"{",
"continue",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"notifyChangeTrackingListeners",
"as",
"$",
"listener",
")",
"{",
"//wondering if we can get away with not passing in the values?",
"$",
"listener",
"->",
"propertyChanged",
"(",
"$",
"this",
",",
"$",
"fieldName",
",",
"$",
"oldValue",
",",
"$",
"newValue",
")",
";",
"}",
"}",
"}",
"}"
] | This notifies the embeddable properties on the owning Entity
@param string $embeddablePropertyName
@param null|string $propName
@param null $oldValue
@param null $newValue | [
"This",
"notifies",
"the",
"embeddable",
"properties",
"on",
"the",
"owning",
"Entity"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php#L65-L91 |
31,851 | edmondscommerce/doctrine-static-meta | src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php | ImplementNotifyChangeTrackingPolicy.updatePropertyValue | private function updatePropertyValue(string $propName, $newValue): void
{
if ($this->$propName === $newValue) {
return;
}
$oldValue = $this->$propName;
$this->$propName = $newValue;
foreach ($this->notifyChangeTrackingListeners as $listener) {
$listener->propertyChanged($this, $propName, $oldValue, $newValue);
}
} | php | private function updatePropertyValue(string $propName, $newValue): void
{
if ($this->$propName === $newValue) {
return;
}
$oldValue = $this->$propName;
$this->$propName = $newValue;
foreach ($this->notifyChangeTrackingListeners as $listener) {
$listener->propertyChanged($this, $propName, $oldValue, $newValue);
}
} | [
"private",
"function",
"updatePropertyValue",
"(",
"string",
"$",
"propName",
",",
"$",
"newValue",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"$",
"propName",
"===",
"$",
"newValue",
")",
"{",
"return",
";",
"}",
"$",
"oldValue",
"=",
"$",
"this",
"->",
"$",
"propName",
";",
"$",
"this",
"->",
"$",
"propName",
"=",
"$",
"newValue",
";",
"foreach",
"(",
"$",
"this",
"->",
"notifyChangeTrackingListeners",
"as",
"$",
"listener",
")",
"{",
"$",
"listener",
"->",
"propertyChanged",
"(",
"$",
"this",
",",
"$",
"propName",
",",
"$",
"oldValue",
",",
"$",
"newValue",
")",
";",
"}",
"}"
] | To be called from all set methods
This method updates the property value, then it runs this through validation
If validation fails, it sets the old value back and throws the caught exception
If validation passes, it then performs the Doctrine notification for property change
@param string $propName
@param mixed $newValue
@throws ValidationException | [
"To",
"be",
"called",
"from",
"all",
"set",
"methods"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Traits/ImplementNotifyChangeTrackingPolicy.php#L106-L116 |
31,852 | chameleon-system/chameleon-shop | src/ShopListFilterBundle/pkgShop/objects/db/TPkgShopListfilter_TShopCategory.class.php | TPkgShopListfilter_TShopCategory.GetFieldPkgShopListfilterIdRecursive | public function GetFieldPkgShopListfilterIdRecursive()
{
$sFilterId = $this->GetFromInternalCache('sActingFilterForCategory');
if (null !== $sFilterId) {
return $sFilterId;
}
if (isset($this->sqlData['lft']) && isset($this->sqlData['rgt'])) {
$sFilterId = $this->findFilterFromNestedSet();
} else {
$sFilterId = '';
if (empty($this->fieldPkgShopListfilterId) && !empty($this->fieldShopCategoryId)) {
$oParent = $this->GetParent();
if ($oParent) {
$sFilterId = $oParent->GetFieldPkgShopListfilterIdRecursive();
}
} else {
$sFilterId = $this->fieldPkgShopListfilterId;
}
}
$this->SetInternalCache('sActingFilterForCategory', $sFilterId);
return $sFilterId;
} | php | public function GetFieldPkgShopListfilterIdRecursive()
{
$sFilterId = $this->GetFromInternalCache('sActingFilterForCategory');
if (null !== $sFilterId) {
return $sFilterId;
}
if (isset($this->sqlData['lft']) && isset($this->sqlData['rgt'])) {
$sFilterId = $this->findFilterFromNestedSet();
} else {
$sFilterId = '';
if (empty($this->fieldPkgShopListfilterId) && !empty($this->fieldShopCategoryId)) {
$oParent = $this->GetParent();
if ($oParent) {
$sFilterId = $oParent->GetFieldPkgShopListfilterIdRecursive();
}
} else {
$sFilterId = $this->fieldPkgShopListfilterId;
}
}
$this->SetInternalCache('sActingFilterForCategory', $sFilterId);
return $sFilterId;
} | [
"public",
"function",
"GetFieldPkgShopListfilterIdRecursive",
"(",
")",
"{",
"$",
"sFilterId",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'sActingFilterForCategory'",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"sFilterId",
")",
"{",
"return",
"$",
"sFilterId",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'lft'",
"]",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'rgt'",
"]",
")",
")",
"{",
"$",
"sFilterId",
"=",
"$",
"this",
"->",
"findFilterFromNestedSet",
"(",
")",
";",
"}",
"else",
"{",
"$",
"sFilterId",
"=",
"''",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"fieldPkgShopListfilterId",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldShopCategoryId",
")",
")",
"{",
"$",
"oParent",
"=",
"$",
"this",
"->",
"GetParent",
"(",
")",
";",
"if",
"(",
"$",
"oParent",
")",
"{",
"$",
"sFilterId",
"=",
"$",
"oParent",
"->",
"GetFieldPkgShopListfilterIdRecursive",
"(",
")",
";",
"}",
"}",
"else",
"{",
"$",
"sFilterId",
"=",
"$",
"this",
"->",
"fieldPkgShopListfilterId",
";",
"}",
"}",
"$",
"this",
"->",
"SetInternalCache",
"(",
"'sActingFilterForCategory'",
",",
"$",
"sFilterId",
")",
";",
"return",
"$",
"sFilterId",
";",
"}"
] | returns the ID of the Listfilter for that is set for this category or one of its ancestors. | [
"returns",
"the",
"ID",
"of",
"the",
"Listfilter",
"for",
"that",
"is",
"set",
"for",
"this",
"category",
"or",
"one",
"of",
"its",
"ancestors",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/pkgShop/objects/db/TPkgShopListfilter_TShopCategory.class.php#L17-L41 |
31,853 | PGB-LIV/php-ms | src/Core/Spectra/PrecursorIon.php | PrecursorIon.setScan | public function setScan($scan)
{
if (! (is_int($scan) || is_float($scan))) {
throw new \InvalidArgumentException(
'Argument 1 must be of type int or float. Value is of type ' . gettype($scan));
}
$this->scan = $scan;
} | php | public function setScan($scan)
{
if (! (is_int($scan) || is_float($scan))) {
throw new \InvalidArgumentException(
'Argument 1 must be of type int or float. Value is of type ' . gettype($scan));
}
$this->scan = $scan;
} | [
"public",
"function",
"setScan",
"(",
"$",
"scan",
")",
"{",
"if",
"(",
"!",
"(",
"is_int",
"(",
"$",
"scan",
")",
"||",
"is_float",
"(",
"$",
"scan",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Argument 1 must be of type int or float. Value is of type '",
".",
"gettype",
"(",
"$",
"scan",
")",
")",
";",
"}",
"$",
"this",
"->",
"scan",
"=",
"$",
"scan",
";",
"}"
] | Sets the scan number for this precursor
@param int|float $scan
Scan number to set
@throws \InvalidArgumentException | [
"Sets",
"the",
"scan",
"number",
"for",
"this",
"precursor"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Spectra/PrecursorIon.php#L112-L120 |
31,854 | chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopModuleArticlelistOrderbyList.class.php | TShopModuleArticlelistOrderbyList.& | public static function &GetListForIds($aIdList, $iLanguageId = null)
{
$aIdList = TTools::MysqlRealEscapeArray($aIdList);
$sQuery = self::GetDefaultQuery($iLanguageId, "`id` IN ('".implode("', '", $aIdList)."') ");
return TdbShopModuleArticlelistOrderbyList::GetList($sQuery, $iLanguageId);
} | php | public static function &GetListForIds($aIdList, $iLanguageId = null)
{
$aIdList = TTools::MysqlRealEscapeArray($aIdList);
$sQuery = self::GetDefaultQuery($iLanguageId, "`id` IN ('".implode("', '", $aIdList)."') ");
return TdbShopModuleArticlelistOrderbyList::GetList($sQuery, $iLanguageId);
} | [
"public",
"static",
"function",
"&",
"GetListForIds",
"(",
"$",
"aIdList",
",",
"$",
"iLanguageId",
"=",
"null",
")",
"{",
"$",
"aIdList",
"=",
"TTools",
"::",
"MysqlRealEscapeArray",
"(",
"$",
"aIdList",
")",
";",
"$",
"sQuery",
"=",
"self",
"::",
"GetDefaultQuery",
"(",
"$",
"iLanguageId",
",",
"\"`id` IN ('\"",
".",
"implode",
"(",
"\"', '\"",
",",
"$",
"aIdList",
")",
".",
"\"') \"",
")",
";",
"return",
"TdbShopModuleArticlelistOrderbyList",
"::",
"GetList",
"(",
"$",
"sQuery",
",",
"$",
"iLanguageId",
")",
";",
"}"
] | return list for a set of ids.
@param array $aIdList
@param int $iLanguageId
@return TdbShopModuleArticlelistOrderbyList | [
"return",
"list",
"for",
"a",
"set",
"of",
"ids",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticlelistOrderbyList.class.php#L26-L32 |
31,855 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/CodeHelper.php | CodeHelper.replaceTypeHintsInFile | public function replaceTypeHintsInFile(
string $filePath,
string $type,
string $dbalType,
bool $isNullable
): void {
$contents = \ts\file_get_contents($filePath);
$search = [
': string;',
'(string $',
': string {',
'@var string',
'@return string',
'@param string',
];
$replaceNormal = [
": $type;",
"($type $",
": $type {",
"@var $type",
"@return $type",
"@param $type",
];
$replaceNullable = [
": ?$type;",
"(?$type $",
": ?$type {",
"@var $type|null",
"@return $type|null",
"@param $type|null",
];
$replaceRemove = [
';',
'($',
' {',
'',
'',
'',
];
$replace = $replaceNormal;
if (\in_array($dbalType, MappingHelper::MIXED_TYPES, true)) {
$replace = $replaceRemove;
} elseif ($isNullable) {
$replace = $replaceNullable;
}
$contents = \str_replace(
$search,
$replace,
$contents
);
\file_put_contents($filePath, $contents);
} | php | public function replaceTypeHintsInFile(
string $filePath,
string $type,
string $dbalType,
bool $isNullable
): void {
$contents = \ts\file_get_contents($filePath);
$search = [
': string;',
'(string $',
': string {',
'@var string',
'@return string',
'@param string',
];
$replaceNormal = [
": $type;",
"($type $",
": $type {",
"@var $type",
"@return $type",
"@param $type",
];
$replaceNullable = [
": ?$type;",
"(?$type $",
": ?$type {",
"@var $type|null",
"@return $type|null",
"@param $type|null",
];
$replaceRemove = [
';',
'($',
' {',
'',
'',
'',
];
$replace = $replaceNormal;
if (\in_array($dbalType, MappingHelper::MIXED_TYPES, true)) {
$replace = $replaceRemove;
} elseif ($isNullable) {
$replace = $replaceNullable;
}
$contents = \str_replace(
$search,
$replace,
$contents
);
\file_put_contents($filePath, $contents);
} | [
"public",
"function",
"replaceTypeHintsInFile",
"(",
"string",
"$",
"filePath",
",",
"string",
"$",
"type",
",",
"string",
"$",
"dbalType",
",",
"bool",
"$",
"isNullable",
")",
":",
"void",
"{",
"$",
"contents",
"=",
"\\",
"ts",
"\\",
"file_get_contents",
"(",
"$",
"filePath",
")",
";",
"$",
"search",
"=",
"[",
"': string;'",
",",
"'(string $'",
",",
"': string {'",
",",
"'@var string'",
",",
"'@return string'",
",",
"'@param string'",
",",
"]",
";",
"$",
"replaceNormal",
"=",
"[",
"\": $type;\"",
",",
"\"($type $\"",
",",
"\": $type {\"",
",",
"\"@var $type\"",
",",
"\"@return $type\"",
",",
"\"@param $type\"",
",",
"]",
";",
"$",
"replaceNullable",
"=",
"[",
"\": ?$type;\"",
",",
"\"(?$type $\"",
",",
"\": ?$type {\"",
",",
"\"@var $type|null\"",
",",
"\"@return $type|null\"",
",",
"\"@param $type|null\"",
",",
"]",
";",
"$",
"replaceRemove",
"=",
"[",
"';'",
",",
"'($'",
",",
"' {'",
",",
"''",
",",
"''",
",",
"''",
",",
"]",
";",
"$",
"replace",
"=",
"$",
"replaceNormal",
";",
"if",
"(",
"\\",
"in_array",
"(",
"$",
"dbalType",
",",
"MappingHelper",
"::",
"MIXED_TYPES",
",",
"true",
")",
")",
"{",
"$",
"replace",
"=",
"$",
"replaceRemove",
";",
"}",
"elseif",
"(",
"$",
"isNullable",
")",
"{",
"$",
"replace",
"=",
"$",
"replaceNullable",
";",
"}",
"$",
"contents",
"=",
"\\",
"str_replace",
"(",
"$",
"search",
",",
"$",
"replace",
",",
"$",
"contents",
")",
";",
"\\",
"file_put_contents",
"(",
"$",
"filePath",
",",
"$",
"contents",
")",
";",
"}"
] | We use the string type hint as our default in templates
This method will then replace those with the updated type
@param string $filePath
@param string $type
@param string $dbalType
@param bool $isNullable | [
"We",
"use",
"the",
"string",
"type",
"hint",
"as",
"our",
"default",
"in",
"templates"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/CodeHelper.php#L82-L140 |
31,856 | chameleon-system/chameleon-shop | src/ShopListFilterBundle/objects/db/TPkgShopListfilterItemList.class.php | TPkgShopListfilterItemList.GetQueryRestriction | public function GetQueryRestriction($oExcludeItem = null, $bReturnAsArray = false)
{
$sQuery = '';
$aQueryItems = array();
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = $this->Next()) {
if (is_null($oExcludeItem) || !$oExcludeItem->IsSameAs($oItem)) {
$sTmpQuery = trim($oItem->GetQueryRestrictionForActiveFilter());
if (!empty($sTmpQuery)) {
$aQueryItems[] = $sTmpQuery;
}
}
}
$this->setItemPointer($iPointer);
if (!$bReturnAsArray) {
if (count($aQueryItems)) {
$sQuery = '('.implode(') AND (', $aQueryItems).')';
}
return $sQuery;
} else {
return $aQueryItems;
}
} | php | public function GetQueryRestriction($oExcludeItem = null, $bReturnAsArray = false)
{
$sQuery = '';
$aQueryItems = array();
$iPointer = $this->getItemPointer();
$this->GoToStart();
while ($oItem = $this->Next()) {
if (is_null($oExcludeItem) || !$oExcludeItem->IsSameAs($oItem)) {
$sTmpQuery = trim($oItem->GetQueryRestrictionForActiveFilter());
if (!empty($sTmpQuery)) {
$aQueryItems[] = $sTmpQuery;
}
}
}
$this->setItemPointer($iPointer);
if (!$bReturnAsArray) {
if (count($aQueryItems)) {
$sQuery = '('.implode(') AND (', $aQueryItems).')';
}
return $sQuery;
} else {
return $aQueryItems;
}
} | [
"public",
"function",
"GetQueryRestriction",
"(",
"$",
"oExcludeItem",
"=",
"null",
",",
"$",
"bReturnAsArray",
"=",
"false",
")",
"{",
"$",
"sQuery",
"=",
"''",
";",
"$",
"aQueryItems",
"=",
"array",
"(",
")",
";",
"$",
"iPointer",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oItem",
"=",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"oExcludeItem",
")",
"||",
"!",
"$",
"oExcludeItem",
"->",
"IsSameAs",
"(",
"$",
"oItem",
")",
")",
"{",
"$",
"sTmpQuery",
"=",
"trim",
"(",
"$",
"oItem",
"->",
"GetQueryRestrictionForActiveFilter",
"(",
")",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sTmpQuery",
")",
")",
"{",
"$",
"aQueryItems",
"[",
"]",
"=",
"$",
"sTmpQuery",
";",
"}",
"}",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iPointer",
")",
";",
"if",
"(",
"!",
"$",
"bReturnAsArray",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"aQueryItems",
")",
")",
"{",
"$",
"sQuery",
"=",
"'('",
".",
"implode",
"(",
"') AND ('",
",",
"$",
"aQueryItems",
")",
".",
"')'",
";",
"}",
"return",
"$",
"sQuery",
";",
"}",
"else",
"{",
"return",
"$",
"aQueryItems",
";",
"}",
"}"
] | return sql condition for the current filter list. optionaly excluding the element passed.
@param TdbPkgShopListfilterItem $oExcludeItem
@param bool $bReturnAsArray - set to true if you want an array with the query parts instead of a string
@return string | [
"return",
"sql",
"condition",
"for",
"the",
"current",
"filter",
"list",
".",
"optionaly",
"excluding",
"the",
"element",
"passed",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopListFilterBundle/objects/db/TPkgShopListfilterItemList.class.php#L34-L58 |
31,857 | PGB-LIV/php-ms | src/Reader/MzIdentMlReaderFactory.php | MzIdentMlReaderFactory.getReader | public static function getReader($filePath)
{
$xmlReader = new \SimpleXMLElement($filePath, null, true);
switch ($xmlReader->attributes()->version) {
case '1.1.0':
return new MzIdentMlReader1r1($filePath);
case '1.2.0':
return new MzIdentMlReader1r2($filePath);
default:
throw new \UnexpectedValueException('Version ' . $xmlReader->attributes()->version . ' is not supported');
}
} | php | public static function getReader($filePath)
{
$xmlReader = new \SimpleXMLElement($filePath, null, true);
switch ($xmlReader->attributes()->version) {
case '1.1.0':
return new MzIdentMlReader1r1($filePath);
case '1.2.0':
return new MzIdentMlReader1r2($filePath);
default:
throw new \UnexpectedValueException('Version ' . $xmlReader->attributes()->version . ' is not supported');
}
} | [
"public",
"static",
"function",
"getReader",
"(",
"$",
"filePath",
")",
"{",
"$",
"xmlReader",
"=",
"new",
"\\",
"SimpleXMLElement",
"(",
"$",
"filePath",
",",
"null",
",",
"true",
")",
";",
"switch",
"(",
"$",
"xmlReader",
"->",
"attributes",
"(",
")",
"->",
"version",
")",
"{",
"case",
"'1.1.0'",
":",
"return",
"new",
"MzIdentMlReader1r1",
"(",
"$",
"filePath",
")",
";",
"case",
"'1.2.0'",
":",
"return",
"new",
"MzIdentMlReader1r2",
"(",
"$",
"filePath",
")",
";",
"default",
":",
"throw",
"new",
"\\",
"UnexpectedValueException",
"(",
"'Version '",
".",
"$",
"xmlReader",
"->",
"attributes",
"(",
")",
"->",
"version",
".",
"' is not supported'",
")",
";",
"}",
"}"
] | Parses the XML file to identify the specification version and then returns the appropriate reader
@param string $filePath
Path to the location of the mzIdentML file
@return MzIdentMlReader1Interface | [
"Parses",
"the",
"XML",
"file",
"to",
"identify",
"the",
"specification",
"version",
"and",
"then",
"returns",
"the",
"appropriate",
"reader"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Reader/MzIdentMlReaderFactory.php#L33-L45 |
31,858 | sylingd/Yesf | src/Http/Request.php | Request.file | public function file() {
static $res = null;
if ($res === null) {
$res = [];
foreach ($this->files as $v) {
$res[] = new File($v);
}
}
return $res;
} | php | public function file() {
static $res = null;
if ($res === null) {
$res = [];
foreach ($this->files as $v) {
$res[] = new File($v);
}
}
return $res;
} | [
"public",
"function",
"file",
"(",
")",
"{",
"static",
"$",
"res",
"=",
"null",
";",
"if",
"(",
"$",
"res",
"===",
"null",
")",
"{",
"$",
"res",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"files",
"as",
"$",
"v",
")",
"{",
"$",
"res",
"[",
"]",
"=",
"new",
"File",
"(",
"$",
"v",
")",
";",
"}",
"}",
"return",
"$",
"res",
";",
"}"
] | Get uploaded files
@access public
@return array | [
"Get",
"uploaded",
"files"
] | 0fc2b42903bb3519c54c596270c890c826aeb1df | https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Http/Request.php#L88-L97 |
31,859 | sylingd/Yesf | src/Http/Request.php | Request.end | public function end() {
$this->get = null;
$this->post = null;
$this->server = null;
$this->header = null;
$this->cookie = null;
$this->files = null;
$this->sw_request = null;
if ($this->session !== null) {
$handler = Container::getInstance()->get(Dispatcher::class)->getSessionHandler();
$handler->write($this->session->id(), $this->session->encode());
$this->session = null;
}
} | php | public function end() {
$this->get = null;
$this->post = null;
$this->server = null;
$this->header = null;
$this->cookie = null;
$this->files = null;
$this->sw_request = null;
if ($this->session !== null) {
$handler = Container::getInstance()->get(Dispatcher::class)->getSessionHandler();
$handler->write($this->session->id(), $this->session->encode());
$this->session = null;
}
} | [
"public",
"function",
"end",
"(",
")",
"{",
"$",
"this",
"->",
"get",
"=",
"null",
";",
"$",
"this",
"->",
"post",
"=",
"null",
";",
"$",
"this",
"->",
"server",
"=",
"null",
";",
"$",
"this",
"->",
"header",
"=",
"null",
";",
"$",
"this",
"->",
"cookie",
"=",
"null",
";",
"$",
"this",
"->",
"files",
"=",
"null",
";",
"$",
"this",
"->",
"sw_request",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"session",
"!==",
"null",
")",
"{",
"$",
"handler",
"=",
"Container",
"::",
"getInstance",
"(",
")",
"->",
"get",
"(",
"Dispatcher",
"::",
"class",
")",
"->",
"getSessionHandler",
"(",
")",
";",
"$",
"handler",
"->",
"write",
"(",
"$",
"this",
"->",
"session",
"->",
"id",
"(",
")",
",",
"$",
"this",
"->",
"session",
"->",
"encode",
"(",
")",
")",
";",
"$",
"this",
"->",
"session",
"=",
"null",
";",
"}",
"}"
] | Finish request, release resources
@access public | [
"Finish",
"request",
"release",
"resources"
] | 0fc2b42903bb3519c54c596270c890c826aeb1df | https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Http/Request.php#L182-L195 |
31,860 | chameleon-system/chameleon-shop | src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php | TPkgShopProductExportCSVEndPoint.getLine | private function getLine(array $fields): string
{
$fields = $this->quoteFields($fields);
return $this->sEnclosure.implode($this->sEnclosure.$this->sDelimiter.$this->sEnclosure, $fields).$this->sEnclosure;
} | php | private function getLine(array $fields): string
{
$fields = $this->quoteFields($fields);
return $this->sEnclosure.implode($this->sEnclosure.$this->sDelimiter.$this->sEnclosure, $fields).$this->sEnclosure;
} | [
"private",
"function",
"getLine",
"(",
"array",
"$",
"fields",
")",
":",
"string",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"quoteFields",
"(",
"$",
"fields",
")",
";",
"return",
"$",
"this",
"->",
"sEnclosure",
".",
"implode",
"(",
"$",
"this",
"->",
"sEnclosure",
".",
"$",
"this",
"->",
"sDelimiter",
".",
"$",
"this",
"->",
"sEnclosure",
",",
"$",
"fields",
")",
".",
"$",
"this",
"->",
"sEnclosure",
";",
"}"
] | Returns a CSV line from the given field data. This line does not end with line break characters.
@param string[] $fields
@return string | [
"Returns",
"a",
"CSV",
"line",
"from",
"the",
"given",
"field",
"data",
".",
"This",
"line",
"does",
"not",
"end",
"with",
"line",
"break",
"characters",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php#L63-L68 |
31,861 | chameleon-system/chameleon-shop | src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php | TPkgShopProductExportCSVEndPoint.quoteFields | protected function quoteFields(array $fields): array
{
if ('"' !== $this->sEnclosure) {
return $fields;
}
return array_map(function ($element) {
return \str_replace('"', '""', $element);
}, $fields);
} | php | protected function quoteFields(array $fields): array
{
if ('"' !== $this->sEnclosure) {
return $fields;
}
return array_map(function ($element) {
return \str_replace('"', '""', $element);
}, $fields);
} | [
"protected",
"function",
"quoteFields",
"(",
"array",
"$",
"fields",
")",
":",
"array",
"{",
"if",
"(",
"'\"'",
"!==",
"$",
"this",
"->",
"sEnclosure",
")",
"{",
"return",
"$",
"fields",
";",
"}",
"return",
"array_map",
"(",
"function",
"(",
"$",
"element",
")",
"{",
"return",
"\\",
"str_replace",
"(",
"'\"'",
",",
"'\"\"'",
",",
"$",
"element",
")",
";",
"}",
",",
"$",
"fields",
")",
";",
"}"
] | Quotes occurrences of the enclosure character within the passed fields.
@param string[] $fields
@return string[] | [
"Quotes",
"occurrences",
"of",
"the",
"enclosure",
"character",
"within",
"the",
"passed",
"fields",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php#L77-L86 |
31,862 | chameleon-system/chameleon-shop | src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php | TPkgShopProductExportCSVEndPoint.HandleArticleList | protected function HandleArticleList()
{
$aFields = $this->GetFields();
$oArticleList = $this->GetArticleList();
$iCount = 0;
if (!is_null($oArticleList)) {
/** @var $oArticle TdbShopArticle */
while ($oArticle = &$oArticleList->Next() && !$this->BreakUp($iCount)) {
$oArticle = $this->PreProcessArticle($oArticle);
$this->HandleArticle($oArticle, $aFields);
++$iCount;
}
}
return;
} | php | protected function HandleArticleList()
{
$aFields = $this->GetFields();
$oArticleList = $this->GetArticleList();
$iCount = 0;
if (!is_null($oArticleList)) {
/** @var $oArticle TdbShopArticle */
while ($oArticle = &$oArticleList->Next() && !$this->BreakUp($iCount)) {
$oArticle = $this->PreProcessArticle($oArticle);
$this->HandleArticle($oArticle, $aFields);
++$iCount;
}
}
return;
} | [
"protected",
"function",
"HandleArticleList",
"(",
")",
"{",
"$",
"aFields",
"=",
"$",
"this",
"->",
"GetFields",
"(",
")",
";",
"$",
"oArticleList",
"=",
"$",
"this",
"->",
"GetArticleList",
"(",
")",
";",
"$",
"iCount",
"=",
"0",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oArticleList",
")",
")",
"{",
"/** @var $oArticle TdbShopArticle */",
"while",
"(",
"$",
"oArticle",
"=",
"&",
"$",
"oArticleList",
"->",
"Next",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"BreakUp",
"(",
"$",
"iCount",
")",
")",
"{",
"$",
"oArticle",
"=",
"$",
"this",
"->",
"PreProcessArticle",
"(",
"$",
"oArticle",
")",
";",
"$",
"this",
"->",
"HandleArticle",
"(",
"$",
"oArticle",
",",
"$",
"aFields",
")",
";",
"++",
"$",
"iCount",
";",
"}",
"}",
"return",
";",
"}"
] | loop through the article list and handle each article. | [
"loop",
"through",
"the",
"article",
"list",
"and",
"handle",
"each",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php#L91-L106 |
31,863 | chameleon-system/chameleon-shop | src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php | TPkgShopProductExportCSVEndPoint.HandleArticle | protected function HandleArticle(&$oArticle, &$aFields)
{
/**
* @var $logger LoggerInterface
*/
$logger = ServiceLocator::get('logger');
$iStart = microtime(true);
static $iCount = 0;
static $sMemUsageBeforeArticleProcessed = null;
static $sMemUsageTmp = null;
++$iCount;
if (null === $sMemUsageBeforeArticleProcessed) {
$sMemUsageBeforeArticleProcessed = memory_get_usage();
$sMemUsageTmp = $sMemUsageBeforeArticleProcessed;
}
$aFieldValues = array();
reset($aFields);
foreach ($aFields as $sFieldName) {
$aFieldValues[] = $this->GetFieldValue($sFieldName, $oArticle);
}
$sLine = $this->getLine($aFieldValues);
$this->Write($sLine.$this->lineBreak);
$iLogCount = 1000;
if (0 === $iCount % $iLogCount) {
$sMemUsageAfterArticleProcessed = memory_get_usage();
$sMemDifference = $sMemUsageAfterArticleProcessed - $sMemUsageBeforeArticleProcessed;
$sMemDifference = $sMemDifference / 1024;
$sMemDifference = $sMemDifference / 1024;
$sMemDifferenceTmp = $sMemUsageAfterArticleProcessed - $sMemUsageTmp;
$sMemDifferenceTmp = $sMemDifferenceTmp / 1024;
$sMemDifferenceTmp = $sMemDifferenceTmp / 1024;
if ($this->GetDebug()) {
$logger->debug('memory difference after processing '.$iLogCount.' articles: '.$sMemDifference.'MB ('.$sMemDifferenceTmp.'MB for '.$iLogCount.' articles) - total article count: '.$iCount);
}
$sMemUsageTmp = $sMemUsageAfterArticleProcessed;
}
$iEnd = microtime(true);
$iTime = $iEnd - $iStart;
if ($this->GetDebug()) {
$logger->debug("\n start ".$iStart."\n end ".$iEnd."\n time for one article: ".$iTime);
}
return $sLine;
} | php | protected function HandleArticle(&$oArticle, &$aFields)
{
/**
* @var $logger LoggerInterface
*/
$logger = ServiceLocator::get('logger');
$iStart = microtime(true);
static $iCount = 0;
static $sMemUsageBeforeArticleProcessed = null;
static $sMemUsageTmp = null;
++$iCount;
if (null === $sMemUsageBeforeArticleProcessed) {
$sMemUsageBeforeArticleProcessed = memory_get_usage();
$sMemUsageTmp = $sMemUsageBeforeArticleProcessed;
}
$aFieldValues = array();
reset($aFields);
foreach ($aFields as $sFieldName) {
$aFieldValues[] = $this->GetFieldValue($sFieldName, $oArticle);
}
$sLine = $this->getLine($aFieldValues);
$this->Write($sLine.$this->lineBreak);
$iLogCount = 1000;
if (0 === $iCount % $iLogCount) {
$sMemUsageAfterArticleProcessed = memory_get_usage();
$sMemDifference = $sMemUsageAfterArticleProcessed - $sMemUsageBeforeArticleProcessed;
$sMemDifference = $sMemDifference / 1024;
$sMemDifference = $sMemDifference / 1024;
$sMemDifferenceTmp = $sMemUsageAfterArticleProcessed - $sMemUsageTmp;
$sMemDifferenceTmp = $sMemDifferenceTmp / 1024;
$sMemDifferenceTmp = $sMemDifferenceTmp / 1024;
if ($this->GetDebug()) {
$logger->debug('memory difference after processing '.$iLogCount.' articles: '.$sMemDifference.'MB ('.$sMemDifferenceTmp.'MB for '.$iLogCount.' articles) - total article count: '.$iCount);
}
$sMemUsageTmp = $sMemUsageAfterArticleProcessed;
}
$iEnd = microtime(true);
$iTime = $iEnd - $iStart;
if ($this->GetDebug()) {
$logger->debug("\n start ".$iStart."\n end ".$iEnd."\n time for one article: ".$iTime);
}
return $sLine;
} | [
"protected",
"function",
"HandleArticle",
"(",
"&",
"$",
"oArticle",
",",
"&",
"$",
"aFields",
")",
"{",
"/**\n * @var $logger LoggerInterface\n */",
"$",
"logger",
"=",
"ServiceLocator",
"::",
"get",
"(",
"'logger'",
")",
";",
"$",
"iStart",
"=",
"microtime",
"(",
"true",
")",
";",
"static",
"$",
"iCount",
"=",
"0",
";",
"static",
"$",
"sMemUsageBeforeArticleProcessed",
"=",
"null",
";",
"static",
"$",
"sMemUsageTmp",
"=",
"null",
";",
"++",
"$",
"iCount",
";",
"if",
"(",
"null",
"===",
"$",
"sMemUsageBeforeArticleProcessed",
")",
"{",
"$",
"sMemUsageBeforeArticleProcessed",
"=",
"memory_get_usage",
"(",
")",
";",
"$",
"sMemUsageTmp",
"=",
"$",
"sMemUsageBeforeArticleProcessed",
";",
"}",
"$",
"aFieldValues",
"=",
"array",
"(",
")",
";",
"reset",
"(",
"$",
"aFields",
")",
";",
"foreach",
"(",
"$",
"aFields",
"as",
"$",
"sFieldName",
")",
"{",
"$",
"aFieldValues",
"[",
"]",
"=",
"$",
"this",
"->",
"GetFieldValue",
"(",
"$",
"sFieldName",
",",
"$",
"oArticle",
")",
";",
"}",
"$",
"sLine",
"=",
"$",
"this",
"->",
"getLine",
"(",
"$",
"aFieldValues",
")",
";",
"$",
"this",
"->",
"Write",
"(",
"$",
"sLine",
".",
"$",
"this",
"->",
"lineBreak",
")",
";",
"$",
"iLogCount",
"=",
"1000",
";",
"if",
"(",
"0",
"===",
"$",
"iCount",
"%",
"$",
"iLogCount",
")",
"{",
"$",
"sMemUsageAfterArticleProcessed",
"=",
"memory_get_usage",
"(",
")",
";",
"$",
"sMemDifference",
"=",
"$",
"sMemUsageAfterArticleProcessed",
"-",
"$",
"sMemUsageBeforeArticleProcessed",
";",
"$",
"sMemDifference",
"=",
"$",
"sMemDifference",
"/",
"1024",
";",
"$",
"sMemDifference",
"=",
"$",
"sMemDifference",
"/",
"1024",
";",
"$",
"sMemDifferenceTmp",
"=",
"$",
"sMemUsageAfterArticleProcessed",
"-",
"$",
"sMemUsageTmp",
";",
"$",
"sMemDifferenceTmp",
"=",
"$",
"sMemDifferenceTmp",
"/",
"1024",
";",
"$",
"sMemDifferenceTmp",
"=",
"$",
"sMemDifferenceTmp",
"/",
"1024",
";",
"if",
"(",
"$",
"this",
"->",
"GetDebug",
"(",
")",
")",
"{",
"$",
"logger",
"->",
"debug",
"(",
"'memory difference after processing '",
".",
"$",
"iLogCount",
".",
"' articles: '",
".",
"$",
"sMemDifference",
".",
"'MB ('",
".",
"$",
"sMemDifferenceTmp",
".",
"'MB for '",
".",
"$",
"iLogCount",
".",
"' articles) - total article count: '",
".",
"$",
"iCount",
")",
";",
"}",
"$",
"sMemUsageTmp",
"=",
"$",
"sMemUsageAfterArticleProcessed",
";",
"}",
"$",
"iEnd",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"iTime",
"=",
"$",
"iEnd",
"-",
"$",
"iStart",
";",
"if",
"(",
"$",
"this",
"->",
"GetDebug",
"(",
")",
")",
"{",
"$",
"logger",
"->",
"debug",
"(",
"\"\\n start \"",
".",
"$",
"iStart",
".",
"\"\\n end \"",
".",
"$",
"iEnd",
".",
"\"\\n time for one article: \"",
".",
"$",
"iTime",
")",
";",
"}",
"return",
"$",
"sLine",
";",
"}"
] | do work for one article
loops through the available fields and calls GetFieldValue method for each field.
@param TdbShopArticle $oArticle
@param array $aFields
@return string | [
"do",
"work",
"for",
"one",
"article",
"loops",
"through",
"the",
"available",
"fields",
"and",
"calls",
"GetFieldValue",
"method",
"for",
"each",
"field",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php#L117-L169 |
31,864 | chameleon-system/chameleon-shop | src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php | TPkgShopProductExportCSVEndPoint.CleanContent | protected function CleanContent($sValue)
{
$sValue = parent::CleanContent($sValue);
$sValue = preg_replace('/\ +/', ' ', $sValue);
if ('"' === $this->sEnclosure) {
return $sValue;
}
if (true === \in_array($this->sDelimiter, [',', "\t", "\n"], true)) {
$sValue = str_replace($this->sDelimiter, ' ', $sValue);
} else {
$sValue = str_replace($this->sDelimiter, ',', $sValue);
}
return $sValue;
} | php | protected function CleanContent($sValue)
{
$sValue = parent::CleanContent($sValue);
$sValue = preg_replace('/\ +/', ' ', $sValue);
if ('"' === $this->sEnclosure) {
return $sValue;
}
if (true === \in_array($this->sDelimiter, [',', "\t", "\n"], true)) {
$sValue = str_replace($this->sDelimiter, ' ', $sValue);
} else {
$sValue = str_replace($this->sDelimiter, ',', $sValue);
}
return $sValue;
} | [
"protected",
"function",
"CleanContent",
"(",
"$",
"sValue",
")",
"{",
"$",
"sValue",
"=",
"parent",
"::",
"CleanContent",
"(",
"$",
"sValue",
")",
";",
"$",
"sValue",
"=",
"preg_replace",
"(",
"'/\\ +/'",
",",
"' '",
",",
"$",
"sValue",
")",
";",
"if",
"(",
"'\"'",
"===",
"$",
"this",
"->",
"sEnclosure",
")",
"{",
"return",
"$",
"sValue",
";",
"}",
"if",
"(",
"true",
"===",
"\\",
"in_array",
"(",
"$",
"this",
"->",
"sDelimiter",
",",
"[",
"','",
",",
"\"\\t\"",
",",
"\"\\n\"",
"]",
",",
"true",
")",
")",
"{",
"$",
"sValue",
"=",
"str_replace",
"(",
"$",
"this",
"->",
"sDelimiter",
",",
"' '",
",",
"$",
"sValue",
")",
";",
"}",
"else",
"{",
"$",
"sValue",
"=",
"str_replace",
"(",
"$",
"this",
"->",
"sDelimiter",
",",
"','",
",",
"$",
"sValue",
")",
";",
"}",
"return",
"$",
"sValue",
";",
"}"
] | Clean double blanks in content and replace delimiter to avoid errors.
@param $sValue
@return string | [
"Clean",
"double",
"blanks",
"in",
"content",
"and",
"replace",
"delimiter",
"to",
"avoid",
"errors",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopProductExportBundle/objects/TPkgShopProductExportCSVEndPoint.class.php#L192-L208 |
31,865 | PGB-LIV/php-ms | src/Core/Identification.php | Identification.getScore | public function getScore($key)
{
if (! array_key_exists($key, $this->scores)) {
throw new \OutOfBoundsException('The key "' . $key . ' was not found.');
}
return $this->scores[$key];
} | php | public function getScore($key)
{
if (! array_key_exists($key, $this->scores)) {
throw new \OutOfBoundsException('The key "' . $key . ' was not found.');
}
return $this->scores[$key];
} | [
"public",
"function",
"getScore",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"scores",
")",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"'The key \"'",
".",
"$",
"key",
".",
"' was not found.'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"scores",
"[",
"$",
"key",
"]",
";",
"}"
] | Gets the value for a score identified by the key that was set when setScore was called.
@param string $key
The key to retrieve the value for
@throws \OutOfBoundsException If the key was not found on this identification
@return mixed | [
"Gets",
"the",
"value",
"for",
"a",
"score",
"identified",
"by",
"the",
"key",
"that",
"was",
"set",
"when",
"setScore",
"was",
"called",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Identification.php#L131-L138 |
31,866 | PGB-LIV/php-ms | src/Core/Identification.php | Identification.setIonsMatched | public function setIonsMatched($ionsMatched)
{
if (! is_int($ionsMatched)) {
throw new \InvalidArgumentException(
'Argument 1 must be an int value. Valued passed is of type ' . gettype($ionsMatched));
}
$this->ionsMatched = $ionsMatched;
} | php | public function setIonsMatched($ionsMatched)
{
if (! is_int($ionsMatched)) {
throw new \InvalidArgumentException(
'Argument 1 must be an int value. Valued passed is of type ' . gettype($ionsMatched));
}
$this->ionsMatched = $ionsMatched;
} | [
"public",
"function",
"setIonsMatched",
"(",
"$",
"ionsMatched",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"ionsMatched",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Argument 1 must be an int value. Valued passed is of type '",
".",
"gettype",
"(",
"$",
"ionsMatched",
")",
")",
";",
"}",
"$",
"this",
"->",
"ionsMatched",
"=",
"$",
"ionsMatched",
";",
"}"
] | Sets the the number of fragment ions matched
@param int $ionsMatched
The number of ions matched
@throws \InvalidArgumentException If the arguments do not match the data types | [
"Sets",
"the",
"the",
"number",
"of",
"fragment",
"ions",
"matched"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Identification.php#L155-L163 |
31,867 | PGB-LIV/php-ms | src/Core/Identification.php | Identification.setRank | public function setRank($rank)
{
if (! is_int($rank)) {
throw new \InvalidArgumentException(
'Argument 1 must be an int value. Valued passed is of type ' . gettype($rank));
}
$this->rank = $rank;
} | php | public function setRank($rank)
{
if (! is_int($rank)) {
throw new \InvalidArgumentException(
'Argument 1 must be an int value. Valued passed is of type ' . gettype($rank));
}
$this->rank = $rank;
} | [
"public",
"function",
"setRank",
"(",
"$",
"rank",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"rank",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Argument 1 must be an int value. Valued passed is of type '",
".",
"gettype",
"(",
"$",
"rank",
")",
")",
";",
"}",
"$",
"this",
"->",
"rank",
"=",
"$",
"rank",
";",
"}"
] | Sets the rank for this instance
@param int $rank
Rank value to set too | [
"Sets",
"the",
"rank",
"for",
"this",
"instance"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Identification.php#L181-L189 |
31,868 | chameleon-system/chameleon-shop | src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionDataEndPoint.class.php | TPkgShopPaymentTransactionDataEndPoint.getTotalValueForItemType | public function getTotalValueForItemType($sType)
{
$dTotal = 0;
reset($this->items);
/** @var TPkgShopPaymentTransactionItemData $oItem */
foreach ($this->items as $oItem) {
if ($sType !== $oItem->getType()) {
continue;
}
$dTotal = $dTotal + ($oItem->getAmount() * $oItem->getValue());
}
return $dTotal;
} | php | public function getTotalValueForItemType($sType)
{
$dTotal = 0;
reset($this->items);
/** @var TPkgShopPaymentTransactionItemData $oItem */
foreach ($this->items as $oItem) {
if ($sType !== $oItem->getType()) {
continue;
}
$dTotal = $dTotal + ($oItem->getAmount() * $oItem->getValue());
}
return $dTotal;
} | [
"public",
"function",
"getTotalValueForItemType",
"(",
"$",
"sType",
")",
"{",
"$",
"dTotal",
"=",
"0",
";",
"reset",
"(",
"$",
"this",
"->",
"items",
")",
";",
"/** @var TPkgShopPaymentTransactionItemData $oItem */",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"oItem",
")",
"{",
"if",
"(",
"$",
"sType",
"!==",
"$",
"oItem",
"->",
"getType",
"(",
")",
")",
"{",
"continue",
";",
"}",
"$",
"dTotal",
"=",
"$",
"dTotal",
"+",
"(",
"$",
"oItem",
"->",
"getAmount",
"(",
")",
"*",
"$",
"oItem",
"->",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"$",
"dTotal",
";",
"}"
] | return the total value of all items with the given item type.
@param $sType - must be one of TPkgShopPaymentTransactionItemData::TYPE_*
@return int | [
"return",
"the",
"total",
"value",
"of",
"all",
"items",
"with",
"the",
"given",
"item",
"type",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentTransactionBundle/objects/TPkgShopPaymentTransactionDataEndPoint.class.php#L243-L256 |
31,869 | edmondscommerce/doctrine-static-meta | src/Entity/Fields/Traits/String/EnumFieldTrait.php | EnumFieldTrait.setEnum | private function setEnum(string $enum): self
{
$this->updatePropertyValue(
EnumFieldInterface::PROP_ENUM,
$enum
);
return $this;
} | php | private function setEnum(string $enum): self
{
$this->updatePropertyValue(
EnumFieldInterface::PROP_ENUM,
$enum
);
return $this;
} | [
"private",
"function",
"setEnum",
"(",
"string",
"$",
"enum",
")",
":",
"self",
"{",
"$",
"this",
"->",
"updatePropertyValue",
"(",
"EnumFieldInterface",
"::",
"PROP_ENUM",
",",
"$",
"enum",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Uses the Symfony Validator and fails back to basic in_array validation with exception
@param string $enum
@return self | [
"Uses",
"the",
"Symfony",
"Validator",
"and",
"fails",
"back",
"to",
"basic",
"in_array",
"validation",
"with",
"exception"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Fields/Traits/String/EnumFieldTrait.php#L88-L96 |
31,870 | chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Model/IdList.php | OffAmazonPaymentsService_Model_IdList.setmember | public function setmember($member)
{
if (!$this->_isNumericArray($member)) {
$member = array ($member);
}
$this->_fields['member']['FieldValue'] = $member;
return $this;
} | php | public function setmember($member)
{
if (!$this->_isNumericArray($member)) {
$member = array ($member);
}
$this->_fields['member']['FieldValue'] = $member;
return $this;
} | [
"public",
"function",
"setmember",
"(",
"$",
"member",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_isNumericArray",
"(",
"$",
"member",
")",
")",
"{",
"$",
"member",
"=",
"array",
"(",
"$",
"member",
")",
";",
"}",
"$",
"this",
"->",
"_fields",
"[",
"'member'",
"]",
"[",
"'FieldValue'",
"]",
"=",
"$",
"member",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the value of the member.
@param string or an array of string member
@return this instance | [
"Sets",
"the",
"value",
"of",
"the",
"member",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Model/IdList.php#L75-L82 |
31,871 | CVO-Technologies/cakephp-github | src/Model/Resource/Event.php | Event.describe | public function describe()
{
var_dump($this);
var_dump($this->type);
return $this->id . ' - ' . $this->type . ' - ' . $this->actor->login;
} | php | public function describe()
{
var_dump($this);
var_dump($this->type);
return $this->id . ' - ' . $this->type . ' - ' . $this->actor->login;
} | [
"public",
"function",
"describe",
"(",
")",
"{",
"var_dump",
"(",
"$",
"this",
")",
";",
"var_dump",
"(",
"$",
"this",
"->",
"type",
")",
";",
"return",
"$",
"this",
"->",
"id",
".",
"' - '",
".",
"$",
"this",
"->",
"type",
".",
"' - '",
".",
"$",
"this",
"->",
"actor",
"->",
"login",
";",
"}"
] | Return a text description of a event.
@return string description of a event. | [
"Return",
"a",
"text",
"description",
"of",
"a",
"event",
"."
] | 43647e53fd87a3ab93fe2f24ce3686b594d36241 | https://github.com/CVO-Technologies/cakephp-github/blob/43647e53fd87a3ab93fe2f24ce3686b594d36241/src/Model/Resource/Event.php#L17-L23 |
31,872 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketDiscountCoreList.class.php | TShopBasketDiscountCoreList.GetDiscountValue | public function GetDiscountValue()
{
$dValue = 0;
$iTmpPointer = $this->getItemPointer();
$this->GoToStart();
while ($oDiscount = $this->Next()) {
$dValue += $oDiscount->GetValue();
}
$this->setItemPointer($iTmpPointer);
return $dValue;
} | php | public function GetDiscountValue()
{
$dValue = 0;
$iTmpPointer = $this->getItemPointer();
$this->GoToStart();
while ($oDiscount = $this->Next()) {
$dValue += $oDiscount->GetValue();
}
$this->setItemPointer($iTmpPointer);
return $dValue;
} | [
"public",
"function",
"GetDiscountValue",
"(",
")",
"{",
"$",
"dValue",
"=",
"0",
";",
"$",
"iTmpPointer",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oDiscount",
"=",
"$",
"this",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"dValue",
"+=",
"$",
"oDiscount",
"->",
"GetValue",
"(",
")",
";",
"}",
"$",
"this",
"->",
"setItemPointer",
"(",
"$",
"iTmpPointer",
")",
";",
"return",
"$",
"dValue",
";",
"}"
] | return the total discount value for all active discounts. note that the method will fetch the current basket
using the baskets singleton factory.
@return float | [
"return",
"the",
"total",
"discount",
"value",
"for",
"all",
"active",
"discounts",
".",
"note",
"that",
"the",
"method",
"will",
"fetch",
"the",
"current",
"basket",
"using",
"the",
"baskets",
"singleton",
"factory",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketDiscountCoreList.class.php#L28-L40 |
31,873 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketDiscountCoreList.class.php | TShopBasketDiscountCoreList.RemoveInvalidDiscounts | public function RemoveInvalidDiscounts($sMessangerName = null)
{
// since the min value of the basket for which a discount may work is affected by other discounts,
// we need to remove the discounts first, and then add them one by one back to the basket
// we suppress the add messages, but keep the negative messages
$oMessageManager = TCMSMessageManager::GetInstance();
// get copy of discounts
$aDiscountList = $this->_items;
$this->Destroy();
foreach ($aDiscountList as $iDiscountKey => $oDiscount) {
/** @var $oDiscount TdbShopDiscount */
$cDiscountAllowUseCode = $oDiscount->AllowUseOfDiscount();
if (TdbShopDiscount::ALLOW_USE == $cDiscountAllowUseCode) {
$this->AddItem($oDiscount);
} else {
if (!is_null($sMessangerName)) {
// send message that the discount was removed
$aMessageData = $oDiscount->GetObjectPropertiesAsArray();
$aMessageData['iRemoveReasoneCode'] = $cDiscountAllowUseCode;
$oMessageManager->AddMessage($sMessangerName, 'DISCOUNT-ERROR-NO-LONGER-VALID-FOR-BASKET', $aMessageData);
}
}
}
} | php | public function RemoveInvalidDiscounts($sMessangerName = null)
{
// since the min value of the basket for which a discount may work is affected by other discounts,
// we need to remove the discounts first, and then add them one by one back to the basket
// we suppress the add messages, but keep the negative messages
$oMessageManager = TCMSMessageManager::GetInstance();
// get copy of discounts
$aDiscountList = $this->_items;
$this->Destroy();
foreach ($aDiscountList as $iDiscountKey => $oDiscount) {
/** @var $oDiscount TdbShopDiscount */
$cDiscountAllowUseCode = $oDiscount->AllowUseOfDiscount();
if (TdbShopDiscount::ALLOW_USE == $cDiscountAllowUseCode) {
$this->AddItem($oDiscount);
} else {
if (!is_null($sMessangerName)) {
// send message that the discount was removed
$aMessageData = $oDiscount->GetObjectPropertiesAsArray();
$aMessageData['iRemoveReasoneCode'] = $cDiscountAllowUseCode;
$oMessageManager->AddMessage($sMessangerName, 'DISCOUNT-ERROR-NO-LONGER-VALID-FOR-BASKET', $aMessageData);
}
}
}
} | [
"public",
"function",
"RemoveInvalidDiscounts",
"(",
"$",
"sMessangerName",
"=",
"null",
")",
"{",
"// since the min value of the basket for which a discount may work is affected by other discounts,",
"// we need to remove the discounts first, and then add them one by one back to the basket",
"// we suppress the add messages, but keep the negative messages",
"$",
"oMessageManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"// get copy of discounts",
"$",
"aDiscountList",
"=",
"$",
"this",
"->",
"_items",
";",
"$",
"this",
"->",
"Destroy",
"(",
")",
";",
"foreach",
"(",
"$",
"aDiscountList",
"as",
"$",
"iDiscountKey",
"=>",
"$",
"oDiscount",
")",
"{",
"/** @var $oDiscount TdbShopDiscount */",
"$",
"cDiscountAllowUseCode",
"=",
"$",
"oDiscount",
"->",
"AllowUseOfDiscount",
"(",
")",
";",
"if",
"(",
"TdbShopDiscount",
"::",
"ALLOW_USE",
"==",
"$",
"cDiscountAllowUseCode",
")",
"{",
"$",
"this",
"->",
"AddItem",
"(",
"$",
"oDiscount",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"sMessangerName",
")",
")",
"{",
"// send message that the discount was removed",
"$",
"aMessageData",
"=",
"$",
"oDiscount",
"->",
"GetObjectPropertiesAsArray",
"(",
")",
";",
"$",
"aMessageData",
"[",
"'iRemoveReasoneCode'",
"]",
"=",
"$",
"cDiscountAllowUseCode",
";",
"$",
"oMessageManager",
"->",
"AddMessage",
"(",
"$",
"sMessangerName",
",",
"'DISCOUNT-ERROR-NO-LONGER-VALID-FOR-BASKET'",
",",
"$",
"aMessageData",
")",
";",
"}",
"}",
"}",
"}"
] | Removes all discounts from the basket, that are not valid based on the contents of the basket and the current user
Returns the number of discounts removed.
@param string $sMessangerName - optional message manager to which we output why a discount was removed
@return int | [
"Removes",
"all",
"discounts",
"from",
"the",
"basket",
"that",
"are",
"not",
"valid",
"based",
"on",
"the",
"contents",
"of",
"the",
"basket",
"and",
"the",
"current",
"user",
"Returns",
"the",
"number",
"of",
"discounts",
"removed",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketDiscountCoreList.class.php#L50-L75 |
31,874 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Embeddable/ArchetypeEmbeddableGenerator.php | ArchetypeEmbeddableGenerator.getNewEmbeddableFqnFromClassName | private function getNewEmbeddableFqnFromClassName(string $className): string
{
return $this->namespaceHelper->tidy(
$this->projectRootNamespace . '\\'
. implode('\\', \array_slice($this->archetypeObjectSubDirectories, 1))
. '\\' . $className
);
} | php | private function getNewEmbeddableFqnFromClassName(string $className): string
{
return $this->namespaceHelper->tidy(
$this->projectRootNamespace . '\\'
. implode('\\', \array_slice($this->archetypeObjectSubDirectories, 1))
. '\\' . $className
);
} | [
"private",
"function",
"getNewEmbeddableFqnFromClassName",
"(",
"string",
"$",
"className",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"namespaceHelper",
"->",
"tidy",
"(",
"$",
"this",
"->",
"projectRootNamespace",
".",
"'\\\\'",
".",
"implode",
"(",
"'\\\\'",
",",
"\\",
"array_slice",
"(",
"$",
"this",
"->",
"archetypeObjectSubDirectories",
",",
"1",
")",
")",
".",
"'\\\\'",
".",
"$",
"className",
")",
";",
"}"
] | Get the Fully Qualified name for the new embeddable object based upon the project root names
@param string $className
@return string | [
"Get",
"the",
"Fully",
"Qualified",
"name",
"for",
"the",
"new",
"embeddable",
"object",
"based",
"upon",
"the",
"project",
"root",
"names"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Embeddable/ArchetypeEmbeddableGenerator.php#L348-L355 |
31,875 | edmondscommerce/doctrine-static-meta | src/CodeGeneration/Generator/Embeddable/ArchetypeEmbeddableGenerator.php | ArchetypeEmbeddableGenerator.getNewPathFromArchetypePath | private function getNewPathFromArchetypePath(string $archetypePath): string
{
$rootArchetypePath = substr($archetypePath, 0, \ts\strpos($archetypePath, '/src/Entity/Embeddable'));
$path = \str_replace($rootArchetypePath, $this->pathToProjectRoot, $archetypePath);
$pattern = '%^(.*?)/([^/]*?)' . $this->archetypeObjectClassName . '([^/]*?)php$%m';
$replacement = '$1/$2' . $this->newObjectClassName . '$3php';
$path = \preg_replace($pattern, $replacement, $path, -1, $replacements);
if (0 === $replacements) {
throw new \RuntimeException('Failed updating the path with regex in ' . __METHOD__);
}
return $path;
} | php | private function getNewPathFromArchetypePath(string $archetypePath): string
{
$rootArchetypePath = substr($archetypePath, 0, \ts\strpos($archetypePath, '/src/Entity/Embeddable'));
$path = \str_replace($rootArchetypePath, $this->pathToProjectRoot, $archetypePath);
$pattern = '%^(.*?)/([^/]*?)' . $this->archetypeObjectClassName . '([^/]*?)php$%m';
$replacement = '$1/$2' . $this->newObjectClassName . '$3php';
$path = \preg_replace($pattern, $replacement, $path, -1, $replacements);
if (0 === $replacements) {
throw new \RuntimeException('Failed updating the path with regex in ' . __METHOD__);
}
return $path;
} | [
"private",
"function",
"getNewPathFromArchetypePath",
"(",
"string",
"$",
"archetypePath",
")",
":",
"string",
"{",
"$",
"rootArchetypePath",
"=",
"substr",
"(",
"$",
"archetypePath",
",",
"0",
",",
"\\",
"ts",
"\\",
"strpos",
"(",
"$",
"archetypePath",
",",
"'/src/Entity/Embeddable'",
")",
")",
";",
"$",
"path",
"=",
"\\",
"str_replace",
"(",
"$",
"rootArchetypePath",
",",
"$",
"this",
"->",
"pathToProjectRoot",
",",
"$",
"archetypePath",
")",
";",
"$",
"pattern",
"=",
"'%^(.*?)/([^/]*?)'",
".",
"$",
"this",
"->",
"archetypeObjectClassName",
".",
"'([^/]*?)php$%m'",
";",
"$",
"replacement",
"=",
"'$1/$2'",
".",
"$",
"this",
"->",
"newObjectClassName",
".",
"'$3php'",
";",
"$",
"path",
"=",
"\\",
"preg_replace",
"(",
"$",
"pattern",
",",
"$",
"replacement",
",",
"$",
"path",
",",
"-",
"1",
",",
"$",
"replacements",
")",
";",
"if",
"(",
"0",
"===",
"$",
"replacements",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Failed updating the path with regex in '",
".",
"__METHOD__",
")",
";",
"}",
"return",
"$",
"path",
";",
"}"
] | Calculate the new path by doing a preg replace on the corresponding archetype path
@param string $archetypePath
@return null|string|string[] | [
"Calculate",
"the",
"new",
"path",
"by",
"doing",
"a",
"preg",
"replace",
"on",
"the",
"corresponding",
"archetype",
"path"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/CodeGeneration/Generator/Embeddable/ArchetypeEmbeddableGenerator.php#L364-L379 |
31,876 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.SetActiveShippingGroup | public function SetActiveShippingGroup($oShippingGroup)
{
$bGroupAssigned = false;
if (!is_null($oShippingGroup)) {
$oAvailableShippingGroups = $this->GetAvailableShippingGroups();
if (!is_null($oAvailableShippingGroups) && $oAvailableShippingGroups->IsInList($oShippingGroup->id)) {
$bGroupAssigned = true;
$this->oActiveShippingGroup = $oShippingGroup;
// if a payment method is selected, then we need to make sure it is available for the selected shipping group.
// since the SetActivePaymentmethod performs the check we call it.
if (!is_null($this->GetActivePaymentMethod())) {
$this->SetActivePaymentMethod($this->GetActivePaymentMethod());
}
}
} else {
$this->oActiveShippingGroup = null;
$this->SetActivePaymentMethod(null);
}
return $bGroupAssigned;
} | php | public function SetActiveShippingGroup($oShippingGroup)
{
$bGroupAssigned = false;
if (!is_null($oShippingGroup)) {
$oAvailableShippingGroups = $this->GetAvailableShippingGroups();
if (!is_null($oAvailableShippingGroups) && $oAvailableShippingGroups->IsInList($oShippingGroup->id)) {
$bGroupAssigned = true;
$this->oActiveShippingGroup = $oShippingGroup;
// if a payment method is selected, then we need to make sure it is available for the selected shipping group.
// since the SetActivePaymentmethod performs the check we call it.
if (!is_null($this->GetActivePaymentMethod())) {
$this->SetActivePaymentMethod($this->GetActivePaymentMethod());
}
}
} else {
$this->oActiveShippingGroup = null;
$this->SetActivePaymentMethod(null);
}
return $bGroupAssigned;
} | [
"public",
"function",
"SetActiveShippingGroup",
"(",
"$",
"oShippingGroup",
")",
"{",
"$",
"bGroupAssigned",
"=",
"false",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oShippingGroup",
")",
")",
"{",
"$",
"oAvailableShippingGroups",
"=",
"$",
"this",
"->",
"GetAvailableShippingGroups",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oAvailableShippingGroups",
")",
"&&",
"$",
"oAvailableShippingGroups",
"->",
"IsInList",
"(",
"$",
"oShippingGroup",
"->",
"id",
")",
")",
"{",
"$",
"bGroupAssigned",
"=",
"true",
";",
"$",
"this",
"->",
"oActiveShippingGroup",
"=",
"$",
"oShippingGroup",
";",
"// if a payment method is selected, then we need to make sure it is available for the selected shipping group.",
"// since the SetActivePaymentmethod performs the check we call it.",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"GetActivePaymentMethod",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"SetActivePaymentMethod",
"(",
"$",
"this",
"->",
"GetActivePaymentMethod",
"(",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"oActiveShippingGroup",
"=",
"null",
";",
"$",
"this",
"->",
"SetActivePaymentMethod",
"(",
"null",
")",
";",
"}",
"return",
"$",
"bGroupAssigned",
";",
"}"
] | set the active shipping group - return false, if an invalid group is selected.
@param TdbShopShippingGroup $oShippingGroup
@return bool | [
"set",
"the",
"active",
"shipping",
"group",
"-",
"return",
"false",
"if",
"an",
"invalid",
"group",
"is",
"selected",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L304-L325 |
31,877 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.& | public function &GetActiveShippingGroup()
{
if (is_null($this->oActiveShippingGroup)) {
// fetch the one from the shop
$oShopConfig = TdbShop::GetInstance();
$oActiveShippingGroup = $oShopConfig->GetFieldShopShippingGroup();
if (false == $this->SetActiveShippingGroup($oActiveShippingGroup)) {
// unable to set - group not in allowed list
$oList = $this->GetAvailableShippingGroups();
$oList->GoToStart();
if ($oList->Length() > 0) {
$oActiveShippingGroup = $oList->Current();
$this->SetActiveShippingGroup($oActiveShippingGroup);
}
}
}
return $this->oActiveShippingGroup;
} | php | public function &GetActiveShippingGroup()
{
if (is_null($this->oActiveShippingGroup)) {
// fetch the one from the shop
$oShopConfig = TdbShop::GetInstance();
$oActiveShippingGroup = $oShopConfig->GetFieldShopShippingGroup();
if (false == $this->SetActiveShippingGroup($oActiveShippingGroup)) {
// unable to set - group not in allowed list
$oList = $this->GetAvailableShippingGroups();
$oList->GoToStart();
if ($oList->Length() > 0) {
$oActiveShippingGroup = $oList->Current();
$this->SetActiveShippingGroup($oActiveShippingGroup);
}
}
}
return $this->oActiveShippingGroup;
} | [
"public",
"function",
"&",
"GetActiveShippingGroup",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"oActiveShippingGroup",
")",
")",
"{",
"// fetch the one from the shop",
"$",
"oShopConfig",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oActiveShippingGroup",
"=",
"$",
"oShopConfig",
"->",
"GetFieldShopShippingGroup",
"(",
")",
";",
"if",
"(",
"false",
"==",
"$",
"this",
"->",
"SetActiveShippingGroup",
"(",
"$",
"oActiveShippingGroup",
")",
")",
"{",
"// unable to set - group not in allowed list",
"$",
"oList",
"=",
"$",
"this",
"->",
"GetAvailableShippingGroups",
"(",
")",
";",
"$",
"oList",
"->",
"GoToStart",
"(",
")",
";",
"if",
"(",
"$",
"oList",
"->",
"Length",
"(",
")",
">",
"0",
")",
"{",
"$",
"oActiveShippingGroup",
"=",
"$",
"oList",
"->",
"Current",
"(",
")",
";",
"$",
"this",
"->",
"SetActiveShippingGroup",
"(",
"$",
"oActiveShippingGroup",
")",
";",
"}",
"}",
"}",
"return",
"$",
"this",
"->",
"oActiveShippingGroup",
";",
"}"
] | return the active shipping group - will set the shipping group to the default group, if none is set.
@return TdbShopShippingGroup | [
"return",
"the",
"active",
"shipping",
"group",
"-",
"will",
"set",
"the",
"shipping",
"group",
"to",
"the",
"default",
"group",
"if",
"none",
"is",
"set",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L332-L350 |
31,878 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.GetAvailablePaymentMethods | public function GetAvailablePaymentMethods()
{
$oList = null;
if ($this->GetActiveShippingGroup()) {
$oList = $this->GetActiveShippingGroup()->GetValidPaymentMethods();
}
return $oList;
} | php | public function GetAvailablePaymentMethods()
{
$oList = null;
if ($this->GetActiveShippingGroup()) {
$oList = $this->GetActiveShippingGroup()->GetValidPaymentMethods();
}
return $oList;
} | [
"public",
"function",
"GetAvailablePaymentMethods",
"(",
")",
"{",
"$",
"oList",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"GetActiveShippingGroup",
"(",
")",
")",
"{",
"$",
"oList",
"=",
"$",
"this",
"->",
"GetActiveShippingGroup",
"(",
")",
"->",
"GetValidPaymentMethods",
"(",
")",
";",
"}",
"return",
"$",
"oList",
";",
"}"
] | return all payment methods for the active shipping group.
@return TdbShopPaymentMethodList | [
"return",
"all",
"payment",
"methods",
"for",
"the",
"active",
"shipping",
"group",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L375-L383 |
31,879 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.GetValidPaymentMethodsSelectableByTheUser | public function GetValidPaymentMethodsSelectableByTheUser()
{
$oList = null;
if ($this->GetActiveShippingGroup()) {
$oList = $this->GetActiveShippingGroup()->GetValidPaymentMethodsSelectableByTheUser();
}
return $oList;
} | php | public function GetValidPaymentMethodsSelectableByTheUser()
{
$oList = null;
if ($this->GetActiveShippingGroup()) {
$oList = $this->GetActiveShippingGroup()->GetValidPaymentMethodsSelectableByTheUser();
}
return $oList;
} | [
"public",
"function",
"GetValidPaymentMethodsSelectableByTheUser",
"(",
")",
"{",
"$",
"oList",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"GetActiveShippingGroup",
"(",
")",
")",
"{",
"$",
"oList",
"=",
"$",
"this",
"->",
"GetActiveShippingGroup",
"(",
")",
"->",
"GetValidPaymentMethodsSelectableByTheUser",
"(",
")",
";",
"}",
"return",
"$",
"oList",
";",
"}"
] | return all payment methods for the active shipping group that are selectable by the user.
@return TdbShopPaymentMethodList | [
"return",
"all",
"payment",
"methods",
"for",
"the",
"active",
"shipping",
"group",
"that",
"are",
"selectable",
"by",
"the",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L390-L398 |
31,880 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.ClearBasket | public function ClearBasket()
{
$this->UnlockBasket();
/** @var Request $request */
$request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();
$request->getSession()->remove(self::SESSION_KEY_NAME);
$event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent(
TdbDataExtranetUser::GetInstance(),
$this
);
$this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_CLEAR, $event);
} | php | public function ClearBasket()
{
$this->UnlockBasket();
/** @var Request $request */
$request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();
$request->getSession()->remove(self::SESSION_KEY_NAME);
$event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent(
TdbDataExtranetUser::GetInstance(),
$this
);
$this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_CLEAR, $event);
} | [
"public",
"function",
"ClearBasket",
"(",
")",
"{",
"$",
"this",
"->",
"UnlockBasket",
"(",
")",
";",
"/** @var Request $request */",
"$",
"request",
"=",
"\\",
"ChameleonSystem",
"\\",
"CoreBundle",
"\\",
"ServiceLocator",
"::",
"get",
"(",
"'request_stack'",
")",
"->",
"getCurrentRequest",
"(",
")",
";",
"$",
"request",
"->",
"getSession",
"(",
")",
"->",
"remove",
"(",
"self",
"::",
"SESSION_KEY_NAME",
")",
";",
"$",
"event",
"=",
"new",
"\\",
"ChameleonSystem",
"\\",
"ShopBundle",
"\\",
"objects",
"\\",
"TShopBasket",
"\\",
"BasketItemEvent",
"(",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
",",
"$",
"this",
")",
";",
"$",
"this",
"->",
"getEventDispatcher",
"(",
")",
"->",
"dispatch",
"(",
"\\",
"ChameleonSystem",
"\\",
"ShopBundle",
"\\",
"ShopEvents",
"::",
"BASKET_CLEAR",
",",
"$",
"event",
")",
";",
"}"
] | deletes contents of basket. | [
"deletes",
"contents",
"of",
"basket",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L443-L455 |
31,881 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.BasketInSession | public static function BasketInSession()
{
/** @var Request $request */
$request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();
return $request->getSession()->has(self::SESSION_KEY_NAME);
} | php | public static function BasketInSession()
{
/** @var Request $request */
$request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();
return $request->getSession()->has(self::SESSION_KEY_NAME);
} | [
"public",
"static",
"function",
"BasketInSession",
"(",
")",
"{",
"/** @var Request $request */",
"$",
"request",
"=",
"\\",
"ChameleonSystem",
"\\",
"CoreBundle",
"\\",
"ServiceLocator",
"::",
"get",
"(",
"'request_stack'",
")",
"->",
"getCurrentRequest",
"(",
")",
";",
"return",
"$",
"request",
"->",
"getSession",
"(",
")",
"->",
"has",
"(",
"self",
"::",
"SESSION_KEY_NAME",
")",
";",
"}"
] | return true if the basket item is stored in session.
@return bool | [
"return",
"true",
"if",
"the",
"basket",
"item",
"is",
"stored",
"in",
"session",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L482-L488 |
31,882 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.CommitToSession | public function CommitToSession($bForce = false)
{
// save copy to session
if (TShopBasket::BasketInSession()) {
$oTmp = TShopBasket::GetInstance();
if (true === $bForce || $oTmp == $this) {
$oUser = TdbDataExtranetUser::GetInstance();
$oUser->ObserverUnregister('oUserBasket');
/** @var Request $request */
$request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();
/** @var TPKgCmsSession $session */
$session = $request->getSession();
$session->set(self::SESSION_KEY_NAME, $this);
}
}
} | php | public function CommitToSession($bForce = false)
{
// save copy to session
if (TShopBasket::BasketInSession()) {
$oTmp = TShopBasket::GetInstance();
if (true === $bForce || $oTmp == $this) {
$oUser = TdbDataExtranetUser::GetInstance();
$oUser->ObserverUnregister('oUserBasket');
/** @var Request $request */
$request = \ChameleonSystem\CoreBundle\ServiceLocator::get('request_stack')->getCurrentRequest();
/** @var TPKgCmsSession $session */
$session = $request->getSession();
$session->set(self::SESSION_KEY_NAME, $this);
}
}
} | [
"public",
"function",
"CommitToSession",
"(",
"$",
"bForce",
"=",
"false",
")",
"{",
"// save copy to session",
"if",
"(",
"TShopBasket",
"::",
"BasketInSession",
"(",
")",
")",
"{",
"$",
"oTmp",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"true",
"===",
"$",
"bForce",
"||",
"$",
"oTmp",
"==",
"$",
"this",
")",
"{",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oUser",
"->",
"ObserverUnregister",
"(",
"'oUserBasket'",
")",
";",
"/** @var Request $request */",
"$",
"request",
"=",
"\\",
"ChameleonSystem",
"\\",
"CoreBundle",
"\\",
"ServiceLocator",
"::",
"get",
"(",
"'request_stack'",
")",
"->",
"getCurrentRequest",
"(",
")",
";",
"/** @var TPKgCmsSession $session */",
"$",
"session",
"=",
"$",
"request",
"->",
"getSession",
"(",
")",
";",
"$",
"session",
"->",
"set",
"(",
"self",
"::",
"SESSION_KEY_NAME",
",",
"$",
"this",
")",
";",
"}",
"}",
"}"
] | commits the basket to session, AND unregisters itself als an observer from
oUser - this method is called through the register_shutdown_function and should
not be called directly.
@param bool $bForce - overwrite session with basket data even if this is not the correct basket instance
if you use this to replace the basket object, make sure to call TShopBasket::GetInstance(false,true) after
to set the instance based on this new session | [
"commits",
"the",
"basket",
"to",
"session",
"AND",
"unregisters",
"itself",
"als",
"an",
"observer",
"from",
"oUser",
"-",
"this",
"method",
"is",
"called",
"through",
"the",
"register_shutdown_function",
"and",
"should",
"not",
"be",
"called",
"directly",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L528-L544 |
31,883 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.GetBasketSumForVoucher | public function GetBasketSumForVoucher(TShopVoucher &$oVoucher)
{
$value = $this->GetBasketArticles()->GetBasketSumForVoucher($oVoucher);
if (true === $oVoucher->IsSponsored()) {
$value += $this->dCostShipping;
}
return $value;
} | php | public function GetBasketSumForVoucher(TShopVoucher &$oVoucher)
{
$value = $this->GetBasketArticles()->GetBasketSumForVoucher($oVoucher);
if (true === $oVoucher->IsSponsored()) {
$value += $this->dCostShipping;
}
return $value;
} | [
"public",
"function",
"GetBasketSumForVoucher",
"(",
"TShopVoucher",
"&",
"$",
"oVoucher",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"GetBasketArticles",
"(",
")",
"->",
"GetBasketSumForVoucher",
"(",
"$",
"oVoucher",
")",
";",
"if",
"(",
"true",
"===",
"$",
"oVoucher",
"->",
"IsSponsored",
"(",
")",
")",
"{",
"$",
"value",
"+=",
"$",
"this",
"->",
"dCostShipping",
";",
"}",
"return",
"$",
"value",
";",
"}"
] | exposes the GetBasketSumForVoucher method in TShopBasketArticleList.
@param TShopVoucher $oVoucher
@return float | [
"exposes",
"the",
"GetBasketSumForVoucher",
"method",
"in",
"TShopBasketArticleList",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L553-L561 |
31,884 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.RecalculateShipping | protected function RecalculateShipping()
{
$this->dCostShipping = 0;
// validate shipping group - reset if not valid
if (null !== $this->GetActiveShippingGroup()) {
if (false === $this->SetActiveShippingGroup($this->GetActiveShippingGroup())) {
$this->SetActiveShippingGroup(null);
}
}
// if the basket contains a voucher that is set to free_shipping, then we keep costs to zero
if (is_null($this->GetActiveVouchers()) || !$this->GetActiveVouchers()->HasFreeShippingVoucher()) {
if (!is_null($this->GetActiveShippingGroup())) {
$this->dCostShipping = $this->GetActiveShippingGroup()->GetShippingCostsForBasket();
}
}
} | php | protected function RecalculateShipping()
{
$this->dCostShipping = 0;
// validate shipping group - reset if not valid
if (null !== $this->GetActiveShippingGroup()) {
if (false === $this->SetActiveShippingGroup($this->GetActiveShippingGroup())) {
$this->SetActiveShippingGroup(null);
}
}
// if the basket contains a voucher that is set to free_shipping, then we keep costs to zero
if (is_null($this->GetActiveVouchers()) || !$this->GetActiveVouchers()->HasFreeShippingVoucher()) {
if (!is_null($this->GetActiveShippingGroup())) {
$this->dCostShipping = $this->GetActiveShippingGroup()->GetShippingCostsForBasket();
}
}
} | [
"protected",
"function",
"RecalculateShipping",
"(",
")",
"{",
"$",
"this",
"->",
"dCostShipping",
"=",
"0",
";",
"// validate shipping group - reset if not valid",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"GetActiveShippingGroup",
"(",
")",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"SetActiveShippingGroup",
"(",
"$",
"this",
"->",
"GetActiveShippingGroup",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"SetActiveShippingGroup",
"(",
"null",
")",
";",
"}",
"}",
"// if the basket contains a voucher that is set to free_shipping, then we keep costs to zero",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"GetActiveVouchers",
"(",
")",
")",
"||",
"!",
"$",
"this",
"->",
"GetActiveVouchers",
"(",
")",
"->",
"HasFreeShippingVoucher",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"GetActiveShippingGroup",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"dCostShipping",
"=",
"$",
"this",
"->",
"GetActiveShippingGroup",
"(",
")",
"->",
"GetShippingCostsForBasket",
"(",
")",
";",
"}",
"}",
"}"
] | fetches the shipping costs from the active shipping group. | [
"fetches",
"the",
"shipping",
"costs",
"from",
"the",
"active",
"shipping",
"group",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L804-L821 |
31,885 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.& | public function &GetActiveVATList()
{
if (is_null($this->oActiveVatList)) {
$this->oActiveVatList = TdbShopVatList::GetList();
$this->oActiveVatList->bAllowItemCache = true;
$this->oActiveVatList->GoToStart();
}
return $this->oActiveVatList;
} | php | public function &GetActiveVATList()
{
if (is_null($this->oActiveVatList)) {
$this->oActiveVatList = TdbShopVatList::GetList();
$this->oActiveVatList->bAllowItemCache = true;
$this->oActiveVatList->GoToStart();
}
return $this->oActiveVatList;
} | [
"public",
"function",
"&",
"GetActiveVATList",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"oActiveVatList",
")",
")",
"{",
"$",
"this",
"->",
"oActiveVatList",
"=",
"TdbShopVatList",
"::",
"GetList",
"(",
")",
";",
"$",
"this",
"->",
"oActiveVatList",
"->",
"bAllowItemCache",
"=",
"true",
";",
"$",
"this",
"->",
"oActiveVatList",
"->",
"GoToStart",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"oActiveVatList",
";",
"}"
] | return copy of active vat group list.
@return TdbShopVatList | [
"return",
"copy",
"of",
"active",
"vat",
"group",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L895-L904 |
31,886 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.GetLargestVATObject | public function GetLargestVATObject()
{
$oActiveVatList = $this->GetActiveVATList();
/** @var $oMaxItem TdbShopVat */
$oMaxItem = null;
if (is_object($oActiveVatList)) {
$oMaxItem = $oActiveVatList->GetMaxItem();
}
return $oMaxItem;
} | php | public function GetLargestVATObject()
{
$oActiveVatList = $this->GetActiveVATList();
/** @var $oMaxItem TdbShopVat */
$oMaxItem = null;
if (is_object($oActiveVatList)) {
$oMaxItem = $oActiveVatList->GetMaxItem();
}
return $oMaxItem;
} | [
"public",
"function",
"GetLargestVATObject",
"(",
")",
"{",
"$",
"oActiveVatList",
"=",
"$",
"this",
"->",
"GetActiveVATList",
"(",
")",
";",
"/** @var $oMaxItem TdbShopVat */",
"$",
"oMaxItem",
"=",
"null",
";",
"if",
"(",
"is_object",
"(",
"$",
"oActiveVatList",
")",
")",
"{",
"$",
"oMaxItem",
"=",
"$",
"oActiveVatList",
"->",
"GetMaxItem",
"(",
")",
";",
"}",
"return",
"$",
"oMaxItem",
";",
"}"
] | return the largest vat object from the active vat group.
@return TdbShopVat | [
"return",
"the",
"largest",
"vat",
"object",
"from",
"the",
"active",
"vat",
"group",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L911-L921 |
31,887 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.RecalculateNoneSponsoredVouchers | protected function RecalculateNoneSponsoredVouchers()
{
if (!is_null($this->GetActiveVouchers())) {
$this->dCostNoneSponsoredVouchers = 0;
$this->GetActiveVouchers()->RemoveInvalidVouchers(MTShopBasketCore::MSG_CONSUMER_NAME, $this);
$this->dCostNoneSponsoredVouchers = $this->GetActiveVouchers()->GetVoucherValue(false);
if ($this->dCostNoneSponsoredVouchers > $this->dCostArticlesTotalAfterDiscounts) {
$this->dCostNoneSponsoredVouchers = $this->dCostArticlesTotalAfterDiscounts;
}
} else {
$this->dCostNoneSponsoredVouchers = 0;
}
} | php | protected function RecalculateNoneSponsoredVouchers()
{
if (!is_null($this->GetActiveVouchers())) {
$this->dCostNoneSponsoredVouchers = 0;
$this->GetActiveVouchers()->RemoveInvalidVouchers(MTShopBasketCore::MSG_CONSUMER_NAME, $this);
$this->dCostNoneSponsoredVouchers = $this->GetActiveVouchers()->GetVoucherValue(false);
if ($this->dCostNoneSponsoredVouchers > $this->dCostArticlesTotalAfterDiscounts) {
$this->dCostNoneSponsoredVouchers = $this->dCostArticlesTotalAfterDiscounts;
}
} else {
$this->dCostNoneSponsoredVouchers = 0;
}
} | [
"protected",
"function",
"RecalculateNoneSponsoredVouchers",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"GetActiveVouchers",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"dCostNoneSponsoredVouchers",
"=",
"0",
";",
"$",
"this",
"->",
"GetActiveVouchers",
"(",
")",
"->",
"RemoveInvalidVouchers",
"(",
"MTShopBasketCore",
"::",
"MSG_CONSUMER_NAME",
",",
"$",
"this",
")",
";",
"$",
"this",
"->",
"dCostNoneSponsoredVouchers",
"=",
"$",
"this",
"->",
"GetActiveVouchers",
"(",
")",
"->",
"GetVoucherValue",
"(",
"false",
")",
";",
"if",
"(",
"$",
"this",
"->",
"dCostNoneSponsoredVouchers",
">",
"$",
"this",
"->",
"dCostArticlesTotalAfterDiscounts",
")",
"{",
"$",
"this",
"->",
"dCostNoneSponsoredVouchers",
"=",
"$",
"this",
"->",
"dCostArticlesTotalAfterDiscounts",
";",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"dCostNoneSponsoredVouchers",
"=",
"0",
";",
"}",
"}"
] | calculates the value of NONE sponsored vouchers. The article prices for each item in the
basket affected by a voucher is reduced by the value calculated for the item. | [
"calculates",
"the",
"value",
"of",
"NONE",
"sponsored",
"vouchers",
".",
"The",
"article",
"prices",
"for",
"each",
"item",
"in",
"the",
"basket",
"affected",
"by",
"a",
"voucher",
"is",
"reduced",
"by",
"the",
"value",
"calculated",
"for",
"the",
"item",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L962-L975 |
31,888 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.redirectToPaymentStep | protected function redirectToPaymentStep()
{
if (defined('CMS_PAYMENT_REDIRECT_ON_FAILURE') && CMS_PAYMENT_REDIRECT_ON_FAILURE != '') {
$oOrderStep = TdbShopOrderStep::GetStep(CMS_PAYMENT_REDIRECT_ON_FAILURE);
if ($oOrderStep) {
$oOrderStep->JumpToStep($oOrderStep);
}
}
} | php | protected function redirectToPaymentStep()
{
if (defined('CMS_PAYMENT_REDIRECT_ON_FAILURE') && CMS_PAYMENT_REDIRECT_ON_FAILURE != '') {
$oOrderStep = TdbShopOrderStep::GetStep(CMS_PAYMENT_REDIRECT_ON_FAILURE);
if ($oOrderStep) {
$oOrderStep->JumpToStep($oOrderStep);
}
}
} | [
"protected",
"function",
"redirectToPaymentStep",
"(",
")",
"{",
"if",
"(",
"defined",
"(",
"'CMS_PAYMENT_REDIRECT_ON_FAILURE'",
")",
"&&",
"CMS_PAYMENT_REDIRECT_ON_FAILURE",
"!=",
"''",
")",
"{",
"$",
"oOrderStep",
"=",
"TdbShopOrderStep",
"::",
"GetStep",
"(",
"CMS_PAYMENT_REDIRECT_ON_FAILURE",
")",
";",
"if",
"(",
"$",
"oOrderStep",
")",
"{",
"$",
"oOrderStep",
"->",
"JumpToStep",
"(",
"$",
"oOrderStep",
")",
";",
"}",
"}",
"}"
] | if CMS_PAYMENT_REDIRECT_ON_FAILURE is defined with correct order step system name do redirect
to defined step.
This step should contain payment selection. | [
"if",
"CMS_PAYMENT_REDIRECT_ON_FAILURE",
"is",
"defined",
"with",
"correct",
"order",
"step",
"system",
"name",
"do",
"redirect",
"to",
"defined",
"step",
".",
"This",
"step",
"should",
"contain",
"payment",
"selection",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1131-L1139 |
31,889 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.& | public static function &GetLastCreatedOrder($bResetValue = false)
{
$oOrder = null;
if (array_key_exists(self::SESSION_KEY_LAST_CREATED_ORDER_ID, $_SESSION)) {
$oOrder = TdbShopOrder::GetNewInstance();
/** @var $oOrder TdbShopOrder */
if ($oOrder->Load($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID])) {
// now we want to make sure that the current user is the owner of that order. this is
// the case if: the user is logged in and the user id in the order matches, or the user is
// not logged in and the order has no user id
$oUser = TdbDataExtranetUser::GetInstance();
$isOwner = ($oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId == $oUser->id);
$isOwner = ($isOwner || (!$oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId < 1));
if (!$isOwner) {
$oOrder = null;
}
} else {
$oOrder = null;
}
if ($bResetValue) {
unset($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID]);
}
}
return $oOrder;
} | php | public static function &GetLastCreatedOrder($bResetValue = false)
{
$oOrder = null;
if (array_key_exists(self::SESSION_KEY_LAST_CREATED_ORDER_ID, $_SESSION)) {
$oOrder = TdbShopOrder::GetNewInstance();
/** @var $oOrder TdbShopOrder */
if ($oOrder->Load($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID])) {
// now we want to make sure that the current user is the owner of that order. this is
// the case if: the user is logged in and the user id in the order matches, or the user is
// not logged in and the order has no user id
$oUser = TdbDataExtranetUser::GetInstance();
$isOwner = ($oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId == $oUser->id);
$isOwner = ($isOwner || (!$oUser->IsLoggedIn() && $oOrder->fieldDataExtranetUserId < 1));
if (!$isOwner) {
$oOrder = null;
}
} else {
$oOrder = null;
}
if ($bResetValue) {
unset($_SESSION[self::SESSION_KEY_LAST_CREATED_ORDER_ID]);
}
}
return $oOrder;
} | [
"public",
"static",
"function",
"&",
"GetLastCreatedOrder",
"(",
"$",
"bResetValue",
"=",
"false",
")",
"{",
"$",
"oOrder",
"=",
"null",
";",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"SESSION_KEY_LAST_CREATED_ORDER_ID",
",",
"$",
"_SESSION",
")",
")",
"{",
"$",
"oOrder",
"=",
"TdbShopOrder",
"::",
"GetNewInstance",
"(",
")",
";",
"/** @var $oOrder TdbShopOrder */",
"if",
"(",
"$",
"oOrder",
"->",
"Load",
"(",
"$",
"_SESSION",
"[",
"self",
"::",
"SESSION_KEY_LAST_CREATED_ORDER_ID",
"]",
")",
")",
"{",
"// now we want to make sure that the current user is the owner of that order. this is",
"// the case if: the user is logged in and the user id in the order matches, or the user is",
"// not logged in and the order has no user id",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
";",
"$",
"isOwner",
"=",
"(",
"$",
"oUser",
"->",
"IsLoggedIn",
"(",
")",
"&&",
"$",
"oOrder",
"->",
"fieldDataExtranetUserId",
"==",
"$",
"oUser",
"->",
"id",
")",
";",
"$",
"isOwner",
"=",
"(",
"$",
"isOwner",
"||",
"(",
"!",
"$",
"oUser",
"->",
"IsLoggedIn",
"(",
")",
"&&",
"$",
"oOrder",
"->",
"fieldDataExtranetUserId",
"<",
"1",
")",
")",
";",
"if",
"(",
"!",
"$",
"isOwner",
")",
"{",
"$",
"oOrder",
"=",
"null",
";",
"}",
"}",
"else",
"{",
"$",
"oOrder",
"=",
"null",
";",
"}",
"if",
"(",
"$",
"bResetValue",
")",
"{",
"unset",
"(",
"$",
"_SESSION",
"[",
"self",
"::",
"SESSION_KEY_LAST_CREATED_ORDER_ID",
"]",
")",
";",
"}",
"}",
"return",
"$",
"oOrder",
";",
"}"
] | returns the order object created last within the current session of the user.
@param bool $bResetValue - set to true if you want to reset the session item
@return TdbShopOrder | [
"returns",
"the",
"order",
"object",
"created",
"last",
"within",
"the",
"current",
"session",
"of",
"the",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1259-L1284 |
31,890 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.CreateOrderAllowCreation | protected function CreateOrderAllowCreation($sMessageConsumer, $bSkipPaymentValidation = false)
{
$oMsgManager = TCMSMessageManager::GetInstance();
$bAllowCreation = true;
if ($bAllowCreation) {
if ($this->LockIsActive()) {
// the order has already been created...
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-ON-ALREADY-CREATED-ORDER');
$bAllowCreation = false;
// kill basket, and reset key
$oBasket = TShopBasket::GetInstance();
$this->UnlockBasket();
$oBasket->ClearBasket();
unset($oBasket);
}
}
if ($bAllowCreation) {
// prevent order creation if the last order is less then 10 seconds ago - the system will prevent this anyway, but we need to
// show the user a sensible error message in this case
if (true === $this->isReorderDueToDoubleClick()) {
$bAllowCreation = false;
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-ON-ALREADY-CREATED-ORDER');
}
}
if ($bAllowCreation) {
// now check if there are article in the basket
if ($this->dCostTotal < 0) {
// negativ orders are not permitted
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-NEGATIV-ORDER');
$bAllowCreation = false;
}
}
if ($bAllowCreation) {
if ($this->iTotalNumberOfUniqueArticles < 1 || $this->dTotalNumberOfArticles <= 0) {
// no articles in order
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-EMPTY-ORDER');
$bAllowCreation = false;
}
}
if ($bAllowCreation) {
// check to make sure we have a billing addres for the user
$oUser = TdbDataExtranetUser::GetInstance();
$oBillingAdr = $oUser->GetBillingAddress();
if (is_null($oBillingAdr) || !$oBillingAdr->ContainsData()) {
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-USER-HAS-NO-BILLING-ADDRESS');
$bAllowCreation = false;
}
}
if ($bAllowCreation) {
// check if shipping and payment have been selected
if (false == $this->HasValidShippingGroup()) {
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-SHIPPING-GROUP-NOT-VALID');
$bAllowCreation = false;
}
}
if ($bAllowCreation) {
if (!$bSkipPaymentValidation) {
if (false == $this->HasValidPaymentMethod()) {
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-METHOD-NOT-VALID');
$bAllowCreation = false;
}
}
}
return $bAllowCreation;
} | php | protected function CreateOrderAllowCreation($sMessageConsumer, $bSkipPaymentValidation = false)
{
$oMsgManager = TCMSMessageManager::GetInstance();
$bAllowCreation = true;
if ($bAllowCreation) {
if ($this->LockIsActive()) {
// the order has already been created...
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-ON-ALREADY-CREATED-ORDER');
$bAllowCreation = false;
// kill basket, and reset key
$oBasket = TShopBasket::GetInstance();
$this->UnlockBasket();
$oBasket->ClearBasket();
unset($oBasket);
}
}
if ($bAllowCreation) {
// prevent order creation if the last order is less then 10 seconds ago - the system will prevent this anyway, but we need to
// show the user a sensible error message in this case
if (true === $this->isReorderDueToDoubleClick()) {
$bAllowCreation = false;
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-ON-ALREADY-CREATED-ORDER');
}
}
if ($bAllowCreation) {
// now check if there are article in the basket
if ($this->dCostTotal < 0) {
// negativ orders are not permitted
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-NEGATIV-ORDER');
$bAllowCreation = false;
}
}
if ($bAllowCreation) {
if ($this->iTotalNumberOfUniqueArticles < 1 || $this->dTotalNumberOfArticles <= 0) {
// no articles in order
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-CREATE-EMPTY-ORDER');
$bAllowCreation = false;
}
}
if ($bAllowCreation) {
// check to make sure we have a billing addres for the user
$oUser = TdbDataExtranetUser::GetInstance();
$oBillingAdr = $oUser->GetBillingAddress();
if (is_null($oBillingAdr) || !$oBillingAdr->ContainsData()) {
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-USER-HAS-NO-BILLING-ADDRESS');
$bAllowCreation = false;
}
}
if ($bAllowCreation) {
// check if shipping and payment have been selected
if (false == $this->HasValidShippingGroup()) {
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-SHIPPING-GROUP-NOT-VALID');
$bAllowCreation = false;
}
}
if ($bAllowCreation) {
if (!$bSkipPaymentValidation) {
if (false == $this->HasValidPaymentMethod()) {
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-METHOD-NOT-VALID');
$bAllowCreation = false;
}
}
}
return $bAllowCreation;
} | [
"protected",
"function",
"CreateOrderAllowCreation",
"(",
"$",
"sMessageConsumer",
",",
"$",
"bSkipPaymentValidation",
"=",
"false",
")",
"{",
"$",
"oMsgManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"$",
"bAllowCreation",
"=",
"true",
";",
"if",
"(",
"$",
"bAllowCreation",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"LockIsActive",
"(",
")",
")",
"{",
"// the order has already been created...",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageConsumer",
",",
"'ERROR-ORDER-REQUEST-CREATE-ON-ALREADY-CREATED-ORDER'",
")",
";",
"$",
"bAllowCreation",
"=",
"false",
";",
"// kill basket, and reset key",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"$",
"this",
"->",
"UnlockBasket",
"(",
")",
";",
"$",
"oBasket",
"->",
"ClearBasket",
"(",
")",
";",
"unset",
"(",
"$",
"oBasket",
")",
";",
"}",
"}",
"if",
"(",
"$",
"bAllowCreation",
")",
"{",
"// prevent order creation if the last order is less then 10 seconds ago - the system will prevent this anyway, but we need to",
"// show the user a sensible error message in this case",
"if",
"(",
"true",
"===",
"$",
"this",
"->",
"isReorderDueToDoubleClick",
"(",
")",
")",
"{",
"$",
"bAllowCreation",
"=",
"false",
";",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageConsumer",
",",
"'ERROR-ORDER-REQUEST-CREATE-ON-ALREADY-CREATED-ORDER'",
")",
";",
"}",
"}",
"if",
"(",
"$",
"bAllowCreation",
")",
"{",
"// now check if there are article in the basket",
"if",
"(",
"$",
"this",
"->",
"dCostTotal",
"<",
"0",
")",
"{",
"// negativ orders are not permitted",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageConsumer",
",",
"'ERROR-ORDER-REQUEST-CREATE-NEGATIV-ORDER'",
")",
";",
"$",
"bAllowCreation",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"$",
"bAllowCreation",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"iTotalNumberOfUniqueArticles",
"<",
"1",
"||",
"$",
"this",
"->",
"dTotalNumberOfArticles",
"<=",
"0",
")",
"{",
"// no articles in order",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageConsumer",
",",
"'ERROR-ORDER-REQUEST-CREATE-EMPTY-ORDER'",
")",
";",
"$",
"bAllowCreation",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"$",
"bAllowCreation",
")",
"{",
"// check to make sure we have a billing addres for the user",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oBillingAdr",
"=",
"$",
"oUser",
"->",
"GetBillingAddress",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oBillingAdr",
")",
"||",
"!",
"$",
"oBillingAdr",
"->",
"ContainsData",
"(",
")",
")",
"{",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageConsumer",
",",
"'ERROR-ORDER-REQUEST-USER-HAS-NO-BILLING-ADDRESS'",
")",
";",
"$",
"bAllowCreation",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"$",
"bAllowCreation",
")",
"{",
"// check if shipping and payment have been selected",
"if",
"(",
"false",
"==",
"$",
"this",
"->",
"HasValidShippingGroup",
"(",
")",
")",
"{",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageConsumer",
",",
"'ERROR-ORDER-REQUEST-SHIPPING-GROUP-NOT-VALID'",
")",
";",
"$",
"bAllowCreation",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"$",
"bAllowCreation",
")",
"{",
"if",
"(",
"!",
"$",
"bSkipPaymentValidation",
")",
"{",
"if",
"(",
"false",
"==",
"$",
"this",
"->",
"HasValidPaymentMethod",
"(",
")",
")",
"{",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageConsumer",
",",
"'ERROR-ORDER-REQUEST-PAYMENT-METHOD-NOT-VALID'",
")",
";",
"$",
"bAllowCreation",
"=",
"false",
";",
"}",
"}",
"}",
"return",
"$",
"bAllowCreation",
";",
"}"
] | return true if the basket may be saved as an order, false if we want to prevent saving the order.
@param string $sMessageConsumer - message manager who we want to send errors to
@param bool $bSkipPaymentValidation - set to true if you want to skip the validation of the selected payment method
@return bool | [
"return",
"true",
"if",
"the",
"basket",
"may",
"be",
"saved",
"as",
"an",
"order",
"false",
"if",
"we",
"want",
"to",
"prevent",
"saving",
"the",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1308-L1380 |
31,891 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.HasValidShippingGroup | protected function HasValidShippingGroup()
{
$bHasValidShippingGroup = false;
$oShipping = $this->GetActiveShippingGroup();
if (!is_null($oShipping) && $oShipping->IsAvailable()) {
$bHasValidShippingGroup = true;
}
return $bHasValidShippingGroup;
} | php | protected function HasValidShippingGroup()
{
$bHasValidShippingGroup = false;
$oShipping = $this->GetActiveShippingGroup();
if (!is_null($oShipping) && $oShipping->IsAvailable()) {
$bHasValidShippingGroup = true;
}
return $bHasValidShippingGroup;
} | [
"protected",
"function",
"HasValidShippingGroup",
"(",
")",
"{",
"$",
"bHasValidShippingGroup",
"=",
"false",
";",
"$",
"oShipping",
"=",
"$",
"this",
"->",
"GetActiveShippingGroup",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oShipping",
")",
"&&",
"$",
"oShipping",
"->",
"IsAvailable",
"(",
")",
")",
"{",
"$",
"bHasValidShippingGroup",
"=",
"true",
";",
"}",
"return",
"$",
"bHasValidShippingGroup",
";",
"}"
] | return true if the basket as a valid shipping group selected.
@return bool | [
"return",
"true",
"if",
"the",
"basket",
"as",
"a",
"valid",
"shipping",
"group",
"selected",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1387-L1396 |
31,892 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.HasValidPaymentMethod | protected function HasValidPaymentMethod()
{
$bHasValidPaymentMethod = false;
$oPayment = $this->GetActivePaymentMethod();
if (!is_null($oPayment) && $oPayment->IsAvailable()) {
$bHasValidPaymentMethod = true;
}
return $bHasValidPaymentMethod;
} | php | protected function HasValidPaymentMethod()
{
$bHasValidPaymentMethod = false;
$oPayment = $this->GetActivePaymentMethod();
if (!is_null($oPayment) && $oPayment->IsAvailable()) {
$bHasValidPaymentMethod = true;
}
return $bHasValidPaymentMethod;
} | [
"protected",
"function",
"HasValidPaymentMethod",
"(",
")",
"{",
"$",
"bHasValidPaymentMethod",
"=",
"false",
";",
"$",
"oPayment",
"=",
"$",
"this",
"->",
"GetActivePaymentMethod",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oPayment",
")",
"&&",
"$",
"oPayment",
"->",
"IsAvailable",
"(",
")",
")",
"{",
"$",
"bHasValidPaymentMethod",
"=",
"true",
";",
"}",
"return",
"$",
"bHasValidPaymentMethod",
";",
"}"
] | return true if the basket as a valid payment method selected.
@return bool | [
"return",
"true",
"if",
"the",
"basket",
"as",
"a",
"valid",
"payment",
"method",
"selected",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1403-L1412 |
31,893 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.RemoveVoucher | public function RemoveVoucher($sBasketVoucherKey, $sMessageHandler)
{
$bRemoved = $this->GetActiveVouchers()->RemoveItem('sBasketVoucherKey', $sBasketVoucherKey);
$oMessageManager = TCMSMessageManager::GetInstance();
if ($bRemoved) {
$oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-REMOVED');
$this->SetBasketRecalculationFlag();
} else {
$oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-ERROR-NOT-FOUND');
}
return $bRemoved;
} | php | public function RemoveVoucher($sBasketVoucherKey, $sMessageHandler)
{
$bRemoved = $this->GetActiveVouchers()->RemoveItem('sBasketVoucherKey', $sBasketVoucherKey);
$oMessageManager = TCMSMessageManager::GetInstance();
if ($bRemoved) {
$oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-REMOVED');
$this->SetBasketRecalculationFlag();
} else {
$oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-ERROR-NOT-FOUND');
}
return $bRemoved;
} | [
"public",
"function",
"RemoveVoucher",
"(",
"$",
"sBasketVoucherKey",
",",
"$",
"sMessageHandler",
")",
"{",
"$",
"bRemoved",
"=",
"$",
"this",
"->",
"GetActiveVouchers",
"(",
")",
"->",
"RemoveItem",
"(",
"'sBasketVoucherKey'",
",",
"$",
"sBasketVoucherKey",
")",
";",
"$",
"oMessageManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"$",
"bRemoved",
")",
"{",
"$",
"oMessageManager",
"->",
"AddMessage",
"(",
"$",
"sMessageHandler",
",",
"'VOUCHER-REMOVED'",
")",
";",
"$",
"this",
"->",
"SetBasketRecalculationFlag",
"(",
")",
";",
"}",
"else",
"{",
"$",
"oMessageManager",
"->",
"AddMessage",
"(",
"$",
"sMessageHandler",
",",
"'VOUCHER-ERROR-NOT-FOUND'",
")",
";",
"}",
"return",
"$",
"bRemoved",
";",
"}"
] | remove the voucher with the given basket key from the voucher list. Results will be sent to sMessageHandler.
@param string $sBasketVoucherKey - The basket key of the voucher
@param string $sMessageHandler
@return bool | [
"remove",
"the",
"voucher",
"with",
"the",
"given",
"basket",
"key",
"from",
"the",
"voucher",
"list",
".",
"Results",
"will",
"be",
"sent",
"to",
"sMessageHandler",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1543-L1555 |
31,894 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.CheckBasketVoucherAvailable | protected function CheckBasketVoucherAvailable($sMessageConsumer)
{
$bBasketVoucherAvailable = true;
$oVoucherList = $this->GetVoucherList();
$oMessageManager = TCMSMessageManager::GetInstance();
if ($oVoucherList) {
if ($oVoucherList->Length() > 0) {
$oVoucherList->GoToStart();
while ($oBasketVoucher = $oVoucherList->Next()) {
$sVoucherCode = $oBasketVoucher->fieldCode;
$sBasketVoucherKey = $oBasketVoucher->sBasketVoucherKey;
$sBasketVoucherSeriesId = $oBasketVoucher->fieldShopVoucherSeriesId;
$oVoucher = TdbShopVoucher::GetNewInstance();
$bVoucherLoaded = $oVoucher->Load($oBasketVoucher->id);
if (($bVoucherLoaded && $oVoucher->fieldIsUsedUp) || !$bVoucherLoaded) {
$oNextAvailableVoucher = $this->GetNextAvailableVoucher($sVoucherCode, $sBasketVoucherSeriesId, $sMessageConsumer);
/**
* next voucher with same code is available, so auto add that one.
* as we do not want to inform the customer that this happened,
* we create a temporary message consumer for RemoveVoucher and AddVoucher messages and clear them afterwards.
*/
if (!is_null($oNextAvailableVoucher)) {
$this->RemoveVoucher($sBasketVoucherKey, $sMessageConsumer.'-TO-BE-REMOVED');
$this->AddVoucher($oNextAvailableVoucher, $sMessageConsumer.'-TO-BE-REMOVED');
$oMessageManager->ClearMessages($sMessageConsumer.'-TO-BE-REMOVED');
} else {
$this->RemoveVoucher($sBasketVoucherKey, $sMessageConsumer);
$bBasketVoucherAvailable = false;
$this->bMarkAsRecalculationNeeded = true;
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-VOUCHER-NOT-LONGER-AVAILABLE', array('sVoucherCode' => $sVoucherCode));
}
}
}
}
}
return $bBasketVoucherAvailable;
} | php | protected function CheckBasketVoucherAvailable($sMessageConsumer)
{
$bBasketVoucherAvailable = true;
$oVoucherList = $this->GetVoucherList();
$oMessageManager = TCMSMessageManager::GetInstance();
if ($oVoucherList) {
if ($oVoucherList->Length() > 0) {
$oVoucherList->GoToStart();
while ($oBasketVoucher = $oVoucherList->Next()) {
$sVoucherCode = $oBasketVoucher->fieldCode;
$sBasketVoucherKey = $oBasketVoucher->sBasketVoucherKey;
$sBasketVoucherSeriesId = $oBasketVoucher->fieldShopVoucherSeriesId;
$oVoucher = TdbShopVoucher::GetNewInstance();
$bVoucherLoaded = $oVoucher->Load($oBasketVoucher->id);
if (($bVoucherLoaded && $oVoucher->fieldIsUsedUp) || !$bVoucherLoaded) {
$oNextAvailableVoucher = $this->GetNextAvailableVoucher($sVoucherCode, $sBasketVoucherSeriesId, $sMessageConsumer);
/**
* next voucher with same code is available, so auto add that one.
* as we do not want to inform the customer that this happened,
* we create a temporary message consumer for RemoveVoucher and AddVoucher messages and clear them afterwards.
*/
if (!is_null($oNextAvailableVoucher)) {
$this->RemoveVoucher($sBasketVoucherKey, $sMessageConsumer.'-TO-BE-REMOVED');
$this->AddVoucher($oNextAvailableVoucher, $sMessageConsumer.'-TO-BE-REMOVED');
$oMessageManager->ClearMessages($sMessageConsumer.'-TO-BE-REMOVED');
} else {
$this->RemoveVoucher($sBasketVoucherKey, $sMessageConsumer);
$bBasketVoucherAvailable = false;
$this->bMarkAsRecalculationNeeded = true;
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-VOUCHER-NOT-LONGER-AVAILABLE', array('sVoucherCode' => $sVoucherCode));
}
}
}
}
}
return $bBasketVoucherAvailable;
} | [
"protected",
"function",
"CheckBasketVoucherAvailable",
"(",
"$",
"sMessageConsumer",
")",
"{",
"$",
"bBasketVoucherAvailable",
"=",
"true",
";",
"$",
"oVoucherList",
"=",
"$",
"this",
"->",
"GetVoucherList",
"(",
")",
";",
"$",
"oMessageManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"$",
"oVoucherList",
")",
"{",
"if",
"(",
"$",
"oVoucherList",
"->",
"Length",
"(",
")",
">",
"0",
")",
"{",
"$",
"oVoucherList",
"->",
"GoToStart",
"(",
")",
";",
"while",
"(",
"$",
"oBasketVoucher",
"=",
"$",
"oVoucherList",
"->",
"Next",
"(",
")",
")",
"{",
"$",
"sVoucherCode",
"=",
"$",
"oBasketVoucher",
"->",
"fieldCode",
";",
"$",
"sBasketVoucherKey",
"=",
"$",
"oBasketVoucher",
"->",
"sBasketVoucherKey",
";",
"$",
"sBasketVoucherSeriesId",
"=",
"$",
"oBasketVoucher",
"->",
"fieldShopVoucherSeriesId",
";",
"$",
"oVoucher",
"=",
"TdbShopVoucher",
"::",
"GetNewInstance",
"(",
")",
";",
"$",
"bVoucherLoaded",
"=",
"$",
"oVoucher",
"->",
"Load",
"(",
"$",
"oBasketVoucher",
"->",
"id",
")",
";",
"if",
"(",
"(",
"$",
"bVoucherLoaded",
"&&",
"$",
"oVoucher",
"->",
"fieldIsUsedUp",
")",
"||",
"!",
"$",
"bVoucherLoaded",
")",
"{",
"$",
"oNextAvailableVoucher",
"=",
"$",
"this",
"->",
"GetNextAvailableVoucher",
"(",
"$",
"sVoucherCode",
",",
"$",
"sBasketVoucherSeriesId",
",",
"$",
"sMessageConsumer",
")",
";",
"/**\n * next voucher with same code is available, so auto add that one.\n * as we do not want to inform the customer that this happened,\n * we create a temporary message consumer for RemoveVoucher and AddVoucher messages and clear them afterwards.\n */",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oNextAvailableVoucher",
")",
")",
"{",
"$",
"this",
"->",
"RemoveVoucher",
"(",
"$",
"sBasketVoucherKey",
",",
"$",
"sMessageConsumer",
".",
"'-TO-BE-REMOVED'",
")",
";",
"$",
"this",
"->",
"AddVoucher",
"(",
"$",
"oNextAvailableVoucher",
",",
"$",
"sMessageConsumer",
".",
"'-TO-BE-REMOVED'",
")",
";",
"$",
"oMessageManager",
"->",
"ClearMessages",
"(",
"$",
"sMessageConsumer",
".",
"'-TO-BE-REMOVED'",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"RemoveVoucher",
"(",
"$",
"sBasketVoucherKey",
",",
"$",
"sMessageConsumer",
")",
";",
"$",
"bBasketVoucherAvailable",
"=",
"false",
";",
"$",
"this",
"->",
"bMarkAsRecalculationNeeded",
"=",
"true",
";",
"$",
"oMsgManager",
"=",
"TCMSMessageManager",
"::",
"GetInstance",
"(",
")",
";",
"$",
"oMsgManager",
"->",
"AddMessage",
"(",
"$",
"sMessageConsumer",
",",
"'ERROR-ORDER-REQUEST-VOUCHER-NOT-LONGER-AVAILABLE'",
",",
"array",
"(",
"'sVoucherCode'",
"=>",
"$",
"sVoucherCode",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"$",
"bBasketVoucherAvailable",
";",
"}"
] | Check all vouchers in basket and check if voucher was not in use by other order.
If one voucher was used in other order try to get another one with in the same series and voucher code.
@param string $sMessageConsumer
@return bool | [
"Check",
"all",
"vouchers",
"in",
"basket",
"and",
"check",
"if",
"voucher",
"was",
"not",
"in",
"use",
"by",
"other",
"order",
".",
"If",
"one",
"voucher",
"was",
"used",
"in",
"other",
"order",
"try",
"to",
"get",
"another",
"one",
"with",
"in",
"the",
"same",
"series",
"and",
"voucher",
"code",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1839-L1878 |
31,895 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.GetNextAvailableVoucher | protected function GetNextAvailableVoucher($sVoucherCode, $sSeriesId, $sMessageConsumer)
{
$oNextAvailableVoucher = null;
$oVoucher = TdbShopVoucher::GetNewInstance();
if ($oVoucher->LoadFromFields(array('code' => $sVoucherCode, 'is_used_up' => '0', 'shop_voucher_series_id' => $sSeriesId))) {
$oNextAvailableVoucher = $oVoucher;
}
return $oNextAvailableVoucher;
} | php | protected function GetNextAvailableVoucher($sVoucherCode, $sSeriesId, $sMessageConsumer)
{
$oNextAvailableVoucher = null;
$oVoucher = TdbShopVoucher::GetNewInstance();
if ($oVoucher->LoadFromFields(array('code' => $sVoucherCode, 'is_used_up' => '0', 'shop_voucher_series_id' => $sSeriesId))) {
$oNextAvailableVoucher = $oVoucher;
}
return $oNextAvailableVoucher;
} | [
"protected",
"function",
"GetNextAvailableVoucher",
"(",
"$",
"sVoucherCode",
",",
"$",
"sSeriesId",
",",
"$",
"sMessageConsumer",
")",
"{",
"$",
"oNextAvailableVoucher",
"=",
"null",
";",
"$",
"oVoucher",
"=",
"TdbShopVoucher",
"::",
"GetNewInstance",
"(",
")",
";",
"if",
"(",
"$",
"oVoucher",
"->",
"LoadFromFields",
"(",
"array",
"(",
"'code'",
"=>",
"$",
"sVoucherCode",
",",
"'is_used_up'",
"=>",
"'0'",
",",
"'shop_voucher_series_id'",
"=>",
"$",
"sSeriesId",
")",
")",
")",
"{",
"$",
"oNextAvailableVoucher",
"=",
"$",
"oVoucher",
";",
"}",
"return",
"$",
"oNextAvailableVoucher",
";",
"}"
] | Get next available voucher for whith given vocuehr code and series id.
Was used after deleting vouchers used in other order.
@param string $sVoucherCode
@param string $sSeriesId
@param string $sMessageConsumer
@return TdbShopVoucher | [
"Get",
"next",
"available",
"voucher",
"for",
"whith",
"given",
"vocuehr",
"code",
"and",
"series",
"id",
".",
"Was",
"used",
"after",
"deleting",
"vouchers",
"used",
"in",
"other",
"order",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1890-L1899 |
31,896 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.OnBasketItemUpdateEvent | public function OnBasketItemUpdateEvent($oBasketItemChanged)
{
$event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent(
TdbDataExtranetUser::GetInstance(),
$this,
$oBasketItemChanged
);
$this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_UPDATE_ITEM, $event);
} | php | public function OnBasketItemUpdateEvent($oBasketItemChanged)
{
$event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent(
TdbDataExtranetUser::GetInstance(),
$this,
$oBasketItemChanged
);
$this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_UPDATE_ITEM, $event);
} | [
"public",
"function",
"OnBasketItemUpdateEvent",
"(",
"$",
"oBasketItemChanged",
")",
"{",
"$",
"event",
"=",
"new",
"\\",
"ChameleonSystem",
"\\",
"ShopBundle",
"\\",
"objects",
"\\",
"TShopBasket",
"\\",
"BasketItemEvent",
"(",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
",",
"$",
"this",
",",
"$",
"oBasketItemChanged",
")",
";",
"$",
"this",
"->",
"getEventDispatcher",
"(",
")",
"->",
"dispatch",
"(",
"\\",
"ChameleonSystem",
"\\",
"ShopBundle",
"\\",
"ShopEvents",
"::",
"BASKET_UPDATE_ITEM",
",",
"$",
"event",
")",
";",
"}"
] | the hook is triggered when the basket item list contained in the basket changed an article.
@param TShopBasketArticle $oBasketItemChanged | [
"the",
"hook",
"is",
"triggered",
"when",
"the",
"basket",
"item",
"list",
"contained",
"in",
"the",
"basket",
"changed",
"an",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1939-L1947 |
31,897 | chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php | TShopBasketCore.OnBasketItemDeleteEvent | public function OnBasketItemDeleteEvent($oBasketItemRemoved)
{
$event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent(
TdbDataExtranetUser::GetInstance(),
$this,
$oBasketItemRemoved
);
$this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_DELETE_ITEM, $event);
} | php | public function OnBasketItemDeleteEvent($oBasketItemRemoved)
{
$event = new \ChameleonSystem\ShopBundle\objects\TShopBasket\BasketItemEvent(
TdbDataExtranetUser::GetInstance(),
$this,
$oBasketItemRemoved
);
$this->getEventDispatcher()->dispatch(\ChameleonSystem\ShopBundle\ShopEvents::BASKET_DELETE_ITEM, $event);
} | [
"public",
"function",
"OnBasketItemDeleteEvent",
"(",
"$",
"oBasketItemRemoved",
")",
"{",
"$",
"event",
"=",
"new",
"\\",
"ChameleonSystem",
"\\",
"ShopBundle",
"\\",
"objects",
"\\",
"TShopBasket",
"\\",
"BasketItemEvent",
"(",
"TdbDataExtranetUser",
"::",
"GetInstance",
"(",
")",
",",
"$",
"this",
",",
"$",
"oBasketItemRemoved",
")",
";",
"$",
"this",
"->",
"getEventDispatcher",
"(",
")",
"->",
"dispatch",
"(",
"\\",
"ChameleonSystem",
"\\",
"ShopBundle",
"\\",
"ShopEvents",
"::",
"BASKET_DELETE_ITEM",
",",
"$",
"event",
")",
";",
"}"
] | the hook is triggered when the basket item list contained in the basket deletes an article.
@param TShopBasketArticle $oBasketItemRemoved | [
"the",
"hook",
"is",
"triggered",
"when",
"the",
"basket",
"item",
"list",
"contained",
"in",
"the",
"basket",
"deletes",
"an",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketCore.class.php#L1954-L1962 |
31,898 | chameleon-system/chameleon-shop | src/ShopBundle/mappers/order/TPkgShopMapper_OrderUserData.class.php | TPkgShopMapper_OrderUserData.getAddress | protected function getAddress(TdbShopOrder $oOrder, $iAddressType, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
{
$aAddress = array();
if (self::ADDRESS_TYPE_BILLING === $iAddressType) {
$oSalutation = $oOrder->GetFieldAdrBillingSalutation();
if ($oSalutation && $bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oSalutation->table, $oSalutation->id);
}
$aAddress['sSalutation'] = (null !== $oSalutation) ? ($oSalutation->GetName()) : ('');
$aAddress['sFirstName'] = $oOrder->fieldAdrBillingFirstname;
$aAddress['sLastName'] = $oOrder->fieldAdrBillingLastname;
$aAddress['sAdditionalInfo'] = $oOrder->fieldAdrBillingAdditionalInfo;
$aAddress['sAddressStreet'] = $oOrder->fieldAdrBillingStreet;
$aAddress['sAddressStreetNr'] = $oOrder->fieldAdrBillingStreetnr;
$aAddress['sAddressZip'] = $oOrder->fieldAdrBillingPostalcode;
$aAddress['sAddressCity'] = $oOrder->fieldAdrBillingCity;
$aAddress['sAddressTelephone'] = $oOrder->fieldAdrBillingTelefon;
$aAddress['sAddressFax'] = $oOrder->fieldAdrBillingFax;
$oCountry = $oOrder->GetFieldAdrBillingCountry();
if (null !== $oCountry) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oCountry->table, $oCountry->id);
}
$aAddress['sAddressCountry'] = (null !== $oCountry) ? ($oCountry->GetName()) : ('');
}
} elseif (self::ADDRESS_TYPE_SHIPPING === $iAddressType) {
$oSalutation = $oOrder->GetFieldAdrShippingSalutation();
if ($oSalutation && $bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oSalutation->table, $oSalutation->id);
}
$aAddress['sSalutation'] = (null !== $oSalutation) ? ($oSalutation->GetName()) : ('');
$aAddress['sFirstName'] = $oOrder->fieldAdrShippingFirstname;
$aAddress['sLastName'] = $oOrder->fieldAdrShippingLastname;
$aAddress['sAdditionalInfo'] = $oOrder->fieldAdrShippingAdditionalInfo;
$aAddress['sAddressStreet'] = $oOrder->fieldAdrShippingStreet;
$aAddress['sAddressStreetNr'] = $oOrder->fieldAdrShippingStreetnr;
$aAddress['sAddressZip'] = $oOrder->fieldAdrShippingPostalcode;
$aAddress['sAddressCity'] = $oOrder->fieldAdrShippingCity;
$aAddress['sAddressTelephone'] = $oOrder->fieldAdrShippingTelefon;
$aAddress['sAddressFax'] = $oOrder->fieldAdrShippingFax;
$oCountry = $oOrder->GetFieldAdrShippingCountry();
if (null !== $oCountry) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oCountry->table, $oCountry->id);
}
$aAddress['sAddressCountry'] = (null !== $oCountry) ? ($oCountry->GetName()) : ('');
}
}
return $aAddress;
} | php | protected function getAddress(TdbShopOrder $oOrder, $iAddressType, IMapperCacheTriggerRestricted $oCacheTriggerManager, $bCachingEnabled)
{
$aAddress = array();
if (self::ADDRESS_TYPE_BILLING === $iAddressType) {
$oSalutation = $oOrder->GetFieldAdrBillingSalutation();
if ($oSalutation && $bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oSalutation->table, $oSalutation->id);
}
$aAddress['sSalutation'] = (null !== $oSalutation) ? ($oSalutation->GetName()) : ('');
$aAddress['sFirstName'] = $oOrder->fieldAdrBillingFirstname;
$aAddress['sLastName'] = $oOrder->fieldAdrBillingLastname;
$aAddress['sAdditionalInfo'] = $oOrder->fieldAdrBillingAdditionalInfo;
$aAddress['sAddressStreet'] = $oOrder->fieldAdrBillingStreet;
$aAddress['sAddressStreetNr'] = $oOrder->fieldAdrBillingStreetnr;
$aAddress['sAddressZip'] = $oOrder->fieldAdrBillingPostalcode;
$aAddress['sAddressCity'] = $oOrder->fieldAdrBillingCity;
$aAddress['sAddressTelephone'] = $oOrder->fieldAdrBillingTelefon;
$aAddress['sAddressFax'] = $oOrder->fieldAdrBillingFax;
$oCountry = $oOrder->GetFieldAdrBillingCountry();
if (null !== $oCountry) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oCountry->table, $oCountry->id);
}
$aAddress['sAddressCountry'] = (null !== $oCountry) ? ($oCountry->GetName()) : ('');
}
} elseif (self::ADDRESS_TYPE_SHIPPING === $iAddressType) {
$oSalutation = $oOrder->GetFieldAdrShippingSalutation();
if ($oSalutation && $bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oSalutation->table, $oSalutation->id);
}
$aAddress['sSalutation'] = (null !== $oSalutation) ? ($oSalutation->GetName()) : ('');
$aAddress['sFirstName'] = $oOrder->fieldAdrShippingFirstname;
$aAddress['sLastName'] = $oOrder->fieldAdrShippingLastname;
$aAddress['sAdditionalInfo'] = $oOrder->fieldAdrShippingAdditionalInfo;
$aAddress['sAddressStreet'] = $oOrder->fieldAdrShippingStreet;
$aAddress['sAddressStreetNr'] = $oOrder->fieldAdrShippingStreetnr;
$aAddress['sAddressZip'] = $oOrder->fieldAdrShippingPostalcode;
$aAddress['sAddressCity'] = $oOrder->fieldAdrShippingCity;
$aAddress['sAddressTelephone'] = $oOrder->fieldAdrShippingTelefon;
$aAddress['sAddressFax'] = $oOrder->fieldAdrShippingFax;
$oCountry = $oOrder->GetFieldAdrShippingCountry();
if (null !== $oCountry) {
if ($bCachingEnabled) {
$oCacheTriggerManager->addTrigger($oCountry->table, $oCountry->id);
}
$aAddress['sAddressCountry'] = (null !== $oCountry) ? ($oCountry->GetName()) : ('');
}
}
return $aAddress;
} | [
"protected",
"function",
"getAddress",
"(",
"TdbShopOrder",
"$",
"oOrder",
",",
"$",
"iAddressType",
",",
"IMapperCacheTriggerRestricted",
"$",
"oCacheTriggerManager",
",",
"$",
"bCachingEnabled",
")",
"{",
"$",
"aAddress",
"=",
"array",
"(",
")",
";",
"if",
"(",
"self",
"::",
"ADDRESS_TYPE_BILLING",
"===",
"$",
"iAddressType",
")",
"{",
"$",
"oSalutation",
"=",
"$",
"oOrder",
"->",
"GetFieldAdrBillingSalutation",
"(",
")",
";",
"if",
"(",
"$",
"oSalutation",
"&&",
"$",
"bCachingEnabled",
")",
"{",
"$",
"oCacheTriggerManager",
"->",
"addTrigger",
"(",
"$",
"oSalutation",
"->",
"table",
",",
"$",
"oSalutation",
"->",
"id",
")",
";",
"}",
"$",
"aAddress",
"[",
"'sSalutation'",
"]",
"=",
"(",
"null",
"!==",
"$",
"oSalutation",
")",
"?",
"(",
"$",
"oSalutation",
"->",
"GetName",
"(",
")",
")",
":",
"(",
"''",
")",
";",
"$",
"aAddress",
"[",
"'sFirstName'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrBillingFirstname",
";",
"$",
"aAddress",
"[",
"'sLastName'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrBillingLastname",
";",
"$",
"aAddress",
"[",
"'sAdditionalInfo'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrBillingAdditionalInfo",
";",
"$",
"aAddress",
"[",
"'sAddressStreet'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrBillingStreet",
";",
"$",
"aAddress",
"[",
"'sAddressStreetNr'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrBillingStreetnr",
";",
"$",
"aAddress",
"[",
"'sAddressZip'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrBillingPostalcode",
";",
"$",
"aAddress",
"[",
"'sAddressCity'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrBillingCity",
";",
"$",
"aAddress",
"[",
"'sAddressTelephone'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrBillingTelefon",
";",
"$",
"aAddress",
"[",
"'sAddressFax'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrBillingFax",
";",
"$",
"oCountry",
"=",
"$",
"oOrder",
"->",
"GetFieldAdrBillingCountry",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"oCountry",
")",
"{",
"if",
"(",
"$",
"bCachingEnabled",
")",
"{",
"$",
"oCacheTriggerManager",
"->",
"addTrigger",
"(",
"$",
"oCountry",
"->",
"table",
",",
"$",
"oCountry",
"->",
"id",
")",
";",
"}",
"$",
"aAddress",
"[",
"'sAddressCountry'",
"]",
"=",
"(",
"null",
"!==",
"$",
"oCountry",
")",
"?",
"(",
"$",
"oCountry",
"->",
"GetName",
"(",
")",
")",
":",
"(",
"''",
")",
";",
"}",
"}",
"elseif",
"(",
"self",
"::",
"ADDRESS_TYPE_SHIPPING",
"===",
"$",
"iAddressType",
")",
"{",
"$",
"oSalutation",
"=",
"$",
"oOrder",
"->",
"GetFieldAdrShippingSalutation",
"(",
")",
";",
"if",
"(",
"$",
"oSalutation",
"&&",
"$",
"bCachingEnabled",
")",
"{",
"$",
"oCacheTriggerManager",
"->",
"addTrigger",
"(",
"$",
"oSalutation",
"->",
"table",
",",
"$",
"oSalutation",
"->",
"id",
")",
";",
"}",
"$",
"aAddress",
"[",
"'sSalutation'",
"]",
"=",
"(",
"null",
"!==",
"$",
"oSalutation",
")",
"?",
"(",
"$",
"oSalutation",
"->",
"GetName",
"(",
")",
")",
":",
"(",
"''",
")",
";",
"$",
"aAddress",
"[",
"'sFirstName'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrShippingFirstname",
";",
"$",
"aAddress",
"[",
"'sLastName'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrShippingLastname",
";",
"$",
"aAddress",
"[",
"'sAdditionalInfo'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrShippingAdditionalInfo",
";",
"$",
"aAddress",
"[",
"'sAddressStreet'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrShippingStreet",
";",
"$",
"aAddress",
"[",
"'sAddressStreetNr'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrShippingStreetnr",
";",
"$",
"aAddress",
"[",
"'sAddressZip'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrShippingPostalcode",
";",
"$",
"aAddress",
"[",
"'sAddressCity'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrShippingCity",
";",
"$",
"aAddress",
"[",
"'sAddressTelephone'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrShippingTelefon",
";",
"$",
"aAddress",
"[",
"'sAddressFax'",
"]",
"=",
"$",
"oOrder",
"->",
"fieldAdrShippingFax",
";",
"$",
"oCountry",
"=",
"$",
"oOrder",
"->",
"GetFieldAdrShippingCountry",
"(",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"oCountry",
")",
"{",
"if",
"(",
"$",
"bCachingEnabled",
")",
"{",
"$",
"oCacheTriggerManager",
"->",
"addTrigger",
"(",
"$",
"oCountry",
"->",
"table",
",",
"$",
"oCountry",
"->",
"id",
")",
";",
"}",
"$",
"aAddress",
"[",
"'sAddressCountry'",
"]",
"=",
"(",
"null",
"!==",
"$",
"oCountry",
")",
"?",
"(",
"$",
"oCountry",
"->",
"GetName",
"(",
")",
")",
":",
"(",
"''",
")",
";",
"}",
"}",
"return",
"$",
"aAddress",
";",
"}"
] | get the value map for one address type can be defined by using the class constants.
@param TdbShopOrder $oOrder
@param int $iAddressType use constants of the class to define the type to be fetched from
@return array | [
"get",
"the",
"value",
"map",
"for",
"one",
"address",
"type",
"can",
"be",
"defined",
"by",
"using",
"the",
"class",
"constants",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/mappers/order/TPkgShopMapper_OrderUserData.class.php#L52-L107 |
31,899 | PGB-LIV/php-ms | src/Search/MsgfPlusSearch.php | MsgfPlusSearch.search | public function search(SearchParametersInterface $parameters)
{
if (! is_a($parameters, 'pgb_liv\php_ms\Search\Parameters\MsgfPlusSearchParameters')) {
throw new \InvalidArgumentException('Argument 1 expected to be of type MsgfPlusSearchParameters');
}
if (is_null($parameters->getSpectraPath()) || ! file_exists($parameters->getSpectraPath())) {
throw new \InvalidArgumentException('Valid Spectra file must be specified in paramaters.');
}
if (is_null($parameters->getDatabases()) || ! file_exists($parameters->getDatabases())) {
throw new \InvalidArgumentException('Valid database file must be specified in paramaters.');
}
$command = $this->getCommand($parameters);
$this->executeCommand($command);
if (! is_null($parameters->getOutputFile())) {
return $parameters->getOutputFile();
} else {
$extensionPos = strrpos($parameters->getSpectraPath(), '.');
return substr($parameters->getSpectraPath(), 0, $extensionPos) . '.mzid';
}
} | php | public function search(SearchParametersInterface $parameters)
{
if (! is_a($parameters, 'pgb_liv\php_ms\Search\Parameters\MsgfPlusSearchParameters')) {
throw new \InvalidArgumentException('Argument 1 expected to be of type MsgfPlusSearchParameters');
}
if (is_null($parameters->getSpectraPath()) || ! file_exists($parameters->getSpectraPath())) {
throw new \InvalidArgumentException('Valid Spectra file must be specified in paramaters.');
}
if (is_null($parameters->getDatabases()) || ! file_exists($parameters->getDatabases())) {
throw new \InvalidArgumentException('Valid database file must be specified in paramaters.');
}
$command = $this->getCommand($parameters);
$this->executeCommand($command);
if (! is_null($parameters->getOutputFile())) {
return $parameters->getOutputFile();
} else {
$extensionPos = strrpos($parameters->getSpectraPath(), '.');
return substr($parameters->getSpectraPath(), 0, $extensionPos) . '.mzid';
}
} | [
"public",
"function",
"search",
"(",
"SearchParametersInterface",
"$",
"parameters",
")",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"parameters",
",",
"'pgb_liv\\php_ms\\Search\\Parameters\\MsgfPlusSearchParameters'",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Argument 1 expected to be of type MsgfPlusSearchParameters'",
")",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"parameters",
"->",
"getSpectraPath",
"(",
")",
")",
"||",
"!",
"file_exists",
"(",
"$",
"parameters",
"->",
"getSpectraPath",
"(",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Valid Spectra file must be specified in paramaters.'",
")",
";",
"}",
"if",
"(",
"is_null",
"(",
"$",
"parameters",
"->",
"getDatabases",
"(",
")",
")",
"||",
"!",
"file_exists",
"(",
"$",
"parameters",
"->",
"getDatabases",
"(",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Valid database file must be specified in paramaters.'",
")",
";",
"}",
"$",
"command",
"=",
"$",
"this",
"->",
"getCommand",
"(",
"$",
"parameters",
")",
";",
"$",
"this",
"->",
"executeCommand",
"(",
"$",
"command",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"parameters",
"->",
"getOutputFile",
"(",
")",
")",
")",
"{",
"return",
"$",
"parameters",
"->",
"getOutputFile",
"(",
")",
";",
"}",
"else",
"{",
"$",
"extensionPos",
"=",
"strrpos",
"(",
"$",
"parameters",
"->",
"getSpectraPath",
"(",
")",
",",
"'.'",
")",
";",
"return",
"substr",
"(",
"$",
"parameters",
"->",
"getSpectraPath",
"(",
")",
",",
"0",
",",
"$",
"extensionPos",
")",
".",
"'.mzid'",
";",
"}",
"}"
] | Perform the MS-GF+ search using the specified parameters.
Any paramaters not specified will use the MS-GF+ defaults.
@param SearchParametersInterface $parameters
Paramaters object for any arguments to send to MS-GF+
@throws \InvalidArgumentException Thrown if any of the required properties are missing
@return string Path to the results file | [
"Perform",
"the",
"MS",
"-",
"GF",
"+",
"search",
"using",
"the",
"specified",
"parameters",
".",
"Any",
"paramaters",
"not",
"specified",
"will",
"use",
"the",
"MS",
"-",
"GF",
"+",
"defaults",
"."
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Search/MsgfPlusSearch.php#L58-L82 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.